diff options
Diffstat (limited to 'qtinterface/qt4')
735 files changed, 145607 insertions, 0 deletions
diff --git a/qtinterface/qt4/Qt/Qt3Support b/qtinterface/qt4/Qt/Qt3Support new file mode 100644 index 0000000..666f7a3 --- /dev/null +++ b/qtinterface/qt4/Qt/Qt3Support @@ -0,0 +1,115 @@ +#ifndef QT_QT3SUPPORT_MODULE_H +#define QT_QT3SUPPORT_MODULE_H +#include <QtCore/QtCore> +#include <QtGui/QtGui> +#include <QtNetwork/QtNetwork> +#include <QtSql/QtSql> +#include "q3action.h" +#include "q3button.h" +#include "q3buttongroup.h" +#include "q3combobox.h" +#include "q3datetimeedit.h" +#include "q3dockarea.h" +#include "q3dockwindow.h" +#include "q3frame.h" +#include "q3grid.h" +#include "q3gridview.h" +#include "q3groupbox.h" +#include "q3hbox.h" +#include "q3header.h" +#include "q3hgroupbox.h" +#include "q3mainwindow.h" +#include "q3popupmenu.h" +#include "q3progressbar.h" +#include "q3rangecontrol.h" +#include "q3scrollview.h" +#include "q3toolbar.h" +#include "q3vbox.h" +#include "q3vgroupbox.h" +#include "q3whatsthis.h" +#include "q3widgetstack.h" +#include "q3databrowser.h" +#include "q3datatable.h" +#include "q3dataview.h" +#include "q3editorfactory.h" +#include "q3sqlcursor.h" +#include "q3sqleditorfactory.h" +#include "q3sqlfieldinfo.h" +#include "q3sqlform.h" +#include "q3sqlpropertymap.h" +#include "q3sqlrecordinfo.h" +#include "q3sqlselectcursor.h" +#include "q3dns.h" +#include "q3ftp.h" +#include "q3http.h" +#include "q3localfs.h" +#include "q3network.h" +#include "q3networkprotocol.h" +#include "q3serversocket.h" +#include "q3socket.h" +#include "q3socketdevice.h" +#include "q3url.h" +#include "q3urloperator.h" +#include "q3multilineedit.h" +#include "q3simplerichtext.h" +#include "q3stylesheet.h" +#include "q3syntaxhighlighter.h" +#include "q3textbrowser.h" +#include "q3textedit.h" +#include "q3textstream.h" +#include "q3textview.h" +#include "q3filedialog.h" +#include "q3progressdialog.h" +#include "q3tabdialog.h" +#include "q3wizard.h" +#include "q3accel.h" +#include "q3boxlayout.h" +#include "q3dragobject.h" +#include "q3dropsite.h" +#include "q3gridlayout.h" +#include "q3mimefactory.h" +#include "q3polygonscanner.h" +#include "q3process.h" +#include "qiconset.h" +#include "q3asciicache.h" +#include "q3asciidict.h" +#include "q3cache.h" +#include "q3cleanuphandler.h" +#include "q3cstring.h" +#include "q3deepcopy.h" +#include "q3dict.h" +#include "q3garray.h" +#include "q3gcache.h" +#include "q3gdict.h" +#include "q3glist.h" +#include "q3gvector.h" +#include "q3intcache.h" +#include "q3intdict.h" +#include "q3memarray.h" +#include "q3objectdict.h" +#include "q3ptrcollection.h" +#include "q3ptrdict.h" +#include "q3ptrlist.h" +#include "q3ptrqueue.h" +#include "q3ptrstack.h" +#include "q3ptrvector.h" +#include "q3semaphore.h" +#include "q3shared.h" +#include "q3signal.h" +#include "q3sortedlist.h" +#include "q3strlist.h" +#include "q3strvec.h" +#include "q3tl.h" +#include "q3valuelist.h" +#include "q3valuestack.h" +#include "q3valuevector.h" +#include "q3iconview.h" +#include "q3listbox.h" +#include "q3listview.h" +#include "q3table.h" +#include "q3paintdevicemetrics.h" +#include "q3painter.h" +#include "q3picture.h" +#include "q3pointarray.h" +#include "q3canvas.h" +#endif diff --git a/qtinterface/qt4/Qt/QtCore b/qtinterface/qt4/Qt/QtCore new file mode 100644 index 0000000..58dee0b --- /dev/null +++ b/qtinterface/qt4/Qt/QtCore @@ -0,0 +1,137 @@ +#ifndef QT_QTCORE_MODULE_H +#define QT_QTCORE_MODULE_H +#include "qxmlstream.h" +#include "qabstractfileengine.h" +#include "qbuffer.h" +#include "qdatastream.h" +#include "qdebug.h" +#include "qdir.h" +#include "qdiriterator.h" +#include "qfile.h" +#include "qfileinfo.h" +#include "qfilesystemwatcher.h" +#include "qfsfileengine.h" +#include "qiodevice.h" +#include "qprocess.h" +#include "qresource.h" +#include "qsettings.h" +#include "qtemporaryfile.h" +#include "qtextstream.h" +#include "qurl.h" +#include "qtextcodec.h" +#include "qtextcodecplugin.h" +#include "qalgorithms.h" +#include "qbitarray.h" +#include "qbytearray.h" +#include "qbytearraymatcher.h" +#include "qcache.h" +#include "qchar.h" +#include "qcontainerfwd.h" +#include "qcontiguouscache.h" +#include "qcryptographichash.h" +#include "qdatetime.h" +#include "qeasingcurve.h" +#include "qhash.h" +#include "qiterator.h" +#include "qline.h" +#include "qlinkedlist.h" +#include "qlist.h" +#include "qlocale.h" +#include "qmap.h" +#include "qmargins.h" +#include "qpair.h" +#include "qpoint.h" +#include "qqueue.h" +#include "qrect.h" +#include "qregexp.h" +#include "qscopedpointer.h" +#include "qset.h" +#include "qshareddata.h" +#include "qsharedpointer.h" +#include "qsize.h" +#include "qstack.h" +#include "qstring.h" +#include "qstringbuilder.h" +#include "qstringlist.h" +#include "qstringmatcher.h" +#include "qtextboundaryfinder.h" +#include "qtimeline.h" +#include "qvarlengtharray.h" +#include "qvector.h" +#include "qendian.h" +#include "qfeatures.h" +#include "qglobal.h" +#include "qlibraryinfo.h" +#include "qnamespace.h" +#include "qnumeric.h" +#include "qabstracteventdispatcher.h" +#include "qabstractitemmodel.h" +#include "qbasictimer.h" +#include "qcoreapplication.h" +#include "qcoreevent.h" +#include "qeventloop.h" +#include "qmath.h" +#include "qmetaobject.h" +#include "qmetatype.h" +#include "qmimedata.h" +#include "qobject.h" +#include "qobjectcleanuphandler.h" +#include "qobjectdefs.h" +#include "qpointer.h" +#include "qsharedmemory.h" +#include "qsignalmapper.h" +#include "qsocketnotifier.h" +#include "qsystemsemaphore.h" +#include "qtimer.h" +#include "qtranslator.h" +#include "qvariant.h" +#include "qfuture.h" +#include "qfutureinterface.h" +#include "qfuturesynchronizer.h" +#include "qfuturewatcher.h" +#include "qrunnable.h" +#include "qtconcurrentcompilertest.h" +#include "qtconcurrentexception.h" +#include "qtconcurrentfilter.h" +#include "qtconcurrentfilterkernel.h" +#include "qtconcurrentfunctionwrappers.h" +#include "qtconcurrentiteratekernel.h" +#include "qtconcurrentmap.h" +#include "qtconcurrentmapkernel.h" +#include "qtconcurrentmedian.h" +#include "qtconcurrentreducekernel.h" +#include "qtconcurrentresultstore.h" +#include "qtconcurrentrun.h" +#include "qtconcurrentrunbase.h" +#include "qtconcurrentstoredfunctioncall.h" +#include "qtconcurrentthreadengine.h" +#include "qthreadpool.h" +#include "qfactoryinterface.h" +#include "qlibrary.h" +#include "qplugin.h" +#include "qpluginloader.h" +#include "quuid.h" +#include "qatomic.h" +#include "qbasicatomic.h" +#include "qmutex.h" +#include "qreadwritelock.h" +#include "qsemaphore.h" +#include "qthread.h" +#include "qthreadstorage.h" +#include "qwaitcondition.h" +#include "qabstractstate.h" +#include "qabstracttransition.h" +#include "qeventtransition.h" +#include "qfinalstate.h" +#include "qhistorystate.h" +#include "qsignaltransition.h" +#include "qstate.h" +#include "qstatemachine.h" +#include "qabstractanimation.h" +#include "qanimationgroup.h" +#include "qparallelanimationgroup.h" +#include "qpauseanimation.h" +#include "qpropertyanimation.h" +#include "qsequentialanimationgroup.h" +#include "qvariantanimation.h" +#endif diff --git a/qtinterface/qt4/Qt/QtDBus b/qtinterface/qt4/Qt/QtDBus new file mode 100644 index 0000000..32cf13d --- /dev/null +++ b/qtinterface/qt4/Qt/QtDBus @@ -0,0 +1,21 @@ +#ifndef QT_QTDBUS_MODULE_H +#define QT_QTDBUS_MODULE_H +#include <QtCore/QtCore> +#include "qdbusabstractadaptor.h" +#include "qdbusabstractinterface.h" +#include "qdbusargument.h" +#include "qdbusconnection.h" +#include "qdbusconnectioninterface.h" +#include "qdbuscontext.h" +#include "qdbuserror.h" +#include "qdbusextratypes.h" +#include "qdbusinterface.h" +#include "qdbusmacros.h" +#include "qdbusmessage.h" +#include "qdbusmetatype.h" +#include "qdbuspendingcall.h" +#include "qdbuspendingreply.h" +#include "qdbusreply.h" +#include "qdbusserver.h" +#include "qdbusservicewatcher.h" +#endif diff --git a/qtinterface/qt4/Qt/QtGui b/qtinterface/qt4/Qt/QtGui new file mode 100644 index 0000000..640382d --- /dev/null +++ b/qtinterface/qt4/Qt/QtGui @@ -0,0 +1,228 @@ +#ifndef QT_QTGUI_MODULE_H +#define QT_QTGUI_MODULE_H +#include <QtCore/QtCore> +#include "qbitmap.h" +#include "qicon.h" +#include "qiconengine.h" +#include "qiconengineplugin.h" +#include "qimage.h" +#include "qimageiohandler.h" +#include "qimagereader.h" +#include "qimagewriter.h" +#include "qmovie.h" +#include "qpicture.h" +#include "qpictureformatplugin.h" +#include "qpixmap.h" +#include "qpixmapcache.h" +#include "qs60mainapplication.h" +#include "qs60mainappui.h" +#include "qs60maindocument.h" +#include "qvfbhdr.h" +#include "qwsembedwidget.h" +#include "qabstractbutton.h" +#include "qabstractscrollarea.h" +#include "qabstractslider.h" +#include "qabstractspinbox.h" +#include "qbuttongroup.h" +#include "qcalendarwidget.h" +#include "qcheckbox.h" +#include "qcombobox.h" +#include "qcommandlinkbutton.h" +#include "qdatetimeedit.h" +#include "qdial.h" +#include "qdialogbuttonbox.h" +#include "qdockwidget.h" +#include "qfocusframe.h" +#include "qfontcombobox.h" +#include "qframe.h" +#include "qgroupbox.h" +#include "qlabel.h" +#include "qlcdnumber.h" +#include "qlineedit.h" +#include "qmainwindow.h" +#include "qmdiarea.h" +#include "qmdisubwindow.h" +#include "qmenu.h" +#include "qmenubar.h" +#include "qmenudata.h" +#include "qplaintextedit.h" +#include "qprintpreviewwidget.h" +#include "qprogressbar.h" +#include "qpushbutton.h" +#include "qradiobutton.h" +#include "qrubberband.h" +#include "qscrollarea.h" +#include "qscrollbar.h" +#include "qsizegrip.h" +#include "qslider.h" +#include "qspinbox.h" +#include "qsplashscreen.h" +#include "qsplitter.h" +#include "qstackedwidget.h" +#include "qstatusbar.h" +#include "qtabbar.h" +#include "qtabwidget.h" +#include "qtextbrowser.h" +#include "qtextedit.h" +#include "qtoolbar.h" +#include "qtoolbox.h" +#include "qtoolbutton.h" +#include "qvalidator.h" +#include "qworkspace.h" +#include "qinputcontext.h" +#include "qinputcontextfactory.h" +#include "qinputcontextplugin.h" +#include "qgraphicsanchorlayout.h" +#include "qgraphicsgridlayout.h" +#include "qgraphicsitem.h" +#include "qgraphicsitemanimation.h" +#include "qgraphicslayout.h" +#include "qgraphicslayoutitem.h" +#include "qgraphicslinearlayout.h" +#include "qgraphicsproxywidget.h" +#include "qgraphicsscene.h" +#include "qgraphicssceneevent.h" +#include "qgraphicstransform.h" +#include "qgraphicsview.h" +#include "qgraphicswidget.h" +#include "qgenericmatrix.h" +#include "qmatrix4x4.h" +#include "qquaternion.h" +#include "qvector2d.h" +#include "qvector3d.h" +#include "qvector4d.h" +#include "qabstracttextdocumentlayout.h" +#include "qfont.h" +#include "qfontdatabase.h" +#include "qfontinfo.h" +#include "qfontmetrics.h" +#include "qsyntaxhighlighter.h" +#include "qtextcursor.h" +#include "qtextdocument.h" +#include "qtextdocumentfragment.h" +#include "qtextdocumentwriter.h" +#include "qtextformat.h" +#include "qtextlayout.h" +#include "qtextlist.h" +#include "qtextobject.h" +#include "qtextoption.h" +#include "qtexttable.h" +#include "qabstractpagesetupdialog.h" +#include "qabstractprintdialog.h" +#include "qcolordialog.h" +#include "qdialog.h" +#include "qerrormessage.h" +#include "qfiledialog.h" +#include "qfilesystemmodel.h" +#include "qfontdialog.h" +#include "qinputdialog.h" +#include "qmessagebox.h" +#include "qpagesetupdialog.h" +#include "qprintdialog.h" +#include "qprintpreviewdialog.h" +#include "qprogressdialog.h" +#include "qwizard.h" +#include "qaccessible.h" +#include "qaccessible2.h" +#include "qaccessiblebridge.h" +#include "qaccessibleobject.h" +#include "qaccessibleplugin.h" +#include "qaccessiblewidget.h" +#include "qaction.h" +#include "qactiongroup.h" +#include "qapplication.h" +#include "qboxlayout.h" +#include "qclipboard.h" +#include "qcursor.h" +#include "qdesktopwidget.h" +#include "qdrag.h" +#include "qevent.h" +#include "qformlayout.h" +#include "qgesture.h" +#include "qgesturerecognizer.h" +#include "qgridlayout.h" +#include "qkeysequence.h" +#include "qlayout.h" +#include "qlayoutitem.h" +#include "qmime.h" +#include "qpalette.h" +#include "qsessionmanager.h" +#include "qshortcut.h" +#include "qsizepolicy.h" +#include "qsound.h" +#include "qstackedlayout.h" +#include "qtooltip.h" +#include "qwhatsthis.h" +#include "qwidget.h" +#include "qwidgetaction.h" +#include "qwindowdefs.h" +#include "qabstractitemdelegate.h" +#include "qabstractitemview.h" +#include "qabstractproxymodel.h" +#include "qcolumnview.h" +#include "qdatawidgetmapper.h" +#include "qdirmodel.h" +#include "qfileiconprovider.h" +#include "qheaderview.h" +#include "qitemdelegate.h" +#include "qitemeditorfactory.h" +#include "qitemselectionmodel.h" +#include "qlistview.h" +#include "qlistwidget.h" +#include "qproxymodel.h" +#include "qsortfilterproxymodel.h" +#include "qstandarditemmodel.h" +#include "qstringlistmodel.h" +#include "qstyleditemdelegate.h" +#include "qtableview.h" +#include "qtablewidget.h" +#include "qtreeview.h" +#include "qtreewidget.h" +#include "qtreewidgetitemiterator.h" +#include "qbrush.h" +#include "qcolor.h" +#include "qcolormap.h" +#include "qdrawutil.h" +#include "qmatrix.h" +#include "qpaintdevice.h" +#include "qpaintengine.h" +#include "qpainter.h" +#include "qpainterpath.h" +#include "qpen.h" +#include "qpolygon.h" +#include "qprintengine.h" +#include "qprinter.h" +#include "qprinterinfo.h" +#include "qregion.h" +#include "qrgb.h" +#include "qstylepainter.h" +#include "qtransform.h" +#include "qwmatrix.h" +#include "qsymbianevent.h" +#include "qcdestyle.h" +#include "qcleanlooksstyle.h" +#include "qcommonstyle.h" +#include "qgtkstyle.h" +#include "qmotifstyle.h" +#include "qplastiquestyle.h" +#include "qproxystyle.h" +#include "qs60style.h" +#include "qstyle.h" +#include "qstylefactory.h" +#include "qstyleoption.h" +#include "qstyleplugin.h" +#include "qwindowscestyle.h" +#include "qwindowsmobilestyle.h" +#include "qwindowsstyle.h" +#include "qwindowsvistastyle.h" +#include "qwindowsxpstyle.h" +#include "qkeyeventtransition.h" +#include "qmouseeventtransition.h" +#include "qgraphicseffect.h" +#include "qcompleter.h" +#include "qdesktopservices.h" +#include "qsystemtrayicon.h" +#include "qundogroup.h" +#include "qundostack.h" +#include "qundoview.h" +#endif diff --git a/qtinterface/qt4/Qt/QtHelp b/qtinterface/qt4/Qt/QtHelp new file mode 100644 index 0000000..01c53dd --- /dev/null +++ b/qtinterface/qt4/Qt/QtHelp @@ -0,0 +1,11 @@ +#ifndef QT_QTHELP_MODULE_H +#define QT_QTHELP_MODULE_H +#include <QtSql/QtSql> +#include "qhelpcontentwidget.h" +#include "qhelpengine.h" +#include "qhelpenginecore.h" +#include "qhelpindexwidget.h" +#include "qhelpsearchengine.h" +#include "qhelpsearchquerywidget.h" +#include "qhelpsearchresultwidget.h" +#endif diff --git a/qtinterface/qt4/Qt/QtMultimedia b/qtinterface/qt4/Qt/QtMultimedia new file mode 100644 index 0000000..ae9eb88 --- /dev/null +++ b/qtinterface/qt4/Qt/QtMultimedia @@ -0,0 +1,16 @@ +#ifndef QT_QTMULTIMEDIA_MODULE_H +#define QT_QTMULTIMEDIA_MODULE_H +#include <QtCore/QtCore> +#include <QtGui/QtGui> +#include "qaudio.h" +#include "qaudiodeviceinfo.h" +#include "qaudioengine.h" +#include "qaudioengineplugin.h" +#include "qaudioformat.h" +#include "qaudioinput.h" +#include "qaudiooutput.h" +#include "qabstractvideobuffer.h" +#include "qabstractvideosurface.h" +#include "qvideoframe.h" +#include "qvideosurfaceformat.h" +#endif diff --git a/qtinterface/qt4/Qt/QtNetwork b/qtinterface/qt4/Qt/QtNetwork new file mode 100644 index 0000000..bb9e9ea --- /dev/null +++ b/qtinterface/qt4/Qt/QtNetwork @@ -0,0 +1,32 @@ +#ifndef QT_QTNETWORK_MODULE_H +#define QT_QTNETWORK_MODULE_H +#include <QtCore/QtCore> +#include "qabstractnetworkcache.h" +#include "qftp.h" +#include "qhttp.h" +#include "qnetworkaccessmanager.h" +#include "qnetworkcookie.h" +#include "qnetworkcookiejar.h" +#include "qnetworkdiskcache.h" +#include "qnetworkreply.h" +#include "qnetworkrequest.h" +#include "qauthenticator.h" +#include "qhostaddress.h" +#include "qhostinfo.h" +#include "qnetworkinterface.h" +#include "qnetworkproxy.h" +#include "qurlinfo.h" +#include "qabstractsocket.h" +#include "qlocalserver.h" +#include "qlocalsocket.h" +#include "qtcpserver.h" +#include "qtcpsocket.h" +#include "qudpsocket.h" +#include "qssl.h" +#include "qsslcertificate.h" +#include "qsslcipher.h" +#include "qsslconfiguration.h" +#include "qsslerror.h" +#include "qsslkey.h" +#include "qsslsocket.h" +#endif diff --git a/qtinterface/qt4/Qt/QtOpenGL b/qtinterface/qt4/Qt/QtOpenGL new file mode 100644 index 0000000..5f7fece --- /dev/null +++ b/qtinterface/qt4/Qt/QtOpenGL @@ -0,0 +1,10 @@ +#ifndef QT_QTOPENGL_MODULE_H +#define QT_QTOPENGL_MODULE_H +#include <QtCore/QtCore> +#include <QtGui/QtGui> +#include "qgl.h" +#include "qglcolormap.h" +#include "qglframebufferobject.h" +#include "qglpixelbuffer.h" +#include "qglshaderprogram.h" +#endif diff --git a/qtinterface/qt4/Qt/QtScript b/qtinterface/qt4/Qt/QtScript new file mode 100644 index 0000000..7628ff8 --- /dev/null +++ b/qtinterface/qt4/Qt/QtScript @@ -0,0 +1,17 @@ +#ifndef QT_QTSCRIPT_MODULE_H +#define QT_QTSCRIPT_MODULE_H +#include <QtCore/QtCore> +#include "qscriptable.h" +#include "qscriptclass.h" +#include "qscriptclasspropertyiterator.h" +#include "qscriptcontext.h" +#include "qscriptcontextinfo.h" +#include "qscriptengine.h" +#include "qscriptengineagent.h" +#include "qscriptextensioninterface.h" +#include "qscriptextensionplugin.h" +#include "qscriptprogram.h" +#include "qscriptstring.h" +#include "qscriptvalue.h" +#include "qscriptvalueiterator.h" +#endif diff --git a/qtinterface/qt4/Qt/QtScriptTools b/qtinterface/qt4/Qt/QtScriptTools new file mode 100644 index 0000000..00ade43 --- /dev/null +++ b/qtinterface/qt4/Qt/QtScriptTools @@ -0,0 +1,7 @@ +#ifndef QT_QTSCRIPTTOOLS_MODULE_H +#define QT_QTSCRIPTTOOLS_MODULE_H +#include <QtCore/QtCore> +#include <QtGui/QtGui> +#include <QtScript/QtScript> +#include "qscriptenginedebugger.h" +#endif diff --git a/qtinterface/qt4/Qt/QtSql b/qtinterface/qt4/Qt/QtSql new file mode 100644 index 0000000..e61f02b --- /dev/null +++ b/qtinterface/qt4/Qt/QtSql @@ -0,0 +1,18 @@ +#ifndef QT_QTSQL_MODULE_H +#define QT_QTSQL_MODULE_H +#include <QtCore/QtCore> +#include "qsql.h" +#include "qsqldatabase.h" +#include "qsqldriver.h" +#include "qsqldriverplugin.h" +#include "qsqlerror.h" +#include "qsqlfield.h" +#include "qsqlindex.h" +#include "qsqlquery.h" +#include "qsqlrecord.h" +#include "qsqlresult.h" +#include "qsqlquerymodel.h" +#include "qsqlrelationaldelegate.h" +#include "qsqlrelationaltablemodel.h" +#include "qsqltablemodel.h" +#endif diff --git a/qtinterface/qt4/Qt/QtSvg b/qtinterface/qt4/Qt/QtSvg new file mode 100644 index 0000000..193fcc5 --- /dev/null +++ b/qtinterface/qt4/Qt/QtSvg @@ -0,0 +1,9 @@ +#ifndef QT_QTSVG_MODULE_H +#define QT_QTSVG_MODULE_H +#include <QtCore/QtCore> +#include <QtGui/QtGui> +#include "qgraphicssvgitem.h" +#include "qsvggenerator.h" +#include "qsvgrenderer.h" +#include "qsvgwidget.h" +#endif diff --git a/qtinterface/qt4/Qt/QtTest b/qtinterface/qt4/Qt/QtTest new file mode 100644 index 0000000..6fb1ce2 --- /dev/null +++ b/qtinterface/qt4/Qt/QtTest @@ -0,0 +1,21 @@ +#ifndef QT_QTTEST_MODULE_H +#define QT_QTTEST_MODULE_H +#include <QtCore/QtCore> +#include "qbenchmark.h" +#include "qsignalspy.h" +#include "qtest.h" +#include "qtestassert.h" +#include "qtestbasicstreamer.h" +#include "qtestcase.h" +#include "qtestcoreelement.h" +#include "qtestcorelist.h" +#include "qtestdata.h" +#include "qtestelement.h" +#include "qtestelementattribute.h" +#include "qtesteventloop.h" +#include "qtestfilelogger.h" +#include "qtestlightxmlstreamer.h" +#include "qtestsystem.h" +#include "qtestxmlstreamer.h" +#include "qtestxunitstreamer.h" +#endif diff --git a/qtinterface/qt4/Qt/QtWebKit b/qtinterface/qt4/Qt/QtWebKit new file mode 100644 index 0000000..4a83a1c --- /dev/null +++ b/qtinterface/qt4/Qt/QtWebKit @@ -0,0 +1,18 @@ +#ifndef QT_QTWEBKIT_MODULE_H +#define QT_QTWEBKIT_MODULE_H +#include <QtNetwork/QtNetwork> +#include "qgraphicswebview.h" +#include "qwebdatabase.h" +#include "qwebelement.h" +#include "qwebframe.h" +#include "qwebhistory.h" +#include "qwebhistoryinterface.h" +#include "qwebinspector.h" +#include "qwebkitglobal.h" +#include "qwebkitversion.h" +#include "qwebpage.h" +#include "qwebpluginfactory.h" +#include "qwebsecurityorigin.h" +#include "qwebsettings.h" +#include "qwebview.h" +#endif diff --git a/qtinterface/qt4/Qt/QtXml b/qtinterface/qt4/Qt/QtXml new file mode 100644 index 0000000..41ee387 --- /dev/null +++ b/qtinterface/qt4/Qt/QtXml @@ -0,0 +1,7 @@ +#ifndef QT_QTXML_MODULE_H +#define QT_QTXML_MODULE_H +#include <QtCore/QtCore> +#include "qxml.h" +#include "qdom.h" +#include "qxmlstream.h" +#endif diff --git a/qtinterface/qt4/Qt/QtXmlPatterns b/qtinterface/qt4/Qt/QtXmlPatterns new file mode 100644 index 0000000..fb10661 --- /dev/null +++ b/qtinterface/qt4/Qt/QtXmlPatterns @@ -0,0 +1,18 @@ +#ifndef QT_QTXMLPATTERNS_MODULE_H +#define QT_QTXMLPATTERNS_MODULE_H +#include <QtCore/QtCore> +#include "qabstractmessagehandler.h" +#include "qabstracturiresolver.h" +#include "qabstractxmlnodemodel.h" +#include "qabstractxmlreceiver.h" +#include "qsimplexmlnodemodel.h" +#include "qsourcelocation.h" +#include "qxmlformatter.h" +#include "qxmlname.h" +#include "qxmlnamepool.h" +#include "qxmlquery.h" +#include "qxmlresultitems.h" +#include "qxmlschema.h" +#include "qxmlschemavalidator.h" +#include "qxmlserializer.h" +#endif diff --git a/qtinterface/qt4/Qt/q3accel.h b/qtinterface/qt4/Qt/q3accel.h new file mode 100644 index 0000000..01f8165 --- /dev/null +++ b/qtinterface/qt4/Qt/q3accel.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3ACCEL_H +#define Q3ACCEL_H + +#include <QtCore/qobject.h> +#include <QtGui/qkeysequence.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3AccelPrivate; + +class Q_COMPAT_EXPORT Q3Accel : public QObject // accelerator class +{ + Q_OBJECT +public: + Q3Accel( QWidget *parent, const char *name=0 ); + Q3Accel( QWidget* watch, QObject *parent, const char *name=0 ); + ~Q3Accel(); + + bool isEnabled() const; + void setEnabled( bool ); + + uint count() const; + + int insertItem( const QKeySequence& key, int id=-1); + void removeItem( int id ); + void clear(); + + QKeySequence key( int id ); + int findKey( const QKeySequence& key ) const; + + bool isItemEnabled( int id ) const; + void setItemEnabled( int id, bool enable ); + + bool connectItem( int id, const QObject *receiver, const char* member ); + bool disconnectItem( int id, const QObject *receiver, const char* member ); + + void repairEventFilter() {} + + void setWhatsThis( int id, const QString& ); + QString whatsThis( int id ) const; + void setIgnoreWhatsThis( bool ); + bool ignoreWhatsThis() const; + + static QKeySequence shortcutKey( const QString & ); + static QString keyToString(QKeySequence k ); + static QKeySequence stringToKey( const QString & ); + +Q_SIGNALS: + void activated( int id ); + void activatedAmbiguously( int id ); + +private: + Q3AccelPrivate * d; + +private: + Q_DISABLE_COPY(Q3Accel) + friend class Q3AccelPrivate; + friend class Q3AccelManager; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3ACCEL_H diff --git a/qtinterface/qt4/Qt/q3action.h b/qtinterface/qt4/Qt/q3action.h new file mode 100644 index 0000000..df5bba8 --- /dev/null +++ b/qtinterface/qt4/Qt/q3action.h @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3ACTION_H +#define Q3ACTION_H + +#include <QtGui/qicon.h> +#include <QtGui/qkeysequence.h> +#include <QtCore/qobject.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_ACTION + +class Q3ActionPrivate; +class Q3ActionGroupPrivate; +class QStatusBar; +class Q3PopupMenu; +class QToolTipGroup; +class QWidget; + +class Q_COMPAT_EXPORT Q3Action : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool toggleAction READ isToggleAction WRITE setToggleAction) + Q_PROPERTY(bool on READ isOn WRITE setOn) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + Q_PROPERTY(QIcon iconSet READ iconSet WRITE setIconSet) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QString menuText READ menuText WRITE setMenuText) + Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) + Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) + Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) +#ifndef QT_NO_ACCEL + Q_PROPERTY(QKeySequence accel READ accel WRITE setAccel) +#endif + Q_PROPERTY(bool visible READ isVisible WRITE setVisible) + +public: + Q3Action(QObject* parent, const char* name = 0); +#ifndef QT_NO_ACCEL + Q3Action(const QString& menuText, QKeySequence accel, + QObject* parent, const char* name = 0); + Q3Action(const QIcon& icon, const QString& menuText, QKeySequence accel, + QObject* parent, const char* name = 0); + + Q3Action(const QString& text, const QIcon& icon, const QString& menuText, QKeySequence accel, + QObject* parent, const char* name = 0, bool toggle = false); // obsolete + Q3Action(const QString& text, const QString& menuText, QKeySequence accel, QObject* parent, + const char* name = 0, bool toggle = false); // obsolete +#endif + Q3Action(QObject* parent, const char* name , bool toggle); // obsolete + ~Q3Action(); + + virtual void setIconSet(const QIcon&); + QIcon iconSet() const; + virtual void setText(const QString&); + QString text() const; + virtual void setMenuText(const QString&); + QString menuText() const; + virtual void setToolTip(const QString&); + QString toolTip() const; + virtual void setStatusTip(const QString&); + QString statusTip() const; + virtual void setWhatsThis(const QString&); + QString whatsThis() const; +#ifndef QT_NO_ACCEL + virtual void setAccel(const QKeySequence& key); + QKeySequence accel() const; +#endif + virtual void setToggleAction(bool); + + bool isToggleAction() const; + bool isOn() const; + bool isEnabled() const; + bool isVisible() const; + virtual bool addTo(QWidget*); + virtual bool removeFrom(QWidget*); + +protected: + virtual void addedTo(QWidget *actionWidget, QWidget *container); + virtual void addedTo(int index, Q3PopupMenu *menu); + +public Q_SLOTS: + void activate(); + void toggle(); + virtual void setOn(bool); + virtual void setEnabled(bool); + void setDisabled(bool); + virtual void setVisible(bool); + +Q_SIGNALS: + void activated(); + void toggled(bool); + +private Q_SLOTS: + void internalActivation(); + void toolButtonToggled(bool); + void objectDestroyed(); + void menuStatusText(int id); + void showStatusText(const QString&); + void clearStatusText(); + +private: + Q_DISABLE_COPY(Q3Action) + + void init(); + + Q3ActionPrivate* d; + + friend class Q3ActionPrivate; + friend class Q3ActionGroup; + friend class Q3ActionGroupPrivate; +}; + +class Q_COMPAT_EXPORT Q3ActionGroup : public Q3Action +{ + Q_OBJECT + Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive) + Q_PROPERTY(bool usesDropDown READ usesDropDown WRITE setUsesDropDown) + +public: + Q3ActionGroup(QObject* parent, const char* name = 0); + Q3ActionGroup(QObject* parent, const char* name , bool exclusive ); // obsolete + ~Q3ActionGroup(); + void setExclusive(bool); + bool isExclusive() const; + void add(Q3Action* a); + void addSeparator(); + bool addTo(QWidget*); + bool removeFrom(QWidget*); + void setEnabled(bool); + void setToggleAction(bool toggle); + void setOn(bool on); + void setVisible(bool); + + void setUsesDropDown(bool enable); + bool usesDropDown() const; + + void setIconSet(const QIcon &); + void setText(const QString&); + void setMenuText(const QString&); + void setToolTip(const QString&); + void setWhatsThis(const QString&); + +protected: + void childEvent(QChildEvent*); + virtual void addedTo(QWidget *actionWidget, QWidget *container, Q3Action *a); + virtual void addedTo(int index, Q3PopupMenu *menu, Q3Action *a); + virtual void addedTo(QWidget *actionWidget, QWidget *container); + virtual void addedTo(int index, Q3PopupMenu *menu); + +Q_SIGNALS: + void selected(Q3Action*); + void activated(Q3Action *); + +private Q_SLOTS: + void childToggled(bool); + void childActivated(); + void childDestroyed(); + void internalComboBoxActivated(int); + void internalComboBoxHighlighted(int); + void internalToggle(Q3Action*); + void objectDestroyed(); + +private: + Q3ActionGroupPrivate* d; + +public: + void insert(Q3Action *a) { add(a); } + +private: + Q_DISABLE_COPY(Q3ActionGroup) +}; + +#endif // QT_NO_ACTION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3ACTION_H diff --git a/qtinterface/qt4/Qt/q3asciicache.h b/qtinterface/qt4/Qt/q3asciicache.h new file mode 100644 index 0000000..873e63e --- /dev/null +++ b/qtinterface/qt4/Qt/q3asciicache.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3ASCIICACHE_H +#define Q3ASCIICACHE_H + +#include <Qt3Support/q3gcache.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3AsciiCache +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GCache +#endif +{ +public: + Q3AsciiCache(const Q3AsciiCache<type> &c) : Q3GCache(c) {} + Q3AsciiCache(int maxCost=100, int size=17, bool caseSensitive=true, + bool copyKeys=true) + : Q3GCache(maxCost, size, AsciiKey, caseSensitive, copyKeys) {} + ~Q3AsciiCache() { clear(); } + Q3AsciiCache<type> &operator=(const Q3AsciiCache<type> &c) + { return (Q3AsciiCache<type>&)Q3GCache::operator=(c); } + int maxCost() const { return Q3GCache::maxCost(); } + int totalCost() const { return Q3GCache::totalCost(); } + void setMaxCost(int m) { Q3GCache::setMaxCost(m); } + uint count() const { return Q3GCache::count(); } + uint size() const { return Q3GCache::size(); } + bool isEmpty() const { return Q3GCache::count() == 0; } + void clear() { Q3GCache::clear(); } + bool insert(const char *k, const type *d, int c=1, int p=0) + { return Q3GCache::insert_other(k,(Item)d,c,p);} + bool remove(const char *k) + { return Q3GCache::remove_other(k); } + type *take(const char *k) + { return (type *)Q3GCache::take_other(k); } + type *find(const char *k, bool ref=true) const + { return (type *)Q3GCache::find_other(k,ref);} + type *operator[](const char *k) const + { return (type *)Q3GCache::find_other(k);} + void statistics() const { Q3GCache::statistics(); } +private: + void deleteItem(Item d); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3AsciiCache<void>::deleteItem(Q3PtrCollection::Item) +{ +} +#endif + +template<class type> inline void Q3AsciiCache<type>::deleteItem(Q3PtrCollection::Item d) +{ + if (del_item) delete (type *)d; +} + + +template<class type> +class Q3AsciiCacheIterator : public Q3GCacheIterator +{ +public: + Q3AsciiCacheIterator(const Q3AsciiCache<type> &c):Q3GCacheIterator((Q3GCache &)c) {} + Q3AsciiCacheIterator(const Q3AsciiCacheIterator<type> &ci) + : Q3GCacheIterator((Q3GCacheIterator &)ci) {} + Q3AsciiCacheIterator<type> &operator=(const Q3AsciiCacheIterator<type>&ci) + { return (Q3AsciiCacheIterator<type>&)Q3GCacheIterator::operator=(ci); } + uint count() const { return Q3GCacheIterator::count(); } + bool isEmpty() const { return Q3GCacheIterator::count() == 0; } + bool atFirst() const { return Q3GCacheIterator::atFirst(); } + bool atLast() const { return Q3GCacheIterator::atLast(); } + type *toFirst() { return (type *)Q3GCacheIterator::toFirst(); } + type *toLast() { return (type *)Q3GCacheIterator::toLast(); } + operator type *() const { return (type *)Q3GCacheIterator::get(); } + type *current() const { return (type *)Q3GCacheIterator::get(); } + const char *currentKey() const { return Q3GCacheIterator::getKeyAscii(); } + type *operator()() { return (type *)Q3GCacheIterator::operator()();} + type *operator++() { return (type *)Q3GCacheIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GCacheIterator::operator+=(j);} + type *operator--() { return (type *)Q3GCacheIterator::operator--(); } + type *operator-=(uint j) { return (type *)Q3GCacheIterator::operator-=(j);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3ASCIICACHE_H diff --git a/qtinterface/qt4/Qt/q3asciidict.h b/qtinterface/qt4/Qt/q3asciidict.h new file mode 100644 index 0000000..6bbf388 --- /dev/null +++ b/qtinterface/qt4/Qt/q3asciidict.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3ASCIIDICT_H +#define Q3ASCIIDICT_H + +#include <Qt3Support/q3gdict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3AsciiDict +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GDict +#endif +{ +public: + Q3AsciiDict(int size=17, bool caseSensitive=true, bool copyKeys=true) + : Q3GDict(size,AsciiKey,caseSensitive,copyKeys) {} + Q3AsciiDict(const Q3AsciiDict<type> &d) : Q3GDict(d) {} + ~Q3AsciiDict() { clear(); } + Q3AsciiDict<type> &operator=(const Q3AsciiDict<type> &d) + { return (Q3AsciiDict<type>&)Q3GDict::operator=(d); } + uint count() const { return Q3GDict::count(); } + uint size() const { return Q3GDict::size(); } + bool isEmpty() const { return Q3GDict::count() == 0; } + + void insert(const char *k, const type *d) + { Q3GDict::look_ascii(k,(Item)d,1); } + void replace(const char *k, const type *d) + { Q3GDict::look_ascii(k,(Item)d,2); } + bool remove(const char *k) { return Q3GDict::remove_ascii(k); } + type *take(const char *k) { return (type *)Q3GDict::take_ascii(k); } + type *find(const char *k) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_ascii(k,0,0); } + type *operator[](const char *k) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_ascii(k,0,0); } + + void clear() { Q3GDict::clear(); } + void resize(uint n) { Q3GDict::resize(n); } + void statistics() const { Q3GDict::statistics(); } + +#ifdef qdoc +protected: + virtual QDataStream& read(QDataStream &, Q3PtrCollection::Item &); + virtual QDataStream& write(QDataStream &, Q3PtrCollection::Item) const; +#endif + +private: + void deleteItem(Item d); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3AsciiDict<void>::deleteItem(Q3PtrCollection::Item) +{ +} +#endif + +template<class type> inline void Q3AsciiDict<type>::deleteItem(Q3PtrCollection::Item d) +{ + if (del_item) delete (type *)d; +} + +template<class type> +class Q3AsciiDictIterator : public Q3GDictIterator +{ +public: + Q3AsciiDictIterator(const Q3AsciiDict<type> &d) + : Q3GDictIterator((Q3GDict &)d) {} + ~Q3AsciiDictIterator() {} + uint count() const { return dict->count(); } + bool isEmpty() const { return dict->count() == 0; } + type *toFirst() { return (type *)Q3GDictIterator::toFirst(); } + operator type *() const { return (type *)Q3GDictIterator::get(); } + type *current() const { return (type *)Q3GDictIterator::get(); } + const char *currentKey() const { return Q3GDictIterator::getKeyAscii(); } + type *operator()() { return (type *)Q3GDictIterator::operator()(); } + type *operator++() { return (type *)Q3GDictIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GDictIterator::operator+=(j);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3ASCIIDICT_H diff --git a/qtinterface/qt4/Qt/q3boxlayout.h b/qtinterface/qt4/Qt/q3boxlayout.h new file mode 100644 index 0000000..f901406 --- /dev/null +++ b/qtinterface/qt4/Qt/q3boxlayout.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3BOXLAYOUT_H +#define Q3BOXLAYOUT_H + +#include <QtGui/qboxlayout.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3BoxLayout : public QBoxLayout +{ +public: + inline explicit Q3BoxLayout(Direction dir, QWidget *parent = 0) + : QBoxLayout(dir, parent) { setMargin(0); setSpacing(0); } + + inline Q3BoxLayout(QWidget *parent, Direction dir, int margin = 0, int spacing = -1, + const char *name = 0) + : QBoxLayout(parent, dir, margin, spacing, name) {} + + inline Q3BoxLayout(QLayout *parentLayout, Direction dir, int spacing = -1, + const char *name = 0) + : QBoxLayout(parentLayout, dir, spacing, name) { setMargin(0); } + + inline Q3BoxLayout(Direction dir, int spacing, const char *name = 0) + : QBoxLayout(dir, spacing, name) { setMargin(0); } + +private: + Q_DISABLE_COPY(Q3BoxLayout) +}; + +class Q3HBoxLayout : public Q3BoxLayout +{ +public: + inline Q3HBoxLayout() : Q3BoxLayout(LeftToRight) {} + + inline explicit Q3HBoxLayout(QWidget *parent) : Q3BoxLayout(LeftToRight, parent) {} + + inline Q3HBoxLayout(QWidget *parent, int margin, + int spacing = -1, const char *name = 0) + : Q3BoxLayout(parent, LeftToRight, margin, spacing, name) {} + + inline Q3HBoxLayout(QLayout *parentLayout, + int spacing = -1, const char *name = 0) + : Q3BoxLayout(parentLayout, LeftToRight, spacing, name) {} + + inline Q3HBoxLayout(int spacing, const char *name = 0) + : Q3BoxLayout(LeftToRight, spacing, name) {} + +private: + Q_DISABLE_COPY(Q3HBoxLayout) +}; + +class Q3VBoxLayout : public Q3BoxLayout +{ +public: + inline Q3VBoxLayout() : Q3BoxLayout(TopToBottom) {} + + inline explicit Q3VBoxLayout(QWidget *parent) : Q3BoxLayout(TopToBottom, parent) {} + + inline Q3VBoxLayout(QWidget *parent, int margin, + int spacing = -1, const char *name = 0) + : Q3BoxLayout(parent, TopToBottom, margin, spacing, name) {} + + inline Q3VBoxLayout(QLayout *parentLayout, + int spacing = -1, const char *name = 0) + : Q3BoxLayout(parentLayout, TopToBottom, spacing, name) {} + + inline Q3VBoxLayout(int spacing, const char *name = 0) + : Q3BoxLayout(TopToBottom, spacing, name) {} + +private: + Q_DISABLE_COPY(Q3VBoxLayout) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3BOXLAYOUT_H diff --git a/qtinterface/qt4/Qt/q3button.h b/qtinterface/qt4/Qt/q3button.h new file mode 100644 index 0000000..dc09877 --- /dev/null +++ b/qtinterface/qt4/Qt/q3button.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3BUTTON_H +#define Q3BUTTON_H + +#include <QtGui/qabstractbutton.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3Button : public QAbstractButton +{ + Q_OBJECT +public: + Q3Button( QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0 ); + ~Q3Button(); + +protected: + virtual void drawButton( QPainter * ); + virtual void drawButtonLabel( QPainter * ); + void paintEvent( QPaintEvent * ); + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3BUTTON_H diff --git a/qtinterface/qt4/Qt/q3buttongroup.h b/qtinterface/qt4/Qt/q3buttongroup.h new file mode 100644 index 0000000..9a5297f --- /dev/null +++ b/qtinterface/qt4/Qt/q3buttongroup.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3BUTTONGROUP_H +#define Q3BUTTONGROUP_H + +#include <QtGui/qbuttongroup.h> +#include <Qt3Support/q3groupbox.h> +#include <QtCore/qmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QAbstractButton; + +class Q_COMPAT_EXPORT Q3ButtonGroup : public Q3GroupBox +{ + Q_OBJECT + Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive) + Q_PROPERTY(bool radioButtonExclusive READ isRadioButtonExclusive WRITE setRadioButtonExclusive) + Q_PROPERTY(int selectedId READ selectedId WRITE setButton) + +public: + Q3ButtonGroup(QWidget* parent=0, const char* name=0); + Q3ButtonGroup(const QString &title, + QWidget* parent=0, const char* name=0); + Q3ButtonGroup(int columns, Qt::Orientation o, + QWidget* parent=0, const char* name=0); + Q3ButtonGroup(int columns, Qt::Orientation o, const QString &title, + QWidget* parent=0, const char* name=0); + ~Q3ButtonGroup(); + + bool isExclusive() const; + bool isRadioButtonExclusive() const { return radio_excl; } + void setExclusive(bool); + void setRadioButtonExclusive(bool); + +public: + int insert(QAbstractButton *, int id=-1); + void remove(QAbstractButton *); + QAbstractButton *find(int id) const; + int id(QAbstractButton *) const; + int count() const; + + void setButton(int id); + + QAbstractButton *selected() const; + int selectedId() const; + +Q_SIGNALS: + void pressed(int id); + void released(int id); + void clicked(int id); + +protected Q_SLOTS: + void buttonPressed(); + void buttonReleased(); + void buttonClicked(); + +protected: + bool event(QEvent * e); + +private Q_SLOTS: + void buttonDestroyed(); + +private: + Q_DISABLE_COPY(Q3ButtonGroup) + + void init(); + void fixChildren() const; + int insert_helper(QAbstractButton* , int id=-1); + void remove_helper(QAbstractButton *); + + bool excl_grp; // Not used. + bool radio_excl; + QMap<int, QAbstractButton*> buttonIds; + QButtonGroup group; +}; + +class Q_COMPAT_EXPORT Q3VButtonGroup : public Q3ButtonGroup +{ + Q_OBJECT +public: + inline Q3VButtonGroup(QWidget* parent=0, const char* name=0) + : Q3ButtonGroup(1, Qt::Horizontal /* sic! */, parent, name) {} + inline Q3VButtonGroup(const QString &title, QWidget* parent=0, const char* name=0) + : Q3ButtonGroup(1, Qt::Horizontal /* sic! */, title, parent, name) {} + +private: + Q_DISABLE_COPY(Q3VButtonGroup) +}; + + +class Q_COMPAT_EXPORT Q3HButtonGroup : public Q3ButtonGroup +{ + Q_OBJECT +public: + inline Q3HButtonGroup(QWidget* parent=0, const char* name=0) + : Q3ButtonGroup(1, Qt::Vertical /* sic! */, parent, name) {} + inline Q3HButtonGroup(const QString &title, QWidget* parent=0, const char* name=0) + : Q3ButtonGroup(1, Qt::Vertical /* sic! */, title, parent, name) {} + +private: + Q_DISABLE_COPY(Q3HButtonGroup) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3BUTTONGROUP_H diff --git a/qtinterface/qt4/Qt/q3cache.h b/qtinterface/qt4/Qt/q3cache.h new file mode 100644 index 0000000..8a227b7 --- /dev/null +++ b/qtinterface/qt4/Qt/q3cache.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3CACHE_H +#define Q3CACHE_H + +#include <Qt3Support/q3gcache.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3Cache +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GCache +#endif +{ +public: + Q3Cache(const Q3Cache<type> &c) : Q3GCache(c) {} + Q3Cache(int maxCost=100, int size=17, bool caseSensitive=true) + : Q3GCache(maxCost, size, StringKey, caseSensitive, false) {} + ~Q3Cache() { clear(); } + Q3Cache<type> &operator=(const Q3Cache<type> &c) + { return (Q3Cache<type>&)Q3GCache::operator=(c); } + int maxCost() const { return Q3GCache::maxCost(); } + int totalCost() const { return Q3GCache::totalCost(); } + void setMaxCost(int m) { Q3GCache::setMaxCost(m); } + uint count() const { return Q3GCache::count(); } + uint size() const { return Q3GCache::size(); } + bool isEmpty() const { return Q3GCache::count() == 0; } + void clear() { Q3GCache::clear(); } + bool insert(const QString &k, const type *d, int c=1, int p=0) + { return Q3GCache::insert_string(k,(Item)d,c,p);} + bool remove(const QString &k) + { return Q3GCache::remove_string(k); } + type *take(const QString &k) + { return (type *)Q3GCache::take_string(k); } + type *find(const QString &k, bool ref=true) const + { return (type *)Q3GCache::find_string(k,ref);} + type *operator[](const QString &k) const + { return (type *)Q3GCache::find_string(k);} + void statistics() const { Q3GCache::statistics(); } +private: + void deleteItem(Item d); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3Cache<void>::deleteItem(Q3PtrCollection::Item) +{ +} +#endif + +template<class type> inline void Q3Cache<type>::deleteItem(Q3PtrCollection::Item d) +{ + if (del_item) delete (type *)d; +} + +template<class type> +class Q3CacheIterator : public Q3GCacheIterator +{ +public: + Q3CacheIterator(const Q3Cache<type> &c):Q3GCacheIterator((Q3GCache &)c) {} + Q3CacheIterator(const Q3CacheIterator<type> &ci) + : Q3GCacheIterator((Q3GCacheIterator &)ci) {} + Q3CacheIterator<type> &operator=(const Q3CacheIterator<type>&ci) + { return (Q3CacheIterator<type>&)Q3GCacheIterator::operator=(ci); } + uint count() const { return Q3GCacheIterator::count(); } + bool isEmpty() const { return Q3GCacheIterator::count() == 0; } + bool atFirst() const { return Q3GCacheIterator::atFirst(); } + bool atLast() const { return Q3GCacheIterator::atLast(); } + type *toFirst() { return (type *)Q3GCacheIterator::toFirst(); } + type *toLast() { return (type *)Q3GCacheIterator::toLast(); } + operator type *() const { return (type *)Q3GCacheIterator::get(); } + type *current() const { return (type *)Q3GCacheIterator::get(); } + QString currentKey() const{ return Q3GCacheIterator::getKeyString(); } + type *operator()() { return (type *)Q3GCacheIterator::operator()();} + type *operator++() { return (type *)Q3GCacheIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GCacheIterator::operator+=(j);} + type *operator--() { return (type *)Q3GCacheIterator::operator--(); } + type *operator-=(uint j) { return (type *)Q3GCacheIterator::operator-=(j);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3CACHE_H diff --git a/qtinterface/qt4/Qt/q3canvas.h b/qtinterface/qt4/Qt/q3canvas.h new file mode 100644 index 0000000..be820e3 --- /dev/null +++ b/qtinterface/qt4/Qt/q3canvas.h @@ -0,0 +1,787 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3CANVAS_H +#define Q3CANVAS_H + +#include <Qt3Support/q3scrollview.h> +#include <QtGui/qpixmap.h> +#include <Qt3Support/q3ptrlist.h> +#include <QtGui/qbrush.h> +#include <QtGui/qpen.h> +#include <Qt3Support/q3valuelist.h> +#include <Qt3Support/q3pointarray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +class Q3CanvasSprite; +class Q3CanvasPolygonalItem; +class Q3CanvasRectangle; +class Q3CanvasPolygon; +class Q3CanvasEllipse; +class Q3CanvasText; +class Q3CanvasLine; +class Q3CanvasChunk; +class Q3Canvas; +class Q3CanvasItem; +class Q3CanvasView; +class Q3CanvasPixmap; + +class Q_COMPAT_EXPORT Q3CanvasItemList : public Q3ValueList<Q3CanvasItem*> { +public: + void sort(); + void drawUnique(QPainter& painter); + Q3CanvasItemList operator+(const Q3CanvasItemList &l) const; +}; + + +class Q3CanvasItemExtra; + +class Q_COMPAT_EXPORT Q3CanvasItem +{ +public: + Q3CanvasItem(Q3Canvas* canvas); + virtual ~Q3CanvasItem(); + + double x() const + { return myx; } + double y() const + { return myy; } + double z() const + { return myz; } // (depth) + + virtual void moveBy(double dx, double dy); + void move(double x, double y); + void setX(double a) { move(a,y()); } + void setY(double a) { move(x(),a); } + void setZ(double a) { myz=a; changeChunks(); } + + bool animated() const; + virtual void setAnimated(bool y); + virtual void setVelocity(double vx, double vy); + void setXVelocity(double vx) { setVelocity(vx,yVelocity()); } + void setYVelocity(double vy) { setVelocity(xVelocity(),vy); } + double xVelocity() const; + double yVelocity() const; + virtual void advance(int stage); + + virtual bool collidesWith(const Q3CanvasItem*) const=0; + + Q3CanvasItemList collisions(bool exact /* NO DEFAULT */) const; + + virtual void setCanvas(Q3Canvas*); + + virtual void draw(QPainter&)=0; + + void show(); + void hide(); + + virtual void setVisible(bool yes); + bool isVisible() const + { return (bool)vis; } + virtual void setSelected(bool yes); + bool isSelected() const + { return (bool)sel; } + virtual void setEnabled(bool yes); + bool isEnabled() const + { return (bool)ena; } + virtual void setActive(bool yes); + bool isActive() const + { return (bool)act; } + bool visible() const + { return (bool)vis; } + bool selected() const + { return (bool)sel; } + bool enabled() const + { return (bool)ena; } + bool active() const + { return (bool)act; } + + enum RttiValues { + Rtti_Item = 0, + Rtti_Sprite = 1, + Rtti_PolygonalItem = 2, + Rtti_Text = 3, + Rtti_Polygon = 4, + Rtti_Rectangle = 5, + Rtti_Ellipse = 6, + Rtti_Line = 7, + Rtti_Spline = 8 + }; + + virtual int rtti() const; + static int RTTI; + + virtual QRect boundingRect() const=0; + virtual QRect boundingRectAdvanced() const; + + Q3Canvas* canvas() const + { return cnv; } + +protected: + void update() { changeChunks(); } + +private: + // For friendly subclasses... + + friend class Q3CanvasPolygonalItem; + friend class Q3CanvasSprite; + friend class Q3CanvasRectangle; + friend class Q3CanvasPolygon; + friend class Q3CanvasEllipse; + friend class Q3CanvasText; + friend class Q3CanvasLine; + + virtual Q3PointArray chunks() const; + virtual void addToChunks(); + virtual void removeFromChunks(); + virtual void changeChunks(); + virtual bool collidesWith(const Q3CanvasSprite*, + const Q3CanvasPolygonalItem*, + const Q3CanvasRectangle*, + const Q3CanvasEllipse*, + const Q3CanvasText*) const = 0; + // End of friend stuff + + Q3Canvas* cnv; + static Q3Canvas* current_canvas; + double myx,myy,myz; + Q3CanvasItemExtra *ext; + Q3CanvasItemExtra& extra(); + uint ani:1; + uint vis:1; + uint val:1; + uint sel:1; + uint ena:1; + uint act:1; +}; + + +class Q3CanvasData; + +class Q_COMPAT_EXPORT Q3Canvas : public QObject +{ + Q_OBJECT +public: + Q3Canvas(QObject* parent = 0, const char* name = 0); + Q3Canvas(int w, int h); + Q3Canvas(QPixmap p, int h, int v, int tilewidth, int tileheight); + + virtual ~Q3Canvas(); + + virtual void setTiles(QPixmap tiles, int h, int v, + int tilewidth, int tileheight); + virtual void setBackgroundPixmap(const QPixmap& p); + QPixmap backgroundPixmap() const; + + virtual void setBackgroundColor(const QColor& c); + QColor backgroundColor() const; + + virtual void setTile(int x, int y, int tilenum); + int tile(int x, int y) const + { return grid[x+y*htiles]; } + + int tilesHorizontally() const + { return htiles; } + int tilesVertically() const + { return vtiles; } + + int tileWidth() const + { return tilew; } + int tileHeight() const + { return tileh; } + + virtual void resize(int width, int height); + int width() const + { return awidth; } + int height() const + { return aheight; } + QSize size() const + { return QSize(awidth,aheight); } + QRect rect() const + { return QRect(0, 0, awidth, aheight); } + bool onCanvas(int x, int y) const + { return x>=0 && y>=0 && x<awidth && y<aheight; } + bool onCanvas(const QPoint& p) const + { return onCanvas(p.x(),p.y()); } + bool validChunk(int x, int y) const + { return x>=0 && y>=0 && x<chwidth && y<chheight; } + bool validChunk(const QPoint& p) const + { return validChunk(p.x(),p.y()); } + + int chunkSize() const + { return chunksize; } + virtual void retune(int chunksize, int maxclusters=100); + + bool sameChunk(int x1, int y1, int x2, int y2) const + { return x1/chunksize==x2/chunksize && y1/chunksize==y2/chunksize; } + virtual void setChangedChunk(int i, int j); + virtual void setChangedChunkContaining(int x, int y); + virtual void setAllChanged(); + virtual void setChanged(const QRect& area); + virtual void setUnchanged(const QRect& area); + + // These call setChangedChunk. + void addItemToChunk(Q3CanvasItem*, int i, int j); + void removeItemFromChunk(Q3CanvasItem*, int i, int j); + void addItemToChunkContaining(Q3CanvasItem*, int x, int y); + void removeItemFromChunkContaining(Q3CanvasItem*, int x, int y); + + Q3CanvasItemList allItems(); + Q3CanvasItemList collisions(const QPoint&) const; + Q3CanvasItemList collisions(const QRect&) const; + Q3CanvasItemList collisions(const Q3PointArray& pa, const Q3CanvasItem* item, + bool exact) const; + + void drawArea(const QRect&, QPainter* p, bool double_buffer=false); + + // These are for Q3CanvasView to call + virtual void addView(Q3CanvasView*); + virtual void removeView(Q3CanvasView*); + void drawCanvasArea(const QRect&, QPainter* p=0, bool double_buffer=true); + void drawViewArea(Q3CanvasView* view, QPainter* p, const QRect& r, bool dbuf); + + // These are for Q3CanvasItem to call + virtual void addItem(Q3CanvasItem*); + virtual void addAnimation(Q3CanvasItem*); + virtual void removeItem(Q3CanvasItem*); + virtual void removeAnimation(Q3CanvasItem*); + + virtual void setAdvancePeriod(int ms); + virtual void setUpdatePeriod(int ms); + + virtual void setDoubleBuffering(bool y); + +Q_SIGNALS: + void resized(); + +public Q_SLOTS: + virtual void advance(); + virtual void update(); + +protected: + virtual void drawBackground(QPainter&, const QRect& area); + virtual void drawForeground(QPainter&, const QRect& area); + +private: + void init(int w, int h, int chunksze=16, int maxclust=100); + + Q3CanvasChunk& chunk(int i, int j) const; + Q3CanvasChunk& chunkContaining(int x, int y) const; + + QRect changeBounds(const QRect& inarea); + + void ensureOffScrSize(int osw, int osh); + QPixmap offscr; + int awidth,aheight; + int chunksize; + int maxclusters; + int chwidth,chheight; + Q3CanvasChunk* chunks; + + Q3CanvasData* d; + + void initTiles(QPixmap p, int h, int v, int tilewidth, int tileheight); + ushort *grid; + ushort htiles; + ushort vtiles; + ushort tilew; + ushort tileh; + bool oneone; + QPixmap pm; + QTimer* update_timer; + QColor bgcolor; + bool debug_redraw_areas; + bool dblbuf; + + friend void qt_unview(Q3Canvas* c); + + Q_DISABLE_COPY(Q3Canvas) +}; + +class Q3CanvasViewData; + +class Q_COMPAT_EXPORT Q3CanvasView : public Q3ScrollView +{ + Q_OBJECT +public: + + Q3CanvasView(QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0); + Q3CanvasView(Q3Canvas* viewing, QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0); + ~Q3CanvasView(); + + Q3Canvas* canvas() const + { return viewing; } + void setCanvas(Q3Canvas* v); + + const QMatrix &worldMatrix() const; + const QMatrix &inverseWorldMatrix() const; + bool setWorldMatrix(const QMatrix &); + +protected: + void drawContents(QPainter *p, int cx, int cy, int cw, int ch); + QSize sizeHint() const; + +private: + friend class Q3Canvas; + void drawContents(QPainter*); + Q3Canvas* viewing; + Q3CanvasViewData* d; + friend void qt_unview(Q3Canvas* c); + +private Q_SLOTS: + void updateContentsSize(); + +private: + Q_DISABLE_COPY(Q3CanvasView) +}; + + +class Q_COMPAT_EXPORT Q3CanvasPixmap : public QPixmap +{ +public: +#ifndef QT_NO_IMAGEIO + Q3CanvasPixmap(const QString& datafilename); +#endif + Q3CanvasPixmap(const QImage& image); + Q3CanvasPixmap(const QPixmap&, const QPoint& hotspot); + ~Q3CanvasPixmap(); + + int offsetX() const + { return hotx; } + int offsetY() const + { return hoty; } + void setOffset(int x, int y) { hotx = x; hoty = y; } + +private: + Q_DISABLE_COPY(Q3CanvasPixmap) + + void init(const QImage&); + void init(const QPixmap& pixmap, int hx, int hy); + + friend class Q3CanvasSprite; + friend class Q3CanvasPixmapArray; + friend bool qt_testCollision(const Q3CanvasSprite* s1, const Q3CanvasSprite* s2); + + int hotx,hoty; + + QImage* collision_mask; +}; + + +class Q_COMPAT_EXPORT Q3CanvasPixmapArray +{ +public: + Q3CanvasPixmapArray(); +#ifndef QT_NO_IMAGEIO + Q3CanvasPixmapArray(const QString& datafilenamepattern, int framecount=0); +#endif + // this form is deprecated + Q3CanvasPixmapArray(Q3PtrList<QPixmap>, Q3PtrList<QPoint> hotspots); + + Q3CanvasPixmapArray(Q3ValueList<QPixmap>, Q3PointArray hotspots = Q3PointArray()); + ~Q3CanvasPixmapArray(); + +#ifndef QT_NO_IMAGEIO + bool readPixmaps(const QString& datafilenamepattern, int framecount=0); + bool readCollisionMasks(const QString& filenamepattern); +#endif + + // deprecated + bool operator!(); // Failure check. + bool isValid() const; + + Q3CanvasPixmap* image(int i) const + { return img ? img[i] : 0; } + void setImage(int i, Q3CanvasPixmap* p); + uint count() const + { return (uint)framecount; } + +private: + Q_DISABLE_COPY(Q3CanvasPixmapArray) + +#ifndef QT_NO_IMAGEIO + bool readPixmaps(const QString& datafilenamepattern, int framecount, bool maskonly); +#endif + + void reset(); + int framecount; + Q3CanvasPixmap** img; +}; + + +class Q_COMPAT_EXPORT Q3CanvasSprite : public Q3CanvasItem +{ +public: + Q3CanvasSprite(Q3CanvasPixmapArray* array, Q3Canvas* canvas); + + void setSequence(Q3CanvasPixmapArray* seq); + + virtual ~Q3CanvasSprite(); + + void move(double x, double y); + virtual void move(double x, double y, int frame); + void setFrame(int); + enum FrameAnimationType { Cycle, Oscillate }; + virtual void setFrameAnimation(FrameAnimationType=Cycle, int step=1, int state=0); + int frame() const + { return frm; } + int frameCount() const + { return images->count(); } + + int rtti() const; + static int RTTI; + + bool collidesWith(const Q3CanvasItem*) const; + + QRect boundingRect() const; + + // is there a reason for these to be protected? Lars +//protected: + + int width() const; + int height() const; + + int leftEdge() const; + int topEdge() const; + int rightEdge() const; + int bottomEdge() const; + + int leftEdge(int nx) const; + int topEdge(int ny) const; + int rightEdge(int nx) const; + int bottomEdge(int ny) const; + Q3CanvasPixmap* image() const + { return images->image(frm); } + virtual Q3CanvasPixmap* imageAdvanced() const; + Q3CanvasPixmap* image(int f) const + { return images->image(f); } + virtual void advance(int stage); + +public: + void draw(QPainter& painter); + +private: + Q_DISABLE_COPY(Q3CanvasSprite) + + void addToChunks(); + void removeFromChunks(); + void changeChunks(); + + int frm; + ushort anim_val; + uint anim_state:2; + uint anim_type:14; + bool collidesWith(const Q3CanvasSprite*, + const Q3CanvasPolygonalItem*, + const Q3CanvasRectangle*, + const Q3CanvasEllipse*, + const Q3CanvasText*) const; + + friend bool qt_testCollision(const Q3CanvasSprite* s1, + const Q3CanvasSprite* s2); + + Q3CanvasPixmapArray* images; +}; + +class QPolygonalProcessor; + +class Q_COMPAT_EXPORT Q3CanvasPolygonalItem : public Q3CanvasItem +{ +public: + Q3CanvasPolygonalItem(Q3Canvas* canvas); + virtual ~Q3CanvasPolygonalItem(); + + bool collidesWith(const Q3CanvasItem*) const; + + virtual void setPen(QPen p); + virtual void setBrush(QBrush b); + + QPen pen() const + { return pn; } + QBrush brush() const + { return br; } + + virtual Q3PointArray areaPoints() const=0; + virtual Q3PointArray areaPointsAdvanced() const; + QRect boundingRect() const; + + int rtti() const; + static int RTTI; + +protected: + void draw(QPainter &); + virtual void drawShape(QPainter &) = 0; + + bool winding() const; + void setWinding(bool); + + void invalidate(); + bool isValid() const + { return (bool)val; } + +private: + void scanPolygon(const Q3PointArray& pa, int winding, + QPolygonalProcessor& process) const; + Q3PointArray chunks() const; + + bool collidesWith(const Q3CanvasSprite*, + const Q3CanvasPolygonalItem*, + const Q3CanvasRectangle*, + const Q3CanvasEllipse*, + const Q3CanvasText*) const; + + QBrush br; + QPen pn; + uint wind:1; +}; + + +class Q_COMPAT_EXPORT Q3CanvasRectangle : public Q3CanvasPolygonalItem +{ +public: + Q3CanvasRectangle(Q3Canvas* canvas); + Q3CanvasRectangle(const QRect&, Q3Canvas* canvas); + Q3CanvasRectangle(int x, int y, int width, int height, Q3Canvas* canvas); + + ~Q3CanvasRectangle(); + + int width() const; + int height() const; + void setSize(int w, int h); + QSize size() const + { return QSize(w,h); } + Q3PointArray areaPoints() const; + QRect rect() const + { return QRect(int(x()),int(y()),w,h); } + + bool collidesWith(const Q3CanvasItem*) const; + + int rtti() const; + static int RTTI; + +protected: + void drawShape(QPainter &); + Q3PointArray chunks() const; + +private: + bool collidesWith( const Q3CanvasSprite*, + const Q3CanvasPolygonalItem*, + const Q3CanvasRectangle*, + const Q3CanvasEllipse*, + const Q3CanvasText*) const; + + int w, h; +}; + + +class Q_COMPAT_EXPORT Q3CanvasPolygon : public Q3CanvasPolygonalItem +{ +public: + Q3CanvasPolygon(Q3Canvas* canvas); + ~Q3CanvasPolygon(); + void setPoints(Q3PointArray); + Q3PointArray points() const; + void moveBy(double dx, double dy); + + Q3PointArray areaPoints() const; + + int rtti() const; + static int RTTI; + +protected: + void drawShape(QPainter &); + Q3PointArray poly; +}; + + +class Q_COMPAT_EXPORT Q3CanvasSpline : public Q3CanvasPolygon +{ +public: + Q3CanvasSpline(Q3Canvas* canvas); + ~Q3CanvasSpline(); + + void setControlPoints(Q3PointArray, bool closed=true); + Q3PointArray controlPoints() const; + bool closed() const; + + int rtti() const; + static int RTTI; + +private: + void recalcPoly(); + Q3PointArray bez; + bool cl; +}; + + +class Q_COMPAT_EXPORT Q3CanvasLine : public Q3CanvasPolygonalItem +{ +public: + Q3CanvasLine(Q3Canvas* canvas); + ~Q3CanvasLine(); + void setPoints(int x1, int y1, int x2, int y2); + + QPoint startPoint() const + { return QPoint(x1,y1); } + QPoint endPoint() const + { return QPoint(x2,y2); } + + int rtti() const; + static int RTTI; + + void setPen(QPen p); + void moveBy(double dx, double dy); + +protected: + void drawShape(QPainter &); + Q3PointArray areaPoints() const; + +private: + int x1,y1,x2,y2; +}; + + +class Q_COMPAT_EXPORT Q3CanvasEllipse : public Q3CanvasPolygonalItem +{ + +public: + Q3CanvasEllipse(Q3Canvas* canvas); + Q3CanvasEllipse(int width, int height, Q3Canvas* canvas); + Q3CanvasEllipse(int width, int height, int startangle, int angle, + Q3Canvas* canvas); + + ~Q3CanvasEllipse(); + + int width() const; + int height() const; + void setSize(int w, int h); + void setAngles(int start, int length); + int angleStart() const + { return a1; } + int angleLength() const + { return a2; } + Q3PointArray areaPoints() const; + + bool collidesWith(const Q3CanvasItem*) const; + + int rtti() const; + static int RTTI; + +protected: + void drawShape(QPainter &); + +private: + bool collidesWith(const Q3CanvasSprite*, + const Q3CanvasPolygonalItem*, + const Q3CanvasRectangle*, + const Q3CanvasEllipse*, + const Q3CanvasText*) const; + int w, h; + int a1, a2; +}; + + +class Q3CanvasTextExtra; + +class Q_COMPAT_EXPORT Q3CanvasText : public Q3CanvasItem +{ +public: + Q3CanvasText(Q3Canvas* canvas); + Q3CanvasText(const QString&, Q3Canvas* canvas); + Q3CanvasText(const QString&, QFont, Q3Canvas* canvas); + + virtual ~Q3CanvasText(); + + void setText(const QString&); + void setFont(const QFont&); + void setColor(const QColor&); + QString text() const; + QFont font() const; + QColor color() const; + + void moveBy(double dx, double dy); + + int textFlags() const + { return flags; } + void setTextFlags(int); + + QRect boundingRect() const; + + bool collidesWith(const Q3CanvasItem*) const; + + int rtti() const; + static int RTTI; + +protected: + virtual void draw(QPainter&); + +private: + Q_DISABLE_COPY(Q3CanvasText) + + void addToChunks(); + void removeFromChunks(); + void changeChunks(); + + void setRect(); + QRect brect; + QString txt; + int flags; + QFont fnt; + QColor col; + Q3CanvasTextExtra* extra; + + bool collidesWith(const Q3CanvasSprite*, + const Q3CanvasPolygonalItem*, + const Q3CanvasRectangle*, + const Q3CanvasEllipse*, + const Q3CanvasText*) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3CANVAS_H diff --git a/qtinterface/qt4/Qt/q3cleanuphandler.h b/qtinterface/qt4/Qt/q3cleanuphandler.h new file mode 100644 index 0000000..921b27f --- /dev/null +++ b/qtinterface/qt4/Qt/q3cleanuphandler.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3CLEANUPHANDLER_H +#define Q3CLEANUPHANDLER_H + +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class T> +class Q3CleanupHandler +{ + QListData p; +public: + inline Q3CleanupHandler() + { p.d = 0; } + ~Q3CleanupHandler() + { + if (p.d) { + for (int i = 0; i < p.size(); ++i) { + T** t = static_cast<T**>(*p.at(i)); + delete *t; + *t = 0; + } + qFree(p.d); + p.d = 0; + } + } + + T* add(T **object) + { + if (!p.d) { + p.d = &QListData::shared_null; + p.d->ref.ref(); + p.detach(); + } + *p.prepend() = object; + return *object; + } + void remove(T **object) + { + if (p.d) + for (int i = 0; i < p.size(); ++i) + if (*p.at(i) == object) + p.remove(i--); + } +}; + +template<class T> +class Q3SingleCleanupHandler +{ + T **object; +public: + inline Q3SingleCleanupHandler() + : object(0) {} + inline ~Q3SingleCleanupHandler() + { if (object) { delete *object; *object = 0; } } + inline T* set(T **o) + { object = o; return *object; } + inline void reset() { object = 0; } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //Q3CLEANUPHANDLER_H diff --git a/qtinterface/qt4/Qt/q3combobox.h b/qtinterface/qt4/Qt/q3combobox.h new file mode 100644 index 0000000..d779f71 --- /dev/null +++ b/qtinterface/qt4/Qt/q3combobox.h @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3COMBOBOX_H +#define Q3COMBOBOX_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_COMBOBOX + +class Q3StrList; +class QStringList; +class QLineEdit; +class QValidator; +class Q3ListBox; +class Q3ComboBoxData; +class QWheelEvent; + +class Q_COMPAT_EXPORT Q3ComboBox : public QWidget +{ + Q_OBJECT + Q_ENUMS( Policy ) + Q_PROPERTY( bool editable READ editable WRITE setEditable ) + Q_PROPERTY( int count READ count ) + Q_PROPERTY( QString currentText READ currentText WRITE setCurrentText DESIGNABLE false ) + Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem ) + Q_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false ) + Q_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit ) + Q_PROPERTY( int maxCount READ maxCount WRITE setMaxCount ) + Q_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy ) + Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) + Q_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled ) + +public: + Q3ComboBox( QWidget* parent=0, const char* name=0 ); + Q3ComboBox( bool rw, QWidget* parent=0, const char* name=0 ); + ~Q3ComboBox(); + + int count() const; + + void insertStringList( const QStringList &, int index=-1 ); + void insertStrList( const Q3StrList &, int index=-1 ); + void insertStrList( const Q3StrList *, int index=-1 ); + void insertStrList( const char **, int numStrings=-1, int index=-1); + + void insertItem( const QString &text, int index=-1 ); + void insertItem( const QPixmap &pixmap, int index=-1 ); + void insertItem( const QPixmap &pixmap, const QString &text, int index=-1 ); + + void removeItem( int index ); + + int currentItem() const; + virtual void setCurrentItem( int index ); + + QString currentText() const; + virtual void setCurrentText( const QString& ); + + QString text( int index ) const; + const QPixmap *pixmap( int index ) const; + + void changeItem( const QString &text, int index ); + void changeItem( const QPixmap &pixmap, int index ); + void changeItem( const QPixmap &pixmap, const QString &text, int index ); + + bool autoResize() const; + virtual void setAutoResize( bool ); + QSize sizeHint() const; + + void setPalette( const QPalette & ); + void setFont( const QFont & ); + void setEnabled( bool ); + + virtual void setSizeLimit( int ); + int sizeLimit() const; + + virtual void setMaxCount( int ); + int maxCount() const; + + enum Policy { NoInsertion, + AtTop, + AtCurrent, + AtBottom, + AfterCurrent, + BeforeCurrent, + NoInsert = NoInsertion, + InsertAtTop = AtTop, + InsertAtCurrent = AtCurrent, + InsertAtBottom = AtBottom, + InsertAfterCurrent = AfterCurrent, + InsertBeforeCurrent = BeforeCurrent + }; + + virtual void setInsertionPolicy( Policy policy ); + Policy insertionPolicy() const; + + virtual void setValidator( const QValidator * ); + const QValidator * validator() const; + + virtual void setListBox( Q3ListBox * ); + Q3ListBox * listBox() const; + + virtual void setLineEdit( QLineEdit *edit ); + QLineEdit* lineEdit() const; + + virtual void setAutoCompletion( bool ); + bool autoCompletion() const; + + bool eventFilter( QObject *object, QEvent *event ); + + void setDuplicatesEnabled( bool enable ); + bool duplicatesEnabled() const; + + bool editable() const; + void setEditable( bool ); + + virtual void popup(); + + void hide(); + +public Q_SLOTS: + void clear(); + void clearValidator(); + void clearEdit(); + virtual void setEditText( const QString &); + +Q_SIGNALS: + void activated( int index ); + void highlighted( int index ); + void activated( const QString &); + void highlighted( const QString &); + void textChanged( const QString &); + +private Q_SLOTS: + void internalActivate( int ); + void internalHighlight( int ); + void internalClickTimeout(); + void returnPressed(); + +protected: + void paintEvent( QPaintEvent * ); + void resizeEvent( QResizeEvent * ); + void mousePressEvent( QMouseEvent * ); + void mouseMoveEvent( QMouseEvent * ); + void mouseReleaseEvent( QMouseEvent * ); + void mouseDoubleClickEvent( QMouseEvent * ); + void keyPressEvent( QKeyEvent *e ); + void focusInEvent( QFocusEvent *e ); + void focusOutEvent( QFocusEvent *e ); +#ifndef QT_NO_WHEELEVENT + void wheelEvent( QWheelEvent *e ); +#endif + void styleChange( QStyle& ); + + void updateMask(); + +private: + void setUpListBox(); + void setUpLineEdit(); + void popDownListBox(); + void reIndex(); + void currentChanged(); + int completionIndex( const QString &, int ) const; + + Q3ComboBoxData *d; + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + Q3ComboBox( const Q3ComboBox & ); + Q3ComboBox &operator=( const Q3ComboBox & ); +#endif +}; + + +#endif // QT_NO_COMBOBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3COMBOBOX_H diff --git a/qtinterface/qt4/Qt/q3cstring.h b/qtinterface/qt4/Qt/q3cstring.h new file mode 100644 index 0000000..604dc9a --- /dev/null +++ b/qtinterface/qt4/Qt/q3cstring.h @@ -0,0 +1,273 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3CSTRING_H +#define Q3CSTRING_H + +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +/***************************************************************************** + QCString class + *****************************************************************************/ + +class QRegExp; + +class Q_COMPAT_EXPORT Q3CString : public QByteArray +{ +public: + Q3CString() {} + Q3CString(int size) : QByteArray(size, '\0') {} + Q3CString(const Q3CString &s) : QByteArray(s) {} + Q3CString(const QByteArray &ba) : QByteArray(ba) {} + Q3CString(const char *str) : QByteArray(str) {} + Q3CString(const char *str, uint maxlen) : QByteArray(str, qMin(qstrlen(str), maxlen - 1)) {} + + Q3CString &operator=(const Q3CString &s) { + QByteArray::operator=(s); return *this; + } + Q3CString &operator=(const char *str) { + QByteArray::operator=(str); return *this; + } + Q3CString &operator=(const QByteArray &ba) { + QByteArray::operator=(ba); return *this; + } + + Q3CString copy() const { return *this; } + Q3CString &sprintf(const char *format, ...); + + Q3CString left(uint len) const { return QByteArray::left(len); } + Q3CString right(uint len) const { return QByteArray::right(len); } + Q3CString mid(uint index, uint len=0xffffffff) const { return QByteArray::mid(index, len); } + + Q3CString leftJustify(uint width, char fill=' ', bool trunc=false)const; + Q3CString rightJustify(uint width, char fill=' ',bool trunc=false)const; + + Q3CString lower() const { return QByteArray::toLower(); } + Q3CString upper() const { return QByteArray::toUpper(); } + + Q3CString stripWhiteSpace() const { return QByteArray::trimmed(); } + Q3CString simplifyWhiteSpace() const { return QByteArray::simplified(); } + + Q3CString &insert(uint index, const char *c) { QByteArray::insert(index, c); return *this; } + Q3CString &insert(uint index, char c) { QByteArray::insert(index, c); return *this; } + Q3CString &append(const char *c) { QByteArray::append(c); return *this; } + Q3CString &prepend(const char *c) { QByteArray::prepend(c); return *this; } + Q3CString &remove(uint index, uint len) { QByteArray::remove(index, len); return *this; } + Q3CString &replace(uint index, uint len, const char *c) + { QByteArray::replace(index, len, c); return *this; } + Q3CString &replace(char c, const Q3CString &after) { return replace(c, after.constData()); } + Q3CString &replace(char c, const char *after) { QByteArray::replace(c, after); return *this; } + Q3CString &replace(const Q3CString &b, const Q3CString &a) + { return replace(b.constData(), a.constData()); } + Q3CString &replace(const char *b, const char *a) { QByteArray::replace(b, a); return *this; } + Q3CString &replace(char b, char a) { QByteArray::replace(b, a); return *this; } + + short toShort(bool *ok=0) const; + ushort toUShort(bool *ok=0) const; + int toInt(bool *ok=0) const; + uint toUInt(bool *ok=0) const; + long toLong(bool *ok=0) const; + ulong toULong(bool *ok=0) const; + float toFloat(bool *ok=0) const; + double toDouble(bool *ok=0) const; + + Q3CString &setStr(const char *s) { *this = s; return *this; } + Q3CString &setNum(short); + Q3CString &setNum(ushort); + Q3CString &setNum(int); + Q3CString &setNum(uint); + Q3CString &setNum(long); + Q3CString &setNum(ulong); + Q3CString &setNum(float, char f='g', int prec=6); + Q3CString &setNum(double, char f='g', int prec=6); + + bool setExpand(uint index, char c); + +}; + + +/***************************************************************************** + Q3CString stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_COMPAT_EXPORT QDataStream &operator<<(QDataStream &d, const Q3CString &s); +Q_COMPAT_EXPORT QDataStream &operator>>(QDataStream &d, Q3CString &s); +#endif + +/***************************************************************************** + Q3CString inline functions + *****************************************************************************/ + +inline Q3CString &Q3CString::setNum(short n) +{ return setNum(long(n)); } + +inline Q3CString &Q3CString::setNum(ushort n) +{ return setNum(ulong(n)); } + +inline Q3CString &Q3CString::setNum(int n) +{ return setNum(long(n)); } + +inline Q3CString &Q3CString::setNum(uint n) +{ return setNum(ulong(n)); } + +inline Q3CString &Q3CString::setNum(float n, char f, int prec) +{ return setNum(double(n),f,prec); } + +/***************************************************************************** + Q3CString non-member operators + *****************************************************************************/ + +Q_COMPAT_EXPORT inline bool operator==(const Q3CString &s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) == 0; } + +Q_COMPAT_EXPORT inline bool operator==(const Q3CString &s1, const char *s2) +{ return qstrcmp(s1, s2) == 0; } + +Q_COMPAT_EXPORT inline bool operator==(const char *s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) == 0; } + +Q_COMPAT_EXPORT inline bool operator!=(const Q3CString &s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) != 0; } + +Q_COMPAT_EXPORT inline bool operator!=(const Q3CString &s1, const char *s2) +{ return qstrcmp(s1, s2) != 0; } + +Q_COMPAT_EXPORT inline bool operator!=(const char *s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) != 0; } + +Q_COMPAT_EXPORT inline bool operator<(const Q3CString &s1, const Q3CString& s2) +{ return qstrcmp(s1, s2) < 0; } + +Q_COMPAT_EXPORT inline bool operator<(const Q3CString &s1, const char *s2) +{ return qstrcmp(s1, s2) < 0; } + +Q_COMPAT_EXPORT inline bool operator<(const char *s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) < 0; } + +Q_COMPAT_EXPORT inline bool operator<=(const Q3CString &s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) <= 0; } + +Q_COMPAT_EXPORT inline bool operator<=(const Q3CString &s1, const char *s2) +{ return qstrcmp(s1, s2) <= 0; } + +Q_COMPAT_EXPORT inline bool operator<=(const char *s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) <= 0; } + +Q_COMPAT_EXPORT inline bool operator>(const Q3CString &s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) > 0; } + +Q_COMPAT_EXPORT inline bool operator>(const Q3CString &s1, const char *s2) +{ return qstrcmp(s1, s2) > 0; } + +Q_COMPAT_EXPORT inline bool operator>(const char *s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) > 0; } + +Q_COMPAT_EXPORT inline bool operator>=(const Q3CString &s1, const Q3CString& s2) +{ return qstrcmp(s1, s2) >= 0; } + +Q_COMPAT_EXPORT inline bool operator>=(const Q3CString &s1, const char *s2) +{ return qstrcmp(s1, s2) >= 0; } + +Q_COMPAT_EXPORT inline bool operator>=(const char *s1, const Q3CString &s2) +{ return qstrcmp(s1, s2) >= 0; } + +Q_COMPAT_EXPORT inline const Q3CString operator+(const Q3CString &s1, + const Q3CString &s2) +{ + Q3CString tmp(s1); + tmp += s2; + return tmp; +} +Q_COMPAT_EXPORT inline const Q3CString operator+(const Q3CString &s1, + const QByteArray &s2) +{ + QByteArray tmp(s1); + tmp += s2; + return tmp; +} +Q_COMPAT_EXPORT inline const Q3CString operator+(const QByteArray &s1, + const Q3CString &s2) +{ + QByteArray tmp(s1); + tmp += s2; + return tmp; +} + +Q_COMPAT_EXPORT inline const Q3CString operator+(const Q3CString &s1, const char *s2) +{ + Q3CString tmp(s1); + tmp += s2; + return tmp; +} + +Q_COMPAT_EXPORT inline const Q3CString operator+(const char *s1, const Q3CString &s2) +{ + Q3CString tmp(s1); + tmp += s2; + return tmp; +} + +Q_COMPAT_EXPORT inline const Q3CString operator+(const Q3CString &s1, char c2) +{ + Q3CString tmp(s1); + tmp += c2; + return tmp; +} + +Q_COMPAT_EXPORT inline const Q3CString operator+(char c1, const Q3CString &s2) +{ + Q3CString tmp; + tmp += c1; + tmp += s2; + return tmp; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3CSTRING_H diff --git a/qtinterface/qt4/Qt/q3databrowser.h b/qtinterface/qt4/Qt/q3databrowser.h new file mode 100644 index 0000000..a532adb --- /dev/null +++ b/qtinterface/qt4/Qt/q3databrowser.h @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DATABROWSER_H +#define Q3DATABROWSER_H + +#include <QtGui/qwidget.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtSql/qsql.h> +#include <QtSql/qsqlindex.h> +#include <Qt3Support/q3sqlcursor.h> +#include <QtSql/qsqlerror.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_VIEW_WIDGETS + +class Q3SqlForm; +class Q3DataBrowserPrivate; + +class Q_COMPAT_EXPORT Q3DataBrowser : public QWidget +{ + Q_OBJECT + Q_PROPERTY(bool boundaryChecking READ boundaryChecking WRITE setBoundaryChecking) + Q_PROPERTY(QString filter READ filter WRITE setFilter) + Q_PROPERTY(QStringList sort READ sort WRITE setSort) + Q_PROPERTY(bool confirmEdits READ confirmEdits WRITE setConfirmEdits) + Q_PROPERTY(bool confirmInsert READ confirmInsert WRITE setConfirmInsert) + Q_PROPERTY(bool confirmUpdate READ confirmUpdate WRITE setConfirmUpdate) + Q_PROPERTY(bool confirmDelete READ confirmDelete WRITE setConfirmDelete) + Q_PROPERTY(bool confirmCancels READ confirmCancels WRITE setConfirmCancels) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool autoEdit READ autoEdit WRITE setAutoEdit) + +public: + Q3DataBrowser(QWidget* parent=0, const char* name=0, Qt::WindowFlags fl = 0); + ~Q3DataBrowser(); + + enum Boundary { + Unknown, + None, + BeforeBeginning, + Beginning, + End, + AfterEnd + }; + + Boundary boundary(); + void setBoundaryChecking(bool active); + bool boundaryChecking() const; + + void setSort(const QSqlIndex& sort); + void setSort(const QStringList& sort); + QStringList sort() const; + void setFilter(const QString& filter); + QString filter() const; + virtual void setSqlCursor(Q3SqlCursor* cursor, bool autoDelete = false); + Q3SqlCursor* sqlCursor() const; + virtual void setForm(Q3SqlForm* form); + Q3SqlForm* form(); + + virtual void setConfirmEdits(bool confirm); + virtual void setConfirmInsert(bool confirm); + virtual void setConfirmUpdate(bool confirm); + virtual void setConfirmDelete(bool confirm); + virtual void setConfirmCancels(bool confirm); + bool confirmEdits() const; + bool confirmInsert() const; + bool confirmUpdate() const; + bool confirmDelete() const; + bool confirmCancels() const; + + virtual void setReadOnly(bool active); + bool isReadOnly() const; + virtual void setAutoEdit(bool autoEdit); + bool autoEdit() const; + + virtual bool seek(int i, bool relative = false); + +Q_SIGNALS: + void firstRecordAvailable(bool available); + void lastRecordAvailable(bool available); + void nextRecordAvailable(bool available); + void prevRecordAvailable(bool available); + + void currentChanged(const QSqlRecord* record); + void primeInsert(QSqlRecord* buf); + void primeUpdate(QSqlRecord* buf); + void primeDelete(QSqlRecord* buf); + void beforeInsert(QSqlRecord* buf); + void beforeUpdate(QSqlRecord* buf); + void beforeDelete(QSqlRecord* buf); + void cursorChanged(Q3SqlCursor::Mode mode); + +public Q_SLOTS: + virtual void refresh(); + + virtual void insert(); + virtual void update(); + virtual void del(); + + virtual void first(); + virtual void last(); + virtual void next(); + virtual void prev(); + + virtual void readFields(); + virtual void writeFields(); + virtual void clearValues(); + + void updateBoundary(); + +protected: + virtual bool insertCurrent(); + virtual bool updateCurrent(); + virtual bool deleteCurrent(); + virtual bool currentEdited(); + + virtual QSql::Confirm confirmEdit(QSql::Op m); + virtual QSql::Confirm confirmCancel(QSql::Op m); + + virtual void handleError(const QSqlError& error); + +private: + typedef bool (Q3SqlCursor::*Nav)(); + bool preNav(); + void postNav(bool primeUpd); + void nav(Nav nav); + Q3DataBrowserPrivate* d; + + Q_DISABLE_COPY(Q3DataBrowser) +}; + +#endif // QT_NO_SQL_VIEW_WIDGETS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DATABROWSER_H diff --git a/qtinterface/qt4/Qt/q3datatable.h b/qtinterface/qt4/Qt/q3datatable.h new file mode 100644 index 0000000..68d0ec1 --- /dev/null +++ b/qtinterface/qt4/Qt/q3datatable.h @@ -0,0 +1,251 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DATATABLE_H +#define Q3DATATABLE_H + +#include <QtCore/qstring.h> +#include <QtCore/qvariant.h> +#include <Qt3Support/q3table.h> +#include <QtSql/qsql.h> +#include <Qt3Support/q3sqlcursor.h> +#include <QtSql/qsqlindex.h> +#include <Qt3Support/q3sqleditorfactory.h> +#include <Qt3Support/qiconset.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_VIEW_WIDGETS + +class QPainter; +class QSqlField; +class Q3SqlPropertyMap; +class Q3DataTablePrivate; + +class Q_COMPAT_EXPORT Q3DataTable : public Q3Table +{ + Q_OBJECT + + Q_PROPERTY( QString nullText READ nullText WRITE setNullText ) + Q_PROPERTY( QString trueText READ trueText WRITE setTrueText ) + Q_PROPERTY( QString falseText READ falseText WRITE setFalseText ) + Q_PROPERTY( Qt::DateFormat dateFormat READ dateFormat WRITE setDateFormat ) + Q_PROPERTY( bool confirmEdits READ confirmEdits WRITE setConfirmEdits ) + Q_PROPERTY( bool confirmInsert READ confirmInsert WRITE setConfirmInsert ) + Q_PROPERTY( bool confirmUpdate READ confirmUpdate WRITE setConfirmUpdate ) + Q_PROPERTY( bool confirmDelete READ confirmDelete WRITE setConfirmDelete ) + Q_PROPERTY( bool confirmCancels READ confirmCancels WRITE setConfirmCancels ) + Q_PROPERTY( bool autoEdit READ autoEdit WRITE setAutoEdit ) + Q_PROPERTY( QString filter READ filter WRITE setFilter ) + Q_PROPERTY( QStringList sort READ sort WRITE setSort ) + Q_PROPERTY( int numCols READ numCols ) + Q_PROPERTY( int numRows READ numRows ) + +public: + Q3DataTable ( QWidget* parent=0, const char* name=0 ); + Q3DataTable ( Q3SqlCursor* cursor, bool autoPopulate = false, QWidget* parent=0, const char* name=0 ); + ~Q3DataTable(); + + virtual void addColumn( const QString& fieldName, + const QString& label = QString(), + int width = -1, + const QIconSet& iconset = QIconSet() ); + virtual void removeColumn( int col ); + virtual void setColumn( uint col, const QString& fieldName, + const QString& label = QString(), + int width = -1, + const QIconSet& iconset = QIconSet() ); + + QString nullText() const; + QString trueText() const; + QString falseText() const; + Qt::DateFormat dateFormat() const; + bool confirmEdits() const; + bool confirmInsert() const; + bool confirmUpdate() const; + bool confirmDelete() const; + bool confirmCancels() const; + bool autoDelete() const; + bool autoEdit() const; + QString filter() const; + QStringList sort() const; + + virtual void setSqlCursor( Q3SqlCursor* cursor = 0, + bool autoPopulate = false, bool autoDelete = false ); + Q3SqlCursor* sqlCursor() const; + + virtual void setNullText( const QString& nullText ); + virtual void setTrueText( const QString& trueText ); + virtual void setFalseText( const QString& falseText ); + virtual void setDateFormat( const Qt::DateFormat f ); + virtual void setConfirmEdits( bool confirm ); + virtual void setConfirmInsert( bool confirm ); + virtual void setConfirmUpdate( bool confirm ); + virtual void setConfirmDelete( bool confirm ); + virtual void setConfirmCancels( bool confirm ); + virtual void setAutoDelete( bool enable ); + virtual void setAutoEdit( bool autoEdit ); + virtual void setFilter( const QString& filter ); + virtual void setSort( const QStringList& sort ); + virtual void setSort( const QSqlIndex& sort ); + + enum Refresh { + RefreshData = 1, + RefreshColumns = 2, + RefreshAll = 3 + }; + void refresh( Refresh mode ); + void sortColumn ( int col, bool ascending = true, + bool wholeRows = false ); + QString text ( int row, int col ) const; + QVariant value ( int row, int col ) const; + QSqlRecord* currentRecord() const; + + void installEditorFactory( Q3SqlEditorFactory * f ); + void installPropertyMap( Q3SqlPropertyMap* m ); + + int numCols() const; + int numRows() const; + void setNumCols( int c ); + void setNumRows ( int r ); + bool findBuffer( const QSqlIndex& idx, int atHint = 0 ); + + void hideColumn( int col ); + void showColumn( int col ); + int indexOf( uint i ) const; + void selectRow(int row); + +Q_SIGNALS: + void currentChanged( QSqlRecord* record ); + void primeInsert( QSqlRecord* buf ); + void primeUpdate( QSqlRecord* buf ); + void primeDelete( QSqlRecord* buf ); + void beforeInsert( QSqlRecord* buf ); + void beforeUpdate( QSqlRecord* buf ); + void beforeDelete( QSqlRecord* buf ); + void cursorChanged( QSql::Op mode ); + +public Q_SLOTS: + virtual void find( const QString & str, bool caseSensitive, + bool backwards ); + virtual void sortAscending( int col ); + virtual void sortDescending( int col ); + virtual void refresh(); + void setColumnWidth( int col, int w ); + void adjustColumn( int col ); + void setColumnStretchable( int col, bool stretch ); + void swapColumns( int col1, int col2, bool swapHeaders = false ); + +protected: + virtual bool insertCurrent(); + virtual bool updateCurrent(); + virtual bool deleteCurrent(); + + virtual QSql::Confirm confirmEdit( QSql::Op m ); + virtual QSql::Confirm confirmCancel( QSql::Op m ); + + virtual void handleError( const QSqlError& e ); + + virtual bool beginInsert(); + virtual QWidget* beginUpdate ( int row, int col, bool replace ); + + bool eventFilter( QObject *o, QEvent *e ); + void keyPressEvent( QKeyEvent* ); + void resizeEvent ( QResizeEvent * ); + void contentsMousePressEvent( QMouseEvent* e ); + void contentsContextMenuEvent( QContextMenuEvent* e ); + void endEdit( int row, int col, bool accept, bool replace ); + QWidget * createEditor( int row, int col, bool initFromCell ) const; + void activateNextCell(); + void reset(); + void setSize( Q3SqlCursor* sql ); + void repaintCell( int row, int col ); + void paintCell ( QPainter * p, int row, int col, const QRect & cr, + bool selected, const QColorGroup &cg ); + virtual void paintField( QPainter * p, const QSqlField* field, const QRect & cr, + bool selected ); + void drawContents( QPainter * p, int cx, int cy, int cw, int ch ); + virtual int fieldAlignment( const QSqlField* field ); + void columnClicked ( int col ); + void resizeData ( int len ); + + Q3TableItem * item ( int row, int col ) const; + void setItem ( int row, int col, Q3TableItem * item ); + void clearCell ( int row, int col ) ; + void setPixmap ( int row, int col, const QPixmap & pix ); + void takeItem ( Q3TableItem * i ); + +private Q_SLOTS: + void loadNextPage(); + void setCurrentSelection( int row, int col ); + void updateCurrentSelection(); + void sliderPressed(); + void sliderReleased(); + void doInsertCurrent(); + void doUpdateCurrent(); + +private: + void drawContents( QPainter *p); + QString fieldToString( const QSqlField * field ); + void init(); + QWidget* beginEdit ( int row, int col, bool replace ); + void updateRow( int row ); + void endInsert(); + void endUpdate(); + Q3DataTablePrivate* d; + +#if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator= + Q3DataTable( const Q3DataTable & ); + Q3DataTable &operator=( const Q3DataTable & ); +#endif +}; + +#endif // QT_NO_SQL_VIEW_WIDGETS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DATATABLE_H diff --git a/qtinterface/qt4/Qt/q3dataview.h b/qtinterface/qt4/Qt/q3dataview.h new file mode 100644 index 0000000..17ea2a1 --- /dev/null +++ b/qtinterface/qt4/Qt/q3dataview.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DATAVIEW_H +#define Q3DATAVIEW_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_VIEW_WIDGETS + +class Q3SqlForm; +class QSqlRecord; +class Q3DataViewPrivate; + +class Q_COMPAT_EXPORT Q3DataView : public QWidget +{ + Q_OBJECT + +public: + Q3DataView(QWidget* parent=0, const char* name=0, Qt::WindowFlags fl = 0); + ~Q3DataView(); + + virtual void setForm(Q3SqlForm* form); + Q3SqlForm* form(); + virtual void setRecord(QSqlRecord* record); + QSqlRecord* record(); + +public Q_SLOTS: + virtual void refresh(QSqlRecord* buf); + virtual void readFields(); + virtual void writeFields(); + virtual void clearValues(); + +private: + Q_DISABLE_COPY(Q3DataView) + + Q3DataViewPrivate* d; +}; + +#endif // QT_NO_SQL_VIEW_WIDGETS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DATAVIEW_H diff --git a/qtinterface/qt4/Qt/q3datetimeedit.h b/qtinterface/qt4/Qt/q3datetimeedit.h new file mode 100644 index 0000000..18b2615 --- /dev/null +++ b/qtinterface/qt4/Qt/q3datetimeedit.h @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DATETIMEEDIT_H +#define Q3DATETIMEEDIT_H + +#include <QtGui/qwidget.h> +#include <QtCore/qstring.h> +#include <QtCore/qdatetime.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_DATETIMEEDIT + +class Q_COMPAT_EXPORT Q3DateTimeEditBase : public QWidget +{ + Q_OBJECT +public: + Q3DateTimeEditBase(QWidget* parent=0, const char* name=0) + : QWidget(parent) { setObjectName(QString::fromAscii(name)); } + + virtual bool setFocusSection(int sec) = 0; + virtual QString sectionFormattedText(int sec) = 0; + virtual void addNumber(int sec, int num) = 0; + virtual void removeLastNumber(int sec) = 0; + +public Q_SLOTS: + virtual void stepUp() = 0; + virtual void stepDown() = 0; + +private: + Q_DISABLE_COPY(Q3DateTimeEditBase) +}; + +class Q3DateEditPrivate; + +class Q_COMPAT_EXPORT Q3DateEdit : public Q3DateTimeEditBase +{ + Q_OBJECT + Q_ENUMS(Order) + Q_PROPERTY(Order order READ order WRITE setOrder) + Q_PROPERTY(QDate date READ date WRITE setDate USER true) + Q_PROPERTY(bool autoAdvance READ autoAdvance WRITE setAutoAdvance) + Q_PROPERTY(QDate maxValue READ maxValue WRITE setMaxValue) + Q_PROPERTY(QDate minValue READ minValue WRITE setMinValue) + +public: + Q3DateEdit(QWidget* parent=0, const char* name=0); + Q3DateEdit(const QDate& date, QWidget* parent=0, const char* name=0); + ~Q3DateEdit(); + + enum Order { DMY, MDY, YMD, YDM }; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +public Q_SLOTS: + virtual void setDate(const QDate& date); + +public: + QDate date() const; + virtual void setOrder(Order order); + Order order() const; + virtual void setAutoAdvance(bool advance); + bool autoAdvance() const; + + virtual void setMinValue(const QDate& d) { setRange(d, maxValue()); } + QDate minValue() const; + virtual void setMaxValue(const QDate& d) { setRange(minValue(), d); } + QDate maxValue() const; + virtual void setRange(const QDate& min, const QDate& max); + QString separator() const; + virtual void setSeparator(const QString& s); + + // Make removeFirstNumber() virtual in Q3DateTimeEditBase in 4.0 + void removeFirstNumber(int sec); + +Q_SIGNALS: + void valueChanged(const QDate& date); + +protected: + bool event(QEvent *e); + void timerEvent(QTimerEvent *); + void resizeEvent(QResizeEvent *); + void stepUp(); + void stepDown(); + QString sectionFormattedText(int sec); + void addNumber(int sec, int num); + + void removeLastNumber(int sec); + bool setFocusSection(int s); + + virtual void setYear(int year); + virtual void setMonth(int month); + virtual void setDay(int day); + virtual void fix(); + virtual bool outOfRange(int y, int m, int d) const; + +protected Q_SLOTS: + void updateButtons(); + +private: + Q_DISABLE_COPY(Q3DateEdit) + + void init(); + int sectionOffsetEnd(int sec) const; + int sectionLength(int sec) const; + QString sectionText(int sec) const; + Q3DateEditPrivate* d; +}; + +class Q3TimeEditPrivate; + +class Q_COMPAT_EXPORT Q3TimeEdit : public Q3DateTimeEditBase +{ + Q_OBJECT + Q_FLAGS(Display) + Q_PROPERTY(QTime time READ time WRITE setTime USER true) + Q_PROPERTY(bool autoAdvance READ autoAdvance WRITE setAutoAdvance) + Q_PROPERTY(QTime maxValue READ maxValue WRITE setMaxValue) + Q_PROPERTY(QTime minValue READ minValue WRITE setMinValue) + Q_PROPERTY(Display display READ display WRITE setDisplay) + +public: + enum Display { + Hours = 0x01, + Minutes = 0x02, + Seconds = 0x04, + /*Reserved = 0x08,*/ + AMPM = 0x10 + }; + + Q3TimeEdit(QWidget* parent=0, const char* name=0); + Q3TimeEdit(const QTime& time, QWidget* parent=0, const char* name=0); + ~Q3TimeEdit(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +public Q_SLOTS: + virtual void setTime(const QTime& time); + +public: + QTime time() const; + virtual void setAutoAdvance(bool advance); + bool autoAdvance() const; + + virtual void setMinValue(const QTime& d) { setRange(d, maxValue()); } + QTime minValue() const; + virtual void setMaxValue(const QTime& d) { setRange(minValue(), d); } + QTime maxValue() const; + virtual void setRange(const QTime& min, const QTime& max); + QString separator() const; + virtual void setSeparator(const QString& s); + + uint display() const; + void setDisplay(uint disp); + + // Make removeFirstNumber() virtual in Q3DateTimeEditBase in 4.0 + void removeFirstNumber(int sec); + +Q_SIGNALS: + void valueChanged(const QTime& time); + +protected: + bool event(QEvent *e); + void timerEvent(QTimerEvent *e); + void resizeEvent(QResizeEvent *); + void stepUp(); + void stepDown(); + QString sectionFormattedText(int sec); + void addNumber(int sec, int num); + void removeLastNumber(int sec); + bool setFocusSection(int s); + + virtual bool outOfRange(int h, int m, int s) const; + virtual void setHour(int h); + virtual void setMinute(int m); + virtual void setSecond(int s); + +protected Q_SLOTS: + void updateButtons(); + +private: + Q_DISABLE_COPY(Q3TimeEdit) + + void init(); + QString sectionText(int sec); + Q3TimeEditPrivate* d; +}; + + +class Q3DateTimeEditPrivate; + +class Q_COMPAT_EXPORT Q3DateTimeEdit : public QWidget +{ + Q_OBJECT + Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime USER true) + +public: + Q3DateTimeEdit(QWidget* parent=0, const char* name=0); + Q3DateTimeEdit(const QDateTime& datetime, QWidget* parent=0, + const char* name=0); + ~Q3DateTimeEdit(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +public Q_SLOTS: + virtual void setDateTime(const QDateTime & dt); + +public: + QDateTime dateTime() const; + + Q3DateEdit* dateEdit() { return de; } + Q3TimeEdit* timeEdit() { return te; } + + virtual void setAutoAdvance(bool advance); + bool autoAdvance() const; + +Q_SIGNALS: + void valueChanged(const QDateTime& datetime); + +protected: + void init(); + void resizeEvent(QResizeEvent *); + +protected Q_SLOTS: + void newValue(const QDate& d); + void newValue(const QTime& t); + +private: + Q_DISABLE_COPY(Q3DateTimeEdit) + + Q3DateEdit* de; + Q3TimeEdit* te; + Q3DateTimeEditPrivate* d; +}; + +#endif // QT_NO_DATETIMEEDIT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DATETIMEEDIT_H diff --git a/qtinterface/qt4/Qt/q3deepcopy.h b/qtinterface/qt4/Qt/q3deepcopy.h new file mode 100644 index 0000000..6df4342 --- /dev/null +++ b/qtinterface/qt4/Qt/q3deepcopy.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DEEPCOPY_H +#define Q3DEEPCOPY_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template <class T> +class Q3DeepCopy +{ +public: + inline Q3DeepCopy() + { + } + + inline Q3DeepCopy(const T &t) + : deepcopy(t) + { + deepcopy.detach(); + } + + inline Q3DeepCopy<T> &operator=(const T &t) + { + deepcopy = t; + deepcopy.detach(); + return *this; + } + + inline operator T () + { + T tmp = deepcopy; + tmp.detach(); + return tmp; + } + +private: + T deepcopy; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DEEPCOPY_H diff --git a/qtinterface/qt4/Qt/q3dict.h b/qtinterface/qt4/Qt/q3dict.h new file mode 100644 index 0000000..d18ddf9 --- /dev/null +++ b/qtinterface/qt4/Qt/q3dict.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DICT_H +#define Q3DICT_H + +#include <Qt3Support/q3gdict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3Dict +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GDict +#endif +{ +public: + Q3Dict(int size = 17, bool caseSensitive = true) + : Q3GDict(size, StringKey, caseSensitive, false) { } + Q3Dict(const Q3Dict<type> &d) : Q3GDict(d) { } + ~Q3Dict() { clear(); } + Q3Dict<type> &operator=(const Q3Dict<type> &d) + { return (Q3Dict<type>&)Q3GDict::operator=(d); } + uint count() const { return Q3GDict::count(); } + uint size() const { return Q3GDict::size(); } + bool isEmpty() const { return Q3GDict::count() == 0; } + + void insert(const QString &k, const type *d) + { Q3GDict::look_string(k,(Item)d,1); } + void replace(const QString &k, const type *d) + { Q3GDict::look_string(k,(Item)d,2); } + bool remove(const QString &k) { return Q3GDict::remove_string(k); } + type *take(const QString &k) { return (type *)Q3GDict::take_string(k); } + type *find(const QString &k) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_string(k,0,0); } + type *operator[](const QString &k) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_string(k,0,0); } + + void clear() { Q3GDict::clear(); } + void resize(uint n) { Q3GDict::resize(n); } + void statistics() const { Q3GDict::statistics(); } + +#ifdef qdoc +protected: + virtual QDataStream& read(QDataStream &, Q3PtrCollection::Item &); + virtual QDataStream& write(QDataStream &, Q3PtrCollection::Item) const; +#endif + +private: + void deleteItem(Item d); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3Dict<void>::deleteItem(Item) +{ +} +#endif + +template<class type> inline void Q3Dict<type>::deleteItem(Q3PtrCollection::Item d) +{ + if (del_item) delete (type *)d; +} + +template<class type> +class Q3DictIterator : public Q3GDictIterator +{ +public: + Q3DictIterator(const Q3Dict<type> &d) : Q3GDictIterator((Q3GDict &)d) { } + ~Q3DictIterator() {} + uint count() const { return dict->count(); } + bool isEmpty() const { return dict->count() == 0; } + type *toFirst() { return (type *)Q3GDictIterator::toFirst(); } + operator type *() const { return (type *)Q3GDictIterator::get(); } + type *operator*() { return (type *)Q3GDictIterator::get(); } + type *current() const { return (type *)Q3GDictIterator::get(); } + QString currentKey() const{ return Q3GDictIterator::getKeyString(); } + type *operator()() { return (type *)Q3GDictIterator::operator()(); } + type *operator++() { return (type *)Q3GDictIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GDictIterator::operator+=(j); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DICT_H diff --git a/qtinterface/qt4/Qt/q3dns.h b/qtinterface/qt4/Qt/q3dns.h new file mode 100644 index 0000000..c90cf0a --- /dev/null +++ b/qtinterface/qt4/Qt/q3dns.h @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DNS_H +#define Q3DNS_H + +#include <QtCore/qobject.h> +#include <QtNetwork/qhostaddress.h> +#include <QtCore/qsocketnotifier.h> +#include <QtCore/qstringlist.h> +#include <Qt3Support/q3valuelist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_DNS + +//#define Q_DNS_SYNCHRONOUS + +class Q3DnsPrivate; + +class Q_COMPAT_EXPORT Q3Dns: public QObject { + Q_OBJECT +public: + enum RecordType { + None, + A, Aaaa, + Mx, Srv, + Cname, + Ptr, + Txt + }; + + Q3Dns(); + Q3Dns( const QString & label, RecordType rr = A ); + Q3Dns( const QHostAddress & address, RecordType rr = Ptr ); + virtual ~Q3Dns(); + + // to set/change the query + virtual void setLabel( const QString & label ); + virtual void setLabel( const QHostAddress & address ); + QString label() const { return l; } + + virtual void setRecordType( RecordType rr = A ); + RecordType recordType() const { return t; } + + // whether something is happening behind the scenes + bool isWorking() const; + + // to query for replies + Q3ValueList<QHostAddress> addresses() const; + + class Q_COMPAT_EXPORT MailServer { + public: + MailServer( const QString & n=QString(), Q_UINT16 p=0 ) + :name(n), priority(p) {} + QString name; + Q_UINT16 priority; + Q_DUMMY_COMPARISON_OPERATOR(MailServer) + }; + Q3ValueList<MailServer> mailServers() const; + + class Q_COMPAT_EXPORT Server { + public: + Server(const QString & n=QString(), Q_UINT16 p=0, Q_UINT16 w=0, Q_UINT16 po=0 ) + : name(n), priority(p), weight(w), port(po) {} + QString name; + Q_UINT16 priority; + Q_UINT16 weight; + Q_UINT16 port; + Q_DUMMY_COMPARISON_OPERATOR(Server) + }; + Q3ValueList<Server> servers() const; + + QStringList hostNames() const; + + QStringList texts() const; + + QString canonicalName() const; // ### real-world but uncommon: QStringList + + QStringList qualifiedNames() const { return n; } + +#if defined(Q_DNS_SYNCHRONOUS) +protected: + void connectNotify( const char *signal ); +#endif + +Q_SIGNALS: + void resultsReady(); + +private Q_SLOTS: + void startQuery(); + +private: + static void doResInit(); + void setStartQueryTimer(); + static QString toInAddrArpaDomain( const QHostAddress &address ); +#if defined(Q_DNS_SYNCHRONOUS) + void doSynchronousLookup(); +#endif + + QString l; + QStringList n; + RecordType t; + Q3DnsPrivate * d; + + friend class Q3DnsAnswer; + friend class Q3DnsManager; +}; + + +// Q3DnsSocket are sockets that are used for DNS lookup + +class Q3DnsSocket: public QObject { + Q_OBJECT + // note: Private not public. This class contains NO public API. +protected: + Q3DnsSocket( QObject *, const char * ); + virtual ~Q3DnsSocket(); + +private Q_SLOTS: + virtual void cleanCache(); + virtual void retransmit(); + virtual void answer(); +}; + +#endif // QT_NO_DNS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DNS_H diff --git a/qtinterface/qt4/Qt/q3dockarea.h b/qtinterface/qt4/Qt/q3dockarea.h new file mode 100644 index 0000000..c506368 --- /dev/null +++ b/qtinterface/qt4/Qt/q3dockarea.h @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DOCKAREA_H +#define Q3DOCKAREA_H + +#include <QtGui/qwidget.h> +#include <QtCore/qlist.h> +#include <Qt3Support/q3dockwindow.h> +#include <QtGui/qlayout.h> +#include <QtCore/qpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_MAINWINDOW + +class QBoxLayout; +class Q3DockAreaLayout; +class QMouseEvent; +class Q3DockWindowResizeHandle; +class Q3DockAreaPrivate; +class QTextStream; + +class Q_COMPAT_EXPORT Q3DockAreaLayout : public QLayout +{ + Q_OBJECT + friend class Q3DockArea; + +public: + Q3DockAreaLayout(QWidget* parent, Qt::Orientation o, QList<Q3DockWindow *> *wl, int space = -1, int margin = -1, const char *name = 0) + : QLayout(parent), orient(o), dirty(true), dockWindows(wl), parentWidget(parent) + { + if (space != -1) + setSpacing(space); + if (margin != -1) + setMargin(margin); + setObjectName(QString::fromAscii(name)); + init(); + } + ~Q3DockAreaLayout() {} + + void addItem(QLayoutItem *) {} + bool hasHeightForWidth() const; + int heightForWidth(int) const; + int widthForHeight(int) const; + QSize sizeHint() const; + QSize minimumSize() const; + QLayoutItem *itemAt(int) const; + QLayoutItem *takeAt(int); + int count() const; + Qt::Orientations expandingDirections() const { return Qt::Orientations(0); } + void invalidate(); + Qt::Orientation orientation() const { return orient; } + QList<QRect> lineList() const { return lines; } + QList<Q3DockWindow *> lineStarts() const { return ls; } + +protected: + void setGeometry(const QRect&); + +private: + Q_DISABLE_COPY(Q3DockAreaLayout) + + void init(); + int layoutItems(const QRect&, bool testonly = false); + Qt::Orientation orient; + bool dirty; + int cached_width, cached_height; + int cached_hfw, cached_wfh; + QList<Q3DockWindow *> *dockWindows; + QWidget *parentWidget; + QList<QRect> lines; + QList<Q3DockWindow *> ls; +}; + +class Q_COMPAT_EXPORT Q3DockArea : public QWidget +{ + Q_OBJECT + Q_ENUMS(HandlePosition) + Q_PROPERTY(Qt::Orientation orientation READ orientation) + Q_PROPERTY(int count READ count) + Q_PROPERTY(bool empty READ isEmpty) + Q_PROPERTY(HandlePosition handlePosition READ handlePosition) + + friend class Q3DockWindow; + friend class Q3DockWindowResizeHandle; + friend class Q3DockAreaLayout; + +public: + enum HandlePosition { Normal, Reverse }; + + Q3DockArea(Qt::Orientation o, HandlePosition h = Normal, QWidget* parent=0, const char* name=0); + ~Q3DockArea(); + + void moveDockWindow(Q3DockWindow *w, const QPoint &globalPos, const QRect &rect, bool swap); + void removeDockWindow(Q3DockWindow *w, bool makeFloating, bool swap, bool fixNewLines = true); + void moveDockWindow(Q3DockWindow *w, int index = -1); + bool hasDockWindow(Q3DockWindow *w, int *index = 0); + + void invalidNextOffset(Q3DockWindow *dw); + + Qt::Orientation orientation() const { return orient; } + HandlePosition handlePosition() const { return hPos; } + + bool eventFilter(QObject *, QEvent *); + bool isEmpty() const; + int count() const; + QList<Q3DockWindow *> dockWindowList() const; + + bool isDockWindowAccepted(Q3DockWindow *dw); + void setAcceptDockWindow(Q3DockWindow *dw, bool accept); + +public Q_SLOTS: + void lineUp(bool keepNewLines); + +private: + struct DockWindowData + { + int index; + int offset; + int line; + QSize fixedExtent; + QPointer<Q3DockArea> area; + }; + + int findDockWindow(Q3DockWindow *w); + int lineOf(int index); + DockWindowData *dockWindowData(Q3DockWindow *w); + void dockWindow(Q3DockWindow *dockWindow, DockWindowData *data); + void updateLayout(); + void invalidateFixedSizes(); + int maxSpace(int hint, Q3DockWindow *dw); + void setFixedExtent(int d, Q3DockWindow *dw); + bool isLastDockWindow(Q3DockWindow *dw); + +private: + Q_DISABLE_COPY(Q3DockArea) + + Qt::Orientation orient; + QList<Q3DockWindow *> dockWindows; + Q3DockAreaLayout *layout; + HandlePosition hPos; + QList<Q3DockWindow *> forbiddenWidgets; + Q3DockAreaPrivate *d; +}; + +#ifndef QT_NO_TEXTSTREAM +Q_COMPAT_EXPORT QTextStream &operator<<(QTextStream &, const Q3DockArea &); +Q_COMPAT_EXPORT QTextStream &operator>>(QTextStream &, Q3DockArea &); +#endif + +#endif // QT_NO_MAINWINDOW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DOCKAREA_H diff --git a/qtinterface/qt4/Qt/q3dockwindow.h b/qtinterface/qt4/Qt/q3dockwindow.h new file mode 100644 index 0000000..1069012 --- /dev/null +++ b/qtinterface/qt4/Qt/q3dockwindow.h @@ -0,0 +1,239 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DOCKWINDOW_H +#define Q3DOCKWINDOW_H + +#include <Qt3Support/q3frame.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_MAINWINDOW + +class Q3DockWindowHandle; +class Q3DockWindowTitleBar; +class QPainter; +class Q3DockWindowResizeHandle; +class QBoxLayout; +class QHBoxLayout; +class QVBoxLayout; +class Q3DockArea; +class QWidgetResizeHandler; +class Q3MainWindow; +class Q3DockAreaLayout; +class Q3DockWindowPrivate; +class Q3ToolBar; +class QWindowsXPStyle; +class QRubberBand; + +class Q_COMPAT_EXPORT Q3DockWindow : public Q3Frame +{ + Q_OBJECT + Q_ENUMS(CloseMode Place) + Q_PROPERTY(int closeMode READ closeMode WRITE setCloseMode) + Q_PROPERTY(bool resizeEnabled READ isResizeEnabled WRITE setResizeEnabled) + Q_PROPERTY(bool movingEnabled READ isMovingEnabled WRITE setMovingEnabled) + Q_PROPERTY(bool horizontallyStretchable READ isHorizontallyStretchable WRITE setHorizontallyStretchable) + Q_PROPERTY(bool verticallyStretchable READ isVerticallyStretchable WRITE setVerticallyStretchable) + Q_PROPERTY(bool stretchable READ isStretchable) + Q_PROPERTY(bool newLine READ newLine WRITE setNewLine) + Q_PROPERTY(bool opaqueMoving READ opaqueMoving WRITE setOpaqueMoving) + Q_PROPERTY(int offset READ offset WRITE setOffset) + Q_PROPERTY(Place place READ place) + + friend class Q3DockWindowHandle; + friend class Q3DockWindowTitleBar; + friend class Q3DockArea; + friend class Q3DockAreaLayout; + friend class Q3MainWindow; + friend class QCEMainWindow; + friend class Q3ToolBar; + friend class QWindowsXPStyle; + +public: + enum Place { InDock, OutsideDock }; + enum CloseMode { Never = 0, Docked = 1, Undocked = 2, Always = Docked | Undocked }; + + Q3DockWindow(Place p = InDock, QWidget* parent=0, const char* name=0, Qt::WindowFlags f = 0); + Q3DockWindow(QWidget* parent, const char* name=0, Qt::WindowFlags f = 0); + ~Q3DockWindow(); + + virtual void setWidget(QWidget *w); + QWidget *widget() const; + + Place place() const { return curPlace; } + + Q3DockArea *area() const; + + virtual void setCloseMode(int m); + bool isCloseEnabled() const; + int closeMode() const; + + virtual void setResizeEnabled(bool b); + virtual void setMovingEnabled(bool b); + bool isResizeEnabled() const; + bool isMovingEnabled() const; + + virtual void setHorizontallyStretchable(bool b); + virtual void setVerticallyStretchable(bool b); + bool isHorizontallyStretchable() const; + bool isVerticallyStretchable() const; + void setHorizontalStretchable(bool b) { setHorizontallyStretchable(b); } + void setVerticalStretchable(bool b) { setVerticallyStretchable(b); } + bool isHorizontalStretchable() const { return isHorizontallyStretchable(); } + bool isVerticalStretchable() const { return isVerticallyStretchable(); } + bool isStretchable() const; + + virtual void setOffset(int o); + int offset() const; + + virtual void setFixedExtentWidth(int w); + virtual void setFixedExtentHeight(int h); + QSize fixedExtent() const; + + virtual void setNewLine(bool b); + bool newLine() const; + + Qt::Orientation orientation() const; + + QSize sizeHint() const; + QSize minimumSize() const; + QSize minimumSizeHint() const; + + QBoxLayout *boxLayout(); + + virtual void setOpaqueMoving(bool b); + bool opaqueMoving() const; + + bool eventFilter(QObject *o, QEvent *e); + + QString windowTitle() const; + +Q_SIGNALS: + void orientationChanged(Qt::Orientation o); + void placeChanged(Q3DockWindow::Place p); + void visibilityChanged(bool); + +public Q_SLOTS: + virtual void undock(QWidget *w); + virtual void undock() { undock(0); } + virtual void dock(); + virtual void setOrientation(Qt::Orientation o); + +protected: + void resizeEvent(QResizeEvent *e); + void showEvent(QShowEvent *e); + void hideEvent(QHideEvent *e); + void contextMenuEvent(QContextMenuEvent *e); + + void drawFrame(QPainter *); + void drawContents(QPainter *); + + bool event(QEvent *e); + +private Q_SLOTS: + void toggleVisible() { setVisible(!isVisible()); } + +private: + Q3DockWindow(Place p, QWidget* parent, const char* name, Qt::WindowFlags f, bool toolbar); + + void handleMove(const QPoint &pos, const QPoint &gp, bool drawRect); + void updateGui(); + void updateSplitterVisibility(bool visible); + + void startRectDraw(const QPoint &so, bool drawRect); + void endRectDraw(bool drawRect); + void updatePosition(const QPoint &globalPos ); + QWidget *areaAt(const QPoint &gp); + void removeFromDock(bool fixNewLines = true); + void swapRect(QRect &r, Qt::Orientation o, const QPoint &offset, Q3DockArea *area); + void init(); + +private: + Q3DockWindowHandle *horHandle, *verHandle; + Q3DockWindowTitleBar *titleBar; + QWidget *wid; + QRubberBand *rubberBand; + Q3DockArea *dockArea, *tmpDockArea; + QRect currRect; + Place curPlace; + Place state; + bool resizeEnabled : 1; + bool moveEnabled : 1; + bool nl : 1; + bool opaque : 1; + bool isToolbar : 1; + bool stretchable[3]; + Qt::Orientation startOrientation; + int cMode; + QPoint startOffset; + int offs; + QSize fExtent; + Q3DockWindowResizeHandle *hHandleTop, *hHandleBottom, *vHandleLeft, *vHandleRight; + QVBoxLayout *hbox; + QHBoxLayout *vbox; + QBoxLayout *childBox; + void *dockWindowData; + QPoint lastPos; + QSize lastSize; + QWidgetResizeHandler *widgetResizeHandler; + Q3DockWindowPrivate *d; + +private: + Q_DISABLE_COPY(Q3DockWindow) +}; + +inline Q3DockArea *Q3DockWindow::area() const +{ + return dockArea; +} + +#endif // QT_NO_MAINWINDOW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DOCKWINDOW_H diff --git a/qtinterface/qt4/Qt/q3dragobject.h b/qtinterface/qt4/Qt/q3dragobject.h new file mode 100644 index 0000000..0cc6dac --- /dev/null +++ b/qtinterface/qt4/Qt/q3dragobject.h @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DRAGOBJECT_H +#define Q3DRAGOBJECT_H + +#include <QtCore/qobject.h> +#include <QtGui/qcolor.h> +#include <QtGui/qmime.h> +#include <QtGui/qimage.h> +#include <Qt3Support/q3strlist.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QWidget; +class Q3TextDragPrivate; +class Q3DragObjectPrivate; +class Q3StoredDragPrivate; +class Q3ImageDragPrivate; +class Q3ImageDrag; +class Q3TextDrag; +class Q3StrList; +class QImage; +class QPixmap; + +class Q_COMPAT_EXPORT Q3DragObject : public QObject, public QMimeSource { + Q_OBJECT + Q_DECLARE_PRIVATE(Q3DragObject) +public: + Q3DragObject(QWidget * dragSource = 0, const char *name = 0); + virtual ~Q3DragObject(); + + bool drag(); + bool dragMove(); + void dragCopy(); + void dragLink(); + + virtual void setPixmap(QPixmap); + virtual void setPixmap(QPixmap, const QPoint& hotspot); + QPixmap pixmap() const; + QPoint pixmapHotSpot() const; + + QWidget * source(); + static QWidget * target(); + + enum DragMode { DragDefault, DragCopy, DragMove, DragLink, DragCopyOrMove }; + +protected: + Q3DragObject(Q3DragObjectPrivate &, QWidget *dragSource = 0); + virtual bool drag(DragMode); + +private: + friend class QDragMime; + Q_DISABLE_COPY(Q3DragObject) +}; + +class Q_COMPAT_EXPORT Q3StoredDrag: public Q3DragObject { + Q_OBJECT + Q_DECLARE_PRIVATE(Q3StoredDrag) +public: + Q3StoredDrag(const char *mimeType, QWidget *dragSource = 0, const char *name = 0); + ~Q3StoredDrag(); + + virtual void setEncodedData(const QByteArray &); + + const char * format(int i) const; + virtual QByteArray encodedData(const char*) const; + +protected: + Q3StoredDrag(Q3StoredDragPrivate &, const char *mimeType, QWidget *dragSource = 0); + +private: + Q_DISABLE_COPY(Q3StoredDrag) +}; + +class Q_COMPAT_EXPORT Q3TextDrag: public Q3DragObject { + Q_OBJECT + Q_DECLARE_PRIVATE(Q3TextDrag) +public: + Q3TextDrag(const QString &, QWidget *dragSource = 0, const char *name = 0); + Q3TextDrag(QWidget * dragSource = 0, const char * name = 0); + ~Q3TextDrag(); + + virtual void setText(const QString &); + virtual void setSubtype(const QString &); + + const char * format(int i) const; + virtual QByteArray encodedData(const char*) const; + + static bool canDecode(const QMimeSource* e); + static bool decode(const QMimeSource* e, QString& s); + static bool decode(const QMimeSource* e, QString& s, QString& subtype); + +protected: + Q3TextDrag(Q3TextDragPrivate &, QWidget * dragSource = 0); + +private: + Q_DISABLE_COPY(Q3TextDrag) +}; + +class Q_COMPAT_EXPORT Q3ImageDrag: public Q3DragObject { + Q_OBJECT + Q_DECLARE_PRIVATE(Q3ImageDrag) +public: + Q3ImageDrag(QImage image, QWidget * dragSource = 0, const char * name = 0); + Q3ImageDrag(QWidget * dragSource = 0, const char * name = 0); + ~Q3ImageDrag(); + + virtual void setImage(QImage image); + + const char * format(int i) const; + virtual QByteArray encodedData(const char*) const; + + static bool canDecode(const QMimeSource* e); + static bool decode(const QMimeSource* e, QImage& i); + static bool decode(const QMimeSource* e, QPixmap& i); + +protected: + Q3ImageDrag(Q3ImageDragPrivate &, QWidget * dragSource = 0); + +private: + Q_DISABLE_COPY(Q3ImageDrag) +}; + + +class Q_COMPAT_EXPORT Q3UriDrag: public Q3StoredDrag { + Q_OBJECT + +public: + Q3UriDrag(const Q3StrList &uris, QWidget * dragSource = 0, const char * name = 0); + Q3UriDrag(QWidget * dragSource = 0, const char * name = 0); + ~Q3UriDrag(); + + void setFileNames(const QStringList & fnames); + inline void setFileNames(const QString & fname) { setFileNames(QStringList(fname)); } + void setFilenames(const QStringList & fnames) { setFileNames(fnames); } + inline void setFilenames(const QString & fname) { setFileNames(QStringList(fname)); } + void setUnicodeUris(const QStringList & uuris); + virtual void setUris(const QList<QByteArray> &uris); + + static QString uriToLocalFile(const char*); + static QByteArray localFileToUri(const QString&); + static QString uriToUnicodeUri(const char*); + static QByteArray unicodeUriToUri(const QString&); + static bool canDecode(const QMimeSource* e); + static bool decode(const QMimeSource* e, Q3StrList& i); + static bool decodeToUnicodeUris(const QMimeSource* e, QStringList& i); + static bool decodeLocalFiles(const QMimeSource* e, QStringList& i); + +private: + Q_DISABLE_COPY(Q3UriDrag) +}; + +class Q_COMPAT_EXPORT Q3ColorDrag : public Q3StoredDrag +{ + Q_OBJECT + QColor color; + +public: + Q3ColorDrag(const QColor &col, QWidget *dragsource = 0, const char *name = 0); + Q3ColorDrag(QWidget * dragSource = 0, const char * name = 0); + void setColor(const QColor &col); + + static bool canDecode(QMimeSource *); + static bool decode(QMimeSource *, QColor &col); + +private: + Q_DISABLE_COPY(Q3ColorDrag) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3DRAGOBJECT_H diff --git a/qtinterface/qt4/Qt/q3dropsite.h b/qtinterface/qt4/Qt/q3dropsite.h new file mode 100644 index 0000000..cea597a --- /dev/null +++ b/qtinterface/qt4/Qt/q3dropsite.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3DROPSITE_H +#define Q3DROPSITE_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QWidget; + +class Q_COMPAT_EXPORT Q3DropSite { +public: + Q3DropSite(QWidget* parent); + virtual ~Q3DropSite(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDROPSITE_H diff --git a/qtinterface/qt4/Qt/q3editorfactory.h b/qtinterface/qt4/Qt/q3editorfactory.h new file mode 100644 index 0000000..930a3f5 --- /dev/null +++ b/qtinterface/qt4/Qt/q3editorfactory.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3EDITORFACTORY_H +#define Q3EDITORFACTORY_H + +#include <QtCore/qobject.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_EDIT_WIDGETS + +class Q_COMPAT_EXPORT Q3EditorFactory : public QObject +{ +public: + Q3EditorFactory (QObject * parent = 0); + ~Q3EditorFactory(); + + virtual QWidget * createEditor(QWidget * parent, const QVariant & v); + + static Q3EditorFactory * defaultFactory(); + static void installDefaultFactory(Q3EditorFactory * factory); + +private: + Q_DISABLE_COPY(Q3EditorFactory) +}; + +#endif // QT_NO_SQL_EDIT_WIDGETS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3EDITORFACTORY_H diff --git a/qtinterface/qt4/Qt/q3filedialog.h b/qtinterface/qt4/Qt/q3filedialog.h new file mode 100644 index 0000000..6515ef9 --- /dev/null +++ b/qtinterface/qt4/Qt/q3filedialog.h @@ -0,0 +1,346 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3FILEDIALOG_H +#define Q3FILEDIALOG_H + +#include <QtCore/qdir.h> +#include <QtGui/qdialog.h> +#include <Qt3Support/q3urloperator.h> +#include <Qt3Support/q3valuelist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QAbstractButton; +class QPushButton; +class QLabel; +class QWidget; +class QFileDialog; +class QTimer; +class Q3NetworkOperation; +class QLineEdit; +class Q3ListViewItem; +class Q3ListBoxItem; +class Q3FileDialogPrivate; +class Q3FileDialogQFileListView; +class QUrlInfo; + +#ifndef QT_NO_FILEDIALOG + +class Q_COMPAT_EXPORT Q3FileIconProvider : public QObject +{ + Q_OBJECT +public: + Q3FileIconProvider(QObject * parent = 0, const char* name = 0); + virtual const QPixmap * pixmap(const QFileInfo &); + +private: + Q_DISABLE_COPY(Q3FileIconProvider) +}; + +class Q_COMPAT_EXPORT Q3FilePreview +{ +public: + Q3FilePreview(); + virtual ~Q3FilePreview() {} + virtual void previewUrl(const Q3Url &url) = 0; + +}; + +class Q_COMPAT_EXPORT Q3FileDialog : public QDialog +{ + Q_OBJECT + Q_ENUMS(Mode ViewMode PreviewMode) + // ##### Why are this read-only properties ? + Q_PROPERTY(QString selectedFile READ selectedFile) + Q_PROPERTY(QString selectedFilter READ selectedFilter) + Q_PROPERTY(QStringList selectedFiles READ selectedFiles) + // #### Should not we be able to set the path ? + Q_PROPERTY(QString dirPath READ dirPath) + Q_PROPERTY(bool showHiddenFiles READ showHiddenFiles WRITE setShowHiddenFiles) + Q_PROPERTY(Mode mode READ mode WRITE setMode) + Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) + Q_PROPERTY(PreviewMode previewMode READ previewMode WRITE setPreviewMode) + Q_PROPERTY(bool infoPreview READ isInfoPreviewEnabled WRITE setInfoPreviewEnabled) + Q_PROPERTY(bool contentsPreview READ isContentsPreviewEnabled WRITE setContentsPreviewEnabled) + +public: + Q3FileDialog(const QString& dirName, const QString& filter = QString(), + QWidget* parent=0, const char* name=0, bool modal = false); + Q3FileDialog(QWidget* parent=0, const char* name=0, bool modal = false); + ~Q3FileDialog(); + + // recommended static functions + + static QString getOpenFileName(const QString &initially = QString(), + const QString &filter = QString(), + QWidget *parent = 0, const char* name = 0, + const QString &caption = QString(), + QString *selectedFilter = 0, + bool resolveSymlinks = true); + static QString getSaveFileName(const QString &initially = QString(), + const QString &filter = QString(), + QWidget *parent = 0, const char* name = 0, + const QString &caption = QString(), + QString *selectedFilter = 0, + bool resolveSymlinks = true); + static QString getExistingDirectory(const QString &dir = QString(), + QWidget *parent = 0, + const char* name = 0, + const QString &caption = QString(), + bool dirOnly = true, + bool resolveSymlinks = true); + static QStringList getOpenFileNames(const QString &filter= QString(), + const QString &dir = QString(), + QWidget *parent = 0, + const char* name = 0, + const QString &caption = QString(), + QString *selectedFilter = 0, + bool resolveSymlinks = true); + + // other static functions + + static void setIconProvider(Q3FileIconProvider *); + static Q3FileIconProvider * iconProvider(); + + // non-static function for special needs + + QString selectedFile() const; + QString selectedFilter() const; + virtual void setSelectedFilter(const QString&); + virtual void setSelectedFilter(int); + + void setSelection(const QString &); + + void selectAll(bool b); + + QStringList selectedFiles() const; + + QString dirPath() const; + + void setDir(const QDir &); + const QDir *dir() const; + + void setShowHiddenFiles(bool s); + bool showHiddenFiles() const; + + void rereadDir(); + void resortDir(); + + enum Mode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }; + void setMode(Mode); + Mode mode() const; + + enum ViewMode { Detail, List }; + enum PreviewMode { NoPreview, Contents, Info }; + void setViewMode(ViewMode m); + ViewMode viewMode() const; + void setPreviewMode(PreviewMode m); + PreviewMode previewMode() const; + + bool eventFilter(QObject *, QEvent *); + + bool isInfoPreviewEnabled() const; + bool isContentsPreviewEnabled() const; + void setInfoPreviewEnabled(bool); + void setContentsPreviewEnabled(bool); + + void setInfoPreview(QWidget *w, Q3FilePreview *preview); + void setContentsPreview(QWidget *w, Q3FilePreview *preview); + + Q3Url url() const; + + void addFilter(const QString &filter); + +public Q_SLOTS: + void done(int); + void setDir(const QString&); + void setUrl(const Q3UrlOperator &url); + void setFilter(const QString&); + void setFilters(const QString&); + void setFilters(const char **); + void setFilters(const QStringList&); + +protected: + void resizeEvent(QResizeEvent *); + void keyPressEvent(QKeyEvent *); + + void addWidgets(QLabel *, QWidget *, QPushButton *); + void addToolButton(QAbstractButton *b, bool separator = false); + void addLeftWidget(QWidget *w); + void addRightWidget(QWidget *w); + +Q_SIGNALS: + void fileHighlighted(const QString&); + void fileSelected(const QString&); + void filesSelected(const QStringList&); + void dirEntered(const QString&); + void filterSelected(const QString&); + +private Q_SLOTS: + void detailViewSelectionChanged(); + void listBoxSelectionChanged(); + void changeMode(int); + void fileNameEditReturnPressed(); + void stopCopy(); + void removeProgressDia(); + + void fileSelected(int); + void fileHighlighted(int); + void dirSelected(int); + void pathSelected(int); + + void updateFileNameEdit(Q3ListViewItem *); + void selectDirectoryOrFile(Q3ListViewItem *); + void popupContextMenu(Q3ListViewItem *, const QPoint &, int); + void popupContextMenu(Q3ListBoxItem *, const QPoint &); + void updateFileNameEdit(Q3ListBoxItem *); + void selectDirectoryOrFile(Q3ListBoxItem *); + void fileNameEditDone(); + + void okClicked(); + void filterClicked(); // not used + void cancelClicked(); + + void cdUpClicked(); + void newFolderClicked(); + + void fixupNameEdit(); + + void doMimeTypeLookup(); + + void updateGeometries(); + void modeButtonsDestroyed(); + void urlStart(Q3NetworkOperation *op); + void urlFinished(Q3NetworkOperation *op); + void dataTransferProgress(int bytesDone, int bytesTotal, Q3NetworkOperation *); + void insertEntry(const Q3ValueList<QUrlInfo> &fi, Q3NetworkOperation *op); + void removeEntry(Q3NetworkOperation *); + void createdDirectory(const QUrlInfo &info, Q3NetworkOperation *); + void itemChanged(Q3NetworkOperation *); + void goBack(); + +private: + Q_DISABLE_COPY(Q3FileDialog) + + enum PopupAction { + PA_Open = 0, + PA_Delete, + PA_Rename, + PA_SortName, + PA_SortSize, + PA_SortType, + PA_SortDate, + PA_SortUnsorted, + PA_Cancel, + PA_Reload, + PA_Hidden + }; + + void init(); + bool trySetSelection(bool isDir, const Q3UrlOperator &, bool); + void deleteFile(const QString &filename); + void popupContextMenu(const QString &filename, bool withSort, + PopupAction &action, const QPoint &p); + void updatePreviews(const Q3Url &u); + + QString fileName; + + friend class Q3FileDialogQFileListView; + friend class QFileListBox; + + Q3FileDialogPrivate *d; + Q3FileDialogQFileListView *files; + + QLineEdit *nameEdit; // also filter + QPushButton *okB; + QPushButton *cancelB; + +#if defined(Q_WS_WIN) + static QString winGetOpenFileName(const QString &initialSelection, + const QString &filter, + QString* workingDirectory, + QWidget *parent = 0, + const char* name = 0, + const QString& caption = QString(), + QString* selectedFilter = 0); + static QString winGetSaveFileName(const QString &initialSelection, + const QString &filter, + QString* workingDirectory, + QWidget *parent = 0, + const char* name = 0, + const QString& caption = QString(), + QString* selectedFilter = 0); + static QStringList winGetOpenFileNames(const QString &filter, + QString* workingDirectory, + QWidget *parent = 0, + const char* name = 0, + const QString& caption = QString(), + QString* selectedFilter = 0); + static QString winGetExistingDirectory(const QString &initialDirectory, + QWidget* parent = 0, + const char* name = 0, + const QString& caption = QString()); + static QString resolveLinkFile(const QString& linkfile); + int old_qt_ntfs_permission_lookup; +#endif +#if defined(Q_WS_MAC) + static QString macGetSaveFileName(const QString &, const QString &, + QString *, QWidget *, const char*, + const QString&, QString *); + static QStringList macGetOpenFileNames(const QString &, QString*, + QWidget *, const char *, + const QString&, QString *, + bool = true, bool = false); +#endif +}; + +#endif // QT_NO_FILEDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3FILEDIALOG_H diff --git a/qtinterface/qt4/Qt/q3frame.h b/qtinterface/qt4/Qt/q3frame.h new file mode 100644 index 0000000..8490481 --- /dev/null +++ b/qtinterface/qt4/Qt/q3frame.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3FRAME_H +#define Q3FRAME_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3Frame : public QFrame +{ + Q_OBJECT + Q_PROPERTY(int margin READ margin WRITE setMargin) + Q_PROPERTY(QRect contentsRect READ contentsRect) + +public: + Q3Frame(QWidget* parent, const char* name = 0, Qt::WindowFlags f = 0); + ~Q3Frame(); +#ifndef qdoc + bool lineShapesOk() const { return true; } +#endif + + int margin() const { return marg; } + void setMargin(int); + + QRect contentsRect() const; + int frameWidth() const; + +protected: + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + + virtual void frameChanged(); + virtual void drawFrame(QPainter *); + virtual void drawContents(QPainter *); + +private: + Q_DISABLE_COPY(Q3Frame) + + int marg; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3FRAME_H diff --git a/qtinterface/qt4/Qt/q3ftp.h b/qtinterface/qt4/Qt/q3ftp.h new file mode 100644 index 0000000..a79ae10 --- /dev/null +++ b/qtinterface/qt4/Qt/q3ftp.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3FTP_H +#define Q3FTP_H + +#include <QtCore/qstring.h> // char*->QString conversion +#include <QtNetwork/qurlinfo.h> +#include <Qt3Support/q3networkprotocol.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_NETWORKPROTOCOL_FTP + +class Q3Socket; +class Q3FtpCommand; + +class Q_COMPAT_EXPORT Q3Ftp : public Q3NetworkProtocol +{ + Q_OBJECT + +public: + Q3Ftp(); // ### Qt 4.0: get rid of this overload + Q3Ftp( QObject *parent, const char *name=0 ); + virtual ~Q3Ftp(); + + int supportedOperations() const; + + // non-Q3NetworkProtocol functions: + enum State { + Unconnected, + HostLookup, + Connecting, + Connected, + LoggedIn, + Closing + }; + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + NotConnected + }; + enum Command { + None, + ConnectToHost, + Login, + Close, + List, + Cd, + Get, + Put, + Remove, + Mkdir, + Rmdir, + Rename, + RawCommand + }; + + int connectToHost( const QString &host, Q_UINT16 port=21 ); + int login( const QString &user=QString(), const QString &password=QString() ); + int close(); + int list( const QString &dir=QString() ); + int cd( const QString &dir ); + int get( const QString &file, QIODevice *dev=0 ); + int put( const QByteArray &data, const QString &file ); + int put( QIODevice *dev, const QString &file ); + int remove( const QString &file ); + int mkdir( const QString &dir ); + int rmdir( const QString &dir ); + int rename( const QString &oldname, const QString &newname ); + + int rawCommand( const QString &command ); + + Q_ULONG bytesAvailable() const; + Q_LONG readBlock( char *data, Q_ULONG maxlen ); + QByteArray readAll(); + + int currentId() const; + QIODevice* currentDevice() const; + Command currentCommand() const; + bool hasPendingCommands() const; + void clearPendingCommands(); + + State state() const; + + Error error() const; + QString errorString() const; + +public Q_SLOTS: + void abort(); + +Q_SIGNALS: + void stateChanged( int ); + void listInfo( const QUrlInfo& ); + void readyRead(); + void dataTransferProgress( int, int ); + void rawCommandReply( int, const QString& ); + + void commandStarted( int ); + void commandFinished( int, bool ); + void done( bool ); + +protected: + void parseDir( const QString &buffer, QUrlInfo &info ); // ### Qt 4.0: delete this? (not public API) + void operationListChildren( Q3NetworkOperation *op ); + void operationMkDir( Q3NetworkOperation *op ); + void operationRemove( Q3NetworkOperation *op ); + void operationRename( Q3NetworkOperation *op ); + void operationGet( Q3NetworkOperation *op ); + void operationPut( Q3NetworkOperation *op ); + + // ### Qt 4.0: delete these + // unused variables: + Q3Socket *commandSocket, *dataSocket; + bool connectionReady, passiveMode; + int getTotalSize, getDoneSize; + bool startGetOnFail; + int putToWrite, putWritten; + bool errorInListChildren; + +private: + void init(); + int addCommand( Q3FtpCommand * ); + + bool checkConnection( Q3NetworkOperation *op ); + +private Q_SLOTS: + void startNextCommand(); + void piFinished( const QString& ); + void piError( int, const QString& ); + void piConnectState( int ); + void piFtpReply( int, const QString& ); + +private Q_SLOTS: + void npListInfo( const QUrlInfo & ); + void npDone( bool ); + void npStateChanged( int ); + void npDataTransferProgress( int, int ); + void npReadyRead(); + +protected Q_SLOTS: + // ### Qt 4.0: delete these + void hostFound(); + void connected(); + void closed(); + void dataHostFound(); + void dataConnected(); + void dataClosed(); + void dataReadyRead(); + void dataBytesWritten( int nbytes ); + void error( int ); +}; + +#endif // QT_NO_NETWORKPROTOCOL_FTP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3FTP_H diff --git a/qtinterface/qt4/Qt/q3garray.h b/qtinterface/qt4/Qt/q3garray.h new file mode 100644 index 0000000..761d812 --- /dev/null +++ b/qtinterface/qt4/Qt/q3garray.h @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GARRAY_H +#define Q3GARRAY_H + +#include <Qt3Support/q3shared.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3GArray // generic array +{ + friend class QBuffer; +public: + // do not use this, even though this is public + struct array_data : public Q3Shared { // shared array + array_data():data(0),len(0) +#ifdef QT_QGARRAY_SPEED_OPTIM + ,maxl(0) +#endif + {} + char *data; // actual array data + uint len; +#ifdef QT_QGARRAY_SPEED_OPTIM + uint maxl; +#endif + }; + Q3GArray(); + enum Optimization { MemOptim, SpeedOptim }; +protected: + Q3GArray(int, int); // dummy; does not alloc + Q3GArray(int size); // allocate 'size' bytes + Q3GArray(const Q3GArray &a); // shallow copy + virtual ~Q3GArray(); + + Q3GArray &operator=(const Q3GArray &a) { return assign(a); } + + virtual void detach() { duplicate(*this); } + + // ### Qt 4.0: maybe provide two versions of data(), at(), etc. + char *data() const { return shd->data; } + uint nrefs() const { return shd->count; } + uint size() const { return shd->len; } + bool isEqual(const Q3GArray &a) const; + + bool resize(uint newsize, Optimization optim); + bool resize(uint newsize); + + bool fill(const char *d, int len, uint sz); + + Q3GArray &assign(const Q3GArray &a); + Q3GArray &assign(const char *d, uint len); + Q3GArray &duplicate(const Q3GArray &a); + Q3GArray &duplicate(const char *d, uint len); + void store(const char *d, uint len); + + array_data *sharedBlock() const { return shd; } + void setSharedBlock(array_data *p) { shd=(array_data*)p; } + + Q3GArray &setRawData(const char *d, uint len); + void resetRawData(const char *d, uint len); + + int find(const char *d, uint index, uint sz) const; + int contains(const char *d, uint sz) const; + + void sort(uint sz); + int bsearch(const char *d, uint sz) const; + + char *at(uint index) const; + + bool setExpand(uint index, const char *d, uint sz); + +protected: + virtual array_data *newData(); + virtual void deleteData(array_data *p); + +private: + static void msg_index(uint); + array_data *shd; +}; + + +inline char *Q3GArray::at(uint index) const +{ +#if defined(QT_CHECK_RANGE) + if (index >= size()) { + msg_index(index); + index = 0; + } +#endif + return &shd->data[index]; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GARRAY_H diff --git a/qtinterface/qt4/Qt/q3gcache.h b/qtinterface/qt4/Qt/q3gcache.h new file mode 100644 index 0000000..f3756a0 --- /dev/null +++ b/qtinterface/qt4/Qt/q3gcache.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GCACHE_H +#define Q3GCACHE_H + +#include <Qt3Support/q3ptrcollection.h> +#include <Qt3Support/q3glist.h> +#include <Qt3Support/q3gdict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3CList; // internal classes +class Q3CListIt; +class Q3CDict; + +class Q_COMPAT_EXPORT Q3GCache : public Q3PtrCollection // generic LRU cache +{ +friend class Q3GCacheIterator; +protected: + enum KeyType { StringKey, AsciiKey, IntKey, PtrKey }; + // identical to Q3GDict's, but PtrKey is not used at the moment + + Q3GCache(int maxCost, uint size, KeyType kt, bool caseSensitive, + bool copyKeys); + Q3GCache(const Q3GCache &); // not allowed, calls fatal() + ~Q3GCache(); + Q3GCache &operator=(const Q3GCache &); // not allowed, calls fatal() + + uint count() const; + uint size() const; + int maxCost() const { return mCost; } + int totalCost() const { return tCost; } + void setMaxCost(int maxCost); + void clear(); + + bool insert_string(const QString &key, Q3PtrCollection::Item, + int cost, int priority); + bool insert_other(const char *key, Q3PtrCollection::Item, + int cost, int priority); + bool remove_string(const QString &key); + bool remove_other(const char *key); + Q3PtrCollection::Item take_string(const QString &key); + Q3PtrCollection::Item take_other(const char *key); + + Q3PtrCollection::Item find_string(const QString &key, bool ref=true) const; + Q3PtrCollection::Item find_other(const char *key, bool ref=true) const; + + void statistics() const; + +private: + bool makeRoomFor(int cost, int priority = -1); + KeyType keytype; + Q3CList *lruList; + Q3CDict *dict; + int mCost; + int tCost; + bool copyk; +}; + + +class Q_COMPAT_EXPORT Q3GCacheIterator // generic cache iterator +{ +protected: + Q3GCacheIterator(const Q3GCache &); + Q3GCacheIterator(const Q3GCacheIterator &); + ~Q3GCacheIterator(); + Q3GCacheIterator &operator=(const Q3GCacheIterator &); + + uint count() const; + bool atFirst() const; + bool atLast() const; + Q3PtrCollection::Item toFirst(); + Q3PtrCollection::Item toLast(); + + Q3PtrCollection::Item get() const; + QString getKeyString() const; + const char *getKeyAscii() const; + long getKeyInt() const; + + Q3PtrCollection::Item operator()(); + Q3PtrCollection::Item operator++(); + Q3PtrCollection::Item operator+=(uint); + Q3PtrCollection::Item operator--(); + Q3PtrCollection::Item operator-=(uint); + +protected: + Q3CListIt *it; // iterator on cache list +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GCACHE_H diff --git a/qtinterface/qt4/Qt/q3gdict.h b/qtinterface/qt4/Qt/q3gdict.h new file mode 100644 index 0000000..43485a6 --- /dev/null +++ b/qtinterface/qt4/Qt/q3gdict.h @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GDICT_H +#define Q3GDICT_H + +#include <Qt3Support/q3ptrcollection.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3GDictIterator; +class Q3GDItList; + + +class Q3BaseBucket // internal dict node +{ +public: + Q3PtrCollection::Item getData() { return data; } + Q3PtrCollection::Item setData( Q3PtrCollection::Item d ) { return data = d; } + Q3BaseBucket *getNext() { return next; } + void setNext( Q3BaseBucket *n) { next = n; } +protected: + Q3BaseBucket( Q3PtrCollection::Item d, Q3BaseBucket *n ) : data(d), next(n) {} + Q3PtrCollection::Item data; + Q3BaseBucket *next; +}; + +class Q3StringBucket : public Q3BaseBucket +{ +public: + Q3StringBucket( const QString &k, Q3PtrCollection::Item d, Q3BaseBucket *n ) + : Q3BaseBucket(d,n), key(k) {} + const QString &getKey() const { return key; } +private: + QString key; +}; + +class Q3AsciiBucket : public Q3BaseBucket +{ +public: + Q3AsciiBucket( const char *k, Q3PtrCollection::Item d, Q3BaseBucket *n ) + : Q3BaseBucket(d,n), key(k) {} + const char *getKey() const { return key; } +private: + const char *key; +}; + +class Q3IntBucket : public Q3BaseBucket +{ +public: + Q3IntBucket( long k, Q3PtrCollection::Item d, Q3BaseBucket *n ) + : Q3BaseBucket(d,n), key(k) {} + long getKey() const { return key; } +private: + long key; +}; + +class Q3PtrBucket : public Q3BaseBucket +{ +public: + Q3PtrBucket( void *k, Q3PtrCollection::Item d, Q3BaseBucket *n ) + : Q3BaseBucket(d,n), key(k) {} + void *getKey() const { return key; } +private: + void *key; +}; + + +class Q_COMPAT_EXPORT Q3GDict : public Q3PtrCollection // generic dictionary class +{ +public: + uint count() const { return numItems; } + uint size() const { return vlen; } + Q3PtrCollection::Item look_string( const QString& key, Q3PtrCollection::Item, + int ); + Q3PtrCollection::Item look_ascii( const char *key, Q3PtrCollection::Item, int ); + Q3PtrCollection::Item look_int( long key, Q3PtrCollection::Item, int ); + Q3PtrCollection::Item look_ptr( void *key, Q3PtrCollection::Item, int ); +#ifndef QT_NO_DATASTREAM + QDataStream &read( QDataStream & ); + QDataStream &write( QDataStream & ) const; +#endif +protected: + enum KeyType { StringKey, AsciiKey, IntKey, PtrKey }; + + Q3GDict( uint len, KeyType kt, bool cs, bool ck ); + Q3GDict( const Q3GDict & ); + ~Q3GDict(); + + Q3GDict &operator=( const Q3GDict & ); + + bool remove_string( const QString &key, Q3PtrCollection::Item item=0 ); + bool remove_ascii( const char *key, Q3PtrCollection::Item item=0 ); + bool remove_int( long key, Q3PtrCollection::Item item=0 ); + bool remove_ptr( void *key, Q3PtrCollection::Item item=0 ); + Q3PtrCollection::Item take_string( const QString &key ); + Q3PtrCollection::Item take_ascii( const char *key ); + Q3PtrCollection::Item take_int( long key ); + Q3PtrCollection::Item take_ptr( void *key ); + + void clear(); + void resize( uint ); + + int hashKeyString( const QString & ); + int hashKeyAscii( const char * ); + + void statistics() const; + +#ifndef QT_NO_DATASTREAM + virtual QDataStream &read( QDataStream &, Q3PtrCollection::Item & ); + virtual QDataStream &write( QDataStream &, Q3PtrCollection::Item ) const; +#endif +private: + Q3BaseBucket **vec; + uint vlen; + uint numItems; + uint keytype : 2; + uint cases : 1; + uint copyk : 1; + Q3GDItList *iterators; + void unlink_common( int, Q3BaseBucket *, Q3BaseBucket * ); + Q3StringBucket *unlink_string( const QString &, + Q3PtrCollection::Item item = 0 ); + Q3AsciiBucket *unlink_ascii( const char *, Q3PtrCollection::Item item = 0 ); + Q3IntBucket *unlink_int( long, Q3PtrCollection::Item item = 0 ); + Q3PtrBucket *unlink_ptr( void *, Q3PtrCollection::Item item = 0 ); + void init( uint, KeyType, bool, bool ); + friend class Q3GDictIterator; +}; + + +class Q_COMPAT_EXPORT Q3GDictIterator // generic dictionary iterator +{ +friend class Q3GDict; +public: + Q3GDictIterator( const Q3GDict & ); + Q3GDictIterator( const Q3GDictIterator & ); + Q3GDictIterator &operator=( const Q3GDictIterator & ); + ~Q3GDictIterator(); + + Q3PtrCollection::Item toFirst(); + + Q3PtrCollection::Item get() const; + QString getKeyString() const; + const char *getKeyAscii() const; + long getKeyInt() const; + void *getKeyPtr() const; + + Q3PtrCollection::Item operator()(); + Q3PtrCollection::Item operator++(); + Q3PtrCollection::Item operator+=(uint); + +protected: + Q3GDict *dict; + +private: + Q3BaseBucket *curNode; + uint curIndex; +}; + +inline Q3PtrCollection::Item Q3GDictIterator::get() const +{ + return curNode ? curNode->getData() : 0; +} + +inline QString Q3GDictIterator::getKeyString() const +{ + return curNode ? ((Q3StringBucket*)curNode)->getKey() : QString(); +} + +inline const char *Q3GDictIterator::getKeyAscii() const +{ + return curNode ? ((Q3AsciiBucket*)curNode)->getKey() : 0; +} + +inline long Q3GDictIterator::getKeyInt() const +{ + return curNode ? ((Q3IntBucket*)curNode)->getKey() : 0; +} + +inline void *Q3GDictIterator::getKeyPtr() const +{ + return curNode ? ((Q3PtrBucket*)curNode)->getKey() : 0; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GDICT_H diff --git a/qtinterface/qt4/Qt/q3glist.h b/qtinterface/qt4/Qt/q3glist.h new file mode 100644 index 0000000..d33e0a0 --- /dev/null +++ b/qtinterface/qt4/Qt/q3glist.h @@ -0,0 +1,279 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GLIST_H +#define Q3GLIST_H + +#include <Qt3Support/q3ptrcollection.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3LNode +{ +friend class Q3GList; +friend class Q3GListIterator; +friend class Q3GListStdIterator; +public: + Q3PtrCollection::Item getData() { return data; } +private: + Q3PtrCollection::Item data; + Q3LNode *prev; + Q3LNode *next; + Q3LNode( Q3PtrCollection::Item d ) { data = d; } +}; + +class Q3GListIteratorList; // internal helper class + +class Q_COMPAT_EXPORT Q3GList : public Q3PtrCollection // doubly linked generic list +{ +friend class Q3GListIterator; +friend class Q3GListIteratorList; +friend class Q3GVector; // needed by Q3GVector::toList +public: + uint count() const; // return number of nodes + +#ifndef QT_NO_DATASTREAM + QDataStream &read( QDataStream & ); // read list from stream + QDataStream &write( QDataStream & ) const; // write list to stream +#endif +protected: + Q3GList(); // create empty list + Q3GList( const Q3GList & ); // make copy of other list + virtual ~Q3GList(); + + Q3GList &operator=( const Q3GList & ); // assign from other list + bool operator==( const Q3GList& ) const; + + void inSort( Q3PtrCollection::Item ); // add item sorted in list + void append( Q3PtrCollection::Item ); // add item at end of list + bool insertAt( uint index, Q3PtrCollection::Item ); // add item at i'th position + void relinkNode( Q3LNode * ); // relink as first item + bool removeNode( Q3LNode * ); // remove node + bool remove( Q3PtrCollection::Item = 0 ); // remove item (0=current) + bool removeRef( Q3PtrCollection::Item = 0 ); // remove item (0=current) + bool removeFirst(); // remove first item + bool removeLast(); // remove last item + bool removeAt( uint ); // remove item at i'th position + bool replaceAt( uint, Q3PtrCollection::Item ); // replace item at position i with item + Q3PtrCollection::Item takeNode( Q3LNode * ); // take out node + Q3PtrCollection::Item take(); // take out current item + Q3PtrCollection::Item takeAt( uint index ); // take out item at i'th pos + Q3PtrCollection::Item takeFirst(); // take out first item + Q3PtrCollection::Item takeLast(); // take out last item + + void sort(); // sort all items; + void clear(); // remove all items + + int findRef( Q3PtrCollection::Item, bool = true ); // find exact item in list + int find( Q3PtrCollection::Item, bool = true ); // find equal item in list + + uint containsRef( Q3PtrCollection::Item ) const; // get number of exact matches + uint contains( Q3PtrCollection::Item ) const; // get number of equal matches + + Q3PtrCollection::Item at( uint index ); // access item at i'th pos + int at() const; // get current index + Q3LNode *currentNode() const; // get current node + + Q3PtrCollection::Item get() const; // get current item + + Q3PtrCollection::Item cfirst() const; // get ptr to first list item + Q3PtrCollection::Item clast() const; // get ptr to last list item + Q3PtrCollection::Item first(); // set first item in list curr + Q3PtrCollection::Item last(); // set last item in list curr + Q3PtrCollection::Item next(); // set next item in list curr + Q3PtrCollection::Item prev(); // set prev item in list curr + + void toVector( Q3GVector * ) const; // put items in vector + + virtual int compareItems( Q3PtrCollection::Item, Q3PtrCollection::Item ); + +#ifndef QT_NO_DATASTREAM + virtual QDataStream &read( QDataStream &, Q3PtrCollection::Item & ); + virtual QDataStream &write( QDataStream &, Q3PtrCollection::Item ) const; +#endif + + Q3LNode* begin() const { return firstNode; } + Q3LNode* end() const { return 0; } + Q3LNode* erase( Q3LNode* it ); + +private: + void prepend( Q3PtrCollection::Item ); // add item at start of list + + void heapSortPushDown( Q3PtrCollection::Item* heap, int first, int last ); + + Q3LNode *firstNode; // first node + Q3LNode *lastNode; // last node + Q3LNode *curNode; // current node + int curIndex; // current index + uint numNodes; // number of nodes + Q3GListIteratorList *iterators; // list of iterators + + Q3LNode *locate( uint ); // get node at i'th pos + Q3LNode *unlink(); // unlink node +}; + + +inline uint Q3GList::count() const +{ + return numNodes; +} + +inline bool Q3GList::removeFirst() +{ + first(); + return remove(); +} + +inline bool Q3GList::removeLast() +{ + last(); + return remove(); +} + +inline int Q3GList::at() const +{ + return curIndex; +} + +inline Q3PtrCollection::Item Q3GList::at( uint index ) +{ + Q3LNode *n = locate( index ); + return n ? n->data : 0; +} + +inline Q3LNode *Q3GList::currentNode() const +{ + return curNode; +} + +inline Q3PtrCollection::Item Q3GList::get() const +{ + return curNode ? curNode->data : 0; +} + +inline Q3PtrCollection::Item Q3GList::cfirst() const +{ + return firstNode ? firstNode->data : 0; +} + +inline Q3PtrCollection::Item Q3GList::clast() const +{ + return lastNode ? lastNode->data : 0; +} + + +/***************************************************************************** + Q3GList stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_COMPAT_EXPORT QDataStream &operator>>( QDataStream &, Q3GList & ); +Q_COMPAT_EXPORT QDataStream &operator<<( QDataStream &, const Q3GList & ); +#endif + +/***************************************************************************** + Q3GListIterator class + *****************************************************************************/ + +class Q_COMPAT_EXPORT Q3GListIterator // Q3GList iterator +{ +friend class Q3GList; +friend class Q3GListIteratorList; +protected: + Q3GListIterator( const Q3GList & ); + Q3GListIterator( const Q3GListIterator & ); + Q3GListIterator &operator=( const Q3GListIterator & ); + ~Q3GListIterator(); + + bool atFirst() const; // test if at first item + bool atLast() const; // test if at last item + Q3PtrCollection::Item toFirst(); // move to first item + Q3PtrCollection::Item toLast(); // move to last item + + Q3PtrCollection::Item get() const; // get current item + Q3PtrCollection::Item operator()(); // get current and move to next + Q3PtrCollection::Item operator++(); // move to next item (prefix) + Q3PtrCollection::Item operator+=(uint); // move n positions forward + Q3PtrCollection::Item operator--(); // move to prev item (prefix) + Q3PtrCollection::Item operator-=(uint); // move n positions backward + +protected: + Q3GList *list; // reference to list + +private: + Q3LNode *curNode; // current node in list +}; + + +inline bool Q3GListIterator::atFirst() const +{ + return curNode == list->firstNode; +} + +inline bool Q3GListIterator::atLast() const +{ + return curNode == list->lastNode; +} + +inline Q3PtrCollection::Item Q3GListIterator::get() const +{ + return curNode ? curNode->data : 0; +} + +class Q_COMPAT_EXPORT Q3GListStdIterator +{ +public: + inline Q3GListStdIterator( Q3LNode* n ) : node( n ){} + inline operator Q3LNode* () { return node; } +protected: + inline Q3LNode *next() { return node->next; } + Q3LNode *node; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GLIST_H diff --git a/qtinterface/qt4/Qt/q3grid.h b/qtinterface/qt4/Qt/q3grid.h new file mode 100644 index 0000000..8cfdb66 --- /dev/null +++ b/qtinterface/qt4/Qt/q3grid.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GRID_H +#define Q3GRID_H + +#include <Qt3Support/q3frame.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QGridLayout; + +class Q_COMPAT_EXPORT Q3Grid : public Q3Frame +{ + Q_OBJECT +public: + Q3Grid(int n, QWidget* parent=0, const char* name=0, Qt::WindowFlags f = 0); + Q3Grid(int n, Qt::Orientation orient, QWidget* parent=0, const char* name=0, + Qt::WindowFlags f = 0); + + void setSpacing(int); + QSize sizeHint() const; + + typedef Qt::Orientation Direction; + +protected: + void frameChanged(); + +private: + Q_DISABLE_COPY(Q3Grid) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GRID_H diff --git a/qtinterface/qt4/Qt/q3gridlayout.h b/qtinterface/qt4/Qt/q3gridlayout.h new file mode 100644 index 0000000..1ebb2bf --- /dev/null +++ b/qtinterface/qt4/Qt/q3gridlayout.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GRIDLAYOUT_H +#define Q3GRIDLAYOUT_H + +#include <QtGui/qboxlayout.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3GridLayout : public QGridLayout +{ +public: + inline explicit Q3GridLayout(QWidget *parent) + : QGridLayout(parent) { setMargin(0); setSpacing(0); } + + inline Q3GridLayout(QWidget *parent, int nRows, int nCols = 1, int margin = 0, + int spacing = -1, const char *name = 0) + : QGridLayout(parent, nRows, nCols, margin, spacing, name) {} + + inline Q3GridLayout(int nRows, int nCols = 1, int spacing = -1, const char *name = 0) + : QGridLayout(nRows, nCols, spacing, name) {} + + inline Q3GridLayout(QLayout *parentLayout, int nRows =1, int nCols = 1, int spacing = -1, + const char *name = 0) + : QGridLayout(parentLayout, nRows, nCols, spacing, name) {} + +private: + Q_DISABLE_COPY(Q3GridLayout) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GRIDLAYOUT_H diff --git a/qtinterface/qt4/Qt/q3gridview.h b/qtinterface/qt4/Qt/q3gridview.h new file mode 100644 index 0000000..0fe79fc --- /dev/null +++ b/qtinterface/qt4/Qt/q3gridview.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GRIDVIEW_H +#define Q3GRIDVIEW_H + +#include <Qt3Support/q3scrollview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3GridViewPrivate; + +class Q_COMPAT_EXPORT Q3GridView : public Q3ScrollView +{ + Q_OBJECT + Q_PROPERTY(int numRows READ numRows WRITE setNumRows) + Q_PROPERTY(int numCols READ numCols WRITE setNumCols) + Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth) + Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight) +public: + + Q3GridView(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); + ~Q3GridView(); + + int numRows() const; + virtual void setNumRows(int); + int numCols() const; + virtual void setNumCols(int); + + int cellWidth() const; + virtual void setCellWidth(int); + int cellHeight() const; + virtual void setCellHeight(int); + + QRect cellRect() const; + QRect cellGeometry(int row, int column); + QSize gridSize() const; + + int rowAt(int y) const; + int columnAt(int x) const; + + void repaintCell(int row, int column, bool erase=true); + void updateCell(int row, int column); + void ensureCellVisible(int row, int column); + +protected: + virtual void paintCell(QPainter *, int row, int col) = 0; + virtual void paintEmptyArea(QPainter *p, int cx, int cy, int cw, int ch); + + void drawContents(QPainter *p, int cx, int cy, int cw, int ch); + + virtual void dimensionChange(int, int); + +private: + void drawContents(QPainter*); + void updateGrid(); + + int nrows; + int ncols; + int cellw; + int cellh; + Q3GridViewPrivate* d; + + Q_DISABLE_COPY(Q3GridView) +}; + +inline int Q3GridView::cellWidth() const +{ return cellw; } + +inline int Q3GridView::cellHeight() const +{ return cellh; } + +inline int Q3GridView::rowAt(int y) const +{ return y / cellh; } + +inline int Q3GridView::columnAt(int x) const +{ return x / cellw; } + +inline int Q3GridView::numRows() const +{ return nrows; } + +inline int Q3GridView::numCols() const +{return ncols; } + +inline QRect Q3GridView::cellRect() const +{ return QRect(0, 0, cellw, cellh); } + +inline QSize Q3GridView::gridSize() const +{ return QSize(ncols * cellw, nrows * cellh); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GRIDVIEW_H diff --git a/qtinterface/qt4/Qt/q3groupbox.h b/qtinterface/qt4/Qt/q3groupbox.h new file mode 100644 index 0000000..06cd192 --- /dev/null +++ b/qtinterface/qt4/Qt/q3groupbox.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GROUPBOX_H +#define Q3GROUPBOX_H + +#include <QtGui/qgroupbox.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3GroupBoxPrivate; + +class Q_COMPAT_EXPORT Q3GroupBox : public QGroupBox +{ + Q_OBJECT +public: + enum +#if defined(Q_MOC_RUN) + FrameShape +#else + DummyFrame +#endif + { Box = QFrame::Box, Sunken = QFrame::Sunken, Plain = QFrame::Plain, + Raised = QFrame::Raised, MShadow=QFrame::Shadow_Mask, NoFrame = QFrame::NoFrame, + Panel = QFrame::Panel, StyledPanel = QFrame::StyledPanel, HLine = QFrame::HLine, + VLine = QFrame::VLine, + WinPanel = QFrame::WinPanel,ToolBarPanel = QFrame::StyledPanel, + MenuBarPanel = QFrame::StyledPanel, PopupPanel = QFrame::StyledPanel, + LineEditPanel = QFrame::StyledPanel,TabWidgetPanel = QFrame::StyledPanel, + GroupBoxPanel = 0x0007, + MShape = QFrame::Shape_Mask}; + + typedef DummyFrame FrameShape; + Q_ENUMS(FrameShape) + + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation DESIGNABLE false) + Q_PROPERTY(int columns READ columns WRITE setColumns DESIGNABLE false) + + Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false) + Q_PROPERTY(FrameShape frameShape READ frameShape WRITE setFrameShape) + Q_PROPERTY(FrameShape frameShadow READ frameShadow WRITE setFrameShadow) + Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) + Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth) + Q_PROPERTY(int margin READ margin WRITE setMargin) + +public: + explicit Q3GroupBox(QWidget* parent=0, const char* name=0); + explicit Q3GroupBox(const QString &title, + QWidget* parent=0, const char* name=0); + Q3GroupBox(int strips, Qt::Orientation o, + QWidget* parent=0, const char* name=0); + Q3GroupBox(int strips, Qt::Orientation o, const QString &title, + QWidget* parent=0, const char* name=0); + ~Q3GroupBox(); + + virtual void setColumnLayout(int strips, Qt::Orientation o); + + int columns() const; + void setColumns(int); + + Qt::Orientation orientation() const; + void setOrientation(Qt::Orientation); + + int insideMargin() const; + int insideSpacing() const; + void setInsideMargin(int m); + void setInsideSpacing(int s); + + void addSpace(int); + + void setFrameRect(QRect); + QRect frameRect() const; +#ifdef qdoc + void setFrameShadow(FrameShape); + FrameShape frameShadow() const; + void setFrameShape(FrameShape); + FrameShape frameShape() const; +#else + void setFrameShadow(DummyFrame); + DummyFrame frameShadow() const; + void setFrameShape(DummyFrame); + DummyFrame frameShape() const; +#endif + void setFrameStyle(int); + int frameStyle() const; + int frameWidth() const; + void setLineWidth(int); + int lineWidth() const; + void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } + void setMidLineWidth(int); + int midLineWidth() const; + +protected: + void childEvent(QChildEvent *); + void resizeEvent(QResizeEvent *); + void changeEvent(QEvent *); + bool event(QEvent *); + +private: + void skip(); + void init(); + void calculateFrame(); + void insertWid(QWidget*); + void drawFrame(QPainter *p); + + Q3GroupBoxPrivate * d; + + Q_DISABLE_COPY(Q3GroupBox) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GROUPBOX_H diff --git a/qtinterface/qt4/Qt/q3gvector.h b/qtinterface/qt4/Qt/q3gvector.h new file mode 100644 index 0000000..9e39eec --- /dev/null +++ b/qtinterface/qt4/Qt/q3gvector.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3GVECTOR_H +#define Q3GVECTOR_H + +#include <Qt3Support/q3ptrcollection.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3GVector : public Q3PtrCollection // generic vector +{ +friend class Q3GList; // needed by Q3GList::toVector +public: +#ifndef QT_NO_DATASTREAM + QDataStream &read( QDataStream & ); // read vector from stream + QDataStream &write( QDataStream & ) const; // write vector to stream +#endif + virtual int compareItems( Item, Item ); + +protected: + Q3GVector(); // create empty vector + Q3GVector( uint size ); // create vector with nullptrs + Q3GVector( const Q3GVector &v ); // make copy of other vector + ~Q3GVector(); + + Q3GVector &operator=( const Q3GVector &v ); // assign from other vector + bool operator==( const Q3GVector &v ) const; + + Item *data() const { return vec; } + uint size() const { return len; } + uint count() const { return numItems; } + + bool insert( uint index, Item ); // insert item at index + bool remove( uint index ); // remove item + Item take( uint index ); // take out item + + void clear(); // clear vector + bool resize( uint newsize ); // resize vector + + bool fill( Item, int flen ); // resize and fill vector + + void sort(); // sort vector + int bsearch( Item ) const; // binary search (when sorted) + + int findRef( Item, uint index ) const; // find exact item in vector + int find( Item, uint index ) const; // find equal item in vector + uint containsRef( Item ) const; // get number of exact matches + uint contains( Item ) const; // get number of equal matches + + Item at( uint index ) const // return indexed item + { +#if defined(QT_CHECK_RANGE) + if ( index >= len ) + warningIndexRange( index ); +#endif + return vec[index]; + } + + bool insertExpand( uint index, Item ); // insert, expand if necessary + + void toList( Q3GList * ) const; // put items in list + +#ifndef QT_NO_DATASTREAM + virtual QDataStream &read( QDataStream &, Item & ); + virtual QDataStream &write( QDataStream &, Item ) const; +#endif +private: + Item *vec; + uint len; + uint numItems; + + static void warningIndexRange( uint ); +}; + + +/***************************************************************************** + Q3GVector stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_COMPAT_EXPORT QDataStream &operator>>( QDataStream &, Q3GVector & ); +Q_COMPAT_EXPORT QDataStream &operator<<( QDataStream &, const Q3GVector & ); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3GVECTOR_H diff --git a/qtinterface/qt4/Qt/q3hbox.h b/qtinterface/qt4/Qt/q3hbox.h new file mode 100644 index 0000000..727a090 --- /dev/null +++ b/qtinterface/qt4/Qt/q3hbox.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3HBOX_H +#define Q3HBOX_H + +#include <Qt3Support/q3frame.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QBoxLayout; + +class Q_COMPAT_EXPORT Q3HBox : public Q3Frame +{ + Q_OBJECT +public: + Q3HBox(QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0); + + void setSpacing(int); + bool setStretchFactor(QWidget*, int stretch); + QSize sizeHint() const; + +protected: + Q3HBox(bool horizontal, QWidget* parent, const char* name, Qt::WindowFlags f = 0); + void frameChanged(); + +private: + Q_DISABLE_COPY(Q3HBox) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3HBOX_H diff --git a/qtinterface/qt4/Qt/q3header.h b/qtinterface/qt4/Qt/q3header.h new file mode 100644 index 0000000..702b59b --- /dev/null +++ b/qtinterface/qt4/Qt/q3header.h @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3HEADER_H +#define Q3HEADER_H + +#include <QtGui/qicon.h> +#include <QtGui/qwidget.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_HEADER + +class QShowEvent; +class Q3HeaderData; +class Q3Table; +class Q3ListView; + +class Q_COMPAT_EXPORT Q3Header : public QWidget +{ + friend class Q3Table; + friend class Q3TableHeader; + friend class Q3ListView; + + Q_OBJECT + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(bool tracking READ tracking WRITE setTracking) + Q_PROPERTY(int count READ count) + Q_PROPERTY(int offset READ offset WRITE setOffset) + Q_PROPERTY(bool moving READ isMovingEnabled WRITE setMovingEnabled) + Q_PROPERTY(bool stretching READ isStretchEnabled WRITE setStretchEnabled) + +public: + Q3Header(QWidget* parent=0, const char* name=0); + Q3Header(int, QWidget* parent=0, const char* name=0); + ~Q3Header(); + + int addLabel(const QString &, int size = -1); + int addLabel(const QIcon&, const QString &, int size = -1); + void removeLabel(int section); + virtual void setLabel(int, const QString &, int size = -1); + virtual void setLabel(int, const QIcon&, const QString &, int size = -1); + QString label(int section) const; + QIcon* iconSet(int section) const; + + virtual void setOrientation(Qt::Orientation); + Qt::Orientation orientation() const; + virtual void setTracking(bool enable); + bool tracking() const; + + virtual void setClickEnabled(bool, int section = -1); + virtual void setResizeEnabled(bool, int section = -1); + virtual void setMovingEnabled(bool); + virtual void setStretchEnabled(bool b, int section); + void setStretchEnabled(bool b) { setStretchEnabled(b, -1); } + bool isClickEnabled(int section = -1) const; + bool isResizeEnabled(int section = -1) const; + bool isMovingEnabled() const; + bool isStretchEnabled() const; + bool isStretchEnabled(int section) const; + + void resizeSection(int section, int s); + int sectionSize(int section) const; + int sectionPos(int section) const; + int sectionAt(int pos) const; + int count() const; + int headerWidth() const; + QRect sectionRect(int section) const; + + virtual void setCellSize(int , int); // obsolete, do not use + int cellSize(int i) const { return sectionSize(mapToSection(i)); } // obsolete, do not use + int cellPos(int) const; // obsolete, do not use + int cellAt(int pos) const { return mapToIndex(sectionAt(pos + offset())); } // obsolete, do not use + + int offset() const; + + QSize sizeHint() const; + + int mapToSection(int index) const; + int mapToIndex(int section) const; + int mapToLogical(int) const; // obsolete, do not use + int mapToActual(int) const; // obsolete, do not use + + void moveSection(int section, int toIndex); + virtual void moveCell(int, int); // obsolete, do not use + + void setSortIndicator(int section, bool ascending = true); // obsolete, do not use + inline void setSortIndicator(int section, Qt::SortOrder order) + { setSortIndicator(section, (order == Qt::AscendingOrder)); } + int sortIndicatorSection() const; + Qt::SortOrder sortIndicatorOrder() const; + + void adjustHeaderSize() { adjustHeaderSize(-1); } + +public Q_SLOTS: + void setUpdatesEnabled(bool enable); + virtual void setOffset(int pos); + +Q_SIGNALS: + void clicked(int section); + void pressed(int section); + void released(int section); + void sizeChange(int section, int oldSize, int newSize); + void indexChange(int section, int fromIndex, int toIndex); + void sectionClicked(int); // obsolete, do not use + void moved(int, int); // obsolete, do not use + void sectionHandleDoubleClicked(int section); + +protected: + void paintEvent(QPaintEvent *); + void showEvent(QShowEvent *e); + void resizeEvent(QResizeEvent *e); + QRect sRect(int index); + + virtual void paintSection(QPainter *p, int index, const QRect& fr); + virtual void paintSectionLabel(QPainter* p, int index, const QRect& fr); + + void changeEvent(QEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseDoubleClickEvent(QMouseEvent *); + + void keyPressEvent(QKeyEvent *); + void keyReleaseEvent(QKeyEvent *); + +private: + void handleColumnMove(int fromIdx, int toIdx); + void adjustHeaderSize(int diff); + void init(int); + + void paintRect(int p, int s); + void markLine(int idx); + void unMarkLine(int idx); + int pPos(int i) const; + int pSize(int i) const; + int findLine(int); + int handleAt(int p); + bool reverse() const; + void calculatePositions(bool onlyVisible = false, int start = 0); + void handleColumnResize(int, int, bool, bool = true); + QSize sectionSizeHint(int section, const QFontMetrics& fm) const; + void setSectionSizeAndHeight(int section, int size); + + void resizeArrays(int size); + void setIsATableHeader(bool b); + int offs; + int handleIdx; + int oldHIdxSize; + int moveToIdx; + enum State { Idle, Sliding, Pressed, Moving, Blocked }; + State state; + int clickPos; + bool trackingIsOn; + int oldHandleIdx; + int cachedPos; // not used + Qt::Orientation orient; + + Q3HeaderData *d; + +private: + Q_DISABLE_COPY(Q3Header) +}; + + +inline Qt::Orientation Q3Header::orientation() const +{ + return orient; +} + +inline void Q3Header::setTracking(bool enable) { trackingIsOn = enable; } +inline bool Q3Header::tracking() const { return trackingIsOn; } + +extern Q_COMPAT_EXPORT bool qt_qheader_label_return_null_strings; // needed for professional edition + +#endif // QT_NO_HEADER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3HEADER_H diff --git a/qtinterface/qt4/Qt/q3hgroupbox.h b/qtinterface/qt4/Qt/q3hgroupbox.h new file mode 100644 index 0000000..d2862b4 --- /dev/null +++ b/qtinterface/qt4/Qt/q3hgroupbox.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3HGROUPBOX_H +#define Q3HGROUPBOX_H + +#include <Qt3Support/q3groupbox.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3HGroupBox : public Q3GroupBox +{ + Q_OBJECT +public: + Q3HGroupBox( QWidget* parent=0, const char* name=0 ); + Q3HGroupBox( const QString &title, QWidget* parent=0, const char* name=0 ); + ~Q3HGroupBox(); + +private: + Q_DISABLE_COPY(Q3HGroupBox) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3HGROUPBOX_H diff --git a/qtinterface/qt4/Qt/q3http.h b/qtinterface/qt4/Qt/q3http.h new file mode 100644 index 0000000..77e971e --- /dev/null +++ b/qtinterface/qt4/Qt/q3http.h @@ -0,0 +1,277 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3HTTP_H +#define Q3HTTP_H + +#include <QtCore/qobject.h> +#include <Qt3Support/q3networkprotocol.h> +#include <QtCore/qmap.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) +#ifndef QT_NO_HTTP + +class Q3Socket; +class QTimerEvent; +class QTextStream; +class QIODevice; + +class Q3HttpPrivate; +class Q3HttpRequest; + +class Q_COMPAT_EXPORT Q3HttpHeader +{ +public: + Q3HttpHeader(); + Q3HttpHeader( const Q3HttpHeader& header ); + Q3HttpHeader( const QString& str ); + virtual ~Q3HttpHeader(); + + Q3HttpHeader& operator=( const Q3HttpHeader& h ); + + QString value( const QString& key ) const; + void setValue( const QString& key, const QString& value ); + void removeValue( const QString& key ); + + QStringList keys() const; + bool hasKey( const QString& key ) const; + + 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 ); + +private: + QMap<QString,QString> values; + bool valid; +}; + +class Q_COMPAT_EXPORT Q3HttpResponseHeader : public Q3HttpHeader +{ +private: + Q3HttpResponseHeader( int code, const QString& text = QString(), int majorVer = 1, int minorVer = 1 ); + Q3HttpResponseHeader( const QString& str ); + + void setStatusLine( int code, const QString& text = QString(), int majorVer = 1, int minorVer = 1 ); + +public: + Q3HttpResponseHeader(); + Q3HttpResponseHeader( const Q3HttpResponseHeader& header ); + + int statusCode() const; + QString reasonPhrase() const; + + int majorVersion() const; + int minorVersion() const; + + QString toString() const; + +protected: + bool parseLine( const QString& line, int number ); + +private: + int statCode; + QString reasonPhr; + int majVer; + int minVer; + + friend class Q3Http; +}; + +class Q_COMPAT_EXPORT Q3HttpRequestHeader : public Q3HttpHeader +{ +public: + Q3HttpRequestHeader(); + Q3HttpRequestHeader( const QString& method, const QString& path, int majorVer = 1, int minorVer = 1 ); + Q3HttpRequestHeader( const Q3HttpRequestHeader& header ); + Q3HttpRequestHeader( const QString& str ); + + 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: + QString m; + QString p; + int majVer; + int minVer; +}; + +class Q_COMPAT_EXPORT Q3Http : public Q3NetworkProtocol +{ + Q_OBJECT + +public: + Q3Http(); + Q3Http( QObject* parent, const char* name = 0 ); // ### Qt 4.0: make parent=0 and get rid of the Q3Http() constructor + Q3Http( const QString &hostname, Q_UINT16 port=80, QObject* parent=0, const char* name = 0 ); + virtual ~Q3Http(); + + int supportedOperations() const; + + enum State { Unconnected, HostLookup, Connecting, Sending, Reading, Connected, Closing }; + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + UnexpectedClose, + InvalidResponseHeader, + WrongContentLength, + Aborted + }; + + int setHost(const QString &hostname, Q_UINT16 port=80 ); + + 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 Q3HttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0 ); + int request( const Q3HttpRequestHeader &header, const QByteArray &data, QIODevice *to=0 ); + + int closeConnection(); + + Q_ULONG bytesAvailable() const; + Q_LONG readBlock( char *data, Q_ULONG maxlen ); + QByteArray readAll(); + + int currentId() const; + QIODevice* currentSourceDevice() const; + QIODevice* currentDestinationDevice() const; + Q3HttpRequestHeader currentRequest() const; + bool hasPendingRequests() const; + void clearPendingRequests(); + + State state() const; + + Error error() const; + QString errorString() const; + +public Q_SLOTS: + void abort(); + +Q_SIGNALS: + void stateChanged( int ); + void responseHeaderReceived( const Q3HttpResponseHeader& resp ); + void readyRead( const Q3HttpResponseHeader& resp ); + void dataSendProgress( int, int ); + void dataReadProgress( int, int ); + + void requestStarted( int ); + void requestFinished( int, bool ); + void done( bool ); + +protected: + void operationGet( Q3NetworkOperation *op ); + void operationPut( Q3NetworkOperation *op ); + + void timerEvent( QTimerEvent * ); + +private Q_SLOTS: + void clientReply( const Q3HttpResponseHeader &rep ); + void clientDone( bool ); + void clientStateChanged( int ); + + void startNextRequest(); + void slotReadyRead(); + void slotConnected(); + void slotError( int ); + void slotClosed(); + void slotBytesWritten( int ); + +private: + Q3HttpPrivate *d; + void *unused; // ### Qt 4.0: remove this (in for binary compatibility) + int bytesRead; + + int addRequest( Q3HttpRequest * ); + void sendRequest(); + void finishedWithSuccess(); + void finishedWithError( const QString& detail, int errorCode ); + + void killIdleTimer(); + + void init(); + void setState( int ); + void close(); + + friend class Q3HttpNormalRequest; + friend class Q3HttpSetHostRequest; + friend class Q3HttpCloseRequest; + friend class Q3HttpPGHRequest; +}; + +#endif // QT_NO_HTTP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3HTTP_H diff --git a/qtinterface/qt4/Qt/q3iconview.h b/qtinterface/qt4/Qt/q3iconview.h new file mode 100644 index 0000000..0239d96 --- /dev/null +++ b/qtinterface/qt4/Qt/q3iconview.h @@ -0,0 +1,519 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3ICONVIEW_H +#define Q3ICONVIEW_H + +#include <Qt3Support/q3scrollview.h> +#include <QtCore/qstring.h> +#include <QtCore/qrect.h> +#include <QtCore/qpoint.h> +#include <QtCore/qsize.h> +#include <QtGui/qfont.h> // QString->QFont conversion +#include <Qt3Support/q3dragobject.h> +#include <QtGui/qbitmap.h> +#include <QtGui/qpicture.h> +#include <Qt3Support/q3valuelist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_ICONVIEW + +class Q3IconView; +class QPainter; +class QMimeSource; +class QMouseEvent; +class QDragEnterEvent; +class QDragMoveEvent; +class QDragLeaveEvent; +class QKeyEvent; +class QFocusEvent; +class QShowEvent; +class Q3IconViewItem; +class Q3IconViewItemLineEdit; +class QStringList; +class Q3IconDragPrivate; +class QColorGroup; + +#ifndef QT_NO_DRAGANDDROP + +class Q_COMPAT_EXPORT Q3IconDragItem +{ +public: + Q3IconDragItem(); + virtual ~Q3IconDragItem(); + virtual QByteArray data() const; + virtual void setData(const QByteArray &d); + bool operator== (const Q3IconDragItem&) const; + +private: + QByteArray ba; + +}; + +class Q_COMPAT_EXPORT Q3IconDrag : public Q3DragObject +{ + Q_OBJECT +public: + Q3IconDrag(QWidget * dragSource, const char* name = 0); + virtual ~Q3IconDrag(); + + void append(const Q3IconDragItem &item, const QRect &pr, const QRect &tr); + + virtual const char* format(int i) const; + static bool canDecode(QMimeSource* e); + virtual QByteArray encodedData(const char* mime) const; + +private: + Q_DISABLE_COPY(Q3IconDrag) + + Q3IconDragPrivate *d; + QChar endMark; + + friend class Q3IconView; + friend class Q3IconViewPrivate; +}; + +#endif + +class Q3IconViewToolTip; +class Q3IconViewItemPrivate; + +class Q_COMPAT_EXPORT Q3IconViewItem +{ + friend class Q3IconView; + friend class Q3IconViewToolTip; + friend class Q3IconViewItemLineEdit; + +public: + Q3IconViewItem(Q3IconView *parent); + Q3IconViewItem(Q3IconView *parent, Q3IconViewItem *after); + Q3IconViewItem(Q3IconView *parent, const QString &text); + Q3IconViewItem(Q3IconView *parent, Q3IconViewItem *after, const QString &text); + Q3IconViewItem(Q3IconView *parent, const QString &text, const QPixmap &icon); + Q3IconViewItem(Q3IconView *parent, Q3IconViewItem *after, const QString &text, const QPixmap &icon); +#ifndef QT_NO_PICTURE + Q3IconViewItem(Q3IconView *parent, const QString &text, const QPicture &picture); + Q3IconViewItem(Q3IconView *parent, Q3IconViewItem *after, const QString &text, const QPicture &picture); +#endif + virtual ~Q3IconViewItem(); + + virtual void setRenameEnabled(bool allow); + virtual void setDragEnabled(bool allow); + virtual void setDropEnabled(bool allow); + + virtual QString text() const; + virtual QPixmap *pixmap() const; +#ifndef QT_NO_PICTURE + virtual QPicture *picture() const; +#endif + virtual QString key() const; + + bool renameEnabled() const; + bool dragEnabled() const; + bool dropEnabled() const; + + Q3IconView *iconView() const; + Q3IconViewItem *prevItem() const; + Q3IconViewItem *nextItem() const; + + int index() const; + + virtual void setSelected(bool s, bool cb); + virtual void setSelected(bool s); + virtual void setSelectable(bool s); + + bool isSelected() const; + bool isSelectable() const; + + virtual void repaint(); + + virtual bool move(int x, int y); + virtual void moveBy(int dx, int dy); + virtual bool move(const QPoint &pnt); + virtual void moveBy(const QPoint &pnt); + + QRect rect() const; + int x() const; + int y() const; + int width() const; + int height() const; + QSize size() const; + QPoint pos() const; + QRect textRect(bool relative = true) const; + QRect pixmapRect(bool relative = true) const; + bool contains(const QPoint& pnt) const; + bool intersects(const QRect& r) const; + + virtual bool acceptDrop(const QMimeSource *mime) const; + +#ifndef QT_NO_TEXTEDIT + void rename(); +#endif + + virtual int compare(Q3IconViewItem *i) const; + + virtual void setText(const QString &text); + virtual void setPixmap(const QPixmap &icon); +#ifndef QT_NO_PICTURE + virtual void setPicture(const QPicture &icon); +#endif + virtual void setText(const QString &text, bool recalc, bool redraw = true); + virtual void setPixmap(const QPixmap &icon, bool recalc, bool redraw = true); + virtual void setKey(const QString &k); + + virtual int rtti() const; + static int RTTI; + +protected: +#ifndef QT_NO_TEXTEDIT + virtual void removeRenameBox(); +#endif + virtual void calcRect(const QString &text_ = QString()); + virtual void paintItem(QPainter *p, const QColorGroup &cg); + virtual void paintFocus(QPainter *p, const QColorGroup &cg); +#ifndef QT_NO_DRAGANDDROP + virtual void dropped(QDropEvent *e, const Q3ValueList<Q3IconDragItem> &lst); +#endif + virtual void dragEntered(); + virtual void dragLeft(); + void setItemRect(const QRect &r); + void setTextRect(const QRect &r); + void setPixmapRect(const QRect &r); + void calcTmpText(); + QString tempText() const; + +private: + void init(Q3IconViewItem *after = 0 +#ifndef QT_NO_PICTURE + , QPicture *pic = 0 +#endif + ); +#ifndef QT_NO_TEXTEDIT + void renameItem(); + void cancelRenameItem(); +#endif + void checkRect(); + + Q3IconView *view; + QString itemText, itemKey; + QString tmpText; + QPixmap *itemIcon; +#ifndef QT_NO_PICTURE + QPicture *itemPic; +#endif + Q3IconViewItem *prev, *next; + uint allow_rename : 1; + uint allow_drag : 1; + uint allow_drop : 1; + uint selected : 1; + uint selectable : 1; + uint dirty : 1; + uint wordWrapDirty : 1; + QRect itemRect, itemTextRect, itemIconRect; +#ifndef QT_NO_TEXTEDIT + Q3IconViewItemLineEdit *renameBox; +#endif + QRect oldRect; + + Q3IconViewItemPrivate *d; + +}; + +class Q3IconViewPrivate; + +class Q_COMPAT_EXPORT Q3IconView : public Q3ScrollView +{ + friend class Q3IconViewItem; + friend class Q3IconViewPrivate; + friend class Q3IconViewToolTip; + + Q_OBJECT + // #### sorting and sort direction do not work + Q_ENUMS(SelectionMode ItemTextPos Arrangement ResizeMode) + Q_PROPERTY(bool sorting READ sorting) + Q_PROPERTY(bool sortDirection READ sortDirection) + Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) + Q_PROPERTY(int gridX READ gridX WRITE setGridX) + Q_PROPERTY(int gridY READ gridY WRITE setGridY) + Q_PROPERTY(int spacing READ spacing WRITE setSpacing) + Q_PROPERTY(ItemTextPos itemTextPos READ itemTextPos WRITE setItemTextPos) + Q_PROPERTY(QBrush itemTextBackground READ itemTextBackground WRITE setItemTextBackground) + Q_PROPERTY(Arrangement arrangement READ arrangement WRITE setArrangement) + Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) + Q_PROPERTY(int maxItemWidth READ maxItemWidth WRITE setMaxItemWidth) + Q_PROPERTY(int maxItemTextLength READ maxItemTextLength WRITE setMaxItemTextLength) + Q_PROPERTY(bool autoArrange READ autoArrange WRITE setAutoArrange) + Q_PROPERTY(bool itemsMovable READ itemsMovable WRITE setItemsMovable) + Q_PROPERTY(bool wordWrapIconText READ wordWrapIconText WRITE setWordWrapIconText) + Q_PROPERTY(bool showToolTips READ showToolTips WRITE setShowToolTips) + Q_PROPERTY(uint count READ count) + +public: + enum SelectionMode { + Single = 0, + Multi, + Extended, + NoSelection + }; + enum Arrangement { + LeftToRight = 0, + TopToBottom + }; + enum ResizeMode { + Fixed = 0, + Adjust + }; + enum ItemTextPos { + Bottom = 0, + Right + }; + + Q3IconView(QWidget* parent=0, const char* name=0, Qt::WindowFlags f = 0); + virtual ~Q3IconView(); + + virtual void insertItem(Q3IconViewItem *item, Q3IconViewItem *after = 0L); + virtual void takeItem(Q3IconViewItem *item); + + int index(const Q3IconViewItem *item) const; + + Q3IconViewItem *firstItem() const; + Q3IconViewItem *lastItem() const; + Q3IconViewItem *currentItem() const; + virtual void setCurrentItem(Q3IconViewItem *item); + virtual void setSelected(Q3IconViewItem *item, bool s, bool cb = false); + + uint count() const; + +public: + virtual void showEvent(QShowEvent *); + + virtual void setSelectionMode(SelectionMode m); + SelectionMode selectionMode() const; + + Q3IconViewItem *findItem(const QPoint &pos) const; + + enum StringComparisonMode { + CaseSensitive = 0x00001, // 0 0001 + BeginsWith = 0x00002, // 0 0010 + EndsWith = 0x00004, // 0 0100 + Contains = 0x00008, // 0 1000 + ExactMatch = 0x00010 // 1 0000 + }; + typedef uint ComparisonFlags; + Q3IconViewItem *findItem(const QString &text, ComparisonFlags = BeginsWith | Qt::CaseSensitive) const; + virtual void selectAll(bool select); + virtual void clearSelection(); + virtual void invertSelection(); + + virtual void repaintItem(Q3IconViewItem *item); + void repaintSelectedItems(); + + void ensureItemVisible(Q3IconViewItem *item); + Q3IconViewItem* findFirstVisibleItem(const QRect &r) const; + Q3IconViewItem* findLastVisibleItem(const QRect &r) const; + + virtual void clear(); + + virtual void setGridX(int rx); + virtual void setGridY(int ry); + int gridX() const; + int gridY() const; + virtual void setSpacing(int sp); + int spacing() const; + virtual void setItemTextPos(ItemTextPos pos); + ItemTextPos itemTextPos() const; + virtual void setItemTextBackground(const QBrush &b); + QBrush itemTextBackground() const; + virtual void setArrangement(Arrangement am); + Arrangement arrangement() const; + virtual void setResizeMode(ResizeMode am); + ResizeMode resizeMode() const; + virtual void setMaxItemWidth(int w); + int maxItemWidth() const; + virtual void setMaxItemTextLength(int w); + int maxItemTextLength() const; + virtual void setAutoArrange(bool b); + bool autoArrange() const; + virtual void setShowToolTips(bool b); + bool showToolTips() const; + + void setSorting(bool sort, bool ascending = true); + bool sorting() const; + bool sortDirection() const; + + virtual void setItemsMovable(bool b); + bool itemsMovable() const; + virtual void setWordWrapIconText(bool b); + bool wordWrapIconText() const; + + bool eventFilter(QObject * o, QEvent *); + + QSize minimumSizeHint() const; + QSize sizeHint() const; + + virtual void sort(bool ascending = true); + + bool isRenaming() const; + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + +public Q_SLOTS: + virtual void arrangeItemsInGrid(const QSize &grid, bool update = true); + virtual void arrangeItemsInGrid(bool update = true); + virtual void setContentsPos(int x, int y); + virtual void updateContents(); + +Q_SIGNALS: + void selectionChanged(); + void selectionChanged(Q3IconViewItem *item); + void currentChanged(Q3IconViewItem *item); + void clicked(Q3IconViewItem *); + void clicked(Q3IconViewItem *, const QPoint &); + void pressed(Q3IconViewItem *); + void pressed(Q3IconViewItem *, const QPoint &); + + void doubleClicked(Q3IconViewItem *item); + void returnPressed(Q3IconViewItem *item); + void rightButtonClicked(Q3IconViewItem* item, const QPoint& pos); + void rightButtonPressed(Q3IconViewItem* item, const QPoint& pos); + void mouseButtonPressed(int button, Q3IconViewItem* item, const QPoint& pos); + void mouseButtonClicked(int button, Q3IconViewItem* item, const QPoint& pos); + void contextMenuRequested(Q3IconViewItem* item, const QPoint &pos); + +#ifndef QT_NO_DRAGANDDROP + void dropped(QDropEvent *e, const Q3ValueList<Q3IconDragItem> &lst); +#endif + void moved(); + void onItem(Q3IconViewItem *item); + void onViewport(); + void itemRenamed(Q3IconViewItem *item, const QString &); + void itemRenamed(Q3IconViewItem *item); + +protected Q_SLOTS: + virtual void doAutoScroll(); + virtual void adjustItems(); + virtual void slotUpdate(); + +private Q_SLOTS: + void movedContents(int dx, int dy); + +protected: + void drawContents(QPainter *p, int cx, int cy, int cw, int ch); + void contentsMousePressEvent(QMouseEvent *e); + void contentsMouseReleaseEvent(QMouseEvent *e); + void contentsMouseMoveEvent(QMouseEvent *e); + void contentsMouseDoubleClickEvent(QMouseEvent *e); + void contentsContextMenuEvent(QContextMenuEvent *e); + +#ifndef QT_NO_DRAGANDDROP + void contentsDragEnterEvent(QDragEnterEvent *e); + void contentsDragMoveEvent(QDragMoveEvent *e); + void contentsDragLeaveEvent(QDragLeaveEvent *e); + void contentsDropEvent(QDropEvent *e); +#endif + + void resizeEvent(QResizeEvent* e); + void keyPressEvent(QKeyEvent *e); + void focusInEvent(QFocusEvent *e); + void focusOutEvent(QFocusEvent *e); + void enterEvent(QEvent *e); + + virtual void drawRubber(QPainter *p); +#ifndef QT_NO_DRAGANDDROP + virtual Q3DragObject *dragObject(); + virtual void startDrag(); +#endif + virtual void insertInGrid(Q3IconViewItem *item); + virtual void drawBackground(QPainter *p, const QRect &r); + + void emitSelectionChanged(Q3IconViewItem * i = 0); + void emitRenamed(Q3IconViewItem *item); + + Q3IconViewItem *makeRowLayout(Q3IconViewItem *begin, int &y, bool &changed); + + void changeEvent(QEvent *); + +private: + Q_DISABLE_COPY(Q3IconView) + + void contentsMousePressEventEx(QMouseEvent *e); + virtual void drawDragShapes(const QPoint &pnt); +#ifndef QT_NO_DRAGANDDROP + virtual void initDragEnter(QDropEvent *e); +#endif + Q3IconViewItem* findItemByName(Q3IconViewItem *start); + void handleItemChange(Q3IconViewItem *old, bool shift, + bool control, bool homeend = false); + + int calcGridNum(int w, int x) const; + Q3IconViewItem *rowBegin(Q3IconViewItem *item) const; + void updateItemContainer(Q3IconViewItem *item); + void appendItemContainer(); + void rebuildContainers(); + enum Direction { + DirUp = 0, + DirDown, + DirLeft, + DirRight + }; + Q3IconViewItem* findItem(Direction dir, + const QPoint &relativeTo, + const QRect &searchRect) const; + bool neighbourItem(Direction dir, + const QPoint &relativeTo, + const Q3IconViewItem *item) const; + QBitmap mask(QPixmap *pix) const; + + Q3IconViewPrivate *d; +}; + +#endif // QT_NO_ICONVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QICONVIEW_H diff --git a/qtinterface/qt4/Qt/q3intcache.h b/qtinterface/qt4/Qt/q3intcache.h new file mode 100644 index 0000000..5a851db --- /dev/null +++ b/qtinterface/qt4/Qt/q3intcache.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3INTCACHE_H +#define Q3INTCACHE_H + +#include <Qt3Support/q3gcache.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3IntCache +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GCache +#endif +{ +public: + Q3IntCache( const Q3IntCache<type> &c ) : Q3GCache(c) {} + Q3IntCache( int maxCost=100, int size=17 ) + : Q3GCache( maxCost, size, IntKey, false, false ) {} + ~Q3IntCache() { clear(); } + Q3IntCache<type> &operator=( const Q3IntCache<type> &c ) + { return (Q3IntCache<type>&)Q3GCache::operator=(c); } + int maxCost() const { return Q3GCache::maxCost(); } + int totalCost() const { return Q3GCache::totalCost(); } + void setMaxCost( int m) { Q3GCache::setMaxCost(m); } + uint count() const { return Q3GCache::count(); } + uint size() const { return Q3GCache::size(); } + bool isEmpty() const { return Q3GCache::count() == 0; } + bool insert( long k, const type *d, int c=1, int p=0 ) + { return Q3GCache::insert_other((const char*)k,(Item)d,c,p); } + bool remove( long k ) + { return Q3GCache::remove_other((const char*)k); } + type *take( long k ) + { return (type *)Q3GCache::take_other((const char*)k);} + void clear() { Q3GCache::clear(); } + type *find( long k, bool ref=true ) const + { return (type *)Q3GCache::find_other( (const char*)k,ref);} + type *operator[]( long k ) const + { return (type *)Q3GCache::find_other( (const char*)k); } + void statistics() const { Q3GCache::statistics(); } +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3IntCache<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> inline void Q3IntCache<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type *)d; +} + +template<class type> +class Q3IntCacheIterator : public Q3GCacheIterator +{ +public: + Q3IntCacheIterator( const Q3IntCache<type> &c ) + : Q3GCacheIterator( (Q3GCache &)c ) {} + Q3IntCacheIterator( const Q3IntCacheIterator<type> &ci ) + : Q3GCacheIterator((Q3GCacheIterator &)ci) {} + Q3IntCacheIterator<type> &operator=( const Q3IntCacheIterator<type>&ci ) + { return ( Q3IntCacheIterator<type>&)Q3GCacheIterator::operator=( ci );} + uint count() const { return Q3GCacheIterator::count(); } + bool isEmpty() const { return Q3GCacheIterator::count() == 0; } + bool atFirst() const { return Q3GCacheIterator::atFirst(); } + bool atLast() const { return Q3GCacheIterator::atLast(); } + type *toFirst() { return (type *)Q3GCacheIterator::toFirst(); } + type *toLast() { return (type *)Q3GCacheIterator::toLast(); } + operator type *() const { return (type *)Q3GCacheIterator::get(); } + type *current() const { return (type *)Q3GCacheIterator::get(); } + long currentKey() const { return (long)Q3GCacheIterator::getKeyInt();} + type *operator()() { return (type *)Q3GCacheIterator::operator()();} + type *operator++() { return (type *)Q3GCacheIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GCacheIterator::operator+=(j);} + type *operator--() { return (type *)Q3GCacheIterator::operator--(); } + type *operator-=(uint j) { return (type *)Q3GCacheIterator::operator-=(j);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3INTCACHE_H diff --git a/qtinterface/qt4/Qt/q3intdict.h b/qtinterface/qt4/Qt/q3intdict.h new file mode 100644 index 0000000..afd94a7 --- /dev/null +++ b/qtinterface/qt4/Qt/q3intdict.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3INTDICT_H +#define Q3INTDICT_H + +#include <Qt3Support/q3gdict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3IntDict +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GDict +#endif +{ +public: + Q3IntDict(int size=17) : Q3GDict(size,IntKey,0,0) {} + Q3IntDict( const Q3IntDict<type> &d ) : Q3GDict(d) {} + ~Q3IntDict() { clear(); } + Q3IntDict<type> &operator=(const Q3IntDict<type> &d) + { return (Q3IntDict<type>&)Q3GDict::operator=(d); } + uint count() const { return Q3GDict::count(); } + uint size() const { return Q3GDict::size(); } + bool isEmpty() const { return Q3GDict::count() == 0; } + void insert( long k, const type *d ) + { Q3GDict::look_int(k,(Item)d,1); } + void replace( long k, const type *d ) + { Q3GDict::look_int(k,(Item)d,2); } + bool remove( long k ) { return Q3GDict::remove_int(k); } + type *take( long k ) { return (type*)Q3GDict::take_int(k); } + type *find( long k ) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_int(k,0,0); } + type *operator[]( long k ) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_int(k,0,0); } + void clear() { Q3GDict::clear(); } + void resize( uint n ) { Q3GDict::resize(n); } + void statistics() const { Q3GDict::statistics(); } + +#ifdef qdoc +protected: + virtual QDataStream& read( QDataStream &, Q3PtrCollection::Item & ); + virtual QDataStream& write( QDataStream &, Q3PtrCollection::Item ) const; +#endif + +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3IntDict<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> inline void Q3IntDict<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type*)d; +} + +template<class type> +class Q3IntDictIterator : public Q3GDictIterator +{ +public: + Q3IntDictIterator(const Q3IntDict<type> &d) :Q3GDictIterator((Q3GDict &)d) {} + ~Q3IntDictIterator() {} + uint count() const { return dict->count(); } + bool isEmpty() const { return dict->count() == 0; } + type *toFirst() { return (type *)Q3GDictIterator::toFirst(); } + operator type *() const { return (type *)Q3GDictIterator::get(); } + type *current() const { return (type *)Q3GDictIterator::get(); } + long currentKey() const { return Q3GDictIterator::getKeyInt(); } + type *operator()() { return (type *)Q3GDictIterator::operator()(); } + type *operator++() { return (type *)Q3GDictIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GDictIterator::operator+=(j);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3INTDICT_H diff --git a/qtinterface/qt4/Qt/q3listbox.h b/qtinterface/qt4/Qt/q3listbox.h new file mode 100644 index 0000000..0378c21 --- /dev/null +++ b/qtinterface/qt4/Qt/q3listbox.h @@ -0,0 +1,429 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3LISTBOX_H +#define Q3LISTBOX_H + +#include <Qt3Support/q3scrollview.h> +#include <QtGui/qpixmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_LISTBOX + +class Q3ListBoxPrivate; +class Q3ListBoxItem; +class QString; +class QStringList; + +class Q_COMPAT_EXPORT Q3ListBox : public Q3ScrollView +{ + friend class Q3ListBoxItem; + friend class Q3ListBoxPrivate; + + Q_OBJECT + Q_ENUMS(SelectionMode LayoutMode) + Q_PROPERTY(uint count READ count) + Q_PROPERTY(int numItemsVisible READ numItemsVisible) + Q_PROPERTY(int currentItem READ currentItem WRITE setCurrentItem USER true) + Q_PROPERTY(QString currentText READ currentText) + Q_PROPERTY(int topItem READ topItem WRITE setTopItem DESIGNABLE false) + Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) + Q_PROPERTY(bool multiSelection READ isMultiSelection WRITE setMultiSelection DESIGNABLE false) + Q_PROPERTY(LayoutMode columnMode READ columnMode WRITE setColumnMode) + Q_PROPERTY(LayoutMode rowMode READ rowMode WRITE setRowMode) + Q_PROPERTY(int numColumns READ numColumns) + Q_PROPERTY(int numRows READ numRows) + Q_PROPERTY(bool variableWidth READ variableWidth WRITE setVariableWidth) + Q_PROPERTY(bool variableHeight READ variableHeight WRITE setVariableHeight) + +public: + Q3ListBox(QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0 ); + ~Q3ListBox(); + + uint count() const; + + void insertStringList(const QStringList&, int index=-1); +// ### fix before Qt 4.0 +#if 0 + void insertStrList(const QStrList *, int index=-1); + void insertStrList(const QStrList &, int index=-1); +#endif + void insertStrList(const char **, + int numStrings=-1, int index=-1); + + void insertItem(const Q3ListBoxItem *, int index=-1); + void insertItem(const Q3ListBoxItem *, const Q3ListBoxItem *after); + void insertItem(const QString &text, int index=-1); + void insertItem(const QPixmap &pixmap, int index=-1); + void insertItem(const QPixmap &pixmap, const QString &text, int index=-1); + + void removeItem(int index); + + QString text(int index) const; + const QPixmap *pixmap(int index) const; + + void changeItem(const Q3ListBoxItem *, int index); + void changeItem(const QString &text, int index); + void changeItem(const QPixmap &pixmap, int index); + void changeItem(const QPixmap &pixmap, const QString &text, int index); + + void takeItem(const Q3ListBoxItem *); + + int numItemsVisible() const; + + int currentItem() const; + QString currentText() const { return text(currentItem()); } + virtual void setCurrentItem(int index); + virtual void setCurrentItem(Q3ListBoxItem *); + void centerCurrentItem() { ensureCurrentVisible(); } + int topItem() const; + virtual void setTopItem(int index); + virtual void setBottomItem(int index); + + long maxItemWidth() const; + + enum SelectionMode { Single, Multi, Extended, NoSelection }; + virtual void setSelectionMode(SelectionMode); + SelectionMode selectionMode() const; + + void setMultiSelection(bool multi); + bool isMultiSelection() const; + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + virtual void setSelected(Q3ListBoxItem *, bool); + void setSelected(int, bool); + bool isSelected(int) const; + bool isSelected(const Q3ListBoxItem *) const; + Q3ListBoxItem* selectedItem() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + Q3ListBoxItem *item(int index) const; + int index(const Q3ListBoxItem *) const; + + enum StringComparisonMode { + CaseSensitive = 0x00001, // 0 0001 + BeginsWith = 0x00002, // 0 0010 + EndsWith = 0x00004, // 0 0100 + Contains = 0x00008, // 0 1000 + ExactMatch = 0x00010 // 1 0000 + }; + typedef uint ComparisonFlags; + Q3ListBoxItem *findItem(const QString &text, ComparisonFlags compare = BeginsWith) const; + + void triggerUpdate(bool doLayout); + + bool itemVisible(int index); + bool itemVisible(const Q3ListBoxItem *); + + enum LayoutMode { FixedNumber, + FitToWidth, FitToHeight = FitToWidth, + Variable }; + virtual void setColumnMode(LayoutMode); + virtual void setColumnMode(int); + virtual void setRowMode(LayoutMode); + virtual void setRowMode(int); + + LayoutMode columnMode() const; + LayoutMode rowMode() const; + + int numColumns() const; + int numRows() const; + + bool variableWidth() const; + virtual void setVariableWidth(bool); + + bool variableHeight() const; + virtual void setVariableHeight(bool); + + void viewportPaintEvent(QPaintEvent *); + + bool dragSelect() const { return true; } + void setDragSelect(bool) {} + bool autoScroll() const { return true; } + void setAutoScroll(bool) {} + bool autoScrollBar() const { return vScrollBarMode() == Auto; } + void setAutoScrollBar(bool enable) { setVScrollBarMode(enable ? Auto : AlwaysOff); } + bool scrollBar() const { return vScrollBarMode() != AlwaysOff; } + void setScrollBar(bool enable) { setVScrollBarMode(enable ? AlwaysOn : AlwaysOff); } + bool autoBottomScrollBar() const { return hScrollBarMode() == Auto; } + void setAutoBottomScrollBar(bool enable) { setHScrollBarMode(enable ? Auto : AlwaysOff); } + bool bottomScrollBar() const { return hScrollBarMode() != AlwaysOff; } + void setBottomScrollBar(bool enable) { setHScrollBarMode(enable ? AlwaysOn : AlwaysOff); } + bool smoothScrolling() const { return false; } + void setSmoothScrolling(bool) {} + bool autoUpdate() const { return true; } + void setAutoUpdate(bool) {} + void setFixedVisibleLines(int lines) { setRowMode(lines); } + int inSort(const Q3ListBoxItem *); + int inSort(const QString& text); + int cellHeight(int i) const { return itemHeight(i); } + int cellHeight() const { return itemHeight(); } + int cellWidth() const { return maxItemWidth(); } + int cellWidth(int i) const { Q_ASSERT(i==0); Q_UNUSED(i) return maxItemWidth(); } + int numCols() const { return numColumns(); } + + int itemHeight(int index = 0) const; + Q3ListBoxItem * itemAt(const QPoint &) const; + + QRect itemRect(Q3ListBoxItem *item) const; + + Q3ListBoxItem *firstItem() const; + + void sort(bool ascending = true); + +public Q_SLOTS: + void clear(); + virtual void ensureCurrentVisible(); + virtual void clearSelection(); + virtual void selectAll(bool select); + virtual void invertSelection(); + +Q_SIGNALS: + void highlighted(int index); + void selected(int index); + void highlighted(const QString &); + void selected(const QString &); + void highlighted(Q3ListBoxItem *); + void selected(Q3ListBoxItem *); + + void selectionChanged(); + void selectionChanged(Q3ListBoxItem *); + void currentChanged(Q3ListBoxItem *); + void clicked(Q3ListBoxItem *); + void clicked(Q3ListBoxItem *, const QPoint &); + void pressed(Q3ListBoxItem *); + void pressed(Q3ListBoxItem *, const QPoint &); + + void doubleClicked(Q3ListBoxItem *); + void returnPressed(Q3ListBoxItem *); + void rightButtonClicked(Q3ListBoxItem *, const QPoint &); + void rightButtonPressed(Q3ListBoxItem *, const QPoint &); + void mouseButtonPressed(int, Q3ListBoxItem*, const QPoint&); + void mouseButtonClicked(int, Q3ListBoxItem*, const QPoint&); + + void contextMenuRequested(Q3ListBoxItem *, const QPoint &); + + void onItem(Q3ListBoxItem *item); + void onViewport(); + +protected: + void changeEvent(QEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseDoubleClickEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void contentsContextMenuEvent(QContextMenuEvent *); + + void keyPressEvent(QKeyEvent *e); + void focusInEvent(QFocusEvent *e); + void focusOutEvent(QFocusEvent *e); + void resizeEvent(QResizeEvent *); + void showEvent(QShowEvent *); + + bool eventFilter(QObject *o, QEvent *e); + + void updateItem(int index); + void updateItem(Q3ListBoxItem *); + + void updateCellWidth() { } + int totalWidth() const { return contentsWidth(); } + int totalHeight() const { return contentsHeight(); } + + virtual void paintCell(QPainter *, int row, int col); + + void toggleCurrentItem(); + bool isRubberSelecting() const; + + void doLayout() const; + + int findItem(int yPos) const { return index(itemAt(QPoint(0,yPos))); } + +protected Q_SLOTS: + void clearInputString(); + +private Q_SLOTS: + void refreshSlot(); + void doAutoScroll(); + void adjustItems(); + +private: + Q_DISABLE_COPY(Q3ListBox) + + void mousePressEventEx(QMouseEvent *); + void tryGeometry(int, int) const; + int currentRow() const; + int currentColumn() const; + void updateSelection(); + void repaintSelection(); + void drawRubber(); + void doRubberSelection(const QRect &old, const QRect &rubber); + void handleItemChange(Q3ListBoxItem *old, bool shift, bool control); + void selectRange(Q3ListBoxItem *from, Q3ListBoxItem *to, bool invert, bool includeFirst, bool clearSel = false); + + void emitChangedSignal(bool); + + int columnAt(int) const; + int rowAt(int) const; + + Q3ListBoxPrivate * d; + + static Q3ListBox * changedListBox; +}; + + +class Q_COMPAT_EXPORT Q3ListBoxItem +{ +public: + Q3ListBoxItem(Q3ListBox* listbox = 0); + Q3ListBoxItem(Q3ListBox* listbox, Q3ListBoxItem *after); + virtual ~Q3ListBoxItem(); + + virtual QString text() const; + virtual const QPixmap *pixmap() const; + + virtual int height(const Q3ListBox *) const; + virtual int width(const Q3ListBox *) const; + + bool isSelected() const { return s; } + bool isCurrent() const; + + bool selected() const { return isSelected(); } + bool current() const { return isCurrent(); } + + Q3ListBox *listBox() const; + + void setSelectable(bool b) { selectable = b; } + bool isSelectable() const { return selectable; } + + Q3ListBoxItem *next() const; + Q3ListBoxItem *prev() const; + + virtual int rtti() const; + enum { RTTI = 0 }; + +protected: + virtual void paint(QPainter *) = 0; + virtual void setText(const QString &text) { txt = text; } + void setCustomHighlighting(bool); + +private: + Q_DISABLE_COPY(Q3ListBoxItem) + + QString txt; + uint selectable : 1; + uint s : 1; + uint dirty:1; + uint custom_highlight : 1; + uint unused : 28; + Q3ListBoxItem * p, * n; + Q3ListBox* lbox; + friend class Q3ListBox; + friend class Q3ListBoxPrivate; + friend class Q3ComboBox; + friend class Q3ComboBoxPopupItem; +}; + + +class Q_COMPAT_EXPORT Q3ListBoxText : public Q3ListBoxItem +{ +public: + Q3ListBoxText(Q3ListBox* listbox, const QString & text=QString()); + Q3ListBoxText(const QString & text=QString()); + Q3ListBoxText(Q3ListBox* listbox, const QString & text, Q3ListBoxItem *after); + ~Q3ListBoxText(); + + int height(const Q3ListBox *) const; + int width(const Q3ListBox *) const; + + int rtti() const; + enum { RTTI = 1 }; + +protected: + void paint(QPainter *); + +private: + Q_DISABLE_COPY(Q3ListBoxText) +}; + + +class Q_COMPAT_EXPORT Q3ListBoxPixmap : public Q3ListBoxItem +{ +public: + Q3ListBoxPixmap(Q3ListBox* listbox, const QPixmap &); + Q3ListBoxPixmap(const QPixmap &); + Q3ListBoxPixmap(Q3ListBox* listbox, const QPixmap & pix, Q3ListBoxItem *after); + Q3ListBoxPixmap(Q3ListBox* listbox, const QPixmap &, const QString&); + Q3ListBoxPixmap(const QPixmap &, const QString&); + Q3ListBoxPixmap(Q3ListBox* listbox, const QPixmap & pix, const QString&, Q3ListBoxItem *after); + ~Q3ListBoxPixmap(); + + const QPixmap *pixmap() const { return ± } + + int height(const Q3ListBox *) const; + int width(const Q3ListBox *) const; + + int rtti() const; + enum { RTTI = 2 }; + +protected: + void paint(QPainter *); + +private: + Q_DISABLE_COPY(Q3ListBoxPixmap) + + QPixmap pm; +}; + +#endif // QT_NO_LISTBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3LISTBOX_H diff --git a/qtinterface/qt4/Qt/q3listview.h b/qtinterface/qt4/Qt/q3listview.h new file mode 100644 index 0000000..3e1070e --- /dev/null +++ b/qtinterface/qt4/Qt/q3listview.h @@ -0,0 +1,609 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3LISTVIEW_H +#define Q3LISTVIEW_H + +#include <Qt3Support/q3scrollview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_LISTVIEW + +class QPixmap; +class QFont; +class Q3Header; +class QIcon; + +class Q3ListView; +struct Q3ListViewPrivate; +struct Q3CheckListItemPrivate; +class Q3ListViewItemIterator; +struct Q3ListViewItemIteratorPrivate; +class Q3DragObject; +class QMimeSource; +class QLineEdit; +class Q3ListViewToolTip; + +class Q_COMPAT_EXPORT Q3ListViewItem +{ + friend class Q3ListViewItemIterator; + friend class Q3ListViewToolTip; + +public: + Q3ListViewItem(Q3ListView * parent); + Q3ListViewItem(Q3ListViewItem * parent); + Q3ListViewItem(Q3ListView * parent, Q3ListViewItem * after); + Q3ListViewItem(Q3ListViewItem * parent, Q3ListViewItem * after); + + Q3ListViewItem(Q3ListView * parent, + const QString&, const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString()); + Q3ListViewItem(Q3ListViewItem * parent, + const QString&, const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString()); + + Q3ListViewItem(Q3ListView * parent, Q3ListViewItem * after, + const QString&, const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString()); + Q3ListViewItem(Q3ListViewItem * parent, Q3ListViewItem * after, + const QString&, const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const QString& = QString()); + virtual ~Q3ListViewItem(); + + virtual void insertItem(Q3ListViewItem *); + virtual void takeItem(Q3ListViewItem *); + virtual void removeItem(Q3ListViewItem *item) { takeItem(item); } + + int height() const; + virtual void invalidateHeight(); + int totalHeight() const; + virtual int width(const QFontMetrics&, + const Q3ListView*, int column) const; + void widthChanged(int column=-1) const; + int depth() const; + + virtual void setText(int, const QString &); + virtual QString text(int) const; + + virtual void setPixmap(int, const QPixmap &); + virtual const QPixmap * pixmap(int) const; + + virtual QString key(int, bool) const; + virtual int compare(Q3ListViewItem *i, int col, bool) const; + virtual void sortChildItems(int, bool); + + int childCount() const { return nChildren; } + + bool isOpen() const { return open; } + virtual void setOpen(bool); + virtual void setup(); + + virtual void setSelected(bool); + bool isSelected() const { return selected; } + + virtual void paintCell(QPainter *, const QColorGroup & cg, + int column, int width, int alignment); + virtual void paintBranches(QPainter * p, const QColorGroup & cg, int w, int y, int h); + virtual void paintFocus(QPainter *, const QColorGroup & cg, const QRect & r); + + Q3ListViewItem * firstChild() const; + Q3ListViewItem * nextSibling() const { return siblingItem; } + Q3ListViewItem * parent() const; + + Q3ListViewItem * itemAbove() const; + Q3ListViewItem * itemBelow() const; + + int itemPos() const; + + Q3ListView *listView() const; + + virtual void setSelectable(bool enable); + bool isSelectable() const { return selectable && enabled; } + + virtual void setExpandable(bool); + bool isExpandable() const { return expandable; } + + void repaint() const; + + virtual void sort(); + void moveItem(Q3ListViewItem *after); + + virtual void setDragEnabled(bool allow); + virtual void setDropEnabled(bool allow); + bool dragEnabled() const; + bool dropEnabled() const; + virtual bool acceptDrop(const QMimeSource *mime) const; + + void setVisible(bool b); + bool isVisible() const; + + virtual void setRenameEnabled(int col, bool b); + bool renameEnabled(int col) const; + virtual void startRename(int col); + + virtual void setEnabled(bool b); + bool isEnabled() const; + + virtual int rtti() const; + enum { RTTI = 0 }; + + virtual void setMultiLinesEnabled(bool b); + bool multiLinesEnabled() const; + +protected: + virtual void enforceSortOrder() const; + virtual void setHeight(int); + virtual void activate(); + + bool activatedPos(QPoint &); +#ifndef QT_NO_DRAGANDDROP + virtual void dropped(QDropEvent *e); +#endif + virtual void dragEntered(); + virtual void dragLeft(); + virtual void okRename(int col); + virtual void cancelRename(int col); + + void ignoreDoubleClick(); + +private: + void init(); + void moveToJustAfter(Q3ListViewItem *); + void enforceSortOrderBackToRoot(); + void removeRenameBox(); + + int ownHeight; + int maybeTotalHeight; + int nChildren; + + uint lsc: 14; + uint lso: 1; + uint open : 1; + uint selected : 1; + uint selectable: 1; + uint configured: 1; + uint expandable: 1; + uint is_root: 1; + uint allow_drag : 1; + uint allow_drop : 1; + uint visible : 1; + uint enabled : 1; + uint mlenabled : 1; + + Q3ListViewItem * parentItem; + Q3ListViewItem * siblingItem; + Q3ListViewItem * childItem; + QLineEdit *renameBox; + int renameCol; + + void * columns; + + friend class Q3ListView; +}; + +class Q3CheckListItem; + +class Q_COMPAT_EXPORT Q3ListView : public Q3ScrollView +{ + friend class Q3ListViewItemIterator; + friend class Q3ListViewItem; + friend class Q3CheckListItem; + friend class Q3ListViewToolTip; + + Q_OBJECT + Q_ENUMS(SelectionMode ResizeMode RenameAction) + Q_PROPERTY(int columns READ columns) + Q_PROPERTY(bool multiSelection READ isMultiSelection WRITE setMultiSelection DESIGNABLE false) + Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) + Q_PROPERTY(int childCount READ childCount) + Q_PROPERTY(bool allColumnsShowFocus READ allColumnsShowFocus WRITE setAllColumnsShowFocus) + Q_PROPERTY(bool showSortIndicator READ showSortIndicator WRITE setShowSortIndicator) + Q_PROPERTY(int itemMargin READ itemMargin WRITE setItemMargin) + Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated) + Q_PROPERTY(bool showToolTips READ showToolTips WRITE setShowToolTips) + Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) + Q_PROPERTY(int treeStepSize READ treeStepSize WRITE setTreeStepSize) + Q_PROPERTY(RenameAction defaultRenameAction READ defaultRenameAction WRITE setDefaultRenameAction) + +public: + Q3ListView(QWidget* parent=0, const char* name=0, Qt::WindowFlags f = 0); + ~Q3ListView(); + + int treeStepSize() const; + virtual void setTreeStepSize(int); + + virtual void insertItem(Q3ListViewItem *); + virtual void takeItem(Q3ListViewItem *); + virtual void removeItem(Q3ListViewItem *item) { takeItem(item); } + + Q3Header * header() const; + + virtual int addColumn(const QString &label, int size = -1); + virtual int addColumn(const QIcon& icon, const QString &label, int size = -1); + virtual void removeColumn(int index); + virtual void setColumnText(int column, const QString &label); + virtual void setColumnText(int column, const QIcon& icon, const QString &label); + QString columnText(int column) const; + virtual void setColumnWidth(int column, int width); + int columnWidth(int column) const; + enum WidthMode { Manual, Maximum }; + virtual void setColumnWidthMode(int column, WidthMode); + WidthMode columnWidthMode(int column) const; + int columns() const; + + virtual void setColumnAlignment(int, int); + int columnAlignment(int) const; + + void show(); + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + Q3ListViewItem * itemAt(const QPoint & screenPos) const; + QRect itemRect(const Q3ListViewItem *) const; + int itemPos(const Q3ListViewItem *); + + void ensureItemVisible(const Q3ListViewItem *); + + void repaintItem(const Q3ListViewItem *) const; + + virtual void setMultiSelection(bool enable); + bool isMultiSelection() const; + + enum SelectionMode { Single, Multi, Extended, NoSelection }; + void setSelectionMode(SelectionMode mode); + SelectionMode selectionMode() const; + + virtual void clearSelection(); + virtual void setSelected(Q3ListViewItem *, bool); + void setSelectionAnchor(Q3ListViewItem *); + bool isSelected(const Q3ListViewItem *) const; + Q3ListViewItem * selectedItem() const; + virtual void setOpen(Q3ListViewItem *, bool); + bool isOpen(const Q3ListViewItem *) const; + + virtual void setCurrentItem(Q3ListViewItem *); + Q3ListViewItem * currentItem() const; + + Q3ListViewItem * firstChild() const; + Q3ListViewItem * lastItem() const; + + int childCount() const; + + virtual void setAllColumnsShowFocus(bool); + bool allColumnsShowFocus() const; + + virtual void setItemMargin(int); + int itemMargin() const; + + virtual void setRootIsDecorated(bool); + bool rootIsDecorated() const; + + virtual void setSorting(int column, bool ascending = true); + int sortColumn() const; + void setSortColumn(int column); + Qt::SortOrder sortOrder() const; + void setSortOrder(Qt::SortOrder order); + virtual void sort(); + + bool eventFilter(QObject * o, QEvent *); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + virtual void setShowSortIndicator(bool show); + bool showSortIndicator() const; + virtual void setShowToolTips(bool b); + bool showToolTips() const; + + enum ResizeMode { NoColumn, AllColumns, LastColumn }; + virtual void setResizeMode(ResizeMode m); + ResizeMode resizeMode() const; + + enum StringComparisonMode { + CaseSensitive = 0x00001, // 0 0001 + BeginsWith = 0x00002, // 0 0010 + EndsWith = 0x00004, // 0 0100 + Contains = 0x00008, // 0 1000 + ExactMatch = 0x00010 // 1 0000 + }; + typedef uint ComparisonFlags; + Q3ListViewItem * findItem(const QString& text, int column, + ComparisonFlags = ExactMatch | Qt::CaseSensitive ) const; + + enum RenameAction { Accept, Reject }; + virtual void setDefaultRenameAction(RenameAction a); + RenameAction defaultRenameAction() const; + bool isRenaming() const; + + void hideColumn(int column); + +public Q_SLOTS: + virtual void clear(); + virtual void invertSelection(); + virtual void selectAll(bool select); + void triggerUpdate(); + void setContentsPos(int x, int y); + void adjustColumn(int col); + +Q_SIGNALS: + void selectionChanged(); + void selectionChanged(Q3ListViewItem *); + void currentChanged(Q3ListViewItem *); + void clicked(Q3ListViewItem *); + void clicked(Q3ListViewItem *, const QPoint &, int); + void pressed(Q3ListViewItem *); + void pressed(Q3ListViewItem *, const QPoint &, int); + + void doubleClicked(Q3ListViewItem *); + void doubleClicked(Q3ListViewItem *, const QPoint&, int); + void returnPressed(Q3ListViewItem *); + void spacePressed(Q3ListViewItem *); + void rightButtonClicked(Q3ListViewItem *, const QPoint&, int); + void rightButtonPressed(Q3ListViewItem *, const QPoint&, int); + void mouseButtonPressed(int, Q3ListViewItem *, const QPoint& , int); + void mouseButtonClicked(int, Q3ListViewItem *, const QPoint&, int); + + void contextMenuRequested(Q3ListViewItem *, const QPoint &, int); + + void onItem(Q3ListViewItem *item); + void onViewport(); + + void expanded(Q3ListViewItem *item); + void collapsed(Q3ListViewItem *item); +#ifndef QT_NO_DRAGANDDROP + void dropped(QDropEvent *e); +#endif + void itemRenamed(Q3ListViewItem *item, int col, const QString &); + void itemRenamed(Q3ListViewItem *item, int col ); + +protected: + void contentsMousePressEvent(QMouseEvent * e); + void contentsMouseReleaseEvent(QMouseEvent * e); + void contentsMouseMoveEvent(QMouseEvent * e); + void contentsMouseDoubleClickEvent(QMouseEvent * e); + void contentsContextMenuEvent(QContextMenuEvent * e); +#ifndef QT_NO_DRAGANDDROP + void contentsDragEnterEvent(QDragEnterEvent *e); + void contentsDragMoveEvent(QDragMoveEvent *e); + void contentsDragLeaveEvent(QDragLeaveEvent *e); + void contentsDropEvent(QDropEvent *e); + virtual Q3DragObject *dragObject(); + virtual void startDrag(); +#endif + + void focusInEvent(QFocusEvent * e); + void focusOutEvent(QFocusEvent * e); + + void keyPressEvent(QKeyEvent *e); + + void resizeEvent(QResizeEvent *e); + void viewportResizeEvent(QResizeEvent *e); + + void showEvent(QShowEvent *); + + void drawContentsOffset(QPainter *, int ox, int oy, + int cx, int cy, int cw, int ch); + + virtual void paintEmptyArea(QPainter *, const QRect &); + void changeEvent(QEvent *); + +protected Q_SLOTS: + void updateContents(); + void doAutoScroll(); + +private Q_SLOTS: + void changeSortColumn(int); + void handleIndexChange(); + void updateDirtyItems(); + void makeVisible(); + void handleSizeChange(int, int, int); + void startRename(); + void openFocusItem(); + +private: + Q_DISABLE_COPY(Q3ListView) + + void contentsMousePressEventEx(QMouseEvent * e); + void contentsMouseReleaseEventEx(QMouseEvent * e); + void init(); + void updateGeometries(); + void buildDrawableList() const; + void reconfigureItems(); + void widthChanged(const Q3ListViewItem*, int c); + void handleItemChange(Q3ListViewItem *old, bool shift, bool control); + void selectRange(Q3ListViewItem *from, Q3ListViewItem *to, bool invert, bool includeFirst, bool clearSel = false); + bool selectRange(Q3ListViewItem *newItem, Q3ListViewItem *oldItem, Q3ListViewItem *anchorItem); + bool clearRange(Q3ListViewItem *from, Q3ListViewItem *to, bool includeFirst = true); + void doAutoScroll(const QPoint &cursorPos); + + Q3ListViewPrivate *d; +}; + + +class Q_COMPAT_EXPORT Q3CheckListItem : public Q3ListViewItem +{ +public: + enum Type { RadioButton, + CheckBox, + Controller, + RadioButtonController=Controller, + CheckBoxController }; + + enum ToggleState { Off, NoChange, On }; + + Q3CheckListItem(Q3CheckListItem *parent, const QString &text, + Type = RadioButtonController); + Q3CheckListItem(Q3CheckListItem *parent, Q3ListViewItem *after, + const QString &text, Type = RadioButtonController); + Q3CheckListItem(Q3ListViewItem *parent, const QString &text, + Type = RadioButtonController); + Q3CheckListItem(Q3ListViewItem *parent, Q3ListViewItem *after, + const QString &text, Type = RadioButtonController); + Q3CheckListItem(Q3ListView *parent, const QString &text, + Type = RadioButtonController); + Q3CheckListItem(Q3ListView *parent, Q3ListViewItem *after, + const QString &text, Type = RadioButtonController); + Q3CheckListItem(Q3ListViewItem *parent, const QString &text, + const QPixmap &); + Q3CheckListItem(Q3ListView *parent, const QString &text, + const QPixmap &); + ~Q3CheckListItem(); + + void paintCell(QPainter *, const QColorGroup & cg, + int column, int width, int alignment); + virtual void paintFocus(QPainter *, const QColorGroup &cg, + const QRect & r); + int width(const QFontMetrics&, const Q3ListView*, int column) const; + void setup(); + + virtual void setOn(bool); + bool isOn() const { return on; } + Type type() const { return myType; } + QString text() const { return Q3ListViewItem::text(0); } + QString text(int n) const { return Q3ListViewItem::text(n); } + + void setTristate(bool); + bool isTristate() const; + ToggleState state() const; + void setState(ToggleState s); + + int rtti() const; + enum { RTTI = 1 }; + +protected: + void activate(); + void turnOffChild(); + virtual void stateChange(bool); + +private: + void init(); + ToggleState internalState() const; + void setStoredState(ToggleState newState, Q3CheckListItem *key); + ToggleState storedState(Q3CheckListItem *key) const; + void stateChange(ToggleState s); + void restoreState(Q3CheckListItem *key, int depth = 0); + void updateController(bool update = true , bool store = false); + void updateStoredState(Q3CheckListItem *key); + void setState(ToggleState s, bool update, bool store); + void setCurrentState(ToggleState s); + + Type myType; + bool on; + Q3CheckListItemPrivate *d; +}; + +class Q_COMPAT_EXPORT Q3ListViewItemIterator +{ + friend struct Q3ListViewPrivate; + friend class Q3ListView; + friend class Q3ListViewItem; + +public: + enum IteratorFlag { + Visible = 0x00000001, + Invisible = 0x00000002, + Selected = 0x00000004, + Unselected = 0x00000008, + Selectable = 0x00000010, + NotSelectable = 0x00000020, + DragEnabled = 0x00000040, + DragDisabled = 0x00000080, + DropEnabled = 0x00000100, + DropDisabled = 0x00000200, + Expandable = 0x00000400, + NotExpandable = 0x00000800, + Checked = 0x00001000, + NotChecked = 0x00002000 + }; + + Q3ListViewItemIterator(); + Q3ListViewItemIterator(Q3ListViewItem *item); + Q3ListViewItemIterator(Q3ListViewItem *item, int iteratorFlags); + + Q3ListViewItemIterator(const Q3ListViewItemIterator &it); + Q3ListViewItemIterator(Q3ListView *lv); + Q3ListViewItemIterator(Q3ListView *lv, int iteratorFlags); + + Q3ListViewItemIterator &operator=(const Q3ListViewItemIterator &it); + + ~Q3ListViewItemIterator(); + + Q3ListViewItemIterator &operator++(); + const Q3ListViewItemIterator operator++(int); + Q3ListViewItemIterator &operator+=(int j); + + Q3ListViewItemIterator &operator--(); + const Q3ListViewItemIterator operator--(int); + Q3ListViewItemIterator &operator-=(int j); + + Q3ListViewItem* operator*(); + Q3ListViewItem *current() const; + +private: + Q3ListViewItem *curr; + Q3ListView *listView; + int flags; + + void currentRemoved(); + bool matchesFlags(const Q3ListViewItem*) const; + bool testPair(Q3ListViewItemIterator::IteratorFlag, Q3ListViewItemIterator::IteratorFlag, bool) const; + bool isChecked(const Q3ListViewItem*) const; +}; + +#endif // QT_NO_LISTVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3LISTVIEW_H diff --git a/qtinterface/qt4/Qt/q3localfs.h b/qtinterface/qt4/Qt/q3localfs.h new file mode 100644 index 0000000..f9036a1 --- /dev/null +++ b/qtinterface/qt4/Qt/q3localfs.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3LOCALFS_H +#define Q3LOCALFS_H + +#include <Qt3Support/q3networkprotocol.h> +#include <QtCore/qdir.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_NETWORKPROTOCOL + +class Q_COMPAT_EXPORT Q3LocalFs : public Q3NetworkProtocol +{ + Q_OBJECT + +public: + Q3LocalFs(); + virtual int supportedOperations() const; + +protected: + virtual void operationListChildren( Q3NetworkOperation *op ); + virtual void operationMkDir( Q3NetworkOperation *op ); + virtual void operationRemove( Q3NetworkOperation *op ); + virtual void operationRename( Q3NetworkOperation *op ); + virtual void operationGet( Q3NetworkOperation *op ); + virtual void operationPut( Q3NetworkOperation *op ); + +private: + int calcBlockSize( int totalSize ) const; + QDir dir; + +}; + +#endif // QT_NO_NETWORKPROTOCOL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3LOCALFS_H diff --git a/qtinterface/qt4/Qt/q3mainwindow.h b/qtinterface/qt4/Qt/q3mainwindow.h new file mode 100644 index 0000000..cbf33b3 --- /dev/null +++ b/qtinterface/qt4/Qt/q3mainwindow.h @@ -0,0 +1,267 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3MAINWINDOW_H +#define Q3MAINWINDOW_H + +#include <QtGui/qwidget.h> +#include <Qt3Support/q3toolbar.h> +#include <QtCore/qtextstream.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_MAINWINDOW + +class QMenuBar; +class QStatusBar; +class QToolTipGroup; +class Q3MainWindowPrivate; +class Q3MainWindowLayout; +class Q3PopupMenu; +class QHideDock; +template<class T> class QList; + +class Q_COMPAT_EXPORT Q3MainWindow: public QWidget +{ + Q_OBJECT + Q_DECLARE_PRIVATE(Q3MainWindow) + + Q_PROPERTY(bool rightJustification READ rightJustification WRITE setRightJustification DESIGNABLE false) + Q_PROPERTY(bool usesBigPixmaps READ usesBigPixmaps WRITE setUsesBigPixmaps) + Q_PROPERTY(bool usesTextLabel READ usesTextLabel WRITE setUsesTextLabel) + Q_PROPERTY(bool dockWindowsMovable READ dockWindowsMovable WRITE setDockWindowsMovable) + Q_PROPERTY(bool opaqueMoving READ opaqueMoving WRITE setOpaqueMoving) + +public: + Q3MainWindow(QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::WType_TopLevel); + ~Q3MainWindow(); + +#ifndef QT_NO_MENUBAR + QMenuBar * menuBar() const; +#endif + QStatusBar * statusBar() const; +#if 0 + QToolTipGroup * toolTipGroup() const; +#endif + + virtual void setCentralWidget(QWidget *); + QWidget * centralWidget() const; + + virtual void setDockEnabled(Qt::Dock dock, bool enable); + bool isDockEnabled(Qt::Dock dock) const; + bool isDockEnabled(Q3DockArea *area) const; + virtual void setDockEnabled(Q3DockWindow *tb, Qt::Dock dock, bool enable); + bool isDockEnabled(Q3DockWindow *tb, Qt::Dock dock) const; + bool isDockEnabled(Q3DockWindow *tb, Q3DockArea *area) const; + + virtual void addDockWindow(Q3DockWindow *, Qt::Dock = Qt::DockTop, bool newLine = false); + virtual void addDockWindow(Q3DockWindow *, const QString &label, + Qt::Dock = Qt::DockTop, bool newLine = false); + virtual void moveDockWindow(Q3DockWindow *, Qt::Dock = Qt::DockTop); + virtual void moveDockWindow(Q3DockWindow *, Qt::Dock, bool nl, int index, int extraOffset = -1); + virtual void removeDockWindow(Q3DockWindow *); + + void setVisible(bool); + QSize sizeHint() const; + QSize minimumSizeHint() const; + + bool rightJustification() const; + bool usesBigPixmaps() const; + bool usesTextLabel() const; + bool dockWindowsMovable() const; + bool opaqueMoving() const; + + bool eventFilter(QObject*, QEvent*); + + bool getLocation(Q3DockWindow *tb, Qt::Dock &dock, int &index, bool &nl, int &extraOffset) const; + + QList<Q3DockWindow *> dockWindows(Qt::Dock dock) const; + QList<Q3DockWindow *> dockWindows() const; + void lineUpDockWindows(bool keepNewLines = false); + + bool isDockMenuEnabled() const; + + // compatibility stuff + bool hasDockWindow(Q3DockWindow *dw); +#ifndef QT_NO_TOOLBAR + void addToolBar(Q3DockWindow *, Qt::Dock = Qt::DockTop, bool newLine = false); + void addToolBar(Q3DockWindow *, const QString &label, + Qt::Dock = Qt::DockTop, bool newLine = false); + void moveToolBar(Q3DockWindow *, Qt::Dock = Qt::DockTop); + void moveToolBar(Q3DockWindow *, Qt::Dock, bool nl, int index, int extraOffset = -1); + void removeToolBar(Q3DockWindow *); + + bool toolBarsMovable() const; + QList<Q3ToolBar *> toolBars(Qt::Dock dock) const; + void lineUpToolBars(bool keepNewLines = false); +#endif + + virtual Q3DockArea *dockingArea(const QPoint &p); + Q3DockArea *leftDock() const; + Q3DockArea *rightDock() const; + Q3DockArea *topDock() const; + Q3DockArea *bottomDock() const; + + virtual bool isCustomizable() const; + + bool appropriate(Q3DockWindow *dw) const; + + enum DockWindows { OnlyToolBars, NoToolBars, AllDockWindows }; + virtual Q3PopupMenu *createDockWindowMenu(DockWindows dockWindows = AllDockWindows) const; + +public Q_SLOTS: + virtual void setRightJustification(bool); + virtual void setUsesBigPixmaps(bool); + virtual void setUsesTextLabel(bool); + virtual void setDockWindowsMovable(bool); + virtual void setOpaqueMoving(bool); + virtual void setDockMenuEnabled(bool); + virtual void whatsThis(); + virtual void setAppropriate(Q3DockWindow *dw, bool a); + virtual void customize(); + + // compatibility stuff + void setToolBarsMovable(bool); + +Q_SIGNALS: + void pixmapSizeChanged(bool); + void usesTextLabelChanged(bool); + void dockWindowPositionChanged(Q3DockWindow *); + +#ifndef QT_NO_TOOLBAR + // compatibility stuff + void toolBarPositionChanged(Q3ToolBar *); +#endif + +protected Q_SLOTS: + virtual void setUpLayout(); + virtual bool showDockMenu(const QPoint &globalPos); + void menuAboutToShow(); + +protected: + void paintEvent(QPaintEvent *); + void childEvent(QChildEvent *); + bool event(QEvent *); + +private Q_SLOTS: + void slotPlaceChanged(); + void doLineUp() { lineUpDockWindows(true); } + +private: + Q_DISABLE_COPY(Q3MainWindow) + + void triggerLayout(bool deleteLayout = true); + bool dockMainWindow(QObject *dock) const; + +#ifndef QT_NO_MENUBAR + virtual void setMenuBar(QMenuBar *); +#endif + virtual void setStatusBar(QStatusBar *); +#if 0 + virtual void setToolTipGroup(QToolTipGroup *); +#endif + + friend class Q3DockWindow; + friend class QMenuBarPrivate; + friend class QHideDock; + friend class Q3ToolBar; + friend class Q3MainWindowLayout; +}; + +#ifndef QT_NO_TOOLBAR +inline void Q3MainWindow::addToolBar(Q3DockWindow *w, Qt::ToolBarDock dock, bool newLine) +{ + addDockWindow(w, dock, newLine); +} + +inline void Q3MainWindow::addToolBar(Q3DockWindow *w, const QString &label, + Qt::ToolBarDock dock, bool newLine) +{ + addDockWindow(w, label, dock, newLine); +} + +inline void Q3MainWindow::moveToolBar(Q3DockWindow *w, Qt::ToolBarDock dock) +{ + moveDockWindow(w, dock); +} + +inline void Q3MainWindow::moveToolBar(Q3DockWindow *w, Qt::ToolBarDock dock, bool nl, int index, int extraOffset) +{ + moveDockWindow(w, dock, nl, index, extraOffset); +} + +inline void Q3MainWindow::removeToolBar(Q3DockWindow *w) +{ + removeDockWindow(w); +} + +inline bool Q3MainWindow::toolBarsMovable() const +{ + return dockWindowsMovable(); +} + +inline void Q3MainWindow::lineUpToolBars(bool keepNewLines) +{ + lineUpDockWindows(keepNewLines); +} + +inline void Q3MainWindow::setToolBarsMovable(bool b) +{ + setDockWindowsMovable(b); +} +#endif + +#ifndef QT_NO_TEXTSTREAM +Q_COMPAT_EXPORT QTextStream &operator<<(QTextStream &, const Q3MainWindow &); +Q_COMPAT_EXPORT QTextStream &operator>>(QTextStream &, Q3MainWindow &); +#endif + +#endif // QT_NO_MAINWINDOW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3MAINWINDOW_H diff --git a/qtinterface/qt4/Qt/q3memarray.h b/qtinterface/qt4/Qt/q3memarray.h new file mode 100644 index 0000000..12f8cb5 --- /dev/null +++ b/qtinterface/qt4/Qt/q3memarray.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3MEMARRAY_H +#define Q3MEMARRAY_H + +#include <Qt3Support/q3garray.h> +#include <QtCore/qvector.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3MemArray : public Q3GArray +{ +public: + typedef type* Iterator; + typedef const type* ConstIterator; + typedef type ValueType; + +protected: + Q3MemArray(int, int) : Q3GArray(0, 0) {} + +public: + Q3MemArray() {} + Q3MemArray(int size) : Q3GArray(size*sizeof(type)) {} + Q3MemArray(const Q3MemArray<type> &a) : Q3GArray(a) {} + Q3MemArray(const QVector<type> &vector); + ~Q3MemArray() {} + Q3MemArray<type> &operator=(const Q3MemArray<type> &a) + { return (Q3MemArray<type>&)Q3GArray::assign(a); } + type *data() const { return (type *)Q3GArray::data(); } + uint nrefs() const { return Q3GArray::nrefs(); } + uint size() const { return Q3GArray::size()/sizeof(type); } + uint count() const { return size(); } + bool isEmpty() const { return Q3GArray::size() == 0; } + bool isNull() const { return Q3GArray::data() == 0; } + bool resize(uint size) { return Q3GArray::resize(size*sizeof(type)); } + bool resize(uint size, Optimization optim) { return Q3GArray::resize(size*sizeof(type), optim); } + bool truncate(uint pos) { return Q3GArray::resize(pos*sizeof(type)); } + bool fill(const type &d, int size = -1) + { return Q3GArray::fill((char*)&d,size,sizeof(type)); } + void detach() { Q3GArray::detach(); } + Q3MemArray<type> copy() const + { Q3MemArray<type> tmp; return tmp.duplicate(*this); } + Q3MemArray<type>& assign(const Q3MemArray<type>& a) + { return (Q3MemArray<type>&)Q3GArray::assign(a); } + Q3MemArray<type>& assign(const type *a, uint n) + { return (Q3MemArray<type>&)Q3GArray::assign((char*)a,n*sizeof(type)); } + Q3MemArray<type>& duplicate(const Q3MemArray<type>& a) + { return (Q3MemArray<type>&)Q3GArray::duplicate(a); } + Q3MemArray<type>& duplicate(const type *a, uint n) + { return (Q3MemArray<type>&)Q3GArray::duplicate((char*)a,n*sizeof(type)); } + Q3MemArray<type>& setRawData(const type *a, uint n) + { return (Q3MemArray<type>&)Q3GArray::setRawData((char*)a, + n*sizeof(type)); } + void resetRawData(const type *a, uint n) + { Q3GArray::resetRawData((char*)a,n*sizeof(type)); } + int find(const type &d, uint i=0) const + { return Q3GArray::find((char*)&d,i,sizeof(type)); } + int contains(const type &d) const + { return Q3GArray::contains((char*)&d,sizeof(type)); } + void sort() { Q3GArray::sort(sizeof(type)); } + int bsearch(const type &d) const + { return Q3GArray::bsearch((const char*)&d,sizeof(type)); } + // ### Qt 4.0: maybe provide uint overload as work-around for MSVC bug + type& operator[](int i) const + { return (type &)(*(type *)Q3GArray::at(i*sizeof(type))); } + type& at(uint i) const + { return (type &)(*(type *)Q3GArray::at(i*sizeof(type))); } + operator const type*() const { return (const type *)Q3GArray::data(); } + bool operator==(const Q3MemArray<type> &a) const { return isEqual(a); } + bool operator!=(const Q3MemArray<type> &a) const { return !isEqual(a); } + Iterator begin() { return data(); } + Iterator end() { return data() + size(); } + ConstIterator begin() const { return data(); } + ConstIterator end() const { return data() + size(); } + + operator QVector<type>() const; +}; + +template<class type> +Q_OUTOFLINE_TEMPLATE Q3MemArray<type>::Q3MemArray(const QVector<type> &vector) + : Q3GArray(vector.size()*sizeof(type)) +{ + for (int i = 0; i < vector.size(); ++i) + at(i) = vector.at(i); +} + +template<class type> +Q_OUTOFLINE_TEMPLATE Q3MemArray<type>::operator QVector<type>() const +{ + QVector<type> vector; + for (int i = 0; i < size(); ++i) + vector.append(at(i)); + return vector; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3MEMARRAY_H diff --git a/qtinterface/qt4/Qt/q3mimefactory.h b/qtinterface/qt4/Qt/q3mimefactory.h new file mode 100644 index 0000000..1db02f2 --- /dev/null +++ b/qtinterface/qt4/Qt/q3mimefactory.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3MIMEFACTORY_H +#define Q3MIMEFACTORY_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qstring.h> +#include <QtCore/qmap.h> +#include <QtGui/qpixmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_MIMEFACTORY + +class QStringList; +class QMimeSource; +class Q3MimeSourceFactoryData; + +class Q_COMPAT_EXPORT Q3MimeSourceFactory { +public: + Q3MimeSourceFactory(); + virtual ~Q3MimeSourceFactory(); + + static Q3MimeSourceFactory* defaultFactory(); + static void setDefaultFactory(Q3MimeSourceFactory*); + static Q3MimeSourceFactory* takeDefaultFactory(); + static void addFactory(Q3MimeSourceFactory *f); + static void removeFactory(Q3MimeSourceFactory *f); + + virtual const QMimeSource* data(const QString& abs_name) const; + virtual QString makeAbsolute(const QString& abs_or_rel_name, const QString& context) const; + const QMimeSource* data(const QString& abs_or_rel_name, const QString& context) const; + + virtual void setText(const QString& abs_name, const QString& text); + virtual void setImage(const QString& abs_name, const QImage& im); + virtual void setPixmap(const QString& abs_name, const QPixmap& pm); + virtual void setData(const QString& abs_name, QMimeSource* data); + virtual void setFilePath(const QStringList&); + inline void setFilePath(const QString &path) { setFilePath(QStringList(path)); } + virtual QStringList filePath() const; + void addFilePath(const QString&); + virtual void setExtensionType(const QString& ext, const char* mimetype); + +private: + QMimeSource *dataInternal(const QString& abs_name, const QMap<QString, QString> &extensions) const; + Q3MimeSourceFactoryData* d; +}; + +Q_COMPAT_EXPORT QPixmap qPixmapFromMimeSource(const QString &abs_name); + +Q_COMPAT_EXPORT QImage qImageFromMimeSource(const QString &abs_name); + +#endif // QT_NO_MIMEFACTORY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3MIMEFACTORY_H diff --git a/qtinterface/qt4/Qt/q3multilineedit.h b/qtinterface/qt4/Qt/q3multilineedit.h new file mode 100644 index 0000000..5d9db44 --- /dev/null +++ b/qtinterface/qt4/Qt/q3multilineedit.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3MULTILINEEDIT_H +#define Q3MULTILINEEDIT_H + +#include <Qt3Support/q3textedit.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_MULTILINEEDIT + +class Q3MultiLineEditCommand; +class QValidator; +class Q3MultiLineEditData; + +class Q_COMPAT_EXPORT Q3MultiLineEdit : public Q3TextEdit +{ + Q_OBJECT + Q_PROPERTY(int numLines READ numLines) + Q_PROPERTY(bool atBeginning READ atBeginning) + Q_PROPERTY(bool atEnd READ atEnd) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(bool edited READ edited WRITE setEdited DESIGNABLE false) + +public: + Q3MultiLineEdit(QWidget* parent=0, const char* name=0); + ~Q3MultiLineEdit(); + + QString textLine(int line) const; + int numLines() const; + + virtual void insertLine(const QString &s, int line = -1); + virtual void insertAt(const QString &s, int line, int col) { + insertAt(s, line, col, false); + } + virtual void insertAt(const QString &s, int line, int col, bool mark); + virtual void removeLine(int line); + virtual void setCursorPosition(int line, int col) { + setCursorPosition(line, col, false); + } + virtual void setCursorPosition(int line, int col, bool mark); + bool atBeginning() const; + bool atEnd() const; + + void setAlignment(Qt::Alignment flags); + Qt::Alignment alignment() const; + + void setEdited(bool); + bool edited() const; + + bool hasMarkedText() const; + QString markedText() const; + + void cursorWordForward(bool mark); + void cursorWordBackward(bool mark); + + // noops + bool autoUpdate() const { return true; } + virtual void setAutoUpdate(bool) {} + + int totalWidth() const { return contentsWidth(); } + int totalHeight() const { return contentsHeight(); } + + int maxLines() const { return QWIDGETSIZE_MAX; } + void setMaxLines(int) {} + +public Q_SLOTS: + void deselect() { selectAll(false); } + +protected: + QPoint cursorPoint() const; + virtual void insertAndMark(const QString&, bool mark); + virtual void newLine(); + virtual void killLine(); + virtual void pageUp(bool mark=false); + virtual void pageDown(bool mark=false); + virtual void cursorLeft(bool mark=false, bool wrap = true); + virtual void cursorRight(bool mark=false, bool wrap = true); + virtual void cursorUp(bool mark=false); + virtual void cursorDown(bool mark=false); + virtual void backspace(); + virtual void home(bool mark=false); + virtual void end(bool mark=false); + + bool getMarkedRegion(int *line1, int *col1, int *line2, int *col2) const; + int lineLength(int row) const; + +private: + Q_DISABLE_COPY(Q3MultiLineEdit) + + Q3MultiLineEditData *d; +}; + +#endif // QT_NO_MULTILINEEDIT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3MULTILINEEDIT_H diff --git a/qtinterface/qt4/Qt/q3network.h b/qtinterface/qt4/Qt/q3network.h new file mode 100644 index 0000000..052bf24 --- /dev/null +++ b/qtinterface/qt4/Qt/q3network.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3NETWORK_H +#define Q3NETWORK_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_NETWORK + +Q_COMPAT_EXPORT void q3InitNetworkProtocols(); + +#endif // QT_NO_NETWORK + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3NETWORK_H diff --git a/qtinterface/qt4/Qt/q3networkprotocol.h b/qtinterface/qt4/Qt/q3networkprotocol.h new file mode 100644 index 0000000..c02f1e9 --- /dev/null +++ b/qtinterface/qt4/Qt/q3networkprotocol.h @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3NETWORKPROTOCOL_H +#define Q3NETWORKPROTOCOL_H + +#include <QtCore/qstring.h> +#include <QtCore/qobject.h> +#include <Qt3Support/q3dict.h> +#include <Qt3Support/q3valuelist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_NETWORKPROTOCOL + +class Q3NetworkProtocol; +class Q3NetworkOperation; +class QTimer; +class Q3UrlOperator; +class Q3NetworkProtocolPrivate; +class QUrlInfo; +template <class T> class Q3ValueList; + +class Q_COMPAT_EXPORT Q3NetworkProtocolFactoryBase +{ +public: + virtual ~Q3NetworkProtocolFactoryBase() {} + virtual Q3NetworkProtocol *createObject() = 0; +}; + +template< class T > +class Q3NetworkProtocolFactory : public Q3NetworkProtocolFactoryBase +{ +public: + Q3NetworkProtocol *createObject() { + return new T; + } + +}; + +typedef Q3Dict< Q3NetworkProtocolFactoryBase > Q3NetworkProtocolDict; + +class Q_COMPAT_EXPORT Q3NetworkProtocol : public QObject +{ + Q_OBJECT + +public: + enum State { + StWaiting = 0, + StInProgress, + StDone, + StFailed, + StStopped + }; + + enum Operation { + OpListChildren = 1, + OpMkDir = 2, + OpMkdir = OpMkDir, // ### remove in 4.0 + OpRemove = 4, + OpRename = 8, + OpGet = 32, + OpPut = 64 + }; + + enum ConnectionState { + ConHostFound, + ConConnected, + ConClosed + }; + + enum Error { + // no error + NoError = 0, + // general errors + ErrValid, + ErrUnknownProtocol, + ErrUnsupported, + ErrParse, + // errors on connect + ErrLoginIncorrect, + ErrHostNotFound, + // protocol errors + ErrListChildren, + ErrListChlidren = ErrListChildren, // ### remove in 4.0 + ErrMkDir, + ErrMkdir = ErrMkDir, // ### remove in 4.0 + ErrRemove, + ErrRename, + ErrGet, + ErrPut, + ErrFileNotExisting, + ErrPermissionDenied + }; + + Q3NetworkProtocol(); + virtual ~Q3NetworkProtocol(); + + virtual void setUrl( Q3UrlOperator *u ); + + virtual void setAutoDelete( bool b, int i = 10000 ); + bool autoDelete() const; + + static void registerNetworkProtocol( const QString &protocol, + Q3NetworkProtocolFactoryBase *protocolFactory ); + static Q3NetworkProtocol *getNetworkProtocol( const QString &protocol ); + static bool hasOnlyLocalFileSystem(); + + virtual int supportedOperations() const; + virtual void addOperation( Q3NetworkOperation *op ); + + Q3UrlOperator *url() const; + Q3NetworkOperation *operationInProgress() const; + virtual void clearOperationQueue(); + virtual void stop(); + +Q_SIGNALS: + void data( const QByteArray &, Q3NetworkOperation *res ); + void connectionStateChanged( int state, const QString &data ); + void finished( Q3NetworkOperation *res ); + void start( Q3NetworkOperation *res ); + void newChildren( const Q3ValueList<QUrlInfo> &, Q3NetworkOperation *res ); + void newChild( const QUrlInfo &, Q3NetworkOperation *res ); + void createdDirectory( const QUrlInfo &, Q3NetworkOperation *res ); + void removed( Q3NetworkOperation *res ); + void itemChanged( Q3NetworkOperation *res ); + void dataTransferProgress( int bytesDone, int bytesTotal, Q3NetworkOperation *res ); + +protected: + virtual void processOperation( Q3NetworkOperation *op ); + virtual void operationListChildren( Q3NetworkOperation *op ); + virtual void operationMkDir( Q3NetworkOperation *op ); + virtual void operationRemove( Q3NetworkOperation *op ); + virtual void operationRename( Q3NetworkOperation *op ); + virtual void operationGet( Q3NetworkOperation *op ); + virtual void operationPut( Q3NetworkOperation *op ); + virtual void operationPutChunk( Q3NetworkOperation *op ); + virtual bool checkConnection( Q3NetworkOperation *op ); + +private: + Q3NetworkProtocolPrivate *d; + +private Q_SLOTS: + void processNextOperation( Q3NetworkOperation *old ); + void startOps(); + void emitNewChildren( const QUrlInfo &i, Q3NetworkOperation *op ); + + void removeMe(); + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + Q3NetworkProtocol( const Q3NetworkProtocol & ); + Q3NetworkProtocol &operator=( const Q3NetworkProtocol & ); +#endif +}; + +class Q3NetworkOperationPrivate; + +class Q_COMPAT_EXPORT Q3NetworkOperation : public QObject +{ + Q_OBJECT + friend class Q3UrlOperator; + +public: + Q3NetworkOperation( Q3NetworkProtocol::Operation operation, + const QString &arg0, const QString &arg1, + const QString &arg2 ); + Q3NetworkOperation( Q3NetworkProtocol::Operation operation, + const QByteArray &arg0, const QByteArray &arg1, + const QByteArray &arg2 ); + ~Q3NetworkOperation(); + + void setState( Q3NetworkProtocol::State state ); + void setProtocolDetail( const QString &detail ); + void setErrorCode( int ec ); + void setArg( int num, const QString &arg ); + void setRawArg( int num, const QByteArray &arg ); + + Q3NetworkProtocol::Operation operation() const; + Q3NetworkProtocol::State state() const; + QString arg( int num ) const; + QByteArray rawArg( int num ) const; + QString protocolDetail() const; + int errorCode() const; + + void free(); + +private Q_SLOTS: + void deleteMe(); + +private: + QByteArray &raw( int num ) const; + Q3NetworkOperationPrivate *d; + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + Q3NetworkOperation( const Q3NetworkOperation & ); + Q3NetworkOperation &operator=( const Q3NetworkOperation & ); +#endif +}; + +#endif // QT_NO_NETWORKPROTOCOL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3NETWORKPROTOCOL_H diff --git a/qtinterface/qt4/Qt/q3objectdict.h b/qtinterface/qt4/Qt/q3objectdict.h new file mode 100644 index 0000000..4b5bdca --- /dev/null +++ b/qtinterface/qt4/Qt/q3objectdict.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3OBJECTDICT_H +#define Q3OBJECTDICT_H + +#include <QtCore/qmetaobject.h> +#include <Qt3Support/q3asciidict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +// +// The object dictionary is a collection of QMetaObjects +// + +class Q3ObjectDictionary : public Q3AsciiDict<QMetaObject> +{ +public: + Q3ObjectDictionary(int size=17,bool cs=true,bool ck=true) + : Q3AsciiDict<QMetaObject>(size,cs,ck) {} + Q3ObjectDictionary( const Q3ObjectDictionary &dict ) + : Q3AsciiDict<QMetaObject>(dict) {} + ~Q3ObjectDictionary() { clear(); } + Q3ObjectDictionary &operator=(const Q3ObjectDictionary &dict) + { return (Q3ObjectDictionary&)Q3AsciiDict<QMetaObject>::operator=(dict);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3OBJECTDICT_H diff --git a/qtinterface/qt4/Qt/q3paintdevicemetrics.h b/qtinterface/qt4/Qt/q3paintdevicemetrics.h new file mode 100644 index 0000000..f98ff8d --- /dev/null +++ b/qtinterface/qt4/Qt/q3paintdevicemetrics.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PAINTDEVICEMETRICS_H +#define Q3PAINTDEVICEMETRICS_H + +#include <QtGui/qpaintdevice.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3PaintDeviceMetrics // paint device metrics +{ +public: + Q3PaintDeviceMetrics(const QPaintDevice *device) : pdev(device) {} + + int width() const { return pdev->width(); } + int height() const { return pdev->height(); } + int widthMM() const { return pdev->widthMM(); } + int heightMM() const { return pdev->heightMM(); } + int logicalDpiX() const { return pdev->logicalDpiX(); } + int logicalDpiY() const { return pdev->logicalDpiY(); } + int physicalDpiX() const { return pdev->physicalDpiX(); } + int physicalDpiY() const { return pdev->physicalDpiY(); } + int numColors() const { return pdev->colorCount(); } + int depth() const { return pdev->depth(); } + +private: + const QPaintDevice *pdev; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PAINTDEVICEMETRICS_H diff --git a/qtinterface/qt4/Qt/q3painter.h b/qtinterface/qt4/Qt/q3painter.h new file mode 100644 index 0000000..d25a634 --- /dev/null +++ b/qtinterface/qt4/Qt/q3painter.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PAINTER_H +#define Q3PAINTER_H + +#include <QtGui/qpainter.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3Painter : public QPainter +{ +public: + Q3Painter() : QPainter() { } + Q3Painter(QPaintDevice *pdev) : QPainter(pdev) { } + + inline void drawRect(const QRect &rect); + inline void drawRect(int x1, int y1, int w, int h) + { drawRect(QRect(x1, y1, w, h)); } + + inline void drawRoundRect(const QRect &r, int xround = 25, int yround = 25); + inline void drawRoundRect(int x, int y, int w, int h, int xround = 25, int yround = 25) + { drawRoundRect(QRect(x, y, w, h), xround, yround); } + + inline void drawEllipse(const QRect &r); + inline void drawEllipse(int x, int y, int w, int h) + { drawEllipse(QRect(x, y, w, h)); } + + inline void drawArc(const QRect &r, int a, int alen); + inline void drawArc(int x, int y, int w, int h, int a, int alen) + { drawArc(QRect(x, y, w, h), a, alen); } + + inline void drawPie(const QRect &r, int a, int alen); + inline void drawPie(int x, int y, int w, int h, int a, int alen) + { drawPie(QRect(x, y, w, h), a, alen); } + + inline void drawChord(const QRect &r, int a, int alen); + inline void drawChord(int x, int y, int w, int h, int a, int alen) + { drawChord(QRect(x, y, w, h), a, alen); } + +private: + QRect adjustedRectangle(const QRect &r); + + Q_DISABLE_COPY(Q3Painter) +}; + +void inline Q3Painter::drawRect(const QRect &r) +{ + QPainter::drawRect(adjustedRectangle(r)); +} + +void inline Q3Painter::drawEllipse(const QRect &r) +{ + QPainter::drawEllipse(adjustedRectangle(r)); +} + +void inline Q3Painter::drawRoundRect(const QRect &r, int xrnd, int yrnd) +{ + QPainter::drawRoundRect(adjustedRectangle(r), xrnd, yrnd); +} + +void inline Q3Painter::drawArc(const QRect &r, int angle, int arcLength) +{ + QPainter::drawArc(adjustedRectangle(r), angle, arcLength); +} + +void inline Q3Painter::drawPie(const QRect &r, int angle, int arcLength) +{ + QPainter::drawPie(adjustedRectangle(r), angle, arcLength); +} + +void inline Q3Painter::drawChord(const QRect &r, int angle, int arcLength) +{ + QPainter::drawChord(adjustedRectangle(r), angle, arcLength); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PAINTER_H diff --git a/qtinterface/qt4/Qt/q3picture.h b/qtinterface/qt4/Qt/q3picture.h new file mode 100644 index 0000000..8cda1de --- /dev/null +++ b/qtinterface/qt4/Qt/q3picture.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PICTURE_H +#define Q3PICTURE_H + +#include <QtGui/qpicture.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3Picture : public QPicture +{ +public: + Q3Picture() : QPicture(-1) { } + Q3Picture(const QPicture &pic) : QPicture(pic) { } + bool load(QIODevice *dev, const char *format = 0); + bool load(const QString &fileName, const char *format = 0); + bool save(QIODevice *dev, const char *format = 0); + bool save(const QString &fileName, const char *format = 0); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PICTURE_H diff --git a/qtinterface/qt4/Qt/q3pointarray.h b/qtinterface/qt4/Qt/q3pointarray.h new file mode 100644 index 0000000..409c84b --- /dev/null +++ b/qtinterface/qt4/Qt/q3pointarray.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3POINTARRAY_H +#define Q3POINTARRAY_H + +#include <QtGui/qpolygon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3PointArray : public QPolygon +{ +public: + inline Q3PointArray() : QPolygon() {} + inline Q3PointArray(const QRect &r, bool closed=false) : QPolygon(r, closed) {} + inline Q3PointArray(const QPolygon& a) : QPolygon(a) {} + + inline Q3PointArray copy() const { return *this; } + inline bool isNull() { return isEmpty(); } + void makeEllipse(int x, int y, int w, int h); +#ifndef QT_NO_WMATRIX + void makeArc(int x, int y, int w, int h, int a1, int a2); + void makeArc(int x, int y, int w, int h, int a1, int a2, const QMatrix &matrix); +#endif + Q3PointArray cubicBezier() const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3POINTARRAY_H diff --git a/qtinterface/qt4/Qt/q3polygonscanner.h b/qtinterface/qt4/Qt/q3polygonscanner.h new file mode 100644 index 0000000..6293fad --- /dev/null +++ b/qtinterface/qt4/Qt/q3polygonscanner.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3POLYGONSCANNER_H +#define Q3POLYGONSCANNER_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3PointArray; +class QPoint; + +class Q_COMPAT_EXPORT Q3PolygonScanner { +public: + virtual ~Q3PolygonScanner() {} + void scan(const Q3PointArray& pa, bool winding, int index=0, int npoints=-1); + void scan(const Q3PointArray& pa, bool winding, int index, int npoints, bool stitchable); + enum Edge { Left=1, Right=2, Top=4, Bottom=8 }; + void scan(const Q3PointArray& pa, bool winding, int index, int npoints, Edge edges); + virtual void processSpans(int n, QPoint* point, int* width)=0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3POLYGONSCANNER_H diff --git a/qtinterface/qt4/Qt/q3popupmenu.h b/qtinterface/qt4/Qt/q3popupmenu.h new file mode 100644 index 0000000..4e28730 --- /dev/null +++ b/qtinterface/qt4/Qt/q3popupmenu.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3POPUPMENU_H +#define Q3POPUPMENU_H + +#include <QtGui/qmenu.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3PopupMenu : public QMenu +{ + Q_OBJECT +public: + inline Q3PopupMenu(QWidget *parent = 0, const char *name = 0) : QMenu(parent) + { setObjectName(QLatin1String(name)); } + + inline int exec() { return findIdForAction(QMenu::exec()); } + inline int exec(const QPoint & pos, int indexAtPoint = 0) { + return findIdForAction(QMenu::exec(pos, actions().value(indexAtPoint))); + } + + void setFrameRect(QRect) {} + QRect frameRect() const { return QRect(); } + enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel, + HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel, + PopupPanel, LineEditPanel, TabWidgetPanel, MShape }; + void setFrameShadow(DummyFrame) {} + DummyFrame frameShadow() const { return Plain; } + void setFrameShape(DummyFrame) {} + DummyFrame frameShape() const { return NoFrame; } + void setFrameStyle(int) {} + int frameStyle() const { return 0; } + int frameWidth() const { return 0; } + void setLineWidth(int) {} + int lineWidth() const { return 0; } + void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } + void setMidLineWidth(int) {} + int midLineWidth() const { return 0; } + +private: + Q_DISABLE_COPY(Q3PopupMenu) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPOPUPMENU_H diff --git a/qtinterface/qt4/Qt/q3process.h b/qtinterface/qt4/Qt/q3process.h new file mode 100644 index 0000000..cb35343 --- /dev/null +++ b/qtinterface/qt4/Qt/q3process.h @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PROCESS_H +#define Q3PROCESS_H + +#include <QtCore/qobject.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qdir.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_PROCESS + +class Q3ProcessPrivate; +class Q3Membuf; + +class Q_COMPAT_EXPORT Q3Process : public QObject +{ + Q_OBJECT +public: + Q3Process( QObject *parent=0, const char *name=0 ); + Q3Process( const QString& arg0, QObject *parent=0, const char *name=0 ); + Q3Process( const QStringList& args, QObject *parent=0, const char *name=0 ); + ~Q3Process(); + + // set and get the arguments and working directory + QStringList arguments() const; + void clearArguments(); + virtual void setArguments( const QStringList& args ); + virtual void addArgument( const QString& arg ); +#ifndef QT_NO_DIR + QDir workingDirectory() const; + virtual void setWorkingDirectory( const QDir& dir ); +#endif + + // set and get the comms wanted + enum Communication { Stdin=0x01, Stdout=0x02, Stderr=0x04, DupStderr=0x08 }; + void setCommunication( int c ); + int communication() const; + + // start the execution + virtual bool start( QStringList *env=0 ); + virtual bool launch( const QString& buf, QStringList *env=0 ); + virtual bool launch( const QByteArray& buf, QStringList *env=0 ); + + // inquire the status + bool isRunning() const; + bool normalExit() const; + int exitStatus() const; + + // reading + virtual QByteArray readStdout(); + virtual QByteArray readStderr(); + bool canReadLineStdout() const; + bool canReadLineStderr() const; + virtual QString readLineStdout(); + virtual QString readLineStderr(); + + // get platform dependent process information +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) + typedef void* PID; +#else + typedef Q_LONG PID; +#endif + PID processIdentifier(); + + void flushStdin(); + +Q_SIGNALS: + void readyReadStdout(); + void readyReadStderr(); + void processExited(); + void wroteToStdin(); + void launchFinished(); + +public Q_SLOTS: + // end the execution + void tryTerminate() const; + void kill() const; + + // input + virtual void writeToStdin( const QByteArray& buf ); + virtual void writeToStdin( const QString& buf ); + virtual void closeStdin(); + +protected: // ### or private? + void connectNotify( const char * signal ); + void disconnectNotify( const char * signal ); +private: + void setIoRedirection( bool value ); + void setNotifyOnExit( bool value ); + void setWroteStdinConnected( bool value ); + + void init(); + void reset(); +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) + uint readStddev( Qt::HANDLE dev, char *buf, uint bytes ); +#endif + Q3Membuf* membufStdout(); + Q3Membuf* membufStderr(); + +private Q_SLOTS: + void socketRead( int fd ); + void socketWrite( int fd ); + void timeout(); + void closeStdinLaunch(); + +private: + Q3ProcessPrivate *d; +#ifndef QT_NO_DIR + QDir workingDir; +#endif + QStringList _arguments; + + int exitStat; // exit status + bool exitNormal; // normal exit? + bool ioRedirection; // automatically set be (dis)connectNotify + bool notifyOnExit; // automatically set be (dis)connectNotify + bool wroteToStdinConnected; // automatically set be (dis)connectNotify + + bool readStdoutCalled; + bool readStderrCalled; + int comms; + + friend class Q3ProcessPrivate; +#if defined(Q_OS_UNIX) + friend class Q3ProcessManager; + friend class QProc; +#endif + +#if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator= + Q3Process( const Q3Process & ); + Q3Process &operator=( const Q3Process & ); +#endif +}; + +#endif // QT_NO_PROCESS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PROCESS_H diff --git a/qtinterface/qt4/Qt/q3progressbar.h b/qtinterface/qt4/Qt/q3progressbar.h new file mode 100644 index 0000000..aafef6c --- /dev/null +++ b/qtinterface/qt4/Qt/q3progressbar.h @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PROGRESSBAR_H +#define Q3PROGRESSBAR_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_PROGRESSBAR + +class Q3ProgressBarPrivate; + +class Q_COMPAT_EXPORT Q3ProgressBar : public QFrame +{ + Q_OBJECT + Q_PROPERTY(int totalSteps READ totalSteps WRITE setTotalSteps) + Q_PROPERTY(int progress READ progress WRITE setProgress) + Q_PROPERTY(QString progressString READ progressString) + Q_PROPERTY(bool centerIndicator READ centerIndicator WRITE setCenterIndicator) + Q_PROPERTY(bool percentageVisible READ percentageVisible WRITE setPercentageVisible) + +public: + Q3ProgressBar(QWidget *parent, const char *name, Qt::WindowFlags f=0); + Q3ProgressBar(int totalSteps, QWidget *parent, const char *name, + Qt::WindowFlags f=0); + Q3ProgressBar(QWidget *parent = 0, Qt::WindowFlags f = 0); + Q3ProgressBar(int totalSteps, QWidget *parent = 0, Qt::WindowFlags f=0); + + int totalSteps() const; + int progress() const; + const QString &progressString() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setCenterIndicator(bool on); + bool centerIndicator() const; + + bool percentageVisible() const; + void setPercentageVisible(bool); + + void setVisible(bool visible); + + void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } + +public Q_SLOTS: + void reset(); + virtual void setTotalSteps(int totalSteps); + virtual void setProgress(int progress); + void setProgress(int progress, int totalSteps); + +protected: + void paintEvent(QPaintEvent *); + virtual bool setIndicator(QString &progress_str, int progress, int totalSteps); + void changeEvent(QEvent *); + +private: + Q_DISABLE_COPY(Q3ProgressBar) + + int total_steps; + int progress_val; + int percentage; + QString progress_str; + bool center_indicator : 1; + bool percentage_visible : 1; + Q3ProgressBarPrivate *d; + void initFrame(); +}; + + +inline int Q3ProgressBar::totalSteps() const +{ + return total_steps; +} + +inline int Q3ProgressBar::progress() const +{ + return progress_val; +} + +inline const QString &Q3ProgressBar::progressString() const +{ + return progress_str; +} + +inline bool Q3ProgressBar::centerIndicator() const +{ + return center_indicator; +} + +inline bool Q3ProgressBar::percentageVisible() const +{ + return percentage_visible; +} + +#endif // QT_NO_PROGRESSBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PROGRESSBAR_H diff --git a/qtinterface/qt4/Qt/q3progressdialog.h b/qtinterface/qt4/Qt/q3progressdialog.h new file mode 100644 index 0000000..1e68b47 --- /dev/null +++ b/qtinterface/qt4/Qt/q3progressdialog.h @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PROGRESSDIALOG_H +#define Q3PROGRESSDIALOG_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_PROGRESSDIALOG + +class Q3ProgressDialogData; +class QLabel; +class QPushButton; +class QTimer; +class Q3ProgressBar; + +class Q_COMPAT_EXPORT Q3ProgressDialog : public QDialog +{ + Q_OBJECT + Q_PROPERTY(bool wasCanceled READ wasCanceled) + Q_PROPERTY(bool wasCancelled READ wasCancelled DESIGNABLE false STORED false) + Q_PROPERTY(int totalSteps READ totalSteps WRITE setTotalSteps) + Q_PROPERTY(int progress READ progress WRITE setProgress) + Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset) + Q_PROPERTY(bool autoClose READ autoClose WRITE setAutoClose) + Q_PROPERTY(int minimumDuration READ minimumDuration WRITE setMinimumDuration) + Q_PROPERTY(QString labelText READ labelText WRITE setLabelText) + +public: + Q3ProgressDialog(QWidget* parent, const char* name, bool modal=false, + Qt::WindowFlags f=0); + Q3ProgressDialog(const QString& labelText, + const QString &cancelButtonText, int totalSteps, + QWidget* parent=0, const char* name=0, + bool modal=false, Qt::WindowFlags f=0); + Q3ProgressDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); + Q3ProgressDialog(const QString& labelText, const QString &cancelButtonText, + int totalSteps, QWidget* parent=0, Qt::WindowFlags f=0); + ~Q3ProgressDialog(); + + void setLabel(QLabel *); + void setCancelButton(QPushButton *); + void setBar(Q3ProgressBar *); + + bool wasCanceled() const; + bool wasCancelled() const; + + int totalSteps() const; + int progress() const; + + QSize sizeHint() const; + + QString labelText() const; + + void setAutoReset(bool b); + bool autoReset() const; + void setAutoClose(bool b); + bool autoClose() const; + +public Q_SLOTS: + void cancel(); + void reset(); + void setTotalSteps(int totalSteps); + void setProgress(int progress); + void setProgress(int progress, int totalSteps); + void setLabelText(const QString &); + void setCancelButtonText(const QString &); + + void setMinimumDuration(int ms); +public: + int minimumDuration() const; + +Q_SIGNALS: + void canceled(); + void cancelled(); + +protected: + void resizeEvent(QResizeEvent *); + void closeEvent(QCloseEvent *); + void changeEvent(QEvent *); + void showEvent(QShowEvent *e); + +protected Q_SLOTS: + void forceShow(); + +private: + void init(QWidget *creator, const QString& lbl, const QString &canc, + int totstps); + void layout(); + QLabel *label() const; + Q3ProgressBar *bar() const; + Q3ProgressDialogData *d; + QTimer *forceTimer; + +private: + Q_DISABLE_COPY(Q3ProgressDialog) +}; + +#endif // QT_NO_PROGRESSDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PROGRESSDIALOG_H diff --git a/qtinterface/qt4/Qt/q3ptrcollection.h b/qtinterface/qt4/Qt/q3ptrcollection.h new file mode 100644 index 0000000..0eca656 --- /dev/null +++ b/qtinterface/qt4/Qt/q3ptrcollection.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PTRCOLLECTION_H +#define Q3PTRCOLLECTION_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3GVector; +class Q3GList; +class Q3GDict; + +class Q_COMPAT_EXPORT Q3PtrCollection // inherited by all collections +{ +public: + bool autoDelete() const { return del_item; } + void setAutoDelete(bool enable) { del_item = enable; } + + virtual uint count() const = 0; + virtual void clear() = 0; // delete all objects + + typedef void *Item; // generic collection item + +protected: + Q3PtrCollection() { del_item = false; } // no deletion of objects + Q3PtrCollection(const Q3PtrCollection &) { del_item = false; } + virtual ~Q3PtrCollection() {} + + bool del_item; // default false + + virtual Item newItem(Item); // create object + virtual void deleteItem(Item) = 0; // delete object +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PTRCOLLECTION_H diff --git a/qtinterface/qt4/Qt/q3ptrdict.h b/qtinterface/qt4/Qt/q3ptrdict.h new file mode 100644 index 0000000..c7d876f --- /dev/null +++ b/qtinterface/qt4/Qt/q3ptrdict.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PTRDICT_H +#define Q3PTRDICT_H + +#include <Qt3Support/q3gdict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3PtrDict +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GDict +#endif +{ +public: + Q3PtrDict(int size=17) : Q3GDict(size,PtrKey,0,0) {} + Q3PtrDict( const Q3PtrDict<type> &d ) : Q3GDict(d) {} + ~Q3PtrDict() { clear(); } + Q3PtrDict<type> &operator=(const Q3PtrDict<type> &d) + { return (Q3PtrDict<type>&)Q3GDict::operator=(d); } + uint count() const { return Q3GDict::count(); } + uint size() const { return Q3GDict::size(); } + bool isEmpty() const { return Q3GDict::count() == 0; } + void insert( void *k, const type *d ) + { Q3GDict::look_ptr(k,(Item)d,1); } + void replace( void *k, const type *d ) + { Q3GDict::look_ptr(k,(Item)d,2); } + bool remove( void *k ) { return Q3GDict::remove_ptr(k); } + type *take( void *k ) { return (type*)Q3GDict::take_ptr(k); } + type *find( void *k ) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_ptr(k,0,0); } + type *operator[]( void *k ) const + { return (type *)((Q3GDict*)this)->Q3GDict::look_ptr(k,0,0); } + void clear() { Q3GDict::clear(); } + void resize( uint n ) { Q3GDict::resize(n); } + void statistics() const { Q3GDict::statistics(); } + +#ifdef qdoc +protected: + virtual QDataStream& read( QDataStream &, Q3PtrCollection::Item & ); + virtual QDataStream& write( QDataStream &, Q3PtrCollection::Item ) const; +#endif + +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3PtrDict<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> +inline void Q3PtrDict<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type *)d; +} + +template<class type> +class Q3PtrDictIterator : public Q3GDictIterator +{ +public: + Q3PtrDictIterator(const Q3PtrDict<type> &d) :Q3GDictIterator((Q3GDict &)d) {} + ~Q3PtrDictIterator() {} + uint count() const { return dict->count(); } + bool isEmpty() const { return dict->count() == 0; } + type *toFirst() { return (type *)Q3GDictIterator::toFirst(); } + operator type *() const { return (type *)Q3GDictIterator::get(); } + type *current() const { return (type *)Q3GDictIterator::get(); } + void *currentKey() const { return Q3GDictIterator::getKeyPtr(); } + type *operator()() { return (type *)Q3GDictIterator::operator()(); } + type *operator++() { return (type *)Q3GDictIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GDictIterator::operator+=(j);} +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PTRDICT_H diff --git a/qtinterface/qt4/Qt/q3ptrlist.h b/qtinterface/qt4/Qt/q3ptrlist.h new file mode 100644 index 0000000..7cffe35 --- /dev/null +++ b/qtinterface/qt4/Qt/q3ptrlist.h @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PTRLIST_H +#define Q3PTRLIST_H + +#include <Qt3Support/q3glist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3PtrListStdIterator : public Q3GListStdIterator +{ +public: + inline Q3PtrListStdIterator( Q3LNode* n ): Q3GListStdIterator(n) {} + type *operator*() { return node ? (type *)node->getData() : 0; } + inline Q3PtrListStdIterator<type> operator++() + { node = next(); return *this; } + inline Q3PtrListStdIterator<type> operator++(int) + { Q3LNode* n = node; node = next(); return Q3PtrListStdIterator<type>( n ); } + inline bool operator==( const Q3PtrListStdIterator<type>& it ) const { return node == it.node; } + inline bool operator!=( const Q3PtrListStdIterator<type>& it ) const { return node != it.node; } +}; + + +template<class type> +class Q3PtrList +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GList +#endif +{ +public: + + Q3PtrList() {} + Q3PtrList( const Q3PtrList<type> &l ) : Q3GList(l) {} + ~Q3PtrList() { clear(); } + Q3PtrList<type> &operator=(const Q3PtrList<type> &l) + { return (Q3PtrList<type>&)Q3GList::operator=(l); } + bool operator==( const Q3PtrList<type> &list ) const + { return Q3GList::operator==( list ); } + bool operator!=( const Q3PtrList<type> &list ) const + { return !Q3GList::operator==( list ); } + uint count() const { return Q3GList::count(); } + bool isEmpty() const { return Q3GList::count() == 0; } + bool insert( uint i, const type *d){ return Q3GList::insertAt(i,(Q3PtrCollection::Item)d); } + void inSort( const type *d ) { Q3GList::inSort((Q3PtrCollection::Item)d); } + void prepend( const type *d ) { Q3GList::insertAt(0,(Q3PtrCollection::Item)d); } + void append( const type *d ) { Q3GList::append((Q3PtrCollection::Item)d); } + bool remove( uint i ) { return Q3GList::removeAt(i); } + bool remove() { return Q3GList::remove((Q3PtrCollection::Item)0); } + bool remove( const type *d ) { return Q3GList::remove((Q3PtrCollection::Item)d); } + bool removeRef( const type *d ) { return Q3GList::removeRef((Q3PtrCollection::Item)d); } + void removeNode( Q3LNode *n ) { Q3GList::removeNode(n); } + bool removeFirst() { return Q3GList::removeFirst(); } + bool removeLast() { return Q3GList::removeLast(); } + type *take( uint i ) { return (type *)Q3GList::takeAt(i); } + type *take() { return (type *)Q3GList::take(); } + type *takeNode( Q3LNode *n ) { return (type *)Q3GList::takeNode(n); } + void clear() { Q3GList::clear(); } + void sort() { Q3GList::sort(); } + int find( const type *d ) { return Q3GList::find((Q3PtrCollection::Item)d); } + int findNext( const type *d ) { return Q3GList::find((Q3PtrCollection::Item)d,false); } + int findRef( const type *d ) { return Q3GList::findRef((Q3PtrCollection::Item)d); } + int findNextRef( const type *d ){ return Q3GList::findRef((Q3PtrCollection::Item)d,false);} + uint contains( const type *d ) const { return Q3GList::contains((Q3PtrCollection::Item)d); } + uint containsRef( const type *d ) const + { return Q3GList::containsRef((Q3PtrCollection::Item)d); } + bool replace( uint i, const type *d ) { return Q3GList::replaceAt( i, (Q3PtrCollection::Item)d ); } + type *at( uint i ) { return (type *)Q3GList::at(i); } + int at() const { return Q3GList::at(); } + type *current() const { return (type *)Q3GList::get(); } + Q3LNode *currentNode() const { return Q3GList::currentNode(); } + type *getFirst() const { return (type *)Q3GList::cfirst(); } + type *getLast() const { return (type *)Q3GList::clast(); } + type *first() { return (type *)Q3GList::first(); } + type *last() { return (type *)Q3GList::last(); } + type *next() { return (type *)Q3GList::next(); } + type *prev() { return (type *)Q3GList::prev(); } + void toVector( Q3GVector *vec )const{ Q3GList::toVector(vec); } + + + // standard iterators + typedef Q3PtrListStdIterator<type> Iterator; + typedef Q3PtrListStdIterator<type> ConstIterator; + inline Iterator begin() { return Q3GList::begin(); } + inline ConstIterator begin() const { return Q3GList::begin(); } + inline ConstIterator constBegin() const { return Q3GList::begin(); } + inline Iterator end() { return Q3GList::end(); } + inline ConstIterator end() const { return Q3GList::end(); } + inline ConstIterator constEnd() const { return Q3GList::end(); } + inline Iterator erase( Iterator it ) { return Q3GList::erase( it ); } + // stl syntax compatibility + typedef Iterator iterator; + typedef ConstIterator const_iterator; + + +#ifdef qdoc +protected: + virtual int compareItems( Q3PtrCollection::Item, Q3PtrCollection::Item ); + virtual QDataStream& read( QDataStream&, Q3PtrCollection::Item& ); + virtual QDataStream& write( QDataStream&, Q3PtrCollection::Item ) const; +#endif + +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3PtrList<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> inline void Q3PtrList<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type *)d; +} + +template<class type> +class Q3PtrListIterator : public Q3GListIterator +{ +public: + Q3PtrListIterator(const Q3PtrList<type> &l) :Q3GListIterator((Q3GList &)l) {} + ~Q3PtrListIterator() {} + uint count() const { return list->count(); } + bool isEmpty() const { return list->count() == 0; } + bool atFirst() const { return Q3GListIterator::atFirst(); } + bool atLast() const { return Q3GListIterator::atLast(); } + type *toFirst() { return (type *)Q3GListIterator::toFirst(); } + type *toLast() { return (type *)Q3GListIterator::toLast(); } + operator type *() const { return (type *)Q3GListIterator::get(); } + type *operator*() { return (type *)Q3GListIterator::get(); } + + // No good, since Q3PtrList<char> (ie. QStrList fails... + // + // MSVC++ gives warning + // Sunpro C++ 4.1 gives error + // type *operator->() { return (type *)Q3GListIterator::get(); } + + type *current() const { return (type *)Q3GListIterator::get(); } + type *operator()() { return (type *)Q3GListIterator::operator()();} + type *operator++() { return (type *)Q3GListIterator::operator++(); } + type *operator+=(uint j) { return (type *)Q3GListIterator::operator+=(j);} + type *operator--() { return (type *)Q3GListIterator::operator--(); } + type *operator-=(uint j) { return (type *)Q3GListIterator::operator-=(j);} + Q3PtrListIterator<type>& operator=(const Q3PtrListIterator<type>&it) + { Q3GListIterator::operator=(it); return *this; } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PTRLIST_H diff --git a/qtinterface/qt4/Qt/q3ptrqueue.h b/qtinterface/qt4/Qt/q3ptrqueue.h new file mode 100644 index 0000000..0f596c8 --- /dev/null +++ b/qtinterface/qt4/Qt/q3ptrqueue.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PTRQUEUE_H +#define Q3PTRQUEUE_H + +#include <Qt3Support/q3glist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3PtrQueue : protected Q3GList +{ +public: + Q3PtrQueue() {} + Q3PtrQueue( const Q3PtrQueue<type> &q ) : Q3GList(q) {} + ~Q3PtrQueue() { clear(); } + Q3PtrQueue<type>& operator=(const Q3PtrQueue<type> &q) + { return (Q3PtrQueue<type>&)Q3GList::operator=(q); } + bool autoDelete() const { return Q3PtrCollection::autoDelete(); } + void setAutoDelete( bool del ) { Q3PtrCollection::setAutoDelete(del); } + uint count() const { return Q3GList::count(); } + bool isEmpty() const { return Q3GList::count() == 0; } + void enqueue( const type *d ) { Q3GList::append(Item(d)); } + type *dequeue() { return (type *)Q3GList::takeFirst();} + bool remove() { return Q3GList::removeFirst(); } + void clear() { Q3GList::clear(); } + type *head() const { return (type *)Q3GList::cfirst(); } + operator type *() const { return (type *)Q3GList::cfirst(); } + type *current() const { return (type *)Q3GList::cfirst(); } + +#ifdef qdoc +protected: + virtual QDataStream& read( QDataStream&, Q3PtrCollection::Item& ); + virtual QDataStream& write( QDataStream&, Q3PtrCollection::Item ) const; +#endif + +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3PtrQueue<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> inline void Q3PtrQueue<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type *)d; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PTRQUEUE_H diff --git a/qtinterface/qt4/Qt/q3ptrstack.h b/qtinterface/qt4/Qt/q3ptrstack.h new file mode 100644 index 0000000..9a3091a --- /dev/null +++ b/qtinterface/qt4/Qt/q3ptrstack.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PTRSTACK_H +#define Q3PTRSTACK_H + +#include <Qt3Support/q3glist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3PtrStack : protected Q3GList +{ +public: + Q3PtrStack() { } + Q3PtrStack( const Q3PtrStack<type> &s ) : Q3GList( s ) { } + ~Q3PtrStack() { clear(); } + Q3PtrStack<type> &operator=(const Q3PtrStack<type> &s) + { return (Q3PtrStack<type>&)Q3GList::operator=(s); } + bool autoDelete() const { return Q3PtrCollection::autoDelete(); } + void setAutoDelete( bool del ) { Q3PtrCollection::setAutoDelete(del); } + uint count() const { return Q3GList::count(); } + bool isEmpty() const { return Q3GList::count() == 0; } + void push( const type *d ) { Q3GList::insertAt(0,Item(d)); } + type *pop() { return (type *)Q3GList::takeFirst(); } + bool remove() { return Q3GList::removeFirst(); } + void clear() { Q3GList::clear(); } + type *top() const { return (type *)Q3GList::cfirst(); } + operator type *() const { return (type *)Q3GList::cfirst(); } + type *current() const { return (type *)Q3GList::cfirst(); } + +#ifdef qdoc +protected: + virtual QDataStream& read( QDataStream&, Q3PtrCollection::Item& ); + virtual QDataStream& write( QDataStream&, Q3PtrCollection::Item ) const; +#endif + +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3PtrStack<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> inline void Q3PtrStack<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type *)d; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PTRSTACK_H diff --git a/qtinterface/qt4/Qt/q3ptrvector.h b/qtinterface/qt4/Qt/q3ptrvector.h new file mode 100644 index 0000000..196fbf8 --- /dev/null +++ b/qtinterface/qt4/Qt/q3ptrvector.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3PTRVECTOR_H +#define Q3PTRVECTOR_H + +#include <Qt3Support/q3gvector.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3PtrVector +#ifdef qdoc + : public Q3PtrCollection +#else + : public Q3GVector +#endif +{ +public: + Q3PtrVector() { } + Q3PtrVector( uint size ) : Q3GVector(size) { } + Q3PtrVector( const Q3PtrVector<type> &v ) : Q3GVector( v ) { } + ~Q3PtrVector() { clear(); } + Q3PtrVector<type> &operator=(const Q3PtrVector<type> &v) + { return (Q3PtrVector<type>&)Q3GVector::operator=(v); } + bool operator==( const Q3PtrVector<type> &v ) const { return Q3GVector::operator==(v); } + type **data() const { return (type **)Q3GVector::data(); } + uint size() const { return Q3GVector::size(); } + uint count() const { return Q3GVector::count(); } + bool isEmpty() const { return Q3GVector::count() == 0; } + bool isNull() const { return Q3GVector::size() == 0; } + bool resize( uint size ) { return Q3GVector::resize(size); } + bool insert( uint i, const type *d){ return Q3GVector::insert(i,(Item)d); } + bool remove( uint i ) { return Q3GVector::remove(i); } + type *take( uint i ) { return (type *)Q3GVector::take(i); } + void clear() { Q3GVector::clear(); } + bool fill( const type *d, int size=-1 ) + { return Q3GVector::fill((Item)d,size);} + void sort() { Q3GVector::sort(); } + int bsearch( const type *d ) const{ return Q3GVector::bsearch((Item)d); } + int findRef( const type *d, uint i=0 ) const + { return Q3GVector::findRef((Item)d,i);} + int find( const type *d, uint i= 0 ) const + { return Q3GVector::find((Item)d,i); } + uint containsRef( const type *d ) const + { return Q3GVector::containsRef((Item)d); } + uint contains( const type *d ) const + { return Q3GVector::contains((Item)d); } + type *operator[]( int i ) const { return (type *)Q3GVector::at(i); } + type *at( uint i ) const { return (type *)Q3GVector::at(i); } + void toList( Q3GList *list ) const { Q3GVector::toList(list); } + +#ifdef qdoc +protected: + virtual int compareItems( Q3PtrCollection::Item d1, Q3PtrCollection::Item d2 ); + virtual QDataStream& read( QDataStream &s, Q3PtrCollection::Item &d ); + virtual QDataStream& write( QDataStream &s, Q3PtrCollection::Item d ) const; +#endif + +private: + void deleteItem( Item d ); +}; + +#if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION) +template<> inline void Q3PtrVector<void>::deleteItem( Q3PtrCollection::Item ) +{ +} +#endif + +template<class type> inline void Q3PtrVector<type>::deleteItem( Q3PtrCollection::Item d ) +{ + if ( del_item ) delete (type *)d; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3PTRVECTOR_H diff --git a/qtinterface/qt4/Qt/q3rangecontrol.h b/qtinterface/qt4/Qt/q3rangecontrol.h new file mode 100644 index 0000000..18dc812 --- /dev/null +++ b/qtinterface/qt4/Qt/q3rangecontrol.h @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3RANGECONTROL_H +#define Q3RANGECONTROL_H + +#include <QtCore/qglobal.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_RANGECONTROL + +class Q3RangeControlPrivate; + +class Q_COMPAT_EXPORT Q3RangeControl +{ +public: + Q3RangeControl(); + Q3RangeControl(int minValue, int maxValue, + int lineStep, int pageStep, int value); + virtual ~Q3RangeControl(); + + int value() const; + void setValue(int); + void addPage(); + void subtractPage(); + void addLine(); + void subtractLine(); + + int minValue() const; + int maxValue() const; + void setRange(int minValue, int maxValue); + void setMinValue(int minVal); + void setMaxValue(int minVal); + + int lineStep() const; + int pageStep() const; + void setSteps(int line, int page); + + int bound(int) const; + +protected: + int positionFromValue(int val, int space) const; + int valueFromPosition(int pos, int space) const; + void directSetValue(int val); + int prevValue() const; + + virtual void valueChange(); + virtual void rangeChange(); + virtual void stepChange(); + +private: + int minVal, maxVal; + int line, page; + int val, prevVal; + + Q3RangeControlPrivate * d; + +private: + Q_DISABLE_COPY(Q3RangeControl) +}; + + +inline int Q3RangeControl::value() const +{ return val; } + +inline int Q3RangeControl::prevValue() const +{ return prevVal; } + +inline int Q3RangeControl::minValue() const +{ return minVal; } + +inline int Q3RangeControl::maxValue() const +{ return maxVal; } + +inline int Q3RangeControl::lineStep() const +{ return line; } + +inline int Q3RangeControl::pageStep() const +{ return page; } + + +#endif // QT_NO_RANGECONTROL + +#ifndef QT_NO_SPINWIDGET + +class Q3SpinWidgetPrivate; +class Q_COMPAT_EXPORT Q3SpinWidget : public QWidget +{ + Q_OBJECT +public: + Q3SpinWidget(QWidget* parent=0, const char* name=0); + ~Q3SpinWidget(); + + void setEditWidget(QWidget * widget); + QWidget * editWidget(); + + QRect upRect() const; + QRect downRect() const; + + void setUpEnabled(bool on); + void setDownEnabled(bool on); + + bool isUpEnabled() const; + bool isDownEnabled() const; + + enum ButtonSymbols { UpDownArrows, PlusMinus }; + virtual void setButtonSymbols(ButtonSymbols bs); + ButtonSymbols buttonSymbols() const; + + void arrange(); + +Q_SIGNALS: + void stepUpPressed(); + void stepDownPressed(); + +public Q_SLOTS: + void stepUp(); + void stepDown(); + +protected: + void mousePressEvent(QMouseEvent *e); + void resizeEvent(QResizeEvent* ev); + void mouseReleaseEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *); +#endif + void changeEvent(QEvent *); + void paintEvent(QPaintEvent *); + +private Q_SLOTS: + void timerDone(); + void timerDoneEx(); + +private: + Q3SpinWidgetPrivate * d; + + void updateDisplay(); + +private: + Q_DISABLE_COPY(Q3SpinWidget) +}; + +#endif // QT_NO_RANGECONTROL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3RANGECONTROL_H diff --git a/qtinterface/qt4/Qt/q3scrollview.h b/qtinterface/qt4/Qt/q3scrollview.h new file mode 100644 index 0000000..df0d49e --- /dev/null +++ b/qtinterface/qt4/Qt/q3scrollview.h @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SCROLLVIEW_H +#define Q3SCROLLVIEW_H + +#include <Qt3Support/q3frame.h> +#include <QtGui/qscrollbar.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3ScrollViewData; + +class Q_COMPAT_EXPORT Q3ScrollView : public Q3Frame +{ + Q_OBJECT + Q_ENUMS( ResizePolicy ScrollBarMode ) + Q_PROPERTY( ResizePolicy resizePolicy READ resizePolicy WRITE setResizePolicy ) + Q_PROPERTY( ScrollBarMode vScrollBarMode READ vScrollBarMode WRITE setVScrollBarMode ) + Q_PROPERTY( ScrollBarMode hScrollBarMode READ hScrollBarMode WRITE setHScrollBarMode ) + Q_PROPERTY( int visibleWidth READ visibleWidth ) + Q_PROPERTY( int visibleHeight READ visibleHeight ) + Q_PROPERTY( int contentsWidth READ contentsWidth ) + Q_PROPERTY( int contentsHeight READ contentsHeight ) + Q_PROPERTY( int contentsX READ contentsX ) + Q_PROPERTY( int contentsY READ contentsY ) + Q_PROPERTY( bool dragAutoScroll READ dragAutoScroll WRITE setDragAutoScroll ) + +public: + Q3ScrollView(QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0); + ~Q3ScrollView(); + + enum ResizePolicy { Default, Manual, AutoOne, AutoOneFit }; + virtual void setResizePolicy( ResizePolicy ); + ResizePolicy resizePolicy() const; + + void styleChange( QStyle & ); + void removeChild(QWidget* child); + virtual void addChild( QWidget* child, int x=0, int y=0 ); + virtual void moveChild( QWidget* child, int x, int y ); + int childX(QWidget* child); + int childY(QWidget* child); + bool childIsVisible(QWidget* child) { return child->isVisible(); } // obsolete functions + void showChild(QWidget* child, bool yes=true) { child->setVisible(yes); } + + enum ScrollBarMode { Auto, AlwaysOff, AlwaysOn }; + + ScrollBarMode vScrollBarMode() const; + virtual void setVScrollBarMode( ScrollBarMode ); + + ScrollBarMode hScrollBarMode() const; + virtual void setHScrollBarMode( ScrollBarMode ); + + QWidget* cornerWidget() const; + virtual void setCornerWidget(QWidget*); + + // ### 4.0: Consider providing a factory function for scrollbars + // (e.g. make the two following functions virtual) + QScrollBar* horizontalScrollBar() const; + QScrollBar* verticalScrollBar() const; + QWidget* viewport() const; + QWidget* clipper() const; + + int visibleWidth() const; + int visibleHeight() const; + + int contentsWidth() const; + int contentsHeight() const; + int contentsX() const; + int contentsY() const; + + void resize( int w, int h ); + void resize( const QSize& ); + void setVisible(bool visible); + + void updateContents( int x, int y, int w, int h ); + void updateContents( const QRect& r ); + void updateContents(); + void repaintContents( int x, int y, int w, int h, bool erase=true ); + void repaintContents( const QRect& r, bool erase=true ); + void repaintContents( bool erase=true ); + void contentsToViewport( int x, int y, int& vx, int& vy ) const; + void viewportToContents( int vx, int vy, int& x, int& y ) const; + QPoint contentsToViewport( const QPoint& ) const; + QPoint viewportToContents( const QPoint& ) const; + void enableClipper( bool y ); + + void setStaticBackground( bool y ); + bool hasStaticBackground() const; + + QSize viewportSize( int, int ) const; + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void removeChild(QObject* child); + + bool isHorizontalSliderPressed(); + bool isVerticalSliderPressed(); + + virtual void setDragAutoScroll( bool b ); + bool dragAutoScroll() const; + +Q_SIGNALS: + void contentsMoving(int x, int y); + void horizontalSliderPressed(); + void horizontalSliderReleased(); + void verticalSliderPressed(); + void verticalSliderReleased(); + +public Q_SLOTS: + virtual void resizeContents( int w, int h ); + void scrollBy( int dx, int dy ); + virtual void setContentsPos( int x, int y ); + void ensureVisible(int x, int y); + void ensureVisible(int x, int y, int xmargin, int ymargin); + void center(int x, int y); + void center(int x, int y, float xmargin, float ymargin); + + void updateScrollBars(); // ### virtual in 4.0 + void setEnabled( bool enable ); + +protected: + virtual void drawContents(QPainter*, int cx, int cy, int cw, int ch); + virtual void drawContentsOffset(QPainter*, int ox, int oy, + int cx, int cy, int cw, int ch); + + + virtual void contentsMousePressEvent( QMouseEvent* ); + virtual void contentsMouseReleaseEvent( QMouseEvent* ); + virtual void contentsMouseDoubleClickEvent( QMouseEvent* ); + virtual void contentsMouseMoveEvent( QMouseEvent* ); + virtual void contentsDragEnterEvent( QDragEnterEvent * ); + virtual void contentsDragMoveEvent( QDragMoveEvent * ); + virtual void contentsDragLeaveEvent( QDragLeaveEvent * ); + virtual void contentsDropEvent( QDropEvent * ); + virtual void contentsWheelEvent( QWheelEvent * ); + virtual void contentsContextMenuEvent( QContextMenuEvent * ); + + + virtual void viewportPaintEvent( QPaintEvent* ); + virtual void viewportResizeEvent( QResizeEvent* ); + virtual void viewportMousePressEvent( QMouseEvent* ); + virtual void viewportMouseReleaseEvent( QMouseEvent* ); + virtual void viewportMouseDoubleClickEvent( QMouseEvent* ); + virtual void viewportMouseMoveEvent( QMouseEvent* ); + virtual void viewportDragEnterEvent( QDragEnterEvent * ); + virtual void viewportDragMoveEvent( QDragMoveEvent * ); + virtual void viewportDragLeaveEvent( QDragLeaveEvent * ); + virtual void viewportDropEvent( QDropEvent * ); + virtual void viewportWheelEvent( QWheelEvent * ); + virtual void viewportContextMenuEvent( QContextMenuEvent * ); + + void frameChanged(); + +public: + virtual void setMargins(int left, int top, int right, int bottom); + int leftMargin() const; + int topMargin() const; + int rightMargin() const; + int bottomMargin() const; +protected: + + bool focusNextPrevChild( bool next ); + + virtual void setHBarGeometry(QScrollBar& hbar, int x, int y, int w, int h); + virtual void setVBarGeometry(QScrollBar& vbar, int x, int y, int w, int h); + + void resizeEvent(QResizeEvent*); + void mousePressEvent( QMouseEvent * ); + void mouseReleaseEvent( QMouseEvent * ); + void mouseDoubleClickEvent( QMouseEvent * ); + void mouseMoveEvent( QMouseEvent * ); + void wheelEvent( QWheelEvent * ); + void contextMenuEvent( QContextMenuEvent * ); + bool eventFilter( QObject *, QEvent *e ); + + void setCachedSizeHint( const QSize &sh ) const; + QSize cachedSizeHint() const; + void fontChange( const QFont & ); + +private: + void drawContents( QPainter* ); + void moveContents(int x, int y); + + Q3ScrollViewData* d; + +private Q_SLOTS: + void hslide(int); + void vslide(int); + void hbarIsPressed(); + void hbarIsReleased(); + void vbarIsPressed(); + void vbarIsReleased(); + void doDragAutoScroll(); + void startDragAutoScroll(); + void stopDragAutoScroll(); + +private: // Disabled copy constructor and operator= + Q_DISABLE_COPY(Q3ScrollView) + void changeFrameRect(const QRect&); + +public: + void disableSizeHintCaching(); + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SCROLLVIEW_H diff --git a/qtinterface/qt4/Qt/q3semaphore.h b/qtinterface/qt4/Qt/q3semaphore.h new file mode 100644 index 0000000..4c9f0f0 --- /dev/null +++ b/qtinterface/qt4/Qt/q3semaphore.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SEMAPHORE_H +#define Q3SEMAPHORE_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3SemaphorePrivate; + +class Q_COMPAT_EXPORT Q3Semaphore +{ +public: + Q3Semaphore(int); + virtual ~Q3Semaphore(); + + int available() const; + int total() const; + + // postfix operators + int operator++(int); + int operator--(int); + + int operator+=(int); + int operator-=(int); + + bool tryAccess(int); + +private: + Q_DISABLE_COPY(Q3Semaphore) + + Q3SemaphorePrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SEMAPHORE_H diff --git a/qtinterface/qt4/Qt/q3serversocket.h b/qtinterface/qt4/Qt/q3serversocket.h new file mode 100644 index 0000000..c65299c --- /dev/null +++ b/qtinterface/qt4/Qt/q3serversocket.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SERVERSOCKET_H +#define Q3SERVERSOCKET_H + +#include <QtCore/qobject.h> +#include <QtNetwork/qhostaddress.h> +#include <Qt3Support/q3socketdevice.h> // ### remove or keep for users' convenience? + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +class Q3ServerSocketPrivate; + +class Q_COMPAT_EXPORT Q3ServerSocket : public QObject +{ + Q_OBJECT +public: + Q3ServerSocket( Q_UINT16 port, int backlog = 1, + QObject *parent=0, const char *name=0 ); + Q3ServerSocket( const QHostAddress & address, Q_UINT16 port, int backlog = 1, + QObject *parent=0, const char *name=0 ); + Q3ServerSocket( QObject *parent=0, const char *name=0 ); + virtual ~Q3ServerSocket(); + + bool ok() const; + + Q_UINT16 port() const ; + + int socket() const ; + virtual void setSocket( int socket ); + + QHostAddress address() const ; + + virtual void newConnection( int socket ) = 0; + +protected: + Q3SocketDevice *socketDevice(); + +private Q_SLOTS: + void incomingConnection( int socket ); + +private: + Q3ServerSocketPrivate *d; + void init( const QHostAddress & address, Q_UINT16 port, int backlog ); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SERVERSOCKET_H diff --git a/qtinterface/qt4/Qt/q3shared.h b/qtinterface/qt4/Qt/q3shared.h new file mode 100644 index 0000000..19f0e64 --- /dev/null +++ b/qtinterface/qt4/Qt/q3shared.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SHARED_H +#define Q3SHARED_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +struct Q_COMPAT_EXPORT Q3Shared +{ + Q3Shared() : count( 1 ) { } + void ref() { count++; } + bool deref() { return !--count; } + uint count; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SHARED_H diff --git a/qtinterface/qt4/Qt/q3signal.h b/qtinterface/qt4/Qt/q3signal.h new file mode 100644 index 0000000..de57b8f --- /dev/null +++ b/qtinterface/qt4/Qt/q3signal.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SIGNAL_H +#define Q3SIGNAL_H + +#include <QtCore/qvariant.h> +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3Signal : public QObject +{ + Q_OBJECT + +public: + Q3Signal(QObject *parent=0, const char *name=0); + ~Q3Signal(); + + bool connect(const QObject *receiver, const char *member); + bool disconnect(const QObject *receiver, const char *member=0); + + void activate(); + + bool isBlocked() const { return QObject::signalsBlocked(); } + void block(bool b) { QObject::blockSignals(b); } +#ifndef QT_NO_VARIANT + void setParameter(int value); + int parameter() const; +#endif + +#ifndef QT_NO_VARIANT + void setValue(const QVariant &value); + QVariant value() const; +#endif +Q_SIGNALS: +#ifndef QT_NO_VARIANT + void signal(const QVariant&); +#endif + void intSignal(int); + +private: + Q_DISABLE_COPY(Q3Signal) + +#ifndef QT_NO_VARIANT + QVariant val; +#endif + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SIGNAL_H diff --git a/qtinterface/qt4/Qt/q3simplerichtext.h b/qtinterface/qt4/Qt/q3simplerichtext.h new file mode 100644 index 0000000..4074085 --- /dev/null +++ b/qtinterface/qt4/Qt/q3simplerichtext.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SIMPLERICHTEXT_H +#define Q3SIMPLERICHTEXT_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qstring.h> +#include <QtGui/qregion.h> +#include <QtGui/qcolor.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_RICHTEXT + +class QPainter; +class QWidget; +class Q3StyleSheet; +class QBrush; +class Q3MimeSourceFactory; +class Q3SimpleRichTextData; + +class Q_COMPAT_EXPORT Q3SimpleRichText +{ +public: + Q3SimpleRichText(const QString& text, const QFont& fnt, + const QString& context = QString(), const Q3StyleSheet* sheet = 0); + Q3SimpleRichText(const QString& text, const QFont& fnt, + const QString& context, const Q3StyleSheet *sheet, + const Q3MimeSourceFactory* factory, int pageBreak = -1, + const QColor& linkColor = Qt::blue, bool linkUnderline = true); + ~Q3SimpleRichText(); + + void setWidth(int); + void setWidth(QPainter*, int); + void setDefaultFont(const QFont &f); + int width() const; + int widthUsed() const; + int height() const; + void adjustSize(); + + void draw(QPainter* p, int x, int y, const QRect& clipRect, + const QColorGroup& cg, const QBrush* paper = 0) const; + + void draw(QPainter* p, int x, int y, const QRegion& clipRegion, + const QColorGroup& cg, const QBrush* paper = 0) const { + draw(p, x, y, clipRegion.boundingRect(), cg, paper); + } + + QString context() const; + QString anchorAt(const QPoint& pos) const; + + bool inText(const QPoint& pos) const; + +private: + Q_DISABLE_COPY(Q3SimpleRichText) + + Q3SimpleRichTextData* d; +}; + +#endif // QT_NO_RICHTEXT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SIMPLERICHTEXT_H diff --git a/qtinterface/qt4/Qt/q3socket.h b/qtinterface/qt4/Qt/q3socket.h new file mode 100644 index 0000000..3354f34 --- /dev/null +++ b/qtinterface/qt4/Qt/q3socket.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SOCKET_H +#define Q3SOCKET_H + +#include <QtCore/qiodevice.h> +#include <QtNetwork/qhostaddress.h> // int->QHostAddress conversion + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +class Q3SocketPrivate; +class Q3SocketDevice; + +class Q_COMPAT_EXPORT Q3Socket : public QIODevice +{ + Q_OBJECT +public: + enum Error { + ErrConnectionRefused, + ErrHostNotFound, + ErrSocketRead + }; + + Q3Socket( QObject *parent=0, const char *name=0 ); + virtual ~Q3Socket(); + + enum State { Idle, HostLookup, Connecting, + Connected, Closing, + Connection=Connected }; + State state() const; + + int socket() const; + virtual void setSocket( int ); + + Q3SocketDevice *socketDevice(); + virtual void setSocketDevice( Q3SocketDevice * ); + +#ifndef QT_NO_DNS + virtual void connectToHost( const QString &host, Q_UINT16 port ); +#endif + QString peerName() const; + + // Implementation of QIODevice abstract virtual functions + bool open( OpenMode mode ); + bool open(int mode) { return open((OpenMode)mode); } + void close(); + bool flush(); + Offset size() const; + Offset at() const; + bool at( Offset ); + bool atEnd() const; + + qint64 bytesAvailable() const; + Q_ULONG waitForMore( int msecs, bool *timeout ) const; + Q_ULONG waitForMore( int msecs ) const; // ### Qt 4.0: merge the two overloads + qint64 bytesToWrite() const; + void clearPendingData(); + + int getch(); + int putch( int ); + int ungetch(int); + + bool canReadLine() const; + + Q_UINT16 port() const; + Q_UINT16 peerPort() const; + QHostAddress address() const; + QHostAddress peerAddress() const; + + void setReadBufferSize( Q_ULONG ); + Q_ULONG readBufferSize() const; + + inline bool isSequential() const { return true; } + +Q_SIGNALS: + void hostFound(); + void connected(); + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); + void bytesWritten( int nbytes ); + void error( int ); + +protected Q_SLOTS: + virtual void sn_read( bool force=false ); + virtual void sn_write(); + +protected: + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + +private Q_SLOTS: + void tryConnecting(); + void emitErrorConnectionRefused(); + +private: + Q3SocketPrivate *d; + + bool consumeWriteBuf( Q_ULONG nbytes ); + void tryConnection(); + void setSocketIntern( int socket ); + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + Q3Socket( const Q3Socket & ); + Q3Socket &operator=( const Q3Socket & ); +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SOCKET_H diff --git a/qtinterface/qt4/Qt/q3socketdevice.h b/qtinterface/qt4/Qt/q3socketdevice.h new file mode 100644 index 0000000..9d0a9c0 --- /dev/null +++ b/qtinterface/qt4/Qt/q3socketdevice.h @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SOCKETDEVICE_H +#define Q3SOCKETDEVICE_H + +#include <QtCore/qiodevice.h> +#include <QtNetwork/qhostaddress.h> // int->QHostAddress conversion + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_NETWORK + +class Q3SocketDevicePrivate; + +class Q_COMPAT_EXPORT Q3SocketDevice: public QIODevice +{ +public: + enum Type { Stream, Datagram }; + enum Protocol { IPv4, IPv6, Unknown }; + + Q3SocketDevice( Type type = Stream ); + Q3SocketDevice( Type type, Protocol protocol, int dummy ); + Q3SocketDevice( int socket, Type type ); + virtual ~Q3SocketDevice(); + + bool isValid() const; + Type type() const; + Protocol protocol() const; + + int socket() const; + virtual void setSocket( int socket, Type type ); + + bool open( OpenMode mode ); + bool open( int mode ) { return open((OpenMode)mode); } + void close(); + bool flush(); + + // Implementation of QIODevice abstract virtual functions + Offset size() const; + Offset at() const; + bool at( Offset ); + bool atEnd() const; + + bool blocking() const; + virtual void setBlocking( bool ); + + bool addressReusable() const; + virtual void setAddressReusable( bool ); + + int receiveBufferSize() const; + virtual void setReceiveBufferSize( uint ); + int sendBufferSize() const; + virtual void setSendBufferSize( uint ); + + virtual bool connect( const QHostAddress &, Q_UINT16 ); + + virtual bool bind( const QHostAddress &, Q_UINT16 ); + virtual bool listen( int backlog ); + virtual int accept(); + + qint64 bytesAvailable() const; + Q_LONG waitForMore( int msecs, bool *timeout=0 ) const; + virtual Q_LONG writeBlock( const char *data, Q_ULONG len, + const QHostAddress & host, Q_UINT16 port ); + inline Q_LONG writeBlock(const char *data, Q_ULONG len) + { return qint64(write(data, qint64(len))); } + inline qint64 readBlock(char *data, Q_ULONG maxlen) + { return qint64(read(data, qint64(maxlen))); } + + Q_UINT16 port() const; + Q_UINT16 peerPort() const; + QHostAddress address() const; + QHostAddress peerAddress() const; + + enum Error { + NoError, + AlreadyBound, + Inaccessible, + NoResources, + InternalError, + Bug = InternalError, // ### remove in 4.0? + Impossible, + NoFiles, + ConnectionRefused, + NetworkFailure, + UnknownError + }; + Error error() const; + + inline bool isSequential() const { return true; } + +protected: + void setError( Error err ); + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + +private: + int fd; + Type t; + Q_UINT16 p; + QHostAddress a; + Q_UINT16 pp; + QHostAddress pa; + Q3SocketDevice::Error e; + Q3SocketDevicePrivate * d; + + enum Option { Broadcast, ReceiveBuffer, ReuseAddress, SendBuffer }; + + int option( Option ) const; + virtual void setOption( Option, int ); + + void fetchConnectionParameters(); +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) + void fetchPeerConnectionParameters(); +#endif + + static void init(); + int createNewSocket(); + Protocol getProtocol() const; + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + Q3SocketDevice( const Q3SocketDevice & ); + Q3SocketDevice &operator=( const Q3SocketDevice & ); +#endif +}; + +#endif // QT_NO_NETWORK + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SOCKETDEVICE_H diff --git a/qtinterface/qt4/Qt/q3sortedlist.h b/qtinterface/qt4/Qt/q3sortedlist.h new file mode 100644 index 0000000..8d582c2 --- /dev/null +++ b/qtinterface/qt4/Qt/q3sortedlist.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SORTEDLIST_H +#define Q3SORTEDLIST_H + +#include <Qt3Support/q3ptrlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class type> +class Q3SortedList : public Q3PtrList<type> +{ +public: + Q3SortedList() {} + Q3SortedList( const Q3SortedList<type> &l ) : Q3PtrList<type>(l) {} + ~Q3SortedList() { this->clear(); } + Q3SortedList<type> &operator=(const Q3SortedList<type> &l) + { return (Q3SortedList<type>&)Q3PtrList<type>::operator=(l); } + + virtual int compareItems( Q3PtrCollection::Item s1, Q3PtrCollection::Item s2 ) + { if ( *((type*)s1) == *((type*)s2) ) return 0; return ( *((type*)s1) < *((type*)s2) ? -1 : 1 ); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SORTEDLIST_H diff --git a/qtinterface/qt4/Qt/q3sqlcursor.h b/qtinterface/qt4/Qt/q3sqlcursor.h new file mode 100644 index 0000000..03a7fc1 --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqlcursor.h @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLCURSOR_H +#define Q3SQLCURSOR_H + +#include <QtCore/qvariant.h> +#include <QtSql/qsqldatabase.h> +#include <QtSql/qsqlrecord.h> +#include <QtCore/qstringlist.h> +#include <QtSql/qsqlquery.h> +#include <QtSql/qsqlindex.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL + +class Q3SqlCursorPrivate; +class Q3SqlFieldInfo; + +class Q_COMPAT_EXPORT Q3SqlCursor : public QSqlRecord, public QSqlQuery +{ +public: + Q3SqlCursor(const QString & name = QString(), bool autopopulate = true, + QSqlDatabase db = QSqlDatabase()); + Q3SqlCursor(const Q3SqlCursor & other); + Q3SqlCursor& operator=(const Q3SqlCursor& other); + virtual ~Q3SqlCursor(); + + enum Mode { + ReadOnly = 0, + Insert = 1, + Update = 2, + Delete = 4, + Writable = 7 + }; + + QVariant value(int i) const; + inline QVariant value(const QString &name) const { return value(indexOf(name)); } + virtual void setValue(int i, const QVariant &val); + inline void setValue(const QString &name, const QVariant &val) { setValue(indexOf(name), val); } + virtual QSqlIndex primaryIndex(bool prime = true) const; + virtual QSqlIndex index(const QStringList& fieldNames) const; + QSqlIndex index(const QString& fieldName) const; + virtual void setPrimaryIndex(const QSqlIndex& idx); + + virtual void append(const Q3SqlFieldInfo& fieldInfo); + virtual void insert(int pos, const Q3SqlFieldInfo &fieldInfo); + virtual void remove(int pos); + virtual void clear(); + virtual void setGenerated(const QString& name, bool generated); + virtual void setGenerated(int i, bool generated); + + virtual QSqlRecord* editBuffer(bool copy = false); + virtual QSqlRecord* primeInsert(); + virtual QSqlRecord* primeUpdate(); + virtual QSqlRecord* primeDelete(); + virtual int insert(bool invalidate = true); + virtual int update(bool invalidate = true); + virtual int del(bool invalidate = true); + + virtual void setMode(int flags); + int mode() const; + virtual void setCalculated(const QString& name, bool calculated); + bool isCalculated(const QString& name) const; + virtual void setTrimmed(const QString& name, bool trim); + bool isTrimmed(const QString& name) const; + + bool isReadOnly() const; + bool canInsert() const; + bool canUpdate() const; + bool canDelete() const; + + bool select(); + bool select(const QSqlIndex& sort); + bool select(const QSqlIndex & filter, const QSqlIndex & sort); + virtual bool select(const QString & filter, const QSqlIndex & sort = QSqlIndex()); + + virtual void setSort(const QSqlIndex& sort); + QSqlIndex sort() const; + virtual void setFilter(const QString& filter); + QString filter() const; + virtual void setName(const QString& name, bool autopopulate = true); + QString name() const; + QString toString(const QString& prefix = QString(), + const QString& sep = QLatin1String(",")) const; + bool isNull(int i) const; + bool isNull(const QString& name) const; + virtual bool seek(int i, bool relative = false); + virtual bool next(); + inline bool previous() { return prev(); } + virtual bool prev(); + virtual bool first(); + virtual bool last(); + +protected: + virtual bool exec(const QString & sql); + + virtual QVariant calculateField(const QString& name); + virtual int update(const QString & filter, bool invalidate = true); + virtual int del(const QString & filter, bool invalidate = true); + + virtual QString toString(const QString& prefix, QSqlField* field, const QString& fieldSep) const; + virtual QString toString(QSqlRecord* rec, const QString& prefix, const QString& fieldSep, + const QString& sep) const; + virtual QString toString(const QSqlIndex& i, QSqlRecord* rec, const QString& prefix, + const QString& fieldSep, const QString& sep) const; + +private: + void sync(); + int apply(const QString& q, bool invalidate); + int applyPrepared(const QString& q, bool invalidate); + QSqlRecord& operator=(const QSqlRecord & list); + void append(const QSqlField& field); + + Q3SqlCursorPrivate* d; +}; + +#endif // QT_NO_SQL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SQLCURSOR_H diff --git a/qtinterface/qt4/Qt/q3sqleditorfactory.h b/qtinterface/qt4/Qt/q3sqleditorfactory.h new file mode 100644 index 0000000..ef402dc --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqleditorfactory.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLEDITORFACTORY_H +#define Q3SQLEDITORFACTORY_H + +#include <Qt3Support/q3editorfactory.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_EDIT_WIDGETS + +class QSqlField; + +class Q_COMPAT_EXPORT Q3SqlEditorFactory : public Q3EditorFactory +{ +public: + Q3SqlEditorFactory (QObject * parent = 0); + ~Q3SqlEditorFactory(); + virtual QWidget * createEditor(QWidget * parent, const QVariant & variant); + virtual QWidget * createEditor(QWidget * parent, const QSqlField * field); + + static Q3SqlEditorFactory * defaultFactory(); + static void installDefaultFactory(Q3SqlEditorFactory * factory); + +private: + Q_DISABLE_COPY(Q3SqlEditorFactory) +}; + +#endif // QT_NO_SQL_EDIT_WIDGETS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SQLEDITORFACTORY_H diff --git a/qtinterface/qt4/Qt/q3sqlfieldinfo.h b/qtinterface/qt4/Qt/q3sqlfieldinfo.h new file mode 100644 index 0000000..d0bdb6b --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqlfieldinfo.h @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLFIELDINFO_H +#define Q3SQLFIELDINFO_H + +#ifndef QT_NO_SQL + +#include <QtCore/qglobal.h> +#include <QtSql/qsqlfield.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +/* Q3SqlFieldInfo Class + obsoleted, use QSqlField instead +*/ + +class Q_COMPAT_EXPORT Q3SqlFieldInfo +{ + // class is obsoleted, won't change anyways, + // so no d pointer + int req, len, prec, tID; + uint gen: 1; + uint trim: 1; + uint calc: 1; + QString nm; + QVariant::Type typ; + QVariant defValue; + +public: + Q3SqlFieldInfo(const QString& name = QString(), + QVariant::Type typ = QVariant::Invalid, + int required = -1, + int len = -1, + int prec = -1, + const QVariant& defValue = QVariant(), + int sqlType = 0, + bool generated = true, + bool trim = false, + bool calculated = false) : + req(required), len(len), prec(prec), tID(sqlType), + gen(generated), trim(trim), calc(calculated), + nm(name), typ(typ), defValue(defValue) {} + + virtual ~Q3SqlFieldInfo() {} + + Q3SqlFieldInfo(const QSqlField & other) + { + nm = other.name(); + typ = other.type(); + switch (other.requiredStatus()) { + case QSqlField::Unknown: req = -1; break; + case QSqlField::Required: req = 1; break; + case QSqlField::Optional: req = 0; break; + } + len = other.length(); + prec = other.precision(); + defValue = other.defaultValue(); + tID = other.typeID(); + gen = other.isGenerated(); + calc = false; + trim = false; + } + + bool operator==(const Q3SqlFieldInfo& f) const + { + return (nm == f.nm && + typ == f.typ && + req == f.req && + len == f.len && + prec == f.prec && + defValue == f.defValue && + tID == f.tID && + gen == f.gen && + trim == f.trim && + calc == f.calc); + } + + QSqlField toField() const + { QSqlField f(nm, typ); + f.setRequiredStatus(QSqlField::RequiredStatus(req)); + f.setLength(len); + f.setPrecision(prec); + f.setDefaultValue(defValue); + f.setSqlType(tID); + f.setGenerated(gen); + return f; + } + int isRequired() const + { return req; } + QVariant::Type type() const + { return typ; } + int length() const + { return len; } + int precision() const + { return prec; } + QVariant defaultValue() const + { return defValue; } + QString name() const + { return nm; } + int typeID() const + { return tID; } + bool isGenerated() const + { return gen; } + bool isTrim() const + { return trim; } + bool isCalculated() const + { return calc; } + + virtual void setTrim(bool trim) + { this->trim = trim; } + virtual void setGenerated(bool generated) + { gen = generated; } + virtual void setCalculated(bool calculated) + { calc = calculated; } + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SQL + +#endif // Q3SQLFIELDINFO_H diff --git a/qtinterface/qt4/Qt/q3sqlform.h b/qtinterface/qt4/Qt/q3sqlform.h new file mode 100644 index 0000000..dc3ba58 --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqlform.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLFORM_H +#define Q3SQLFORM_H + +#include <QtCore/qobject.h> +#include <QtCore/qmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_FORM + +class QSqlField; +class QSqlRecord; +class Q3SqlEditorFactory; +class Q3SqlPropertyMap; +class QWidget; +class Q3SqlFormPrivate; + +class Q_COMPAT_EXPORT Q3SqlForm : public QObject +{ + Q_OBJECT +public: + Q3SqlForm(QObject * parent = 0); + ~Q3SqlForm(); + + virtual void insert(QWidget * widget, const QString& field); + virtual void remove(const QString& field); + int count() const; + + QWidget * widget(int i) const; + QSqlField * widgetToField(QWidget * widget) const; + QWidget * fieldToWidget(QSqlField * field) const; + + void installPropertyMap(Q3SqlPropertyMap * map); + + virtual void setRecord(QSqlRecord* buf); + +public Q_SLOTS: + virtual void readField(QWidget * widget); + virtual void writeField(QWidget * widget); + virtual void readFields(); + virtual void writeFields(); + + virtual void clear(); + virtual void clearValues(); + +protected: + virtual void insert(QWidget * widget, QSqlField * field); + virtual void remove(QWidget * widget); + void clearMap(); + +private: + Q_DISABLE_COPY(Q3SqlForm) + + virtual void sync(); + Q3SqlFormPrivate* d; +}; + +#endif // QT_NO_SQL_FORM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SQLFORM_H diff --git a/qtinterface/qt4/Qt/q3sqlpropertymap.h b/qtinterface/qt4/Qt/q3sqlpropertymap.h new file mode 100644 index 0000000..96b5aea --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqlpropertymap.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLPROPERTYMAP_H +#define Q3SQLPROPERTYMAP_H + +#include <QtCore/qvariant.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL_FORM + +class QWidget; +class Q3SqlPropertyMapPrivate; + +class Q_COMPAT_EXPORT Q3SqlPropertyMap +{ +public: + Q3SqlPropertyMap(); + virtual ~Q3SqlPropertyMap(); + + QVariant property(QWidget * widget); + virtual void setProperty(QWidget * widget, const QVariant & value); + + void insert(const QString & classname, const QString & property); + void remove(const QString & classname); + + static Q3SqlPropertyMap * defaultMap(); + static void installDefaultMap(Q3SqlPropertyMap * map); + +private: + Q_DISABLE_COPY(Q3SqlPropertyMap) + + Q3SqlPropertyMapPrivate* d; +}; + +#endif // QT_NO_SQL_FORM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SQLPROPERTYMAP_H diff --git a/qtinterface/qt4/Qt/q3sqlrecordinfo.h b/qtinterface/qt4/Qt/q3sqlrecordinfo.h new file mode 100644 index 0000000..5c42201 --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqlrecordinfo.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLRECORDINFO_H +#define Q3SQLRECORDINFO_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_SQL +# include <Qt3Support/q3valuelist.h> +# include <QtSql/qsqlrecord.h> +# include <Qt3Support/q3sqlfieldinfo.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL + +/* Q3SqlRecordInfo Class + This class is obsolete, use QSqlRecord instead. +*/ + +typedef Q3ValueList<Q3SqlFieldInfo> Q3SqlFieldInfoList; + +class Q_COMPAT_EXPORT Q3SqlRecordInfo: public Q3SqlFieldInfoList +{ +public: + Q3SqlRecordInfo(): Q3SqlFieldInfoList() {} + Q3SqlRecordInfo(const Q3SqlFieldInfoList& other): Q3SqlFieldInfoList(other) {} + Q3SqlRecordInfo(const QSqlRecord& other) + { + for (int i = 0; i < other.count(); ++i) + push_back(Q3SqlFieldInfo(other.field(i))); + } + + size_type contains(const QString& fieldName) const; + Q3SqlFieldInfo find(const QString& fieldName) const; + QSqlRecord toRecord() const; +}; + +inline Q3SqlRecordInfo::size_type Q3SqlRecordInfo::contains(const QString& fieldName) const +{ + size_type i = 0; + QString fName = fieldName.toUpper(); + + for(const_iterator it = begin(); it != end(); ++it) { + if ((*it).name().toUpper() == fName) { + ++i; + } + } + return i; +} + +inline Q3SqlFieldInfo Q3SqlRecordInfo::find(const QString& fieldName) const +{ + QString fName = fieldName.toUpper(); + for(const_iterator it = begin(); it != end(); ++it) { + if ((*it).name().toUpper() == fName) { + return *it; + } + } + return Q3SqlFieldInfo(); +} + +inline QSqlRecord Q3SqlRecordInfo::toRecord() const +{ + QSqlRecord buf; + for(const_iterator it = begin(); it != end(); ++it) { + buf.append((*it).toField()); + } + return buf; +} + +#endif // QT_NO_SQL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SQLRECORDINFO_H diff --git a/qtinterface/qt4/Qt/q3sqlselectcursor.h b/qtinterface/qt4/Qt/q3sqlselectcursor.h new file mode 100644 index 0000000..8165a7e --- /dev/null +++ b/qtinterface/qt4/Qt/q3sqlselectcursor.h @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SQLSELECTCURSOR_H +#define Q3SQLSELECTCURSOR_H + +#include <Qt3Support/q3sqlcursor.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +#ifndef QT_NO_SQL + +class Q3SqlSelectCursorPrivate; + +class Q_COMPAT_EXPORT Q3SqlSelectCursor : public Q3SqlCursor +{ +public: + Q3SqlSelectCursor(const QString& query = QString(), QSqlDatabase db = QSqlDatabase()); + Q3SqlSelectCursor(const Q3SqlSelectCursor& other); + ~Q3SqlSelectCursor(); + bool exec(const QString& query); + bool select() { return Q3SqlCursor::select(); } + +protected: + QSqlIndex primaryIndex(bool = true) const { return QSqlIndex(); } + QSqlIndex index(const QStringList&) const { return QSqlIndex(); } + QSqlIndex index(const QString&) const { return QSqlIndex(); } + QSqlIndex index(const char*) const { return QSqlIndex(); } + void setPrimaryIndex(const QSqlIndex&) {} + void append(const Q3SqlFieldInfo&) {} + void insert(int, const Q3SqlFieldInfo&) {} + void remove(int) {} + void clear() {} + void setGenerated(const QString&, bool) {} + void setGenerated(int, bool) {} + QSqlRecord* editBuffer(bool = false) { return 0; } + QSqlRecord* primeInsert() { return 0; } + QSqlRecord* primeUpdate() { return 0; } + QSqlRecord* primeDelete() { return 0; } + int insert(bool = true) { return 0; } + int update(bool = true) { return 0; } + int del(bool = true) { return 0; } + void setMode(int) {} + + void setSort(const QSqlIndex&) {} + QSqlIndex sort() const { return QSqlIndex(); } + void setFilter(const QString&) {} + QString filter() const { return QString(); } + void setName(const QString&, bool = true) {} + QString name() const { return QString(); } + QString toString(const QString& = QString(), const QString& = QLatin1String(",")) const { return QString(); } + bool select(const QString &, const QSqlIndex& = QSqlIndex()); + +private: + void populateCursor(); + + Q3SqlSelectCursorPrivate * d; + +protected: +#if !defined(Q_NO_USING_KEYWORD) + using Q3SqlCursor::update; +#else + virtual int update(const QString & filter, bool invalidate = true) { return Q3SqlCursor::update(filter, invalidate); } +#endif +}; + +#endif // QT_NO_SQL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SQLSELECTCURSOR_H diff --git a/qtinterface/qt4/Qt/q3strlist.h b/qtinterface/qt4/Qt/q3strlist.h new file mode 100644 index 0000000..91c6a78 --- /dev/null +++ b/qtinterface/qt4/Qt/q3strlist.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3STRLIST_H +#define Q3STRLIST_H + +#include <QtCore/qstring.h> +#include <Qt3Support/q3ptrlist.h> +#include <QtCore/qdatastream.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#if defined(qdoc) +class Q3StrListIterator : public Q3PtrListIterator<char> +{ +}; +#else +typedef Q3PtrListIterator<char> Q3StrListIterator; +#endif + +class Q_COMPAT_EXPORT Q3StrList : public Q3PtrList<char> +{ +public: + Q3StrList( bool deepCopies=true ) { dc = deepCopies; del_item = deepCopies; } + Q3StrList( const Q3StrList & ); + ~Q3StrList() { clear(); } + Q3StrList& operator=( const Q3StrList & ); + Q3StrList(const QList<QByteArray> &list) { + for (int i = 0; i < list.size(); ++i) + append(list.at(i).constData()); + } + + Q3StrList &operator =(const QList<QByteArray> &list) { + clear(); + for (int i = 0; i < list.size(); ++i) + append(list.at(i).constData()); + return *this; + } + + operator QList<QByteArray>() const { + QList<QByteArray> list; + for (Q3PtrListStdIterator<char> it = begin(); it != end(); ++it) + list.append(QByteArray(*it)); + return list; + } + +private: + Q3PtrCollection::Item newItem( Q3PtrCollection::Item d ) { return dc ? qstrdup( (const char*)d ) : d; } + void deleteItem( Q3PtrCollection::Item d ) { if ( del_item ) delete[] (char*)d; } + int compareItems( Q3PtrCollection::Item s1, Q3PtrCollection::Item s2 ) { return qstrcmp((const char*)s1, + (const char*)s2); } +#ifndef QT_NO_DATASTREAM + QDataStream &read( QDataStream &s, Q3PtrCollection::Item &d ) + { s >> (char *&)d; return s; } + QDataStream &write( QDataStream &s, Q3PtrCollection::Item d ) const + { return s << (const char *)d; } +#endif + bool dc; +}; + + +class Q_COMPAT_EXPORT Q3StrIList : public Q3StrList // case insensitive string list +{ +public: + Q3StrIList( bool deepCopies=true ) : Q3StrList( deepCopies ) {} + ~Q3StrIList() { clear(); } +private: + int compareItems( Q3PtrCollection::Item s1, Q3PtrCollection::Item s2 ) + { return qstricmp((const char*)s1, + (const char*)s2); } +}; + + +inline Q3StrList & Q3StrList::operator=( const Q3StrList &strList ) +{ + clear(); + dc = strList.dc; + del_item = dc; + Q3PtrList<char>::operator=( strList ); + return *this; +} + +inline Q3StrList::Q3StrList( const Q3StrList &strList ) + : Q3PtrList<char>( strList ) +{ + dc = false; + operator=( strList ); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3STRLIST_H diff --git a/qtinterface/qt4/Qt/q3strvec.h b/qtinterface/qt4/Qt/q3strvec.h new file mode 100644 index 0000000..e66b2d6 --- /dev/null +++ b/qtinterface/qt4/Qt/q3strvec.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3STRVEC_H +#define Q3STRVEC_H + +#include <QtCore/qstring.h> +#include <Qt3Support/q3ptrvector.h> +#include <QtCore/qdatastream.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3StrVec : public Q3PtrVector<char> +{ +public: + Q3StrVec() { dc = true; } + Q3StrVec( uint size, bool deepc = true ) : Q3PtrVector<char>(size) {dc=deepc;} + ~Q3StrVec() { clear(); } +private: + Item newItem( Item d ) { return dc ? qstrdup( (const char*)d ) : d; } + void deleteItem( Item d ) { if ( dc ) delete[] (char*)d; } + int compareItems( Item s1, Item s2 ) + { return qstrcmp((const char*)s1, + (const char*)s2); } +#ifndef QT_NO_DATASTREAM + QDataStream &read( QDataStream &s, Item &d ) + { s >> (char *&)d; return s; } + QDataStream &write( QDataStream &s, Item d ) const + { return s << (const char*)d; } +#endif + bool dc; +}; + + +class Q3StrIVec : public Q3StrVec // case insensitive string vec +{ +public: + Q3StrIVec() {} + Q3StrIVec( uint size, bool dc = true ) : Q3StrVec( size, dc ) {} + ~Q3StrIVec() { clear(); } +private: + int compareItems( Item s1, Item s2 ) + { return qstricmp((const char*)s1, + (const char*)s2); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3STRVEC_H diff --git a/qtinterface/qt4/Qt/q3stylesheet.h b/qtinterface/qt4/Qt/q3stylesheet.h new file mode 100644 index 0000000..dbbf03b --- /dev/null +++ b/qtinterface/qt4/Qt/q3stylesheet.h @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3STYLESHEET_H +#define Q3STYLESHEET_H + +#include <QtCore/qstring.h> +#include <QtCore/qlist.h> +#include <QtCore/qhash.h> +#include <QtCore/qobject.h> +#include <QtGui/qcolor.h> +#include <QtGui/qfont.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_RICHTEXT + +class Q3StyleSheet; +class Q3TextDocument; +template<class Key, class T> class QMap; +class Q3StyleSheetItemData; + +class Q_COMPAT_EXPORT Q3StyleSheetItem +{ +public: + Q3StyleSheetItem(Q3StyleSheet* parent, const QString& name); + Q3StyleSheetItem(const Q3StyleSheetItem &); + ~Q3StyleSheetItem(); + + Q3StyleSheetItem& operator=(const Q3StyleSheetItem& other); + + QString name() const; + + Q3StyleSheet* styleSheet(); + const Q3StyleSheet* styleSheet() const; + + enum AdditionalStyleValues { Undefined = -1 }; + + enum DisplayMode { + DisplayBlock, + DisplayInline, + DisplayListItem, + DisplayNone, + DisplayModeUndefined = -1 + }; + + DisplayMode displayMode() const; + void setDisplayMode(DisplayMode m); + + int alignment() const; + void setAlignment(int f); + + enum VerticalAlignment { + VAlignBaseline, + VAlignSub, + VAlignSuper + }; + + VerticalAlignment verticalAlignment() const; + void setVerticalAlignment(VerticalAlignment valign); + + int fontWeight() const; + void setFontWeight(int w); + + int logicalFontSize() const; + void setLogicalFontSize(int s); + + int logicalFontSizeStep() const; + void setLogicalFontSizeStep(int s); + + int fontSize() const; + void setFontSize(int s); + + QString fontFamily() const; + void setFontFamily(const QString&); + + int numberOfColumns() const; + void setNumberOfColumns(int ncols); + + QColor color() const; + void setColor(const QColor &); + + bool fontItalic() const; + void setFontItalic(bool); + bool definesFontItalic() const; + + bool fontUnderline() const; + void setFontUnderline(bool); + bool definesFontUnderline() const; + + bool fontStrikeOut() const; + void setFontStrikeOut(bool); + bool definesFontStrikeOut() const; + + bool isAnchor() const; + void setAnchor(bool anc); + + enum WhiteSpaceMode { + WhiteSpaceNormal, + WhiteSpacePre, + WhiteSpaceNoWrap, + WhiteSpaceModeUndefined = -1 + }; + WhiteSpaceMode whiteSpaceMode() const; + void setWhiteSpaceMode(WhiteSpaceMode m); + + enum Margin { + MarginLeft, + MarginRight, + MarginTop, + MarginBottom, + MarginFirstLine, + MarginAll, + MarginVertical, + MarginHorizontal, + MarginUndefined = -1 + }; + + int margin(Margin m) const; + void setMargin(Margin, int); + + enum ListStyle { + ListDisc, + ListCircle, + ListSquare, + ListDecimal, + ListLowerAlpha, + ListUpperAlpha, + ListStyleUndefined = -1 + }; + + ListStyle listStyle() const; + void setListStyle(ListStyle); + + QString contexts() const; + void setContexts(const QString&); + bool allowedInContext(const Q3StyleSheetItem*) const; + + bool selfNesting() const; + void setSelfNesting(bool); + + void setLineSpacing(int ls); + int lineSpacing() const; + +private: + void init(); + Q3StyleSheetItemData* d; +}; + +#ifndef QT_NO_TEXTCUSTOMITEM +class Q3TextCustomItem; +#endif + +class Q_COMPAT_EXPORT Q3StyleSheet : public QObject +{ + Q_OBJECT +public: + Q3StyleSheet(QObject *parent=0, const char *name=0); + virtual ~Q3StyleSheet(); + + static Q3StyleSheet* defaultSheet(); + static void setDefaultSheet(Q3StyleSheet*); + + + Q3StyleSheetItem* item(const QString& name); + const Q3StyleSheetItem* item(const QString& name) const; + + void insert(Q3StyleSheetItem* item); + + static QString escape(const QString&); + static QString convertFromPlainText(const QString&, + Q3StyleSheetItem::WhiteSpaceMode mode = Q3StyleSheetItem::WhiteSpacePre); + static bool mightBeRichText(const QString&); + + virtual void scaleFont(QFont& font, int logicalSize) const; + + virtual void error(const QString&) const; + +private: + Q_DISABLE_COPY(Q3StyleSheet) + + void init(); + QHash<QString, Q3StyleSheetItem *> styles; + Q3StyleSheetItem* nullstyle; +}; + +#endif // QT_NO_RICHTEXT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3STYLESHEET_H diff --git a/qtinterface/qt4/Qt/q3syntaxhighlighter.h b/qtinterface/qt4/Qt/q3syntaxhighlighter.h new file mode 100644 index 0000000..2cf5a0a --- /dev/null +++ b/qtinterface/qt4/Qt/q3syntaxhighlighter.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3SYNTAXHIGHLIGHTER_H +#define Q3SYNTAXHIGHLIGHTER_H + +#include <QtGui/qfont.h> +#include <QtGui/qcolor.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3TextEdit; +class Q3SyntaxHighlighterInternal; +class Q3SyntaxHighlighterPrivate; +class Q3TextParagraph; + +class Q_COMPAT_EXPORT Q3SyntaxHighlighter +{ + friend class Q3SyntaxHighlighterInternal; + +public: + Q3SyntaxHighlighter(Q3TextEdit *textEdit); + virtual ~Q3SyntaxHighlighter(); + + virtual int highlightParagraph(const QString &text, int endStateOfLastPara) = 0; + + void setFormat(int start, int count, const QFont &font, const QColor &color); + void setFormat(int start, int count, const QColor &color); + void setFormat(int start, int count, const QFont &font); + Q3TextEdit *textEdit() const { return edit; } + + void rehighlight(); + + int currentParagraph() const; + +private: + Q3TextParagraph *para; + Q3TextEdit *edit; + Q3SyntaxHighlighterPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3SYNTAXHIGHLIGHTER_H diff --git a/qtinterface/qt4/Qt/q3tabdialog.h b/qtinterface/qt4/Qt/q3tabdialog.h new file mode 100644 index 0000000..ec3011c --- /dev/null +++ b/qtinterface/qt4/Qt/q3tabdialog.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TABDIALOG_H +#define Q3TABDIALOG_H + +#include <QtGui/qdialog.h> +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QTabBar; +class QTab; +class Q3TabDialogPrivate; + +class Q_COMPAT_EXPORT Q3TabDialog : public QDialog +{ + Q_OBJECT +public: + Q3TabDialog(QWidget* parent=0, const char* name=0, bool modal=false, Qt::WindowFlags f=0); + ~Q3TabDialog(); + + void show(); + void setFont(const QFont & font); + + void addTab(QWidget *, const QString &); + void addTab(QWidget *child, const QIcon& iconset, const QString &label); + + void insertTab(QWidget *, const QString &, int index = -1); + void insertTab(QWidget *child, const QIcon& iconset, const QString &label, int index = -1); + + void changeTab(QWidget *, const QString &); + void changeTab(QWidget *child, const QIcon& iconset, const QString &label); + + bool isTabEnabled( QWidget *) const; + void setTabEnabled(QWidget *, bool); + bool isTabEnabled(const char*) const; // compatibility + void setTabEnabled(const char*, bool); // compatibility + + void showPage(QWidget *); + void removePage(QWidget *); + QString tabLabel(QWidget *); + + QWidget * currentPage() const; + + void setDefaultButton(const QString &text); + void setDefaultButton(); + bool hasDefaultButton() const; + + void setHelpButton(const QString &text); + void setHelpButton(); + bool hasHelpButton() const; + + void setCancelButton(const QString &text); + void setCancelButton(); + bool hasCancelButton() const; + + void setApplyButton(const QString &text); + void setApplyButton(); + bool hasApplyButton() const; + +#ifndef qdoc + void setOKButton(const QString &text = QString()); +#endif + void setOkButton(const QString &text); + void setOkButton(); + bool hasOkButton() const; + +protected: + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + void showEvent(QShowEvent *); + void styleChange(QStyle&); + void setTabBar(QTabBar*); + QTabBar* tabBar() const; + +Q_SIGNALS: + void aboutToShow(); + + void applyButtonPressed(); + void cancelButtonPressed(); + void defaultButtonPressed(); + void helpButtonPressed(); + + void currentChanged(QWidget *); + void selected(const QString&); // obsolete + +private: + void setSizes(); + void setUpLayout(); + + Q3TabDialogPrivate *d; + + Q_DISABLE_COPY(Q3TabDialog) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TABDIALOG_H diff --git a/qtinterface/qt4/Qt/q3table.h b/qtinterface/qt4/Qt/q3table.h new file mode 100644 index 0000000..70520b7 --- /dev/null +++ b/qtinterface/qt4/Qt/q3table.h @@ -0,0 +1,548 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TABLE_H +#define Q3TABLE_H + +#include <Qt3Support/q3scrollview.h> +#include <QtGui/qpixmap.h> +#include <Qt3Support/q3ptrvector.h> +#include <Qt3Support/q3header.h> +#include <Qt3Support/q3memarray.h> +#include <Qt3Support/q3ptrlist.h> +#include <Qt3Support/q3shared.h> +#include <Qt3Support/q3intdict.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +class Q3TableHeader; +class QValidator; +class Q3Table; +class QPaintEvent; +class QTimer; +class QResizeEvent; +class Q3ComboBox; +class QCheckBox; +class Q3DragObject; +class QColorGroup; + +struct Q3TablePrivate; +struct Q3TableHeaderPrivate; + + +class Q_COMPAT_EXPORT Q3TableSelection +{ +public: + Q3TableSelection(); + Q3TableSelection(int start_row, int start_col, int end_row, int end_col); + void init(int row, int col); + void expandTo(int row, int col); + bool operator==(const Q3TableSelection &s) const; + bool operator!=(const Q3TableSelection &s) const { return !(operator==(s)); } + + int topRow() const { return tRow; } + int bottomRow() const { return bRow; } + int leftCol() const { return lCol; } + int rightCol() const { return rCol; } + int anchorRow() const { return aRow; } + int anchorCol() const { return aCol; } + int numRows() const; + int numCols() const; + + bool isActive() const { return active; } + bool isEmpty() const { return numRows() == 0; } + +private: + uint active : 1; + uint inited : 1; + int tRow, lCol, bRow, rCol; + int aRow, aCol; +}; + +class Q_COMPAT_EXPORT Q3TableItem +{ + friend class Q3Table; + +public: + enum EditType { Never, OnTyping, WhenCurrent, Always }; + + Q3TableItem(Q3Table *table, EditType et); + Q3TableItem(Q3Table *table, EditType et, const QString &text); + Q3TableItem(Q3Table *table, EditType et, const QString &text, + const QPixmap &p); + virtual ~Q3TableItem(); + + virtual QPixmap pixmap() const; + virtual QString text() const; + virtual void setPixmap(const QPixmap &p); + virtual void setText(const QString &t); + Q3Table *table() const { return t; } + + virtual int alignment() const; + virtual void setWordWrap(bool b); + bool wordWrap() const; + + EditType editType() const; + virtual QWidget *createEditor() const; + virtual void setContentFromEditor(QWidget *w); + virtual void setReplaceable(bool); + bool isReplaceable() const; + + virtual QString key() const; + virtual QSize sizeHint() const; + + virtual void setSpan(int rs, int cs); + int rowSpan() const; + int colSpan() const; + + virtual void setRow(int r); + virtual void setCol(int c); + int row() const; + int col() const; + + virtual void paint(QPainter *p, const QColorGroup &cg, + const QRect &cr, bool selected); + + void updateEditor(int oldRow, int oldCol); + + virtual void setEnabled(bool b); + bool isEnabled() const; + + virtual int rtti() const; + static int RTTI; + +private: + QString txt; + QPixmap pix; + Q3Table *t; + EditType edType; + uint wordwrap : 1; + uint tcha : 1; + uint enabled : 1; + int rw, cl; + int rowspan, colspan; +}; + +class Q_COMPAT_EXPORT Q3ComboTableItem : public Q3TableItem +{ +public: + Q3ComboTableItem(Q3Table *table, const QStringList &list, bool editable = false); + ~Q3ComboTableItem(); + virtual QWidget *createEditor() const; + virtual void setContentFromEditor(QWidget *w); + virtual void paint(QPainter *p, const QColorGroup &cg, + const QRect &cr, bool selected); + virtual void setCurrentItem(int i); + virtual void setCurrentItem(const QString &i); + int currentItem() const; + QString currentText() const; + int count() const; +#if !defined(Q_NO_USING_KEYWORD) + using Q3TableItem::text; +#else + inline QString text() const { return Q3TableItem::text(); } +#endif + QString text(int i) const; + virtual void setEditable(bool b); + bool isEditable() const; + virtual void setStringList(const QStringList &l); + + int rtti() const; + static int RTTI; + + QSize sizeHint() const; + +private: + Q3ComboBox *cb; + QStringList entries; + int current; + bool edit; + static Q3ComboBox *fakeCombo; + static QWidget *fakeComboWidget; + static int fakeRef; + +}; + +class Q_COMPAT_EXPORT Q3CheckTableItem : public Q3TableItem +{ +public: + Q3CheckTableItem(Q3Table *table, const QString &txt); + void setText(const QString &t); + virtual QWidget *createEditor() const; + virtual void setContentFromEditor(QWidget *w); + virtual void paint(QPainter *p, const QColorGroup &cg, + const QRect &cr, bool selected); + virtual void setChecked(bool b); + bool isChecked() const; + + int rtti() const; + static int RTTI; + + QSize sizeHint() const; + +private: + QCheckBox *cb; + bool checked; + +}; + +class Q_COMPAT_EXPORT Q3Table : public Q3ScrollView +{ + Q_OBJECT + Q_ENUMS(SelectionMode FocusStyle) + Q_PROPERTY(int numRows READ numRows WRITE setNumRows) + Q_PROPERTY(int numCols READ numCols WRITE setNumCols) + Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid) + Q_PROPERTY(bool rowMovingEnabled READ rowMovingEnabled WRITE setRowMovingEnabled) + Q_PROPERTY(bool columnMovingEnabled READ columnMovingEnabled WRITE setColumnMovingEnabled) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool sorting READ sorting WRITE setSorting) + Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) + Q_PROPERTY(FocusStyle focusStyle READ focusStyle WRITE setFocusStyle) + Q_PROPERTY(int numSelections READ numSelections) + + friend class Q3TableHeader; + friend class Q3ComboTableItem; + friend class Q3CheckTableItem; + friend class Q3TableItem; + +public: + Q3Table(QWidget* parent=0, const char* name=0); + Q3Table(int numRows, int numCols, + QWidget* parent=0, const char* name=0); + ~Q3Table(); + + Q3Header *horizontalHeader() const; + Q3Header *verticalHeader() const; + + enum SelectionMode { Single, Multi, SingleRow, MultiRow, NoSelection }; + virtual void setSelectionMode(SelectionMode mode); + SelectionMode selectionMode() const; + + virtual void setItem(int row, int col, Q3TableItem *item); + virtual void setText(int row, int col, const QString &text); + virtual void setPixmap(int row, int col, const QPixmap &pix); + virtual Q3TableItem *item(int row, int col) const; + virtual QString text(int row, int col) const; + virtual QPixmap pixmap(int row, int col) const; + virtual void clearCell(int row, int col); + + virtual QRect cellGeometry(int row, int col) const; + virtual int columnWidth(int col) const; + virtual int rowHeight(int row) const; + virtual int columnPos(int col) const; + virtual int rowPos(int row) const; + virtual int columnAt(int x) const; + virtual int rowAt(int y) const; + + virtual int numRows() const; + virtual int numCols() const; + + void updateCell(int row, int col); + + bool eventFilter(QObject * o, QEvent *); + + int currentRow() const { return curRow; } + int currentColumn() const { return curCol; } + void ensureCellVisible(int row, int col); + + bool isSelected(int row, int col) const; + bool isRowSelected(int row, bool full = false) const; + bool isColumnSelected(int col, bool full = false) const; + int numSelections() const; + Q3TableSelection selection(int num) const; + virtual int addSelection(const Q3TableSelection &s); + virtual void removeSelection(const Q3TableSelection &s); + virtual void removeSelection(int num); + virtual int currentSelection() const; + + void selectCells(int start_row, int start_col, int end_row, int end_col); + virtual void selectRow(int row); + virtual void selectColumn(int col); + + bool showGrid() const; + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + bool columnMovingEnabled() const; + bool rowMovingEnabled() const; + + virtual void sortColumn(int col, bool ascending = true, + bool wholeRows = false); + bool sorting() const; + + virtual void takeItem(Q3TableItem *i); + + virtual void setCellWidget(int row, int col, QWidget *e); + virtual QWidget *cellWidget(int row, int col) const; + virtual void clearCellWidget(int row, int col); + + virtual QRect cellRect(int row, int col) const; + + virtual void paintCell(QPainter *p, int row, int col, + const QRect &cr, bool selected); + virtual void paintCell(QPainter *p, int row, int col, + const QRect &cr, bool selected, const QColorGroup &cg); + virtual void paintFocus(QPainter *p, const QRect &r); + QSize sizeHint() const; + + bool isReadOnly() const; + bool isRowReadOnly(int row) const; + bool isColumnReadOnly(int col) const; + + void setEnabled(bool b); + + void repaintSelections(); + + enum FocusStyle { FollowStyle, SpreadSheet }; + virtual void setFocusStyle(FocusStyle fs); + FocusStyle focusStyle() const; + + void updateHeaderStates(); + + bool isRowHidden(int row) const; + bool isColumnHidden(int col) const; + bool isColumnStretchable(int col) const; + bool isRowStretchable(int row) const; + bool dragEnabled() const; + +public Q_SLOTS: + virtual void setNumRows(int r); + virtual void setNumCols(int r); + virtual void setShowGrid(bool b); + virtual void hideRow(int row); + virtual void hideColumn(int col); + virtual void showRow(int row); + virtual void showColumn(int col); + + virtual void setColumnWidth(int col, int w); + virtual void setRowHeight(int row, int h); + + virtual void adjustColumn(int col); + virtual void adjustRow(int row); + + virtual void setColumnStretchable(int col, bool stretch); + virtual void setRowStretchable(int row, bool stretch); + virtual void setSorting(bool b); + virtual void swapRows(int row1, int row2, bool swapHeader = false); + virtual void swapColumns(int col1, int col2, bool swapHeader = false); + virtual void swapCells(int row1, int col1, int row2, int col2); + + virtual void setLeftMargin(int m); + virtual void setTopMargin(int m); + virtual void setCurrentCell(int row, int col); + void clearSelection(bool repaint = true); + virtual void setColumnMovingEnabled(bool b); + virtual void setRowMovingEnabled(bool b); + + virtual void setReadOnly(bool b); + virtual void setRowReadOnly(int row, bool ro); + virtual void setColumnReadOnly(int col, bool ro); + + virtual void setDragEnabled(bool b); + + virtual void insertRows(int row, int count = 1); + virtual void insertColumns(int col, int count = 1); + virtual void removeRow(int row); + virtual void removeRows(const Q3MemArray<int> &rows); + virtual void removeColumn(int col); + virtual void removeColumns(const Q3MemArray<int> &cols); + + virtual void editCell(int row, int col, bool replace = false); + + void setRowLabels(const QStringList &labels); + void setColumnLabels(const QStringList &labels); + +protected: + enum EditMode { NotEditing, Editing, Replacing }; + void drawContents(QPainter *p, int cx, int cy, int cw, int ch); + void contentsMousePressEvent(QMouseEvent*); + void contentsMouseMoveEvent(QMouseEvent*); + void contentsMouseDoubleClickEvent(QMouseEvent*); + void contentsMouseReleaseEvent(QMouseEvent*); + void contentsContextMenuEvent(QContextMenuEvent * e); + void keyPressEvent(QKeyEvent*); + void focusInEvent(QFocusEvent*); + void focusOutEvent(QFocusEvent*); + void viewportResizeEvent(QResizeEvent *); + void showEvent(QShowEvent *e); + void paintEvent(QPaintEvent *e); + void setEditMode(EditMode mode, int row, int col); +#ifndef QT_NO_DRAGANDDROP + virtual void contentsDragEnterEvent(QDragEnterEvent *e); + virtual void contentsDragMoveEvent(QDragMoveEvent *e); + virtual void contentsDragLeaveEvent(QDragLeaveEvent *e); + virtual void contentsDropEvent(QDropEvent *e); + virtual Q3DragObject *dragObject(); + virtual void startDrag(); +#endif + + virtual void paintEmptyArea(QPainter *p, int cx, int cy, int cw, int ch); + virtual void activateNextCell(); + virtual QWidget *createEditor(int row, int col, bool initFromCell) const; + virtual void setCellContentFromEditor(int row, int col); + virtual QWidget *beginEdit(int row, int col, bool replace); + virtual void endEdit(int row, int col, bool accept, bool replace); + + virtual void resizeData(int len); + virtual void insertWidget(int row, int col, QWidget *w); + int indexOf(int row, int col) const; + + void windowActivationChange(bool); + bool isEditing() const; + EditMode editMode() const; + int currEditRow() const; + int currEditCol() const; + +protected Q_SLOTS: + virtual void columnWidthChanged(int col); + virtual void rowHeightChanged(int row); + virtual void columnIndexChanged(int section, int fromIndex, int toIndex); + virtual void rowIndexChanged(int section, int fromIndex, int toIndex); + virtual void columnClicked(int col); + +Q_SIGNALS: + void currentChanged(int row, int col); + void clicked(int row, int col, int button, const QPoint &mousePos); + void doubleClicked(int row, int col, int button, const QPoint &mousePos); + void pressed(int row, int col, int button, const QPoint &mousePos); + void selectionChanged(); + void valueChanged(int row, int col); + void contextMenuRequested(int row, int col, const QPoint &pos); +#ifndef QT_NO_DRAGANDDROP + void dropped(QDropEvent *e); +#endif + +private Q_SLOTS: + void doAutoScroll(); + void doValueChanged(); + void updateGeometriesSlot(); + +private: + void contentsMousePressEventEx(QMouseEvent*); + void drawContents(QPainter*); + void updateGeometries(); + void repaintSelections(Q3TableSelection *oldSelection, + Q3TableSelection *newSelection, + bool updateVertical = true, + bool updateHorizontal = true); + QRect rangeGeometry(int topRow, int leftCol, + int bottomRow, int rightCol, bool &optimize); + void fixRow(int &row, int y); + void fixCol(int &col, int x); + + void init(int numRows, int numCols); + QSize tableSize() const; + void repaintCell(int row, int col); + void contentsToViewport2(int x, int y, int& vx, int& vy); + QPoint contentsToViewport2(const QPoint &p); + void viewportToContents2(int vx, int vy, int& x, int& y); + QPoint viewportToContents2(const QPoint &p); + + void updateRowWidgets(int row); + void updateColWidgets(int col); + bool isSelected(int row, int col, bool includeCurrent) const; + void setCurrentCell(int row, int col, bool updateSelections, bool ensureVisible = false); + void fixCell(int &row, int &col, int key); + void delayedUpdateGeometries(); + struct TableWidget + { + TableWidget(QWidget *w, int r, int c) : wid(w), row(r), col (c) {} + QWidget *wid; + int row, col; + }; + void saveContents(Q3PtrVector<Q3TableItem> &tmp, + Q3PtrVector<TableWidget> &tmp2); + void updateHeaderAndResizeContents(Q3TableHeader *header, + int num, int colRow, + int width, bool &updateBefore); + void restoreContents(Q3PtrVector<Q3TableItem> &tmp, + Q3PtrVector<TableWidget> &tmp2); + void finishContentsResze(bool updateBefore); + +private: + Q3PtrVector<Q3TableItem> contents; + Q3PtrVector<QWidget> widgets; + int curRow; + int curCol; + Q3TableHeader *leftHeader, *topHeader; + EditMode edMode; + int editCol, editRow; + Q3PtrList<Q3TableSelection> selections; + Q3TableSelection *currentSel; + QTimer *autoScrollTimer; + int lastSortCol; + bool sGrid : 1; + bool mRows : 1; + bool mCols : 1; + bool asc : 1; + bool doSort : 1; + bool unused : 1; + bool readOnly : 1; + bool shouldClearSelection : 1; + bool dEnabled : 1; + bool context_menu : 1; + bool drawActiveSelection : 1; + bool was_visible : 1; + SelectionMode selMode; + int pressedRow, pressedCol; + Q3TablePrivate *d; + Q3IntDict<int> roRows; + Q3IntDict<int> roCols; + int startDragRow; + int startDragCol; + QPoint dragStartPos; + int oldCurrentRow, oldCurrentCol; + FocusStyle focusStl; + + Q_DISABLE_COPY(Q3Table) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TABLE_H diff --git a/qtinterface/qt4/Qt/q3textbrowser.h b/qtinterface/qt4/Qt/q3textbrowser.h new file mode 100644 index 0000000..d6c015d --- /dev/null +++ b/qtinterface/qt4/Qt/q3textbrowser.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TEXTBROWSER_H +#define Q3TEXTBROWSER_H + +#include <QtGui/qpixmap.h> +#include <QtGui/qcolor.h> +#include <Qt3Support/q3textedit.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_TEXTBROWSER + +class Q3TextBrowserData; + +class Q_COMPAT_EXPORT Q3TextBrowser : public Q3TextEdit +{ + Q_OBJECT + Q_PROPERTY(QString source READ source WRITE setSource) + + friend class Q3TextEdit; + +public: + Q3TextBrowser(QWidget* parent=0, const char* name=0); + ~Q3TextBrowser(); + + QString source() const; + +public Q_SLOTS: + virtual void setSource(const QString& name); + virtual void backward(); + virtual void forward(); + virtual void home(); + virtual void reload(); + void setText(const QString &txt) { setText(txt, QString()); } + virtual void setText(const QString &txt, const QString &context); + +Q_SIGNALS: + void backwardAvailable(bool); + void forwardAvailable(bool); + void sourceChanged(const QString&); + void highlighted(const QString&); + void linkClicked(const QString&); + void anchorClicked(const QString&, const QString&); + +protected: + void keyPressEvent(QKeyEvent * e); + +private: + Q_DISABLE_COPY(Q3TextBrowser) + + void popupDetail(const QString& contents, const QPoint& pos); + bool linksEnabled() const { return true; } + void emitHighlighted(const QString &s); + void emitLinkClicked(const QString &s); + Q3TextBrowserData *d; +}; + +#endif // QT_NO_TEXTBROWSER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TEXTBROWSER_H diff --git a/qtinterface/qt4/Qt/q3textedit.h b/qtinterface/qt4/Qt/q3textedit.h new file mode 100644 index 0000000..2f1cc4c --- /dev/null +++ b/qtinterface/qt4/Qt/q3textedit.h @@ -0,0 +1,613 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TEXTEDIT_H +#define Q3TEXTEDIT_H + +#include <Qt3Support/q3scrollview.h> +#include <Qt3Support/q3stylesheet.h> +#include <Qt3Support/q3mimefactory.h> +#include <QtCore/qmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_TEXTEDIT +// uncomment below to enable optimization mode - also uncomment the +// optimDoAutoScroll() private slot since moc ignores #ifdefs.. +#define QT_TEXTEDIT_OPTIMIZATION + +class QPainter; +class Q3TextDocument; +class Q3TextCursor; +class QKeyEvent; +class QResizeEvent; +class QMouseEvent; +class QTimer; +class Q3TextString; +class QTextCommand; +class Q3TextParagraph; +class Q3TextFormat; +class QFont; +class QColor; +class Q3TextEdit; +class QTextBrowser; +class Q3TextString; +struct QUndoRedoInfoPrivate; +class Q3PopupMenu; +class Q3TextEditPrivate; +class Q3SyntaxHighlighter; +class Q3TextDrag; + +#ifdef QT_TEXTEDIT_OPTIMIZATION +class Q3TextEditOptimPrivate +{ +public: + // Note: no left-tag has any value for leftTag or parent, and + // no right-tag has any formatting flags set. + enum TagType { Color = 0, Format = 1 }; + struct Tag { + TagType type:2; + bool bold:1; + bool italic:1; + bool underline:1; + int line; + int index; + Tag * leftTag; // ptr to left-tag in a left-right tag pair + Tag * parent; // ptr to parent left-tag in a nested tag + Tag * prev; + Tag * next; + QString tag; + }; + Q3TextEditOptimPrivate() + { + len = numLines = maxLineWidth = 0; + selStart.line = selStart.index = -1; + selEnd.line = selEnd.index = -1; + search.line = search.index = 0; + tags = lastTag = 0; + } + void clearTags() + { + Tag * itr = tags; + while (tags) { + itr = tags; + tags = tags->next; + delete itr; + } + tags = lastTag = 0; + tagIndex.clear(); + } + ~Q3TextEditOptimPrivate() + { + clearTags(); + } + int len; + int numLines; + int maxLineWidth; + struct Selection { + int line; + int index; + }; + Selection selStart, selEnd, search; + Tag * tags, * lastTag; + QMap<int, QString> lines; + QMap<int, Tag *> tagIndex; +}; +#endif + +class Q_COMPAT_EXPORT Q3TextEdit : public Q3ScrollView +{ + friend class Q3TextBrowser; + friend class Q3SyntaxHighlighter; + + Q_OBJECT + Q_ENUMS(WordWrap WrapPolicy) + Q_FLAGS(AutoFormattingFlag) + Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QBrush paper READ paper WRITE setPaper) + Q_PROPERTY(bool linkUnderline READ linkUnderline WRITE setLinkUnderline) + Q_PROPERTY(QString documentTitle READ documentTitle) + Q_PROPERTY(int length READ length) + Q_PROPERTY(WordWrap wordWrap READ wordWrap WRITE setWordWrap) + Q_PROPERTY(int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth) + Q_PROPERTY(WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy) + Q_PROPERTY(bool hasSelectedText READ hasSelectedText) + Q_PROPERTY(QString selectedText READ selectedText) + Q_PROPERTY(int undoDepth READ undoDepth WRITE setUndoDepth) + Q_PROPERTY(bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode) + Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) + Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth) + Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) + Q_PROPERTY(AutoFormattingFlag autoFormatting READ autoFormatting WRITE setAutoFormatting) + +public: + enum WordWrap { + NoWrap, + WidgetWidth, + FixedPixelWidth, + FixedColumnWidth + }; + + enum WrapPolicy { + AtWordBoundary, + AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated + Anywhere, + AtWordOrDocumentBoundary + }; + + enum AutoFormattingFlag { + AutoNone = 0, + AutoBulletList = 0x00000001, + AutoAll = 0xffffffff + }; + + Q_DECLARE_FLAGS(AutoFormatting, AutoFormattingFlag) + + enum KeyboardAction { + ActionBackspace, + ActionDelete, + ActionReturn, + ActionKill, + ActionWordBackspace, + ActionWordDelete + }; + + enum CursorAction { + MoveBackward, + MoveForward, + MoveWordBackward, + MoveWordForward, + MoveUp, + MoveDown, + MoveLineStart, + MoveLineEnd, + MoveHome, + MoveEnd, + MovePgUp, + MovePgDown + }; + + enum VerticalAlignment { + AlignNormal, + AlignSuperScript, + AlignSubScript + }; + + enum TextInsertionFlags { + RedoIndentation = 0x0001, + CheckNewLines = 0x0002, + RemoveSelected = 0x0004 + }; + + Q3TextEdit(const QString& text, const QString& context = QString(), + QWidget* parent=0, const char* name=0); + Q3TextEdit(QWidget* parent=0, const char* name=0); + virtual ~Q3TextEdit(); + + QString text() const; + QString text(int para) const; + Qt::TextFormat textFormat() const; + QString context() const; + QString documentTitle() const; + + void getSelection(int *paraFrom, int *indexFrom, + int *paraTo, int *indexTo, int selNum = 0) const; + virtual bool find(const QString &expr, bool cs, bool wo, bool forward = true, + int *para = 0, int *index = 0); + + int paragraphs() const; + int lines() const; + int linesOfParagraph(int para) const; + int lineOfChar(int para, int chr); + int length() const; + QRect paragraphRect(int para) const; + int paragraphAt(const QPoint &pos) const; + int charAt(const QPoint &pos, int *para) const; + int paragraphLength(int para) const; + + Q3StyleSheet* styleSheet() const; +#ifndef QT_NO_MIME + Q3MimeSourceFactory* mimeSourceFactory() const; +#endif + QBrush paper() const; + bool linkUnderline() const; + + int heightForWidth(int w) const; + + bool hasSelectedText() const; + QString selectedText() const; + bool isUndoAvailable() const; + bool isRedoAvailable() const; + + WordWrap wordWrap() const; + int wrapColumnOrWidth() const; + WrapPolicy wrapPolicy() const; + + int tabStopWidth() const; + + QString anchorAt(const QPoint& pos, Qt::AnchorAttribute a = Qt::AnchorHref); + + QSize sizeHint() const; + + bool isReadOnly() const { return readonly; } + + void getCursorPosition(int *parag, int *index) const; + + bool isModified() const; + bool italic() const; + bool bold() const; + bool underline() const; + QString family() const; + int pointSize() const; + QColor color() const; + QFont font() const; + QFont currentFont() const; + int alignment() const; + VerticalAlignment verticalAlignment() const; + int undoDepth() const; + + // do not use, will go away + virtual bool getFormat(int para, int index, QFont *font, QColor *color, VerticalAlignment *verticalAlignment); + // do not use, will go away + virtual bool getParagraphFormat(int para, QFont *font, QColor *color, + VerticalAlignment *verticalAlignment, int *alignment, + Q3StyleSheetItem::DisplayMode *displayMode, + Q3StyleSheetItem::ListStyle *listStyle, + int *listDepth); + + + bool isOverwriteMode() const { return overWrite; } + QColor paragraphBackgroundColor(int para) const; + + bool isUndoRedoEnabled() const; + bool eventFilter(QObject *o, QEvent *e); + bool tabChangesFocus() const; + + void setAutoFormatting(AutoFormatting); + AutoFormatting autoFormatting() const; + Q3SyntaxHighlighter *syntaxHighlighter() const; + +public Q_SLOTS: +#ifndef QT_NO_MIME + virtual void setMimeSourceFactory(Q3MimeSourceFactory* factory); +#endif + virtual void setStyleSheet(Q3StyleSheet* styleSheet); + virtual void scrollToAnchor(const QString& name); + virtual void setPaper(const QBrush& pap); + virtual void setLinkUnderline(bool); + + virtual void setWordWrap(Q3TextEdit::WordWrap mode); + virtual void setWrapColumnOrWidth(int); + virtual void setWrapPolicy(Q3TextEdit::WrapPolicy policy); + + virtual void copy(); + virtual void append(const QString& text); + + void setText(const QString &txt) { setText(txt, QString()); } + virtual void setText(const QString &txt, const QString &context); + virtual void setTextFormat(Qt::TextFormat f); + + virtual void selectAll(bool select = true); + virtual void setTabStopWidth(int ts); + virtual void zoomIn(int range); + virtual void zoomIn() { zoomIn(1); } + virtual void zoomOut(int range); + virtual void zoomOut() { zoomOut(1); } + virtual void zoomTo(int size); + + virtual void sync(); + virtual void setReadOnly(bool b); + + virtual void undo(); + virtual void redo(); + virtual void cut(); + virtual void paste(); +#ifndef QT_NO_CLIPBOARD + virtual void pasteSubType(const QByteArray &subtype); +#endif + virtual void clear(); + virtual void del(); + virtual void indent(); + virtual void setItalic(bool b); + virtual void setBold(bool b); + virtual void setUnderline(bool b); + virtual void setFamily(const QString &f); + virtual void setPointSize(int s); + virtual void setColor(const QColor &c); + virtual void setVerticalAlignment(Q3TextEdit::VerticalAlignment a); + virtual void setAlignment(int a); + + // do not use, will go away + virtual void setParagType(Q3StyleSheetItem::DisplayMode dm, Q3StyleSheetItem::ListStyle listStyle); + + virtual void setCursorPosition(int parag, int index); + virtual void setSelection(int parag_from, int index_from, int parag_to, int index_to, int selNum = 0); + virtual void setSelectionAttributes(int selNum, const QColor &back, bool invertText); + virtual void setModified(bool m); + virtual void resetFormat(); + virtual void setUndoDepth(int d); + virtual void setFormat(Q3TextFormat *f, int flags); + virtual void ensureCursorVisible(); + virtual void placeCursor(const QPoint &pos, Q3TextCursor *c = 0); + virtual void moveCursor(Q3TextEdit::CursorAction action, bool select); + virtual void doKeyboardAction(Q3TextEdit::KeyboardAction action); + virtual void removeSelectedText(int selNum = 0); + virtual void removeSelection(int selNum = 0); + virtual void setCurrentFont(const QFont &f); + virtual void setOverwriteMode(bool b) { overWrite = b; } + + virtual void scrollToBottom(); + + virtual void insert(const QString &text, uint insertionFlags = CheckNewLines | RemoveSelected); + + // obsolete + virtual void insert(const QString &text, bool, bool = true, bool = true); + + virtual void insertAt(const QString &text, int para, int index); + virtual void removeParagraph(int para); + virtual void insertParagraph(const QString &text, int para); + + virtual void setParagraphBackgroundColor(int para, const QColor &bg); + virtual void clearParagraphBackground(int para); + + virtual void setUndoRedoEnabled(bool b); + virtual void setTabChangesFocus(bool b); + +#ifdef QT_TEXTEDIT_OPTIMIZATION + void polishEvent(QEvent*); + void setMaxLogLines(int numLines); + int maxLogLines() const; +#endif + +Q_SIGNALS: + void textChanged(); + void selectionChanged(); + void copyAvailable(bool); + void undoAvailable(bool yes); + void redoAvailable(bool yes); + void currentFontChanged(const QFont &f); + void currentColorChanged(const QColor &c); + void currentAlignmentChanged(int a); + void currentVerticalAlignmentChanged(Q3TextEdit::VerticalAlignment a); + void cursorPositionChanged(Q3TextCursor *c); + void cursorPositionChanged(int para, int pos); + void returnPressed(); + void modificationChanged(bool m); + void clicked(int parag, int index); + void doubleClicked(int parag, int index); + +protected: + void repaintChanged(); + void updateStyles(); + void drawContents(QPainter *p, int cx, int cy, int cw, int ch); + bool event(QEvent *e); + void changeEvent(QEvent *); + void keyPressEvent(QKeyEvent *e); + void resizeEvent(QResizeEvent *e); + void viewportResizeEvent(QResizeEvent*); + void contentsMousePressEvent(QMouseEvent *e); + void contentsMouseMoveEvent(QMouseEvent *e); + void contentsMouseReleaseEvent(QMouseEvent *e); + void contentsMouseDoubleClickEvent(QMouseEvent *e); +#ifndef QT_NO_WHEELEVENT + void contentsWheelEvent(QWheelEvent *e); +#endif + void inputMethodEvent(QInputMethodEvent *); +#ifndef QT_NO_DRAGANDDROP + void contentsDragEnterEvent(QDragEnterEvent *e); + void contentsDragMoveEvent(QDragMoveEvent *e); + void contentsDragLeaveEvent(QDragLeaveEvent *e); + void contentsDropEvent(QDropEvent *e); +#endif + void contentsContextMenuEvent(QContextMenuEvent *e); + bool focusNextPrevChild(bool next); + Q3TextDocument *document() const; + Q3TextCursor *textCursor() const; + void setDocument(Q3TextDocument *doc); + virtual Q3PopupMenu *createPopupMenu(const QPoint& pos); + virtual Q3PopupMenu *createPopupMenu(); + void drawCursor(bool visible); + +protected Q_SLOTS: + virtual void doChangeInterval(); + virtual void sliderReleased(); + +private Q_SLOTS: + void formatMore(); + void doResize(); + void autoScrollTimerDone(); + void blinkCursor(); + void setModified(); + void startDrag(); + void documentWidthChanged(int w); + void clipboardChanged(); + +private: + struct Q_COMPAT_EXPORT UndoRedoInfo { + enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style, IME }; + + UndoRedoInfo(Q3TextDocument *dc); + ~UndoRedoInfo(); + void clear(); + bool valid() const; + + QUndoRedoInfoPrivate *d; + int id; + int index; + int eid; + int eindex; + Q3TextFormat *format; + int flags; + Type type; + Q3TextDocument *doc; + QByteArray styleInformation; + }; + +private: + void updateCursor(const QPoint & pos); + void handleMouseMove(const QPoint& pos); + void drawContents(QPainter *); + virtual bool linksEnabled() const { return false; } + void init(); + void checkUndoRedoInfo(UndoRedoInfo::Type t); + void updateCurrentFormat(); + bool handleReadOnlyKeyEvent(QKeyEvent *e); + void makeParagVisible(Q3TextParagraph *p); + void normalCopy(); + void copyToClipboard(); +#ifndef QT_NO_MIME + QByteArray pickSpecial(QMimeSource* ms, bool always_ask, const QPoint&); + Q3TextDrag *dragObject(QWidget *parent = 0) const; +#endif +#ifndef QT_NO_MIMECLIPBOARD + void pasteSpecial(const QPoint&); +#endif + void setFontInternal(const QFont &f); + + virtual void emitHighlighted(const QString &) {} + virtual void emitLinkClicked(const QString &) {} + + void readFormats(Q3TextCursor &c1, Q3TextCursor &c2, Q3TextString &text, bool fillStyles = false); + void clearUndoRedo(); + void paintDocument(bool drawAll, QPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1); + void moveCursor(CursorAction action); + void ensureFormatted(Q3TextParagraph *p); + void placeCursor(const QPoint &pos, Q3TextCursor *c, bool link); + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + +#ifdef QT_TEXTEDIT_OPTIMIZATION + bool checkOptimMode(); + QString optimText() const; + void optimSetText(const QString &str); + void optimAppend(const QString &str); + void optimInsert(const QString &str, int line, int index); + void optimDrawContents(QPainter * p, int cx, int cy, int cw, int ch); + void optimMousePressEvent(QMouseEvent * e); + void optimMouseReleaseEvent(QMouseEvent * e); + void optimMouseMoveEvent(QMouseEvent * e); + int optimCharIndex(const QString &str, int mx) const; + void optimSelectAll(); + void optimRemoveSelection(); + void optimSetSelection(int startLine, int startIdx, int endLine, + int endIdx); + bool optimHasSelection() const; + QString optimSelectedText() const; + bool optimFind(const QString & str, bool, bool, bool, int *, int *); + void optimParseTags(QString * str, int lineNo = -1, int indexOffset = 0); + Q3TextEditOptimPrivate::Tag * optimPreviousLeftTag(int line); + void optimSetTextFormat(Q3TextDocument *, Q3TextCursor *, Q3TextFormat * f, + int, int, Q3TextEditOptimPrivate::Tag * t); + Q3TextEditOptimPrivate::Tag * optimAppendTag(int index, const QString & tag); + Q3TextEditOptimPrivate::Tag * optimInsertTag(int line, int index, const QString & tag); + void optimCheckLimit(const QString& str); + bool optimHasBoldMetrics(int line); + +private Q_SLOTS: + void optimDoAutoScroll(); +#endif // QT_TEXTEDIT_OPTIMIZATION + +private: +#ifndef QT_NO_CLIPBOARD + void pasteSubType(const QByteArray &subtype, QMimeSource *m); +#endif + +private: + Q_DISABLE_COPY(Q3TextEdit) + + Q3TextDocument *doc; + Q3TextCursor *cursor; + QTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer; + Q3TextParagraph *lastFormatted; + int interval; + UndoRedoInfo undoRedoInfo; + Q3TextFormat *currentFormat; + int currentAlignment; + QPoint oldMousePos, mousePos; + QPoint dragStartPos; + QString onLink; + WordWrap wrapMode; + WrapPolicy wPolicy; + int wrapWidth; + QString pressedLink; + Q3TextEditPrivate *d; + bool inDoubleClick : 1; + bool mousePressed : 1; + bool cursorVisible : 1; + bool blinkCursorVisible : 1; + bool modified : 1; + bool mightStartDrag : 1; + bool inDnD : 1; + bool readonly : 1; + bool undoEnabled : 1; + bool overWrite : 1; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(Q3TextEdit::AutoFormatting) + +inline Q3TextDocument *Q3TextEdit::document() const +{ + return doc; +} + +inline Q3TextCursor *Q3TextEdit::textCursor() const +{ + return cursor; +} + +inline void Q3TextEdit::setCurrentFont(const QFont &f) +{ + Q3TextEdit::setFontInternal(f); +} + +#endif // QT_NO_TEXTEDIT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TEXTEDIT_H diff --git a/qtinterface/qt4/Qt/q3textstream.h b/qtinterface/qt4/Qt/q3textstream.h new file mode 100644 index 0000000..6e83559 --- /dev/null +++ b/qtinterface/qt4/Qt/q3textstream.h @@ -0,0 +1,297 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TEXTSTREAM_H +#define Q3TEXTSTREAM_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qstring.h> +#ifndef QT_NO_TEXTCODEC +#include <QtCore/qtextcodec.h> +#endif +#include <Qt3Support/q3cstring.h> + +#include <stdio.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3TextStreamPrivate; + +class Q_COMPAT_EXPORT Q3TextStream // text stream class +{ +public: + enum Encoding { Locale, Latin1, Unicode, UnicodeNetworkOrder, + UnicodeReverse, RawUnicode, UnicodeUTF8 }; + + void setEncoding( Encoding ); +#ifndef QT_NO_TEXTCODEC + void setCodec( QTextCodec* ); + QTextCodec *codec(); +#endif + + Q3TextStream(); + Q3TextStream( QIODevice * ); + Q3TextStream( QString*, int mode ); + Q3TextStream( QString&, int mode ); // obsolete + Q3TextStream( QByteArray&, int mode ); + Q3TextStream( FILE *, int mode ); + virtual ~Q3TextStream(); + + QIODevice *device() const; + void setDevice( QIODevice * ); + void unsetDevice(); + + bool atEnd() const; + bool eof() const; + + Q3TextStream &operator>>( QChar & ); + Q3TextStream &operator>>( char & ); + Q3TextStream &operator>>( signed short & ); + Q3TextStream &operator>>( unsigned short & ); + Q3TextStream &operator>>( signed int & ); + Q3TextStream &operator>>( unsigned int & ); + Q3TextStream &operator>>( signed long & ); + Q3TextStream &operator>>( unsigned long & ); + Q3TextStream &operator>>( float & ); + Q3TextStream &operator>>( double & ); + Q3TextStream &operator>>( char * ); + Q3TextStream &operator>>( QString & ); + Q3TextStream &operator>>( Q3CString & ); + + Q3TextStream &operator<<( QChar ); + Q3TextStream &operator<<( char ); + Q3TextStream &operator<<( signed short ); + Q3TextStream &operator<<( unsigned short ); + Q3TextStream &operator<<( signed int ); + Q3TextStream &operator<<( unsigned int ); + Q3TextStream &operator<<( signed long ); + Q3TextStream &operator<<( unsigned long ); + Q3TextStream &operator<<( float ); + Q3TextStream &operator<<( double ); + Q3TextStream &operator<<( const char* ); + Q3TextStream &operator<<( const QString & ); + Q3TextStream &operator<<( const Q3CString & ); + Q3TextStream &operator<<( void * ); // any pointer + + Q3TextStream &readRawBytes( char *, uint len ); + Q3TextStream &writeRawBytes( const char* , uint len ); + + QString readLine(); + QString read(); + void skipWhiteSpace(); + + enum { + skipws = 0x0001, // skip whitespace on input + left = 0x0002, // left-adjust output + right = 0x0004, // right-adjust output + internal = 0x0008, // pad after sign + bin = 0x0010, // binary format integer + oct = 0x0020, // octal format integer + dec = 0x0040, // decimal format integer + hex = 0x0080, // hex format integer + showbase = 0x0100, // show base indicator + showpoint = 0x0200, // force decimal point (float) + uppercase = 0x0400, // upper-case hex output + showpos = 0x0800, // add '+' to positive integers + scientific= 0x1000, // scientific float output + fixed = 0x2000 // fixed float output + }; + + static const int basefield; // bin | oct | dec | hex + static const int adjustfield; // left | right | internal + static const int floatfield; // scientific | fixed + + int flags() const; + int flags( int f ); + int setf( int bits ); + int setf( int bits, int mask ); + int unsetf( int bits ); + + void reset(); + + int width() const; + int width( int ); + int fill() const; + int fill( int ); + int precision() const; + int precision( int ); + +private: + long input_int(); + void init(); + Q3TextStream &output_int( int, ulong, bool ); + QIODevice *dev; + + int fflags; + int fwidth; + int fillchar; + int fprec; + bool doUnicodeHeader; + bool owndev; + QTextCodec *mapper; + QTextCodec::ConverterState mapperReadState; + QTextCodec::ConverterState mapperWriteState; + Q3TextStreamPrivate * d; + QChar unused1; // ### remove in Qt 4.0 + bool latin1; + bool internalOrder; + bool networkOrder; + void *unused2; // ### remove in Qt 4.0 + + QChar eat_ws(); + uint ts_getline( QChar* ); + void ts_ungetc( QChar ); + QChar ts_getc(); + uint ts_getbuf( QChar*, uint ); + void ts_putc(int); + void ts_putc(QChar); + bool ts_isspace(QChar); + bool ts_isdigit(QChar); + ulong input_bin(); + ulong input_oct(); + ulong input_dec(); + ulong input_hex(); + double input_double(); + Q3TextStream &writeBlock( const char* p, uint len ); + Q3TextStream &writeBlock( const QChar* p, uint len ); + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + Q3TextStream( const Q3TextStream & ); + Q3TextStream &operator=( const Q3TextStream & ); +#endif +}; + +/***************************************************************************** + Q3TextStream inline functions + *****************************************************************************/ + +inline QIODevice *Q3TextStream::device() const +{ return dev; } + +inline bool Q3TextStream::atEnd() const +{ return dev ? dev->atEnd() : FALSE; } + +inline bool Q3TextStream::eof() const +{ return atEnd(); } + +inline int Q3TextStream::flags() const +{ return fflags; } + +inline int Q3TextStream::flags( int f ) +{ int oldf = fflags; fflags = f; return oldf; } + +inline int Q3TextStream::setf( int bits ) +{ int oldf = fflags; fflags |= bits; return oldf; } + +inline int Q3TextStream::setf( int bits, int mask ) +{ int oldf = fflags; fflags = (fflags & ~mask) | (bits & mask); return oldf; } + +inline int Q3TextStream::unsetf( int bits ) +{ int oldf = fflags; fflags &= ~bits; return oldf; } + +inline int Q3TextStream::width() const +{ return fwidth; } + +inline int Q3TextStream::width( int w ) +{ int oldw = fwidth; fwidth = w; return oldw; } + +inline int Q3TextStream::fill() const +{ return fillchar; } + +inline int Q3TextStream::fill( int f ) +{ int oldc = fillchar; fillchar = f; return oldc; } + +inline int Q3TextStream::precision() const +{ return fprec; } + +inline int Q3TextStream::precision( int p ) +{ int oldp = fprec; fprec = p; return oldp; } + +/*! + Returns one character from the stream, or EOF. +*/ +inline QChar Q3TextStream::ts_getc() +{ QChar r; return ( ts_getbuf( &r,1 ) == 1 ? r : QChar((ushort)0xffff) ); } + +/***************************************************************************** + Q3TextStream manipulators + *****************************************************************************/ + +typedef Q3TextStream & (*Q3TSFUNC)(Q3TextStream &);// manipulator function +typedef int (Q3TextStream::*Q3TSMFI)(int); // manipulator w/int argument + +class Q_COMPAT_EXPORT Q3TSManip { // text stream manipulator +public: + Q3TSManip( Q3TSMFI m, int a ) { mf=m; arg=a; } + void exec( Q3TextStream &s ) { (s.*mf)(arg); } +private: + Q3TSMFI mf; // Q3TextStream member function + int arg; // member function argument +}; + +Q_COMPAT_EXPORT inline Q3TextStream &operator>>( Q3TextStream &s, Q3TSFUNC f ) +{ return (*f)( s ); } + +Q_COMPAT_EXPORT inline Q3TextStream &operator<<( Q3TextStream &s, Q3TSFUNC f ) +{ return (*f)( s ); } + +Q_COMPAT_EXPORT inline Q3TextStream &operator<<( Q3TextStream &s, Q3TSManip m ) +{ m.exec(s); return s; } + +Q_COMPAT_EXPORT Q3TextStream &bin( Q3TextStream &s ); // set bin notation +Q_COMPAT_EXPORT Q3TextStream &oct( Q3TextStream &s ); // set oct notation +Q_COMPAT_EXPORT Q3TextStream &dec( Q3TextStream &s ); // set dec notation +Q_COMPAT_EXPORT Q3TextStream &hex( Q3TextStream &s ); // set hex notation +Q_COMPAT_EXPORT Q3TextStream &endl( Q3TextStream &s ); // insert EOL ('\n') +Q_COMPAT_EXPORT Q3TextStream &flush( Q3TextStream &s ); // flush output +Q_COMPAT_EXPORT Q3TextStream &ws( Q3TextStream &s ); // eat whitespace on input +Q_COMPAT_EXPORT Q3TextStream &reset( Q3TextStream &s ); // set default flags + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TEXTSTREAM_H diff --git a/qtinterface/qt4/Qt/q3textview.h b/qtinterface/qt4/Qt/q3textview.h new file mode 100644 index 0000000..5edd0d2 --- /dev/null +++ b/qtinterface/qt4/Qt/q3textview.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TEXTVIEW_H +#define Q3TEXTVIEW_H + +#include <Qt3Support/q3textedit.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_TEXTVIEW + +class Q_COMPAT_EXPORT Q3TextView : public Q3TextEdit +{ + Q_OBJECT + +public: + Q3TextView(const QString& text, const QString& context = QString(), + QWidget* parent=0, const char* name=0); + Q3TextView(QWidget* parent=0, const char* name=0); + + virtual ~Q3TextView(); + +private: + Q_DISABLE_COPY(Q3TextView) +}; + +#endif // QT_NO_TEXTVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TEXTVIEW_H diff --git a/qtinterface/qt4/Qt/q3tl.h b/qtinterface/qt4/Qt/q3tl.h new file mode 100644 index 0000000..9d800bd --- /dev/null +++ b/qtinterface/qt4/Qt/q3tl.h @@ -0,0 +1,212 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TL_H +#define Q3TL_H + +#include <QtCore/qalgorithms.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template <typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qHeapSortPushDown(T *heap, int first, int last, LessThan lessThan) +{ + int r = first; + while (r <= last / 2) { + if (last == 2 * r) { + // node r has only one child + if (lessThan(heap[2 * r], heap[r])) + qSwap(heap[r], heap[2 * r]); + r = last; + } else { + // node r has two children + if (lessThan(heap[2 * r], heap[r]) && !lessThan(heap[2 * r + 1], heap[2 * r])) { + // swap with left child + qSwap(heap[r], heap[2 * r]); + r *= 2; + } else if (lessThan(heap[2 * r + 1], heap[r]) + && lessThan(heap[2 * r + 1], heap[2 * r])) { + // swap with right child + qSwap(heap[r], heap[2 * r + 1]); + r = 2 * r + 1; + } else { + r = last; + } + } + } +} + +template <typename BiIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qHeapSortHelper(BiIterator begin, BiIterator end, const T & /* dummy */, LessThan lessThan) +{ + BiIterator it = begin; + uint n = 0; + while (it != end) { + ++n; + ++it; + } + if (n == 0) + return; + + // Create the heap + BiIterator insert = begin; + T *realheap = new T[n]; + T *heap = realheap - 1; + int size = 0; + for(; insert != end; ++insert) { + heap[++size] = *insert; + int i = size; + while (i > 1 && lessThan(heap[i], heap[i / 2])) { + qSwap(heap[i], heap[i / 2]); + i /= 2; + } + } + + // Now do the sorting + for (int i = n; i > 0; i--) { + *begin++ = heap[1]; + if (i > 1) { + heap[1] = heap[i]; + qHeapSortPushDown(heap, 1, i - 1, lessThan); + } + } + + delete[] realheap; +} + +template <typename BiIterator, typename T> +inline void qHeapSortHelper(BiIterator begin, BiIterator end, const T &dummy) +{ + qHeapSortHelper(begin, end, dummy, qLess<T>()); +} + +template <typename BiIterator, typename LessThan> +inline void qHeapSort(BiIterator begin, BiIterator end, LessThan lessThan) +{ + if (begin != end) + qHeapSortHelper(begin, end, *begin, lessThan); +} + +template <typename BiIterator> +inline void qHeapSort(BiIterator begin, BiIterator end) +{ + if (begin != end) + qHeapSortHelper(begin, end, *begin); +} + +template <typename Container> +inline void qHeapSort(Container &c) +{ +#ifdef Q_CC_BOR + // Work around Borland 5.5 optimizer bug + c.detach(); +#endif + if (!c.empty()) + qHeapSortHelper(c.begin(), c.end(), *c.begin()); +} + + +template <typename BiIterator, typename LessThan> +void qBubbleSort(BiIterator begin, BiIterator end, LessThan lessThan) +{ + // Goto last element; + BiIterator last = end; + + // empty list + if (begin == end) + return; + + --last; + // only one element ? + if (last == begin) + return; + + // So we have at least two elements in here + while (begin != last) { + bool swapped = false; + BiIterator swapPos = begin; + BiIterator x = end; + BiIterator y = x; + y--; + do { + --x; + --y; + if (lessThan(*x, *y)) { + swapped = true; + qSwap(*x, *y); + swapPos = y; + } + } while (y != begin); + if (!swapped) + return; + begin = swapPos; + ++begin; + } +} + +template <typename BiIterator, typename T> +void qBubbleSortHelper(BiIterator begin, BiIterator end, T) +{ + qBubbleSort(begin, end, qLess<T>()); +} + +template <typename BiIterator> +void qBubbleSort(BiIterator begin, BiIterator end) +{ + if (begin != end) + qBubbleSortHelper(begin, end, *begin); +} + +template <typename Container> +inline void qBubbleSort(Container &c) +{ + qBubbleSort(c.begin(), c.end()); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TL_H diff --git a/qtinterface/qt4/Qt/q3toolbar.h b/qtinterface/qt4/Qt/q3toolbar.h new file mode 100644 index 0000000..096149c --- /dev/null +++ b/qtinterface/qt4/Qt/q3toolbar.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3TOOLBAR_H +#define Q3TOOLBAR_H + +#include <Qt3Support/q3dockwindow.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_TOOLBAR + +class Q3MainWindow; +class Q3ToolBarPrivate; + +class Q_COMPAT_EXPORT Q3ToolBar: public Q3DockWindow +{ + Q_OBJECT + Q_PROPERTY(QString label READ label WRITE setLabel) + +public: + Q3ToolBar(const QString &label, + Q3MainWindow *, Qt::ToolBarDock = Qt::DockTop, + bool newLine = false, const char* name=0); + Q3ToolBar(const QString &label, Q3MainWindow *, QWidget *, + bool newLine = false, const char* name=0, Qt::WindowFlags f = 0); + Q3ToolBar(Q3MainWindow* parent=0, const char* name=0); + ~Q3ToolBar(); + + void addSeparator(); + + void setVisible(bool visible); + + Q3MainWindow * mainWindow() const; + + virtual void setStretchableWidget(QWidget *); + + bool event(QEvent * e); + + virtual void setLabel(const QString &); + QString label() const; + + virtual void clear(); + + QSize minimumSize() const; + QSize minimumSizeHint() const; + + void setOrientation(Qt::Orientation o); + void setMinimumSize(int minw, int minh); + +protected: + void resizeEvent(QResizeEvent *e); + void styleChange(QStyle &); + void actionEvent(QActionEvent *); + +private Q_SLOTS: + void createPopup(); + +private: + void init(); + void checkForExtension(const QSize &sz); + Q3ToolBarPrivate * d; + Q3MainWindow * mw; + QWidget * sw; + QString l; + + friend class Q3MainWindow; + friend class Q3DockAreaLayout; + +private: + Q_DISABLE_COPY(Q3ToolBar) +}; + +#endif // QT_NO_TOOLBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3TOOLBAR_H diff --git a/qtinterface/qt4/Qt/q3url.h b/qtinterface/qt4/Qt/q3url.h new file mode 100644 index 0000000..5fd6dae --- /dev/null +++ b/qtinterface/qt4/Qt/q3url.h @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3URL_H +#define Q3URL_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_URL + +class Q3UrlPrivate; + +class Q_COMPAT_EXPORT Q3Url +{ +public: + Q3Url(); + Q3Url( const QString& url ); + Q3Url( const Q3Url& url ); + Q3Url( const Q3Url& url, const QString& relUrl, bool checkSlash = false ); + virtual ~Q3Url(); + + QString protocol() const; + virtual void setProtocol( const QString& protocol ); + + QString user() const; + virtual void setUser( const QString& user ); + bool hasUser() const; + + QString password() const; + virtual void setPassword( const QString& pass ); + bool hasPassword() const; + + QString host() const; + virtual void setHost( const QString& user ); + bool hasHost() const; + + int port() const; + virtual void setPort( int port ); + bool hasPort() const; + + QString path( bool correct = true ) const; + virtual void setPath( const QString& path ); + bool hasPath() const; + + virtual void setEncodedPathAndQuery( const QString& enc ); + QString encodedPathAndQuery(); + + virtual void setQuery( const QString& txt ); + QString query() const; + + QString ref() const; + virtual void setRef( const QString& txt ); + bool hasRef() const; + + bool isValid() const; + bool isLocalFile() const; + + virtual void addPath( const QString& path ); + virtual void setFileName( const QString& txt ); + + QString fileName() const; + QString dirPath() const; + + Q3Url& operator=( const Q3Url& url ); + Q3Url& operator=( const QString& url ); + + bool operator==( const Q3Url& url ) const; + bool operator==( const QString& url ) const; + + static void decode( QString& url ); + static void encode( QString& url ); + + operator QString() const; + virtual QString toString( bool encodedPath = false, bool forcePrependProtocol = true ) const; + + virtual bool cdUp(); + + static bool isRelativeUrl( const QString &url ); + +protected: + virtual void reset(); + virtual bool parse( const QString& url ); + +private: + Q3UrlPrivate *d; + +}; + +#endif // QT_NO_URL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3URL_H diff --git a/qtinterface/qt4/Qt/q3urloperator.h b/qtinterface/qt4/Qt/q3urloperator.h new file mode 100644 index 0000000..f108f75 --- /dev/null +++ b/qtinterface/qt4/Qt/q3urloperator.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3URLOPERATOR_H +#define Q3URLOPERATOR_H + +#include <QtCore/qobject.h> +#include <Qt3Support/q3url.h> +#include <Qt3Support/q3ptrlist.h> +#include <Qt3Support/q3networkprotocol.h> +#include <QtCore/qstringlist.h> // QString->QStringList conversion + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_NETWORKPROTOCOL + +class QUrlInfo; +class Q3UrlOperatorPrivate; +class Q3NetworkProtocol; + +class Q_COMPAT_EXPORT Q3UrlOperator : public QObject, public Q3Url +{ + Q_OBJECT + friend class Q3NetworkProtocol; + +public: + Q3UrlOperator(); + Q3UrlOperator( const QString &urL ); + Q3UrlOperator( const Q3UrlOperator& url ); + Q3UrlOperator( const Q3UrlOperator& url, const QString& relUrl, bool checkSlash = false ); + virtual ~Q3UrlOperator(); + + virtual void setPath( const QString& path ); + virtual bool cdUp(); + + virtual const Q3NetworkOperation *listChildren(); + virtual const Q3NetworkOperation *mkdir( const QString &dirname ); + virtual const Q3NetworkOperation *remove( const QString &filename ); + virtual const Q3NetworkOperation *rename( const QString &oldname, const QString &newname ); + virtual const Q3NetworkOperation *get( const QString &location = QString() ); + virtual const Q3NetworkOperation *put( const QByteArray &data, const QString &location = QString() ); + virtual Q3PtrList<Q3NetworkOperation> copy( const QString &from, const QString &to, bool move = false, bool toPath = true ); + virtual void copy( const QStringList &files, const QString &dest, bool move = false ); + virtual bool isDir( bool *ok = 0 ); + + virtual void setNameFilter( const QString &nameFilter ); + QString nameFilter() const; + + virtual QUrlInfo info( const QString &entry ) const; + + Q3UrlOperator& operator=( const Q3UrlOperator &url ); + Q3UrlOperator& operator=( const QString &url ); + + virtual void stop(); + +Q_SIGNALS: + void newChildren( const Q3ValueList<QUrlInfo> &, Q3NetworkOperation *res ); + void finished( Q3NetworkOperation *res ); + void start( Q3NetworkOperation *res ); + void createdDirectory( const QUrlInfo &, Q3NetworkOperation *res ); + void removed( Q3NetworkOperation *res ); + void itemChanged( Q3NetworkOperation *res ); + void data( const QByteArray &, Q3NetworkOperation *res ); + void dataTransferProgress( int bytesDone, int bytesTotal, Q3NetworkOperation *res ); + void startedNextCopy( const Q3PtrList<Q3NetworkOperation> &lst ); + void connectionStateChanged( int state, const QString &data ); + +protected: + void reset(); + bool parse( const QString& url ); + virtual bool checkValid(); + virtual void clearEntries(); + void getNetworkProtocol(); + void deleteNetworkProtocol(); + +private Q_SLOTS: + const Q3NetworkOperation *startOperation( Q3NetworkOperation *op ); + void copyGotData( const QByteArray &data, Q3NetworkOperation *op ); + void continueCopy( Q3NetworkOperation *op ); + void finishedCopy(); + void addEntry( const Q3ValueList<QUrlInfo> &i ); + void slotItemChanged( Q3NetworkOperation *op ); + +private: + void deleteOperation( Q3NetworkOperation *op ); + + Q3UrlOperatorPrivate *d; +}; + +#endif // QT_NO_NETWORKPROTOCOL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3URLOPERATOR_H diff --git a/qtinterface/qt4/Qt/q3valuelist.h b/qtinterface/qt4/Qt/q3valuelist.h new file mode 100644 index 0000000..f004145 --- /dev/null +++ b/qtinterface/qt4/Qt/q3valuelist.h @@ -0,0 +1,238 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3VALUELIST_H +#define Q3VALUELIST_H + +#include <QtCore/qalgorithms.h> +#include <QtCore/qdatastream.h> +#include <QtCore/qlinkedlist.h> +#include <QtCore/qlist.h> + +#ifndef QT_NO_STL +#include <iterator> +#include <list> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template <typename T> +class Q3ValueListIterator : public QLinkedList<T>::iterator +{ +public: + inline Q3ValueListIterator() : + QLinkedList<T>::iterator() {} + inline Q3ValueListIterator(const Q3ValueListIterator &o) : + QLinkedList<T>::iterator(o) {} + inline Q3ValueListIterator(const typename QLinkedList<T>::iterator &o) : + QLinkedList<T>::iterator(o) {} +}; + +template <typename T> +class Q3ValueListConstIterator : public QLinkedList<T>::const_iterator +{ +public: + inline Q3ValueListConstIterator() {} + inline Q3ValueListConstIterator(const Q3ValueListConstIterator &o) : + QLinkedList<T>::const_iterator(o) {} + inline Q3ValueListConstIterator(const typename QLinkedList<T>::const_iterator &o) : + QLinkedList<T>::const_iterator(o) {} + inline Q3ValueListConstIterator(const typename QLinkedList<T>::iterator &o) : + QLinkedList<T>::const_iterator(o) {} +}; + +template <typename T> +class Q3ValueList : public QLinkedList<T> +{ +public: + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; +#ifndef QT_NO_STL + typedef ptrdiff_t difference_type; +#else + typedef int difference_type; +#endif + + typedef Q3ValueListIterator<T> Iterator; + typedef Q3ValueListConstIterator<T> ConstIterator; + typedef Q3ValueListIterator<T> iterator; + typedef Q3ValueListConstIterator<T> const_iterator; + typedef typename QLinkedList<T>::size_type size_type; + + /** + * API + */ + Q3ValueList() {} + Q3ValueList(const Q3ValueList<T>& l) : QLinkedList<T>(l) {} + Q3ValueList(const QLinkedList<T>& l) : QLinkedList<T>(l) {} + Q3ValueList(const QList<T>& l) + { + for (int i = 0; i < l.size(); ++i) append(l.at(i)); + } +#ifndef QT_NO_STL + Q3ValueList(const std::list<T>& l) + { + qCopy(l.begin(), l.end(), std::back_inserter(*this)); + } +#endif + ~Q3ValueList() {} + + Q3ValueList<T>& operator= (const Q3ValueList<T>& l) + { + QLinkedList<T>::operator=(l); + return *this; + } + Q3ValueList<T>& operator= (const QList<T>& l) + { + this->clear(); + for (int i = 0; i < l.size(); ++i) append(l.at(i)); + return *this; + } +#ifndef QT_NO_STL + Q3ValueList<T>& operator= (const std::list<T>& l) + { + this->detach(); + qCopy(l.begin(), l.end(), std::back_inserter(*this)); + return *this; + } + bool operator== (const std::list<T>& l) const + { + if (this->size() != l.size()) + return false; + typename Q3ValueList<T>::const_iterator it2 = this->begin(); +#if !defined(Q_CC_MIPS) + typename +#endif + std::list<T>::const_iterator it = l.begin(); + for (; it2 != this->end(); ++it2, ++it) + if (!((*it2) == (*it))) + return false; + return true; + } +#endif + bool operator== (const Q3ValueList<T>& l) const { return QLinkedList<T>::operator==(l); } + bool operator!= (const Q3ValueList<T>& l) const { return QLinkedList<T>::operator!=(l); } + + operator QList<T>() const { + QList<T> list; + for (typename Q3ValueList<T>::const_iterator it = QLinkedList<T>::constBegin(); + it != QLinkedList<T>::constEnd(); ++it) + list.append(*it); + return list; + } + + inline Q3ValueList<T>& operator<< (const T& x) { append(x); return *this; } + + void insert(typename Q3ValueList<T>::Iterator pos, + typename Q3ValueList<T>::size_type n, + const T& x); + + typename Q3ValueList<T>::Iterator insert(typename Q3ValueList<T>::Iterator pos, + const T& x) + { return QLinkedList<T>::insert(pos, x); } + typename Q3ValueList<T>::Iterator remove(typename Q3ValueList<T>::Iterator pos) + { return QLinkedList<T>::erase(pos); } + int remove(const T &value) + { return QLinkedList<T>::removeAll(value); } + + inline Q3ValueList<T> operator+ (const Q3ValueList<T>& l) const + { return static_cast<Q3ValueList<T> >(QLinkedList<T>::operator+(l)); } + inline Q3ValueList<T>& operator+= (const Q3ValueList<T>& l) + { QLinkedList<T>::operator+=(l); return *this; } + + typename Q3ValueList<T>::Iterator fromLast() + { return (this->isEmpty() ? this->end() : --this->end()); } + typename Q3ValueList<T>::ConstIterator fromLast() const + { return (this->isEmpty() ? this->end() : --this->end()); } + + typename Q3ValueList<T>::Iterator append(const T& x) + { QLinkedList<T>::append(x); return --this->end(); } + typename Q3ValueList<T>::Iterator prepend(const T& x) + { QLinkedList<T>::prepend(x); return this->begin(); } + + typename Q3ValueList<T>::Iterator at(typename Q3ValueList<T>::size_type i) + { Q_ASSERT(i < this->size()); this->detach(); return this->begin()+i; } + typename Q3ValueList<T>::ConstIterator at(typename Q3ValueList<T>::size_type i) const + { Q_ASSERT(i < this->size()); return this->begin()+i; } + typename Q3ValueList<T>::size_type contains(const T& x) const + { return QLinkedList<T>::count(x); } + + Q3ValueList<T>& operator+= (const T& x) { append(x); return *this; } + + T& operator[] (typename Q3ValueList<T>::size_type i) { return *at(i); } + const T& operator[] (typename Q3ValueList<T>::size_type i) const { return *at(i); } + +}; + +template <typename T> +Q_OUTOFLINE_TEMPLATE void Q3ValueList<T>::insert(typename Q3ValueList<T>::Iterator pos, + typename Q3ValueList<T>::size_type n, const T& x) +{ + for (; n > 0; --n) + this->insert(pos, x); +} + +#ifndef QT_NO_DATASTREAM +template <typename T> +Q_OUTOFLINE_TEMPLATE QDataStream& operator>>(QDataStream& s, Q3ValueList<T>& l) +{ + return operator>>(s, static_cast<QLinkedList<T> &>(l)); +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QDataStream& operator<<(QDataStream& s, const Q3ValueList<T>& l) +{ + return operator<<(s, static_cast<const QLinkedList<T> &>(l)); +} +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3VALUELIST_H diff --git a/qtinterface/qt4/Qt/q3valuestack.h b/qtinterface/qt4/Qt/q3valuestack.h new file mode 100644 index 0000000..caa2564 --- /dev/null +++ b/qtinterface/qt4/Qt/q3valuestack.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3VALUESTACK_H +#define Q3VALUESTACK_H + +#include <Qt3Support/q3valuelist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template<class T> +class Q3ValueStack : public Q3ValueList<T> +{ +public: + Q3ValueStack() {} + ~Q3ValueStack() {} + void push(const T& val) { this->append(val); } + T pop() + { + T elem(this->last()); + if (!this->isEmpty()) + this->remove(this->fromLast()); + return elem; + } + T& top() { return this->last(); } + const T& top() const { return this->last(); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3VALUESTACK_H diff --git a/qtinterface/qt4/Qt/q3valuevector.h b/qtinterface/qt4/Qt/q3valuevector.h new file mode 100644 index 0000000..3ca6420 --- /dev/null +++ b/qtinterface/qt4/Qt/q3valuevector.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3VALUEVECTOR_H +#define Q3VALUEVECTOR_H + +#include <QtCore/qvector.h> + +#ifndef QT_NO_STL +#include <vector> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +template <typename T> +class Q3ValueVector : public QVector<T> +{ +public: + inline Q3ValueVector() : QVector<T>() {} + inline Q3ValueVector(const Q3ValueVector<T>& v) : QVector<T>(v) {} + inline Q3ValueVector(typename QVector<T>::size_type n, + const T& val = T()) : QVector<T>(n, val) {} + +#ifndef QT_NO_STL + inline Q3ValueVector(const std::vector<T>& v) : QVector<T>() + { this->resize(v.size()); qCopy(v.begin(), v.end(), this->begin()); } +#endif + + Q3ValueVector<T>& operator= (const Q3ValueVector<T>& v) + { QVector<T>::operator=(v); return *this; } + +#ifndef QT_NO_STL + Q3ValueVector<T>& operator= (const std::vector<T>& v) + { + this->clear(); + this->resize(v.size()); + qCopy(v.begin(), v.end(), this->begin()); + return *this; + } +#endif + + void resize(int n, const T& val = T()) + { + if (n < this->size()) + erase(this->begin() + n, this->end()); + else + insert(this->end(), n - this->size(), val); + } + + + T& at(int i, bool* ok = 0) + { + this->detach(); + if (ok) + *ok = (i >= 0 && i < this->size()); + return *(this->begin() + i); + } + + const T&at(int i, bool* ok = 0) const + { + if (ok) + *ok = (i >= 0 && i < this->size()); + return *(this->begin() + i); + } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3VALUEVECTOR_H diff --git a/qtinterface/qt4/Qt/q3vbox.h b/qtinterface/qt4/Qt/q3vbox.h new file mode 100644 index 0000000..11c5afc --- /dev/null +++ b/qtinterface/qt4/Qt/q3vbox.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3VBOX_H +#define Q3VBOX_H + +#include <Qt3Support/q3hbox.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3VBox : public Q3HBox +{ + Q_OBJECT +public: + Q3VBox(QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0); + +private: + Q_DISABLE_COPY(Q3VBox) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3VBOX_H diff --git a/qtinterface/qt4/Qt/q3vgroupbox.h b/qtinterface/qt4/Qt/q3vgroupbox.h new file mode 100644 index 0000000..20551f0 --- /dev/null +++ b/qtinterface/qt4/Qt/q3vgroupbox.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3VGROUPBOX_H +#define Q3VGROUPBOX_H + +#include <Qt3Support/q3groupbox.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3VGroupBox : public Q3GroupBox +{ + Q_OBJECT +public: + Q3VGroupBox( QWidget* parent=0, const char* name=0 ); + Q3VGroupBox( const QString &title, QWidget* parent=0, const char* name=0 ); + ~Q3VGroupBox(); + +private: + Q_DISABLE_COPY(Q3VGroupBox) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3VGROUPBOX_H diff --git a/qtinterface/qt4/Qt/q3whatsthis.h b/qtinterface/qt4/Qt/q3whatsthis.h new file mode 100644 index 0000000..f95bb9e --- /dev/null +++ b/qtinterface/qt4/Qt/q3whatsthis.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3WHATSTHIS_H +#define Q3WHATSTHIS_H + +#include <QtGui/qcursor.h> +#include <QtGui/qwhatsthis.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_WHATSTHIS + +class QToolButton; + +class Q_COMPAT_EXPORT Q3WhatsThis: public QObject +{ + Q_OBJECT +public: + Q3WhatsThis(QWidget *); + ~Q3WhatsThis(); + bool eventFilter(QObject *, QEvent *); + + static inline void enterWhatsThisMode() { QWhatsThis::enterWhatsThisMode(); } + static inline bool inWhatsThisMode() { return QWhatsThis::inWhatsThisMode(); } + + static inline void add(QWidget *w, const QString &s) { w->setWhatsThis(s); } + static inline void remove(QWidget *w) { w->setWhatsThis(QString()); } + static QToolButton * whatsThisButton(QWidget * parent); + static inline void leaveWhatsThisMode(const QString& text = QString(), const QPoint& pos = QCursor::pos(), QWidget* w = 0) + { QWhatsThis::showText(pos, text, w); } + static inline void display(const QString& text, const QPoint& pos = QCursor::pos(), QWidget* w = 0) + { QWhatsThis::showText(pos, text, w); } + + virtual QString text(const QPoint &); + virtual bool clicked(const QString& href); + +}; + +#endif // QT_NO_WHATSTHIS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3WHATSTHIS_H diff --git a/qtinterface/qt4/Qt/q3widgetstack.h b/qtinterface/qt4/Qt/q3widgetstack.h new file mode 100644 index 0000000..836f3de --- /dev/null +++ b/qtinterface/qt4/Qt/q3widgetstack.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3WIDGETSTACK_H +#define Q3WIDGETSTACK_H + +#include <Qt3Support/q3frame.h> +#include <Qt3Support/q3intdict.h> +#include <Qt3Support/q3ptrdict.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q3WidgetStackPrivate; + + +class Q_COMPAT_EXPORT Q3WidgetStack: public Q3Frame +{ + Q_OBJECT +public: + Q3WidgetStack(QWidget* parent, const char* name=0, Qt::WindowFlags f=0); + + ~Q3WidgetStack(); + + int addWidget(QWidget *, int = -1); + void removeWidget(QWidget *); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + void setVisible(bool visible); + + QWidget * widget(int) const; + int id(QWidget *) const; + + QWidget * visibleWidget() const; + + void setFrameRect(const QRect &); + +Q_SIGNALS: + void aboutToShow(int); + void aboutToShow(QWidget *); + +public Q_SLOTS: + void raiseWidget(int); + void raiseWidget(QWidget *); + +protected: + void frameChanged(); + void resizeEvent(QResizeEvent *); + bool event(QEvent* e); + + virtual void setChildGeometries(); + void childEvent(QChildEvent *); + +private: + void init(); + + Q3WidgetStackPrivate * d; + Q3IntDict<QWidget> * dict; + Q3PtrDict<QWidget> * focusWidgets; + QWidget * topWidget; + QWidget * invisible; + + Q_DISABLE_COPY(Q3WidgetStack) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3WIDGETSTACK_H diff --git a/qtinterface/qt4/Qt/q3wizard.h b/qtinterface/qt4/Qt/q3wizard.h new file mode 100644 index 0000000..134777c --- /dev/null +++ b/qtinterface/qt4/Qt/q3wizard.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3WIZARD_H +#define Q3WIZARD_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class QHBoxLayout; +class Q3WizardPrivate; + +class Q_COMPAT_EXPORT Q3Wizard : public QDialog +{ + Q_OBJECT + Q_PROPERTY( QFont titleFont READ titleFont WRITE setTitleFont ) + +public: + Q3Wizard( QWidget* parent=0, const char* name=0, bool modal=false, Qt::WindowFlags f=0 ); + ~Q3Wizard(); + + void setVisible(bool); + + void setFont( const QFont & font ); + + virtual void addPage( QWidget *, const QString & ); + virtual void insertPage( QWidget*, const QString&, int ); + virtual void removePage( QWidget * ); + + QString title( QWidget * ) const; + void setTitle( QWidget *, const QString & ); + QFont titleFont() const; + void setTitleFont( const QFont & ); + + virtual void showPage( QWidget * ); + + QWidget * currentPage() const; + + QWidget* page( int ) const; + int pageCount() const; + int indexOf( QWidget* ) const; + + virtual bool appropriate( QWidget * ) const; + virtual void setAppropriate( QWidget *, bool ); + + QPushButton * backButton() const; + QPushButton * nextButton() const; + QPushButton * finishButton() const; + QPushButton * cancelButton() const; + QPushButton * helpButton() const; + + bool eventFilter( QObject *, QEvent * ); + +public Q_SLOTS: + virtual void setBackEnabled( QWidget *, bool ); + virtual void setNextEnabled( QWidget *, bool ); + virtual void setFinishEnabled( QWidget *, bool ); + + virtual void setHelpEnabled( QWidget *, bool ); + + // obsolete + virtual void setFinish( QWidget *, bool ) {} + +protected Q_SLOTS: + virtual void back(); + virtual void next(); + virtual void help(); + +Q_SIGNALS: + void helpClicked(); + void selected( const QString& ); + +protected: + virtual void layOutButtonRow( QHBoxLayout * ); + virtual void layOutTitleRow( QHBoxLayout *, const QString & ); + +private: + void setBackEnabled( bool ); + void setNextEnabled( bool ); + + void setHelpEnabled( bool ); + + void setNextPage( QWidget * ); + + void updateButtons(); + + void layOut(); + + Q3WizardPrivate *d; + + Q_DISABLE_COPY(Q3Wizard) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3WIZARD_H diff --git a/qtinterface/qt4/Qt/qabstractanimation.h b/qtinterface/qt4/Qt/qabstractanimation.h new file mode 100644 index 0000000..fe40ff1 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractanimation.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTANIMATION_H +#define QABSTRACTANIMATION_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QAnimationGroup; +class QSequentialAnimationGroup; + +class QAbstractAnimationPrivate; +class Q_CORE_EXPORT QAbstractAnimation : public QObject +{ + Q_OBJECT + Q_ENUMS(State) + Q_ENUMS(Direction) + Q_PROPERTY(State state READ state NOTIFY stateChanged) + Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount) + Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime) + Q_PROPERTY(int currentLoop READ currentLoop NOTIFY currentLoopChanged) + Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged) + Q_PROPERTY(int duration READ duration) + +public: + enum Direction { + Forward, + Backward + }; + + enum State { + Stopped, + Paused, + Running + }; + + enum DeletionPolicy { + KeepWhenStopped = 0, + DeleteWhenStopped + }; + + QAbstractAnimation(QObject *parent = 0); + virtual ~QAbstractAnimation(); + + State state() const; + + QAnimationGroup *group() const; + + Direction direction() const; + void setDirection(Direction direction); + + int currentTime() const; + int currentLoopTime() const; + + int loopCount() const; + void setLoopCount(int loopCount); + int currentLoop() const; + + virtual int duration() const = 0; + int totalDuration() const; + +Q_SIGNALS: + void finished(); + void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + void currentLoopChanged(int currentLoop); + void directionChanged(QAbstractAnimation::Direction); + +public Q_SLOTS: + void start(QAbstractAnimation::DeletionPolicy policy = KeepWhenStopped); + void pause(); + void resume(); + void setPaused(bool); + void stop(); + void setCurrentTime(int msecs); + +protected: + QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = 0); + bool event(QEvent *event); + + virtual void updateCurrentTime(int currentTime) = 0; + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + virtual void updateDirection(QAbstractAnimation::Direction direction); + +private: + Q_DISABLE_COPY(QAbstractAnimation) + Q_DECLARE_PRIVATE(QAbstractAnimation) +}; + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTANIMATION_H diff --git a/qtinterface/qt4/Qt/qabstractbutton.h b/qtinterface/qt4/Qt/qabstractbutton.h new file mode 100644 index 0000000..b092cf7 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractbutton.h @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTBUTTON_H +#define QABSTRACTBUTTON_H + +#include <QtGui/qicon.h> +#include <QtGui/qkeysequence.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QButtonGroup; +class QAbstractButtonPrivate; + +class Q_GUI_EXPORT QAbstractButton : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) +#ifndef QT_NO_SHORTCUT + Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) +#endif + Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable) + Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true) + Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat) + Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive) + Q_PROPERTY(int autoRepeatDelay READ autoRepeatDelay WRITE setAutoRepeatDelay) + Q_PROPERTY(int autoRepeatInterval READ autoRepeatInterval WRITE setAutoRepeatInterval) + Q_PROPERTY(bool down READ isDown WRITE setDown DESIGNABLE false) + +public: + explicit QAbstractButton(QWidget* parent=0); + ~QAbstractButton(); + + void setText(const QString &text); + QString text() const; + + void setIcon(const QIcon &icon); + QIcon icon() const; + + QSize iconSize() const; + +#ifndef QT_NO_SHORTCUT + void setShortcut(const QKeySequence &key); + QKeySequence shortcut() const; +#endif + + void setCheckable(bool); + bool isCheckable() const; + + bool isChecked() const; + + void setDown(bool); + bool isDown() const; + + void setAutoRepeat(bool); + bool autoRepeat() const; + + void setAutoRepeatDelay(int); + int autoRepeatDelay() const; + + void setAutoRepeatInterval(int); + int autoRepeatInterval() const; + + void setAutoExclusive(bool); + bool autoExclusive() const; + +#ifndef QT_NO_BUTTONGROUP + QButtonGroup *group() const; +#endif + +public Q_SLOTS: + void setIconSize(const QSize &size); + void animateClick(int msec = 100); + void click(); + void toggle(); + void setChecked(bool); + +Q_SIGNALS: + void pressed(); + void released(); + void clicked(bool checked = false); + void toggled(bool checked); + +protected: + virtual void paintEvent(QPaintEvent *e) = 0; + virtual bool hitButton(const QPoint &pos) const; + virtual void checkStateSet(); + virtual void nextCheckState(); + + bool event(QEvent *e); + void keyPressEvent(QKeyEvent *e); + void keyReleaseEvent(QKeyEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void focusInEvent(QFocusEvent *e); + void focusOutEvent(QFocusEvent *e); + void changeEvent(QEvent *e); + void timerEvent(QTimerEvent *e); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QAbstractButton(QWidget *parent, const char *name, Qt::WindowFlags f=0); + inline QT3_SUPPORT bool isOn() const { return isChecked(); } + inline QT3_SUPPORT const QPixmap *pixmap() const { return 0; } // help styles compile + inline QT3_SUPPORT void setPixmap( const QPixmap &p ) { + setIcon(QIcon(p)); + setIconSize(p.size()); + } + QT3_SUPPORT QIcon *iconSet() const; + inline QT3_SUPPORT void setIconSet(const QIcon &icon) { setIcon(icon); } + inline QT3_SUPPORT bool isToggleButton() const { return isCheckable(); } + inline QT3_SUPPORT void setToggleButton(bool b) { setCheckable(b); } + inline QT3_SUPPORT void setAccel(const QKeySequence &key) { setShortcut(key); } + inline QT3_SUPPORT QKeySequence accel() const { return shortcut(); } + +public Q_SLOTS: + inline QT_MOC_COMPAT void setOn(bool b) { setChecked(b); } +#endif + +protected: + QAbstractButton(QAbstractButtonPrivate &dd, QWidget* parent = 0); + +private: + Q_DECLARE_PRIVATE(QAbstractButton) + Q_DISABLE_COPY(QAbstractButton) + friend class QButtonGroup; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTBUTTON_H diff --git a/qtinterface/qt4/Qt/qabstracteventdispatcher.h b/qtinterface/qt4/Qt/qabstracteventdispatcher.h new file mode 100644 index 0000000..c0bec2b --- /dev/null +++ b/qtinterface/qt4/Qt/qabstracteventdispatcher.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTEVENTDISPATCHER_H +#define QABSTRACTEVENTDISPATCHER_H + +#include <QtCore/qobject.h> +#include <QtCore/qeventloop.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QAbstractEventDispatcherPrivate; +class QSocketNotifier; +template <typename T1, typename T2> struct QPair; + +class Q_CORE_EXPORT QAbstractEventDispatcher : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QAbstractEventDispatcher) + +public: + typedef QPair<int, int> TimerInfo; + + explicit QAbstractEventDispatcher(QObject *parent = 0); + ~QAbstractEventDispatcher(); + + static QAbstractEventDispatcher *instance(QThread *thread = 0); + + virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0; + virtual bool hasPendingEvents() = 0; + + 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; + virtual bool unregisterTimer(int timerId) = 0; + virtual bool unregisterTimers(QObject *object) = 0; + virtual QList<TimerInfo> registeredTimers(QObject *object) const = 0; + + virtual void wakeUp() = 0; + virtual void interrupt() = 0; + virtual void flush() = 0; + + virtual void startingUp(); + virtual void closingDown(); + + typedef bool(*EventFilter)(void *message); + EventFilter setEventFilter(EventFilter filter); + bool filterEvent(void *message); + +Q_SIGNALS: + void aboutToBlock(); + void awake(); + +protected: + QAbstractEventDispatcher(QAbstractEventDispatcherPrivate &, + QObject *parent); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTEVENTDISPATCHER_H diff --git a/qtinterface/qt4/Qt/qabstractfileengine.h b/qtinterface/qt4/Qt/qabstractfileengine.h new file mode 100644 index 0000000..3d41151 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractfileengine.h @@ -0,0 +1,248 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTFILEENGINE_H +#define QABSTRACTFILEENGINE_H + +#include <QtCore/qdir.h> + +#ifdef open +#error qabstractfileengine.h must be included before any header file that defines open +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QFileExtension; +class QFileExtensionResult; +class QVariant; +class QAbstractFileEngineIterator; +class QAbstractFileEnginePrivate; + +class Q_CORE_EXPORT QAbstractFileEngine +{ +public: + enum FileFlag { + //perms (overlaps the QFile::Permission) + ReadOwnerPerm = 0x4000, WriteOwnerPerm = 0x2000, ExeOwnerPerm = 0x1000, + ReadUserPerm = 0x0400, WriteUserPerm = 0x0200, ExeUserPerm = 0x0100, + ReadGroupPerm = 0x0040, WriteGroupPerm = 0x0020, ExeGroupPerm = 0x0010, + ReadOtherPerm = 0x0004, WriteOtherPerm = 0x0002, ExeOtherPerm = 0x0001, + + //types + LinkType = 0x10000, + FileType = 0x20000, + DirectoryType = 0x40000, + BundleType = 0x80000, + + //flags + HiddenFlag = 0x0100000, + LocalDiskFlag = 0x0200000, + ExistsFlag = 0x0400000, + RootFlag = 0x0800000, + Refresh = 0x1000000, + + //masks + PermsMask = 0x0000FFFF, + TypesMask = 0x000F0000, + FlagsMask = 0x0FF00000, + FileInfoAll = FlagsMask | PermsMask | TypesMask + }; + Q_DECLARE_FLAGS(FileFlags, FileFlag) + + enum FileName { + DefaultName, + BaseName, + PathName, + AbsoluteName, + AbsolutePathName, + LinkName, + CanonicalName, + CanonicalPathName, + BundleName, + NFileNames = 9 + }; + enum FileOwner { + OwnerUser, + OwnerGroup + }; + enum FileTime { + CreationTime, + ModificationTime, + AccessTime + }; + + virtual ~QAbstractFileEngine(); + + virtual bool open(QIODevice::OpenMode openMode); + virtual bool close(); + virtual bool flush(); + virtual qint64 size() const; + virtual qint64 pos() const; + virtual bool seek(qint64 pos); + virtual bool isSequential() const; + virtual bool remove(); + virtual bool copy(const QString &newName); + virtual bool rename(const QString &newName); + virtual bool link(const QString &newName); + virtual bool mkdir(const QString &dirName, bool createParentDirectories) const; + virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const; + virtual bool setSize(qint64 size); + virtual bool caseSensitive() const; + virtual bool isRelativePath() const; + virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; + virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const; + virtual bool setPermissions(uint perms); + virtual QString fileName(FileName file=DefaultName) const; + virtual uint ownerId(FileOwner) const; + virtual QString owner(FileOwner) const; + virtual QDateTime fileTime(FileTime time) const; + virtual void setFileName(const QString &file); + virtual int handle() const; + bool atEnd() const; + uchar *map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags); + bool unmap(uchar *ptr); + + typedef QAbstractFileEngineIterator Iterator; + virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames); + virtual Iterator *endEntryList(); + + virtual qint64 read(char *data, qint64 maxlen); + virtual qint64 readLine(char *data, qint64 maxlen); + virtual qint64 write(const char *data, qint64 len); + + QFile::FileError error() const; + QString errorString() const; + + enum Extension { + AtEndExtension, + FastReadLineExtension, + MapExtension, + UnMapExtension + }; + class ExtensionOption + {}; + class ExtensionReturn + {}; + + class MapExtensionOption : public ExtensionOption { + public: + qint64 offset; + qint64 size; + QFile::MemoryMapFlags flags; + }; + class MapExtensionReturn : public ExtensionReturn { + public: + uchar *address; + }; + + class UnMapExtensionOption : public ExtensionOption { + public: + uchar *address; + }; + + virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0); + virtual bool supportsExtension(Extension extension) const; + + // Factory + static QAbstractFileEngine *create(const QString &fileName); + +protected: + void setError(QFile::FileError error, const QString &str); + + QAbstractFileEngine(); + QAbstractFileEngine(QAbstractFileEnginePrivate &); + + QScopedPointer<QAbstractFileEnginePrivate> d_ptr; +private: + Q_DECLARE_PRIVATE(QAbstractFileEngine) + Q_DISABLE_COPY(QAbstractFileEngine) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFileEngine::FileFlags) + +class Q_CORE_EXPORT QAbstractFileEngineHandler +{ +public: + QAbstractFileEngineHandler(); + virtual ~QAbstractFileEngineHandler(); + virtual QAbstractFileEngine *create(const QString &fileName) const = 0; +}; + +class QAbstractFileEngineIteratorPrivate; +class Q_CORE_EXPORT QAbstractFileEngineIterator +{ +public: + QAbstractFileEngineIterator(QDir::Filters filters, const QStringList &nameFilters); + virtual ~QAbstractFileEngineIterator(); + + virtual QString next() = 0; + virtual bool hasNext() const = 0; + + QString path() const; + QStringList nameFilters() const; + QDir::Filters filters() const; + + virtual QString currentFileName() const = 0; + virtual QFileInfo currentFileInfo() const; + QString currentFilePath() const; + +protected: + enum EntryInfoType { + }; + virtual QVariant entryInfo(EntryInfoType type) const; + +private: + Q_DISABLE_COPY(QAbstractFileEngineIterator) + friend class QDirIterator; + friend class QDirIteratorPrivate; + void setPath(const QString &path); + QScopedPointer<QAbstractFileEngineIteratorPrivate> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTFILEENGINE_H diff --git a/qtinterface/qt4/Qt/qabstractfontengine_qws.h b/qtinterface/qt4/Qt/qabstractfontengine_qws.h new file mode 100644 index 0000000..dffb39d --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractfontengine_qws.h @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTFONTENGINE_QWS_H +#define QABSTRACTFONTENGINE_QWS_H + +#include <QtCore/qobject.h> +#include <QtCore/qhash.h> +#include <QtCore/qvariant.h> +#include <QtCore/qfactoryinterface.h> +#include <QtGui/qpaintengine.h> +#include <QtGui/qfontdatabase.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFontEngineInfoPrivate; + +class Q_GUI_EXPORT QFontEngineInfo +{ +public: + QDOC_PROPERTY(QString family READ family WRITE setFamily) + QDOC_PROPERTY(qreal pixelSize READ pixelSize WRITE setPixelSize) + QDOC_PROPERTY(int weight READ weight WRITE setWeight) + QDOC_PROPERTY(QFont::Style style READ style WRITE setStyle) + QDOC_PROPERTY(QList<QFontDatabase::WritingSystem> writingSystems READ writingSystems WRITE setWritingSystems) + + QFontEngineInfo(); + explicit QFontEngineInfo(const QString &family); + QFontEngineInfo(const QFontEngineInfo &other); + QFontEngineInfo &operator=(const QFontEngineInfo &other); + ~QFontEngineInfo(); + + void setFamily(const QString &name); + QString family() const; + + void setPixelSize(qreal size); + qreal pixelSize() const; + + void setWeight(int weight); + int weight() const; + + void setStyle(QFont::Style style); + QFont::Style style() const; + + QList<QFontDatabase::WritingSystem> writingSystems() const; + void setWritingSystems(const QList<QFontDatabase::WritingSystem> &writingSystems); + +private: + QFontEngineInfoPrivate *d; +}; + +class QAbstractFontEngine; + +struct Q_GUI_EXPORT QFontEngineFactoryInterface : public QFactoryInterface +{ + virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0; + virtual QList<QFontEngineInfo> availableFontEngines() const = 0; +}; + +#define QFontEngineFactoryInterface_iid "com.trolltech.Qt.QFontEngineFactoryInterface" +Q_DECLARE_INTERFACE(QFontEngineFactoryInterface, QFontEngineFactoryInterface_iid) + +class QFontEnginePluginPrivate; + +class Q_GUI_EXPORT QFontEnginePlugin : public QObject, public QFontEngineFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QFontEngineFactoryInterface:QFactoryInterface) +public: + QFontEnginePlugin(const QString &foundry, QObject *parent = 0); + ~QFontEnginePlugin(); + + virtual QStringList keys() const; + + virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0; + virtual QList<QFontEngineInfo> availableFontEngines() const = 0; + +private: + Q_DECLARE_PRIVATE(QFontEnginePlugin) + Q_DISABLE_COPY(QFontEnginePlugin) +}; + +class QAbstractFontEnginePrivate; + +class Q_GUI_EXPORT QAbstractFontEngine : public QObject +{ + Q_OBJECT +public: + enum Capability { + CanOutlineGlyphs = 1, + CanRenderGlyphs_Mono = 2, + CanRenderGlyphs_Gray = 4, + CanRenderGlyphs = CanRenderGlyphs_Mono | CanRenderGlyphs_Gray + }; + Q_DECLARE_FLAGS(Capabilities, Capability) + + explicit QAbstractFontEngine(QObject *parent = 0); + ~QAbstractFontEngine(); + + typedef int Fixed; // 26.6 + + struct FixedPoint + { + Fixed x; + Fixed y; + }; + + struct GlyphMetrics + { + inline GlyphMetrics() + : x(0), y(0), width(0), height(0), + advance(0) {} + Fixed x; + Fixed y; + Fixed width; + Fixed height; + Fixed advance; + }; + + enum FontProperty { + Ascent, + Descent, + Leading, + XHeight, + AverageCharWidth, + LineThickness, + UnderlinePosition, + MaxCharWidth, + MinLeftBearing, + MinRightBearing, + GlyphCount, + + // hints + CacheGlyphsHint, + OutlineGlyphsHint + }; + + // keep in sync with QTextEngine::ShaperFlag!! + enum TextShapingFlag { + RightToLeft = 0x0001, + ReturnDesignMetrics = 0x0002 + }; + Q_DECLARE_FLAGS(TextShapingFlags, TextShapingFlag) + + virtual Capabilities capabilities() const = 0; + virtual QVariant fontProperty(FontProperty property) const = 0; + + virtual bool convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const = 0; + + virtual void getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const = 0; + + virtual GlyphMetrics glyphMetrics(uint glyph) const = 0; + + virtual bool renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer); + + virtual void addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path); + + /* + enum Extension { + GetTrueTypeTable + }; + + virtual bool supportsExtension(Extension extension) const; + virtual QVariant extension(Extension extension, const QVariant &argument = QVariant()); + */ + +private: + Q_DECLARE_PRIVATE(QAbstractFontEngine) + Q_DISABLE_COPY(QAbstractFontEngine) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::Capabilities) +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::TextShapingFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractitemdelegate.h b/qtinterface/qt4/Qt/qabstractitemdelegate.h new file mode 100644 index 0000000..ed17575 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractitemdelegate.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTITEMDELEGATE_H +#define QABSTRACTITEMDELEGATE_H + +#include <QtCore/qobject.h> +#include <QtGui/qstyleoption.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class QPainter; +class QModelIndex; +class QAbstractItemModel; +class QAbstractItemView; +class QHelpEvent; + +class Q_GUI_EXPORT QAbstractItemDelegate : public QObject +{ + Q_OBJECT + +public: + + enum EndEditHint { + NoHint, + EditNextItem, + EditPreviousItem, + SubmitModelCache, + RevertModelCache + }; + + explicit QAbstractItemDelegate(QObject *parent = 0); + virtual ~QAbstractItemDelegate(); + + // painting + virtual void paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const = 0; + + virtual QSize sizeHint(const QStyleOptionViewItem &option, + const QModelIndex &index) const = 0; + + // editing + virtual QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; + + virtual void setModelData(QWidget *editor, + QAbstractItemModel *model, + const QModelIndex &index) const; + + virtual void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + // for non-widget editors + virtual bool editorEvent(QEvent *event, + QAbstractItemModel *model, + const QStyleOptionViewItem &option, + const QModelIndex &index); + + 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); + +Q_SIGNALS: + void commitData(QWidget *editor); + void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint = NoHint); + void sizeHintChanged(const QModelIndex &); + +protected: + QAbstractItemDelegate(QObjectPrivate &, QObject *parent = 0); +private: + Q_DISABLE_COPY(QAbstractItemDelegate) +}; + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTITEMDELEGATE_H diff --git a/qtinterface/qt4/Qt/qabstractitemmodel.h b/qtinterface/qt4/Qt/qabstractitemmodel.h new file mode 100644 index 0000000..3ac41b3 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractitemmodel.h @@ -0,0 +1,410 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTITEMMODEL_H +#define QABSTRACTITEMMODEL_H + +#include <QtCore/qvariant.h> +#include <QtCore/qobject.h> +#include <QtCore/qhash.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QAbstractItemModel; +class QPersistentModelIndex; + +class Q_CORE_EXPORT QModelIndex +{ + friend class QAbstractItemModel; + friend class QProxyModel; +public: + inline QModelIndex() : r(-1), c(-1), p(0), m(0) {} + inline QModelIndex(const QModelIndex &other) + : r(other.r), c(other.c), p(other.p), m(other.m) {} + inline ~QModelIndex() { p = 0; m = 0; } + inline int row() const { return r; } + inline int column() const { return c; } + inline void *internalPointer() const { return p; } + inline qint64 internalId() const { return reinterpret_cast<qint64>(p); } + inline QModelIndex parent() const; + inline QModelIndex sibling(int row, int column) const; + inline QModelIndex child(int row, int column) const; + inline QVariant data(int role = Qt::DisplayRole) const; + inline Qt::ItemFlags flags() const; + inline const QAbstractItemModel *model() const { return m; } + inline bool isValid() const { return (r >= 0) && (c >= 0) && (m != 0); } + inline bool operator==(const QModelIndex &other) const + { return (other.r == r) && (other.p == p) && (other.c == c) && (other.m == m); } + inline bool operator!=(const QModelIndex &other) const + { return !(*this == other); } + inline bool operator<(const QModelIndex &other) const + { + if (r < other.r) return true; + if (r == other.r) { + if (c < other.c) return true; + if (c == other.c) { + if (p < other.p) return true; + if (p == other.p) return m < other.m; + } + } + return false; } +private: + inline QModelIndex(int row, int column, void *ptr, const QAbstractItemModel *model); + int r, c; + void *p; + const QAbstractItemModel *m; +}; +Q_DECLARE_TYPEINFO(QModelIndex, Q_MOVABLE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &); +#endif + +class QPersistentModelIndexData; + +class Q_CORE_EXPORT QPersistentModelIndex +{ +public: + QPersistentModelIndex(); + QPersistentModelIndex(const QModelIndex &index); + QPersistentModelIndex(const QPersistentModelIndex &other); + ~QPersistentModelIndex(); + bool operator<(const QPersistentModelIndex &other) const; + bool operator==(const QPersistentModelIndex &other) const; + inline bool operator!=(const QPersistentModelIndex &other) const + { return !operator==(other); } + QPersistentModelIndex &operator=(const QPersistentModelIndex &other); + bool operator==(const QModelIndex &other) const; + bool operator!=(const QModelIndex &other) const; + QPersistentModelIndex &operator=(const QModelIndex &other); + operator const QModelIndex&() const; + int row() const; + int column() const; + void *internalPointer() const; + qint64 internalId() const; + QModelIndex parent() const; + QModelIndex sibling(int row, int column) const; + QModelIndex child(int row, int column) const; + QVariant data(int role = Qt::DisplayRole) const; + Qt::ItemFlags flags() const; + const QAbstractItemModel *model() const; + bool isValid() const; +private: + QPersistentModelIndexData *d; + friend uint qHash(const QPersistentModelIndex &); +#ifndef QT_NO_DEBUG_STREAM + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &); +#endif +}; +Q_DECLARE_TYPEINFO(QPersistentModelIndex, Q_MOVABLE_TYPE); + +inline uint qHash(const QPersistentModelIndex &index) +{ return qHash(index.d); } + + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &); +#endif + +template<typename T> class QList; +typedef QList<QModelIndex> QModelIndexList; + +class QMimeData; +class QAbstractItemModelPrivate; +template <class Key, class T> class QMap; + + +class Q_CORE_EXPORT QAbstractItemModel : public QObject +{ + Q_OBJECT + + friend class QPersistentModelIndexData; + friend class QAbstractItemViewPrivate; +public: + + explicit QAbstractItemModel(QObject *parent = 0); + virtual ~QAbstractItemModel(); + + bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const = 0; + virtual QModelIndex parent(const QModelIndex &child) const = 0; + + inline QModelIndex sibling(int row, int column, const QModelIndex &idx) const + { return index(row, column, parent(idx)); } + + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + virtual QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, + int role = Qt::EditRole); + + virtual QMap<int, QVariant> itemData(const QModelIndex &index) const; + virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles); + + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); + virtual Qt::DropActions supportedDropActions() const; + + Qt::DropActions supportedDragActions() const; + void setSupportedDragActions(Qt::DropActions); + + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + + inline bool insertRow(int row, const QModelIndex &parent = QModelIndex()); + inline bool insertColumn(int column, const QModelIndex &parent = QModelIndex()); + inline bool removeRow(int row, const QModelIndex &parent = QModelIndex()); + inline bool removeColumn(int column, const QModelIndex &parent = QModelIndex()); + + virtual void fetchMore(const QModelIndex &parent); + virtual bool canFetchMore(const QModelIndex &parent) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual QModelIndex buddy(const QModelIndex &index) const; + virtual QModelIndexList match(const QModelIndex &start, int role, + const QVariant &value, int hits = 1, + Qt::MatchFlags flags = + Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const; + virtual QSize span(const QModelIndex &index) const; + + const QHash<int,QByteArray> &roleNames() const; + +#ifdef Q_NO_USING_KEYWORD + inline QObject *parent() const { return QObject::parent(); } +#else + using QObject::parent; +#endif + +Q_SIGNALS: + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void headerDataChanged(Qt::Orientation orientation, int first, int last); + void layoutChanged(); + void layoutAboutToBeChanged(); + +#if !defined(Q_MOC_RUN) && !defined(qdoc) +private: // can only be emitted by QAbstractItemModel +#endif + void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); + void rowsInserted(const QModelIndex &parent, int first, int last); + + void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); + void rowsRemoved(const QModelIndex &parent, int first, int last); + + void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last); + void columnsInserted(const QModelIndex &parent, int first, int last); + + void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last); + void columnsRemoved(const QModelIndex &parent, int first, int last); + + void modelAboutToBeReset(); + void modelReset(); + + void rowsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow ); + void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row ); + + void columnsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn ); + void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column ); + + +public Q_SLOTS: + virtual bool submit(); + virtual void revert(); + +protected: + QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = 0); + + inline QModelIndex createIndex(int row, int column, void *data = 0) const; + inline QModelIndex createIndex(int row, int column, int id) const; + inline QModelIndex createIndex(int row, int column, quint32 id) const; + + void encodeData(const QModelIndexList &indexes, QDataStream &stream) const; + bool decodeData(int row, int column, const QModelIndex &parent, QDataStream &stream); + + void beginInsertRows(const QModelIndex &parent, int first, int last); + void endInsertRows(); + + void beginRemoveRows(const QModelIndex &parent, int first, int last); + void endRemoveRows(); + + bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow); + void endMoveRows(); + + void beginInsertColumns(const QModelIndex &parent, int first, int last); + void endInsertColumns(); + + void beginRemoveColumns(const QModelIndex &parent, int first, int last); + void endRemoveColumns(); + + bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn); + void endMoveColumns(); + + void reset(); + + void beginResetModel(); + void endResetModel(); + + void changePersistentIndex(const QModelIndex &from, const QModelIndex &to); + void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to); + QModelIndexList persistentIndexList() const; + + void setRoleNames(const QHash<int,QByteArray> &roleNames); + +private: + Q_DECLARE_PRIVATE(QAbstractItemModel) + Q_DISABLE_COPY(QAbstractItemModel) +}; + +inline bool QAbstractItemModel::insertRow(int arow, const QModelIndex &aparent) +{ return insertRows(arow, 1, aparent); } +inline bool QAbstractItemModel::insertColumn(int acolumn, const QModelIndex &aparent) +{ return insertColumns(acolumn, 1, aparent); } +inline bool QAbstractItemModel::removeRow(int arow, const QModelIndex &aparent) +{ return removeRows(arow, 1, aparent); } +inline bool QAbstractItemModel::removeColumn(int acolumn, const QModelIndex &aparent) +{ return removeColumns(acolumn, 1, aparent); } + +inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, void *adata) const +{ return QModelIndex(arow, acolumn, adata, this); } +inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, int aid) const +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4312 ) // avoid conversion warning on 64-bit +#endif +{ return QModelIndex(arow, acolumn, reinterpret_cast<void*>(aid), this); } +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif +inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, quint32 aid) const +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4312 ) // avoid conversion warning on 64-bit +#endif +{ return QModelIndex(arow, acolumn, reinterpret_cast<void*>(aid), this); } +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif + + +class Q_CORE_EXPORT QAbstractTableModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + explicit QAbstractTableModel(QObject *parent = 0); + ~QAbstractTableModel(); + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); +protected: + QAbstractTableModel(QAbstractItemModelPrivate &dd, QObject *parent); + +private: + Q_DISABLE_COPY(QAbstractTableModel) + QModelIndex parent(const QModelIndex &child) const; + bool hasChildren(const QModelIndex &parent) const; +}; + +class Q_CORE_EXPORT QAbstractListModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + explicit QAbstractListModel(QObject *parent = 0); + ~QAbstractListModel(); + + QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); +protected: + QAbstractListModel(QAbstractItemModelPrivate &dd, QObject *parent); + +private: + Q_DISABLE_COPY(QAbstractListModel) + QModelIndex parent(const QModelIndex &child) const; + int columnCount(const QModelIndex &parent) const; + bool hasChildren(const QModelIndex &parent) const; +}; + +// inline implementations + +inline QModelIndex::QModelIndex(int arow, int acolumn, void *adata, + const QAbstractItemModel *amodel) + : r(arow), c(acolumn), p(adata), m(amodel) {} + +inline QModelIndex QModelIndex::parent() const +{ return m ? m->parent(*this) : QModelIndex(); } + +inline QModelIndex QModelIndex::sibling(int arow, int acolumn) const +{ return m ? (r == arow && c == acolumn) ? *this : m->index(arow, acolumn, m->parent(*this)) : QModelIndex(); } + +inline QModelIndex QModelIndex::child(int arow, int acolumn) const +{ return m ? m->index(arow, acolumn, *this) : QModelIndex(); } + +inline QVariant QModelIndex::data(int arole) const +{ return m ? m->data(*this, arole) : QVariant(); } + +inline Qt::ItemFlags QModelIndex::flags() const +{ return m ? m->flags(*this) : Qt::ItemFlags(0); } + +inline uint qHash(const QModelIndex &index) +{ return uint((index.row() << 4) + index.column() + index.internalId()); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTITEMMODEL_H diff --git a/qtinterface/qt4/Qt/qabstractitemview.h b/qtinterface/qt4/Qt/qabstractitemview.h new file mode 100644 index 0000000..00677d9 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractitemview.h @@ -0,0 +1,377 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTITEMVIEW_H +#define QABSTRACTITEMVIEW_H + +#include <QtGui/qabstractscrollarea.h> +#include <QtCore/qabstractitemmodel.h> +#include <QtGui/qitemselectionmodel.h> +#include <QtGui/qabstractitemdelegate.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class QMenu; +class QDrag; +class QEvent; +class QAbstractItemViewPrivate; + +class Q_GUI_EXPORT QAbstractItemView : public QAbstractScrollArea +{ + Q_OBJECT + Q_ENUMS(SelectionMode SelectionBehavior ScrollHint ScrollMode DragDropMode) + Q_FLAGS(EditTriggers) + Q_PROPERTY(bool autoScroll READ hasAutoScroll WRITE setAutoScroll) + Q_PROPERTY(int autoScrollMargin READ autoScrollMargin WRITE setAutoScrollMargin) + Q_PROPERTY(EditTriggers editTriggers READ editTriggers WRITE setEditTriggers) + Q_PROPERTY(bool tabKeyNavigation READ tabKeyNavigation WRITE setTabKeyNavigation) +#ifndef QT_NO_DRAGANDDROP + Q_PROPERTY(bool showDropIndicator READ showDropIndicator WRITE setDropIndicatorShown) + Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled) + Q_PROPERTY(bool dragDropOverwriteMode READ dragDropOverwriteMode WRITE setDragDropOverwriteMode) + Q_PROPERTY(DragDropMode dragDropMode READ dragDropMode WRITE setDragDropMode) + Q_PROPERTY(Qt::DropAction defaultDropAction READ defaultDropAction WRITE setDefaultDropAction) +#endif + Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors) + Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) + Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(Qt::TextElideMode textElideMode READ textElideMode WRITE setTextElideMode) + Q_PROPERTY(ScrollMode verticalScrollMode READ verticalScrollMode WRITE setVerticalScrollMode) + Q_PROPERTY(ScrollMode horizontalScrollMode READ horizontalScrollMode WRITE setHorizontalScrollMode) + +public: + enum SelectionMode { + NoSelection, + SingleSelection, + MultiSelection, + ExtendedSelection, + ContiguousSelection + }; + + enum SelectionBehavior { + SelectItems, + SelectRows, + SelectColumns + }; + + enum ScrollHint { + EnsureVisible, + PositionAtTop, + PositionAtBottom, + PositionAtCenter + }; + + enum EditTrigger { + NoEditTriggers = 0, + CurrentChanged = 1, + DoubleClicked = 2, + SelectedClicked = 4, + EditKeyPressed = 8, + AnyKeyPressed = 16, + AllEditTriggers = 31 + }; + + Q_DECLARE_FLAGS(EditTriggers, EditTrigger) + + enum ScrollMode { + ScrollPerItem, + ScrollPerPixel + }; + + explicit QAbstractItemView(QWidget *parent = 0); + ~QAbstractItemView(); + + virtual void setModel(QAbstractItemModel *model); + QAbstractItemModel *model() const; + + virtual void setSelectionModel(QItemSelectionModel *selectionModel); + QItemSelectionModel *selectionModel() const; + + void setItemDelegate(QAbstractItemDelegate *delegate); + QAbstractItemDelegate *itemDelegate() const; + + void setSelectionMode(QAbstractItemView::SelectionMode mode); + QAbstractItemView::SelectionMode selectionMode() const; + + void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior); + QAbstractItemView::SelectionBehavior selectionBehavior() const; + + QModelIndex currentIndex() const; + QModelIndex rootIndex() const; + + void setEditTriggers(EditTriggers triggers); + EditTriggers editTriggers() const; + + void setVerticalScrollMode(ScrollMode mode); + ScrollMode verticalScrollMode() const; + + void setHorizontalScrollMode(ScrollMode mode); + ScrollMode horizontalScrollMode() const; + + void setAutoScroll(bool enable); + bool hasAutoScroll() const; + + void setAutoScrollMargin(int margin); + int autoScrollMargin() const; + + void setTabKeyNavigation(bool enable); + bool tabKeyNavigation() const; + +#ifndef QT_NO_DRAGANDDROP + void setDropIndicatorShown(bool enable); + bool showDropIndicator() const; + + void setDragEnabled(bool enable); + bool dragEnabled() const; + + void setDragDropOverwriteMode(bool overwrite); + bool dragDropOverwriteMode() const; + + enum DragDropMode { + NoDragDrop, + DragOnly, + DropOnly, + DragDrop, + InternalMove + }; + + void setDragDropMode(DragDropMode behavior); + DragDropMode dragDropMode() const; + + void setDefaultDropAction(Qt::DropAction dropAction); + Qt::DropAction defaultDropAction() const; +#endif + + void setAlternatingRowColors(bool enable); + bool alternatingRowColors() const; + + void setIconSize(const QSize &size); + QSize iconSize() const; + + void setTextElideMode(Qt::TextElideMode mode); + Qt::TextElideMode textElideMode() const; + + virtual void keyboardSearch(const QString &search); + + virtual QRect visualRect(const QModelIndex &index) const = 0; + virtual void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) = 0; + virtual QModelIndex indexAt(const QPoint &point) const = 0; + + QSize sizeHintForIndex(const QModelIndex &index) const; + virtual int sizeHintForRow(int row) const; + virtual int sizeHintForColumn(int column) const; + + void openPersistentEditor(const QModelIndex &index); + void closePersistentEditor(const QModelIndex &index); + + void setIndexWidget(const QModelIndex &index, QWidget *widget); + QWidget *indexWidget(const QModelIndex &index) const; + + void setItemDelegateForRow(int row, QAbstractItemDelegate *delegate); + QAbstractItemDelegate *itemDelegateForRow(int row) const; + + void setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate); + QAbstractItemDelegate *itemDelegateForColumn(int column) const; + + QAbstractItemDelegate *itemDelegate(const QModelIndex &index) const; + + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + +#ifdef Q_NO_USING_KEYWORD + inline void update() { QAbstractScrollArea::update(); } +#else + using QAbstractScrollArea::update; +#endif + +public Q_SLOTS: + virtual void reset(); + virtual void setRootIndex(const QModelIndex &index); + virtual void doItemsLayout(); + virtual void selectAll(); + void edit(const QModelIndex &index); + void clearSelection(); + void setCurrentIndex(const QModelIndex &index); + void scrollToTop(); + void scrollToBottom(); + void update(const QModelIndex &index); + +protected Q_SLOTS: + virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + 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); + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + virtual void updateEditorData(); + virtual void updateEditorGeometries(); + virtual void updateGeometries(); + virtual void verticalScrollbarAction(int action); + virtual void horizontalScrollbarAction(int action); + virtual void verticalScrollbarValueChanged(int value); + virtual void horizontalScrollbarValueChanged(int value); + virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint); + virtual void commitData(QWidget *editor); + virtual void editorDestroyed(QObject *editor); + +Q_SIGNALS: + void pressed(const QModelIndex &index); + void clicked(const QModelIndex &index); + void doubleClicked(const QModelIndex &index); + + void activated(const QModelIndex &index); + void entered(const QModelIndex &index); + void viewportEntered(); + +protected: + QAbstractItemView(QAbstractItemViewPrivate &, QWidget *parent = 0); + + void setHorizontalStepsPerItem(int steps); + int horizontalStepsPerItem() const; + void setVerticalStepsPerItem(int steps); + int verticalStepsPerItem() const; + + enum CursorAction { MoveUp, MoveDown, MoveLeft, MoveRight, + MoveHome, MoveEnd, MovePageUp, MovePageDown, + MoveNext, MovePrevious }; + virtual QModelIndex moveCursor(CursorAction cursorAction, + Qt::KeyboardModifiers modifiers) = 0; + + virtual int horizontalOffset() const = 0; + virtual int verticalOffset() const = 0; + + virtual bool isIndexHidden(const QModelIndex &index) const = 0; + + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) = 0; + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const = 0; + virtual QModelIndexList selectedIndexes() const; + + virtual bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event); + + virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, + const QEvent *event = 0) const; + +#ifndef QT_NO_DRAGANDDROP + virtual void startDrag(Qt::DropActions supportedActions); +#endif + + virtual QStyleOptionViewItem viewOptions() const; + + enum State { + NoState, + DraggingState, + DragSelectingState, + EditingState, + ExpandingState, + CollapsingState, + AnimatingState + }; + + State state() const; + void setState(State state); + + void scheduleDelayedItemsLayout(); + void executeDelayedItemsLayout(); + + void setDirtyRegion(const QRegion ®ion); + void scrollDirtyRegion(int dx, int dy); + QPoint dirtyRegionOffset() const; + + void startAutoScroll(); + void stopAutoScroll(); + void doAutoScroll(); + + bool focusNextPrevChild(bool next); + bool event(QEvent *event); + bool viewportEvent(QEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); +#ifndef QT_NO_DRAGANDDROP + void dragEnterEvent(QDragEnterEvent *event); + void dragMoveEvent(QDragMoveEvent *event); + void dragLeaveEvent(QDragLeaveEvent *event); + void dropEvent(QDropEvent *event); +#endif + void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); + void keyPressEvent(QKeyEvent *event); + void resizeEvent(QResizeEvent *event); + void timerEvent(QTimerEvent *event); + void inputMethodEvent(QInputMethodEvent *event); + +#ifndef QT_NO_DRAGANDDROP + enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport }; + DropIndicatorPosition dropIndicatorPosition() const; +#endif + +private: + Q_DECLARE_PRIVATE(QAbstractItemView) + Q_DISABLE_COPY(QAbstractItemView) + Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_columnsInserted(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) + Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_headerDataChanged()) + + friend class QTreeViewPrivate; // needed to compile with MSVC + friend class QAccessibleItemRow; + friend class QListModeViewBase; + friend class QListViewPrivate; // needed to compile for Symbian emulator +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers) + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTITEMVIEW_H diff --git a/qtinterface/qt4/Qt/qabstractmessagehandler.h b/qtinterface/qt4/Qt/qabstractmessagehandler.h new file mode 100644 index 0000000..8de57d4 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractmessagehandler.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTMESSAGEHANDLER_H +#define QABSTRACTMESSAGEHANDLER_H + +#include <QtXmlPatterns/QSourceLocation> +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractMessageHandlerPrivate; +class Q_XMLPATTERNS_EXPORT QAbstractMessageHandler : public QObject +{ + Q_OBJECT +public: + QAbstractMessageHandler(QObject *parent = 0); + virtual ~QAbstractMessageHandler(); + + void message(QtMsgType type, + const QString &description, + const QUrl &identifier = QUrl(), + const QSourceLocation &sourceLocation = QSourceLocation()); + +protected: + virtual void handleMessage(QtMsgType type, + const QString &description, + const QUrl &identifier, + const QSourceLocation &sourceLocation) = 0; +private: + Q_DECLARE_PRIVATE(QAbstractMessageHandler) + Q_DISABLE_COPY(QAbstractMessageHandler) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractnetworkcache.h b/qtinterface/qt4/Qt/qabstractnetworkcache.h new file mode 100644 index 0000000..2960aba --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractnetworkcache.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTNETWORKCACHE_H +#define QABSTRACTNETWORKCACHE_H + +#include <QtCore/qobject.h> +#include <QtCore/qshareddata.h> +#include <QtCore/qpair.h> +#include <QtNetwork/qnetworkrequest.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QIODevice; +class QDateTime; +class QUrl; +template<class T> class QList; + +class QNetworkCacheMetaDataPrivate; +class Q_NETWORK_EXPORT QNetworkCacheMetaData +{ + +public: + typedef QPair<QByteArray, QByteArray> RawHeader; + typedef QList<RawHeader> RawHeaderList; + typedef QHash<QNetworkRequest::Attribute, QVariant> AttributesMap; + + QNetworkCacheMetaData(); + QNetworkCacheMetaData(const QNetworkCacheMetaData &other); + ~QNetworkCacheMetaData(); + + QNetworkCacheMetaData &operator=(const QNetworkCacheMetaData &other); + bool operator==(const QNetworkCacheMetaData &other) const; + inline bool operator!=(const QNetworkCacheMetaData &other) const + { return !(*this == other); } + + bool isValid() const; + + QUrl url() const; + void setUrl(const QUrl &url); + + RawHeaderList rawHeaders() const; + void setRawHeaders(const RawHeaderList &headers); + + QDateTime lastModified() const; + void setLastModified(const QDateTime &dateTime); + + QDateTime expirationDate() const; + void setExpirationDate(const QDateTime &dateTime); + + bool saveToDisk() const; + void setSaveToDisk(bool allow); + + AttributesMap attributes() const; + void setAttributes(const AttributesMap &attributes); + +private: + friend class QNetworkCacheMetaDataPrivate; + QSharedDataPointer<QNetworkCacheMetaDataPrivate> d; +}; + +Q_NETWORK_EXPORT QDataStream &operator<<(QDataStream &, const QNetworkCacheMetaData &); +Q_NETWORK_EXPORT QDataStream &operator>>(QDataStream &, QNetworkCacheMetaData &); + + +class QAbstractNetworkCachePrivate; +class Q_NETWORK_EXPORT QAbstractNetworkCache : public QObject +{ + Q_OBJECT + +public: + virtual ~QAbstractNetworkCache(); + + virtual QNetworkCacheMetaData metaData(const QUrl &url) = 0; + virtual void updateMetaData(const QNetworkCacheMetaData &metaData) = 0; + virtual QIODevice *data(const QUrl &url) = 0; + virtual bool remove(const QUrl &url) = 0; + virtual qint64 cacheSize() const = 0; + + virtual QIODevice *prepare(const QNetworkCacheMetaData &metaData) = 0; + virtual void insert(QIODevice *device) = 0; + +public Q_SLOTS: + virtual void clear() = 0; + +protected: + explicit QAbstractNetworkCache(QObject *parent = 0); + QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent); + +private: + Q_DECLARE_PRIVATE(QAbstractNetworkCache) + Q_DISABLE_COPY(QAbstractNetworkCache) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractpagesetupdialog.h b/qtinterface/qt4/Qt/qabstractpagesetupdialog.h new file mode 100644 index 0000000..c37d33e --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractpagesetupdialog.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTPAGESETUPDIALOG_H +#define QABSTRACTPAGESETUPDIALOG_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTDIALOG + +class QAbstractPageSetupDialogPrivate; +class QPrinter; + +// ### Qt 5: Remove this class +class Q_GUI_EXPORT QAbstractPageSetupDialog : public QDialog +{ + Q_DECLARE_PRIVATE(QAbstractPageSetupDialog) + Q_OBJECT + +public: + explicit QAbstractPageSetupDialog(QPrinter *printer, QWidget *parent = 0); + QAbstractPageSetupDialog(QAbstractPageSetupDialogPrivate &ptr, + QPrinter *printer, QWidget *parent = 0); + ~QAbstractPageSetupDialog(); + + virtual int exec() = 0; + void done(int result); + + QPrinter *printer(); +}; + +#endif // QT_NO_PRINTDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTPAGESETUPDIALOG_H diff --git a/qtinterface/qt4/Qt/qabstractprintdialog.h b/qtinterface/qt4/Qt/qabstractprintdialog.h new file mode 100644 index 0000000..1c73eda --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractprintdialog.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTPRINTDIALOG_H +#define QABSTRACTPRINTDIALOG_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTER + +class QAbstractPrintDialogPrivate; +class QPrinter; + +// ### Qt 5: remove this class +class Q_GUI_EXPORT QAbstractPrintDialog : public QDialog +{ + Q_DECLARE_PRIVATE(QAbstractPrintDialog) + Q_OBJECT + +public: + enum PrintRange { + AllPages, + Selection, + PageRange + }; + + enum PrintDialogOption { + None = 0x0000, // obsolete + PrintToFile = 0x0001, + PrintSelection = 0x0002, + PrintPageRange = 0x0004, + PrintShowPageSize = 0x0008, + PrintCollateCopies = 0x0010, + DontUseSheet = 0x0020 + }; + + Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption) + +#ifndef QT_NO_PRINTDIALOG + explicit QAbstractPrintDialog(QPrinter *printer, QWidget *parent = 0); + ~QAbstractPrintDialog(); + + virtual int exec() = 0; + + // obsolete + void addEnabledOption(PrintDialogOption option); + void setEnabledOptions(PrintDialogOptions options); + PrintDialogOptions enabledOptions() const; + bool isOptionEnabled(PrintDialogOption option) const; + + void setOptionTabs(const QList<QWidget*> &tabs); + + void setPrintRange(PrintRange range); + PrintRange printRange() const; + + void setMinMax(int min, int max); + int minPage() const; + int maxPage() const; + + void setFromTo(int fromPage, int toPage); + int fromPage() const; + int toPage() const; + + QPrinter *printer() const; + +protected: + QAbstractPrintDialog(QAbstractPrintDialogPrivate &ptr, QPrinter *printer, QWidget *parent = 0); + +private: + Q_DISABLE_COPY(QAbstractPrintDialog) + +#endif // QT_NO_PRINTDIALOG +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractPrintDialog::PrintDialogOptions) + +#endif // QT_NO_PRINTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTPRINTDIALOG_H diff --git a/qtinterface/qt4/Qt/qabstractproxymodel.h b/qtinterface/qt4/Qt/qabstractproxymodel.h new file mode 100644 index 0000000..ef1c29a --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractproxymodel.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTPROXYMODEL_H +#define QABSTRACTPROXYMODEL_H + +#include <QtCore/qabstractitemmodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PROXYMODEL + +class QAbstractProxyModelPrivate; +class QItemSelection; + +class Q_GUI_EXPORT QAbstractProxyModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + QAbstractProxyModel(QObject *parent = 0); + ~QAbstractProxyModel(); + + virtual void setSourceModel(QAbstractItemModel *sourceModel); + QAbstractItemModel *sourceModel() const; + + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const = 0; + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const = 0; + + virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const; + virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const; + + bool submit(); + void revert(); + + QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QMap<int, QVariant> itemData(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + +protected: + QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent); + +private: + Q_DECLARE_PRIVATE(QAbstractProxyModel) + Q_DISABLE_COPY(QAbstractProxyModel) + Q_PRIVATE_SLOT(d_func(), void _q_sourceModelDestroyed()) +}; + +#endif // QT_NO_PROXYMODEL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTPROXYMODEL_H diff --git a/qtinterface/qt4/Qt/qabstractscrollarea.h b/qtinterface/qt4/Qt/qabstractscrollarea.h new file mode 100644 index 0000000..526f6ef --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractscrollarea.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTSCROLLAREA_H +#define QABSTRACTSCROLLAREA_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SCROLLAREA + +class QMargins; +class QScrollBar; +class QAbstractScrollAreaPrivate; + +class Q_GUI_EXPORT QAbstractScrollArea : public QFrame +{ + Q_OBJECT + Q_PROPERTY(Qt::ScrollBarPolicy verticalScrollBarPolicy READ verticalScrollBarPolicy WRITE setVerticalScrollBarPolicy) + Q_PROPERTY(Qt::ScrollBarPolicy horizontalScrollBarPolicy READ horizontalScrollBarPolicy WRITE setHorizontalScrollBarPolicy) + +public: + explicit QAbstractScrollArea(QWidget* parent=0); + ~QAbstractScrollArea(); + + Qt::ScrollBarPolicy verticalScrollBarPolicy() const; + void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy); + QScrollBar *verticalScrollBar() const; + void setVerticalScrollBar(QScrollBar *scrollbar); + + Qt::ScrollBarPolicy horizontalScrollBarPolicy() const; + void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy); + QScrollBar *horizontalScrollBar() const; + void setHorizontalScrollBar(QScrollBar *scrollbar); + + QWidget *cornerWidget() const; + void setCornerWidget(QWidget *widget); + + void addScrollBarWidget(QWidget *widget, Qt::Alignment alignment); + QWidgetList scrollBarWidgets(Qt::Alignment alignment); + + QWidget *viewport() const; + void setViewport(QWidget *widget); + QSize maximumViewportSize() const; + + QSize minimumSizeHint() const; + + QSize sizeHint() const; + +protected Q_SLOTS: + void setupViewport(QWidget *viewport); + +protected: + QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent = 0); + void setViewportMargins(int left, int top, int right, int bottom); + void setViewportMargins(const QMargins &margins); + + bool event(QEvent *); + virtual bool viewportEvent(QEvent *); + + void resizeEvent(QResizeEvent *); + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseDoubleClickEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *); +#endif +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *); +#endif +#ifndef QT_NO_DRAGANDDROP + void dragEnterEvent(QDragEnterEvent *); + void dragMoveEvent(QDragMoveEvent *); + void dragLeaveEvent(QDragLeaveEvent *); + void dropEvent(QDropEvent *); +#endif + + void keyPressEvent(QKeyEvent *); + + virtual void scrollContentsBy(int dx, int dy); + +private: + Q_DECLARE_PRIVATE(QAbstractScrollArea) + Q_DISABLE_COPY(QAbstractScrollArea) + Q_PRIVATE_SLOT(d_func(), void _q_hslide(int)) + Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) + Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars()) + + friend class QStyleSheetStyle; + friend class QWidgetPrivate; +}; + +#endif // QT_NO_SCROLLAREA + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTSCROLLAREA_H diff --git a/qtinterface/qt4/Qt/qabstractslider.h b/qtinterface/qt4/Qt/qabstractslider.h new file mode 100644 index 0000000..c46c60e --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractslider.h @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTSLIDER_H +#define QABSTRACTSLIDER_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAbstractSliderPrivate; + +class Q_GUI_EXPORT QAbstractSlider : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(int minimum READ minimum WRITE setMinimum) + Q_PROPERTY(int maximum READ maximum WRITE setMaximum) + Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) + Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep) + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true) + Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved) + Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance) + Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls) + Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false) + +public: + explicit QAbstractSlider(QWidget *parent=0); + ~QAbstractSlider(); + + Qt::Orientation orientation() const; + + void setMinimum(int); + int minimum() const; + + void setMaximum(int); + int maximum() const; + + void setRange(int min, int max); + + void setSingleStep(int); + int singleStep() const; + + void setPageStep(int); + int pageStep() const; + + void setTracking(bool enable); + bool hasTracking() const; + + void setSliderDown(bool); + bool isSliderDown() const; + + void setSliderPosition(int); + int sliderPosition() const; + + void setInvertedAppearance(bool); + bool invertedAppearance() const; + + void setInvertedControls(bool); + bool invertedControls() const; + + enum SliderAction { + SliderNoAction, + SliderSingleStepAdd, + SliderSingleStepSub, + SliderPageStepAdd, + SliderPageStepSub, + SliderToMinimum, + SliderToMaximum, + SliderMove + }; + + int value() const; + + void triggerAction(SliderAction action); + +public Q_SLOTS: + void setValue(int); + void setOrientation(Qt::Orientation); + +Q_SIGNALS: + void valueChanged(int value); + + void sliderPressed(); + void sliderMoved(int position); + void sliderReleased(); + + void rangeChanged(int min, int max); + + void actionTriggered(int action); + +protected: + bool event(QEvent *e); + + void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50); + SliderAction repeatAction() const; + + enum SliderChange { + SliderRangeChange, + SliderOrientationChange, + SliderStepsChange, + SliderValueChange + }; + virtual void sliderChange(SliderChange change); + + void keyPressEvent(QKeyEvent *ev); + void timerEvent(QTimerEvent *); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *e); +#endif + void changeEvent(QEvent *e); + +#ifdef QT3_SUPPORT +public: + inline QT3_SUPPORT int minValue() const { return minimum(); } + inline QT3_SUPPORT int maxValue() const { return maximum(); } + inline QT3_SUPPORT int lineStep() const { return singleStep(); } + inline QT3_SUPPORT void setMinValue(int v) { setMinimum(v); } + inline QT3_SUPPORT void setMaxValue(int v) { setMaximum(v); } + inline QT3_SUPPORT void setLineStep(int v) { setSingleStep(v); } + inline QT3_SUPPORT void setSteps(int single, int page) { setSingleStep(single); setPageStep(page); } + inline QT3_SUPPORT void addPage() { triggerAction(SliderPageStepAdd); } + inline QT3_SUPPORT void subtractPage() { triggerAction(SliderPageStepSub); } + inline QT3_SUPPORT void addLine() { triggerAction(SliderSingleStepAdd); } + inline QT3_SUPPORT void subtractLine() { triggerAction(SliderSingleStepSub); } +#endif + +protected: + QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent=0); + +private: + Q_DISABLE_COPY(QAbstractSlider) + Q_DECLARE_PRIVATE(QAbstractSlider) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTSLIDER_H diff --git a/qtinterface/qt4/Qt/qabstractsocket.h b/qtinterface/qt4/Qt/qabstractsocket.h new file mode 100644 index 0000000..5d29e1f --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractsocket.h @@ -0,0 +1,257 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTSOCKET_H +#define QABSTRACTSOCKET_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qobject.h> +#ifndef QT_NO_DEBUG_STREAM +#include <QtCore/qdebug.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QHostAddress; +#ifndef QT_NO_NETWORKPROXY +class QNetworkProxy; +#endif +class QAbstractSocketPrivate; +class QAuthenticator; + +class Q_NETWORK_EXPORT QAbstractSocket : public QIODevice +{ + Q_OBJECT +public: + enum SocketType { + TcpSocket, + UdpSocket, + UnknownSocketType = -1 + }; + enum NetworkLayerProtocol { + IPv4Protocol, + IPv6Protocol, + UnknownNetworkLayerProtocol = -1 + }; + enum SocketError { + ConnectionRefusedError, + RemoteHostClosedError, + HostNotFoundError, + SocketAccessError, + SocketResourceError, + SocketTimeoutError, /* 5 */ + DatagramTooLargeError, + NetworkError, + AddressInUseError, + SocketAddressNotAvailableError, + UnsupportedSocketOperationError, /* 10 */ + UnfinishedSocketOperationError, + ProxyAuthenticationRequiredError, + SslHandshakeFailedError, + ProxyConnectionRefusedError, + ProxyConnectionClosedError, /* 15 */ + ProxyConnectionTimeoutError, + ProxyNotFoundError, + ProxyProtocolError, + + UnknownSocketError = -1 + }; + enum SocketState { + UnconnectedState, + HostLookupState, + ConnectingState, + ConnectedState, + BoundState, + ListeningState, + ClosingState +#ifdef QT3_SUPPORT + , + Idle = UnconnectedState, + HostLookup = HostLookupState, + Connecting = ConnectingState, + Connected = ConnectedState, + Closing = ClosingState, + Connection = ConnectedState +#endif + }; + enum SocketOption { + LowDelayOption, // TCP_NODELAY + KeepAliveOption // SO_KEEPALIVE + }; + + QAbstractSocket(SocketType socketType, QObject *parent); + virtual ~QAbstractSocket(); + + // ### Qt 5: Make connectToHost() and disconnectFromHost() virtual. + void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite); + void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite); + void disconnectFromHost(); + + bool isValid() const; + + qint64 bytesAvailable() const; + qint64 bytesToWrite() const; + + bool canReadLine() const; + + quint16 localPort() const; + QHostAddress localAddress() const; + quint16 peerPort() const; + QHostAddress peerAddress() const; + QString peerName() const; + + // ### Qt 5: Make setReadBufferSize() virtual + qint64 readBufferSize() const; + void setReadBufferSize(qint64 size); + + void abort(); + + // ### Qt 5: Make socketDescriptor() and setSocketDescriptor() virtual. + int socketDescriptor() const; + bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState, + OpenMode openMode = ReadWrite); + + // ### Qt 5: Make virtual? + void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + QVariant socketOption(QAbstractSocket::SocketOption option); + + SocketType socketType() const; + SocketState state() const; + SocketError error() const; + + // from QIODevice + void close(); + bool isSequential() const; + bool atEnd() const; + bool flush(); + + // for synchronous access + // ### Qt 5: Make waitForConnected() and waitForDisconnected() virtual. + bool waitForConnected(int msecs = 30000); + bool waitForReadyRead(int msecs = 30000); + bool waitForBytesWritten(int msecs = 30000); + bool waitForDisconnected(int msecs = 30000); + +#ifndef QT_NO_NETWORKPROXY + void setProxy(const QNetworkProxy &networkProxy); + QNetworkProxy proxy() const; +#endif + +Q_SIGNALS: + void hostFound(); + void connected(); + void disconnected(); + void stateChanged(QAbstractSocket::SocketState); + void error(QAbstractSocket::SocketError); +#ifndef QT_NO_NETWORKPROXY + 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); + qint64 writeData(const char *data, qint64 len); + + void setSocketState(SocketState state); + void setSocketError(SocketError socketError); + void setLocalPort(quint16 port); + void setLocalAddress(const QHostAddress &address); + void setPeerPort(quint16 port); + void setPeerAddress(const QHostAddress &address); + void setPeerName(const QString &name); + + QAbstractSocket(SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent = 0); + +private: + Q_DECLARE_PRIVATE(QAbstractSocket) + Q_DISABLE_COPY(QAbstractSocket) + + Q_PRIVATE_SLOT(d_func(), void _q_connectToNextAddress()) + Q_PRIVATE_SLOT(d_func(), void _q_startConnecting(const QHostInfo &)) + Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt()) + Q_PRIVATE_SLOT(d_func(), void _q_testConnection()) + Q_PRIVATE_SLOT(d_func(), void _q_forceDisconnect()) + +#ifdef QT3_SUPPORT +public: + enum Error { + ErrConnectionRefused = ConnectionRefusedError, + ErrHostNotFound = HostNotFoundError, + ErrSocketRead = UnknownSocketError + }; + inline QT3_SUPPORT int socket() const { return socketDescriptor(); } + inline QT3_SUPPORT void setSocket(int socket) { setSocketDescriptor(socket); } + inline QT3_SUPPORT qulonglong waitForMore(int msecs, bool *timeout = 0) const + { + QAbstractSocket *that = const_cast<QAbstractSocket *>(this); + if (that->waitForReadyRead(msecs)) + return qulonglong(bytesAvailable()); + if (error() == SocketTimeoutError && timeout) + *timeout = true; + return 0; + } + typedef SocketState State; +Q_SIGNALS: + QT_MOC_COMPAT void connectionClosed(); // same as disconnected() + QT_MOC_COMPAT void delayedCloseFinished(); // same as disconnected() + + +#endif +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketError); +Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketState); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTSOCKET_H diff --git a/qtinterface/qt4/Qt/qabstractspinbox.h b/qtinterface/qt4/Qt/qabstractspinbox.h new file mode 100644 index 0000000..2831206 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractspinbox.h @@ -0,0 +1,179 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTSPINBOX_H +#define QABSTRACTSPINBOX_H + +#include <QtGui/qwidget.h> +#include <QtGui/qvalidator.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SPINBOX + +class QLineEdit; + +class QAbstractSpinBoxPrivate; +class QStyleOptionSpinBox; + +class Q_GUI_EXPORT QAbstractSpinBox : public QWidget +{ + Q_OBJECT + + Q_ENUMS(ButtonSymbols) + Q_ENUMS(CorrectionMode) + Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping) + Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols) + Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText) + Q_PROPERTY(QString text READ text) + Q_PROPERTY(bool accelerated READ isAccelerated WRITE setAccelerated) + Q_PROPERTY(CorrectionMode correctionMode READ correctionMode WRITE setCorrectionMode) + Q_PROPERTY(bool acceptableInput READ hasAcceptableInput) + Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking) +public: + explicit QAbstractSpinBox(QWidget *parent = 0); + ~QAbstractSpinBox(); + + enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01, + StepDownEnabled = 0x02 }; + Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag) + + enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons }; + + ButtonSymbols buttonSymbols() const; + void setButtonSymbols(ButtonSymbols bs); + + enum CorrectionMode { CorrectToPreviousValue, CorrectToNearestValue }; + + void setCorrectionMode(CorrectionMode cm); + CorrectionMode correctionMode() const; + + bool hasAcceptableInput() const; + QString text() const; + + QString specialValueText() const; + void setSpecialValueText(const QString &txt); + + bool wrapping() const; + void setWrapping(bool w); + + void setReadOnly(bool r); + bool isReadOnly() const; + + void setKeyboardTracking(bool kt); + bool keyboardTracking() const; + + void setAlignment(Qt::Alignment flag); + Qt::Alignment alignment() const; + + void setFrame(bool); + bool hasFrame() const; + + void setAccelerated(bool on); + bool isAccelerated() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + void interpretText(); + bool event(QEvent *event); + + QVariant inputMethodQuery(Qt::InputMethodQuery) const; + + virtual QValidator::State validate(QString &input, int &pos) const; + virtual void fixup(QString &input) const; + + virtual void stepBy(int steps); +public Q_SLOTS: + void stepUp(); + void stepDown(); + void selectAll(); + virtual void clear(); +protected: + void resizeEvent(QResizeEvent *event); + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + void wheelEvent(QWheelEvent *event); + void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); + void contextMenuEvent(QContextMenuEvent *event); + void changeEvent(QEvent *event); + void closeEvent(QCloseEvent *event); + void hideEvent(QHideEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void timerEvent(QTimerEvent *event); + void paintEvent(QPaintEvent *event); + void showEvent(QShowEvent *event); + void initStyleOption(QStyleOptionSpinBox *option) const; + + QLineEdit *lineEdit() const; + void setLineEdit(QLineEdit *edit); + + virtual StepEnabled stepEnabled() const; +Q_SIGNALS: + void editingFinished(); +protected: + QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = 0); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &)) + Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int)) + + Q_DECLARE_PRIVATE(QAbstractSpinBox) + Q_DISABLE_COPY(QAbstractSpinBox) +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled) + +#endif // QT_NO_SPINBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTSPINBOX_H diff --git a/qtinterface/qt4/Qt/qabstractstate.h b/qtinterface/qt4/Qt/qabstractstate.h new file mode 100644 index 0000000..e32cf5a --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractstate.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTSTATE_H +#define QABSTRACTSTATE_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QState; +class QStateMachine; + +class QAbstractStatePrivate; +class Q_CORE_EXPORT QAbstractState : public QObject +{ + Q_OBJECT +public: + ~QAbstractState(); + + QState *parentState() const; + QStateMachine *machine() const; + +Q_SIGNALS: +#if !defined(Q_MOC_RUN) && !defined(qdoc) +private: // can only be emitted by QAbstractState +#endif + void entered(); + void exited(); + +protected: + QAbstractState(QState *parent = 0); + + virtual void onEntry(QEvent *event) = 0; + virtual void onExit(QEvent *event) = 0; + + bool event(QEvent *e); + +protected: + QAbstractState(QAbstractStatePrivate &dd, QState *parent); + +private: + Q_DISABLE_COPY(QAbstractState) + Q_DECLARE_PRIVATE(QAbstractState) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstracttextdocumentlayout.h b/qtinterface/qt4/Qt/qabstracttextdocumentlayout.h new file mode 100644 index 0000000..080dcdf --- /dev/null +++ b/qtinterface/qt4/Qt/qabstracttextdocumentlayout.h @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTTEXTDOCUMENTLAYOUT_H +#define QABSTRACTTEXTDOCUMENTLAYOUT_H + +#include <QtCore/qobject.h> +#include <QtGui/qtextlayout.h> +#include <QtGui/qtextdocument.h> +#include <QtGui/qtextcursor.h> +#include <QtGui/qpalette.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAbstractTextDocumentLayoutPrivate; +class QTextBlock; +class QTextObjectInterface; +class QTextFrame; + +class Q_GUI_EXPORT QAbstractTextDocumentLayout : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QAbstractTextDocumentLayout) + +public: + explicit QAbstractTextDocumentLayout(QTextDocument *doc); + ~QAbstractTextDocumentLayout(); + + struct Selection + { + QTextCursor cursor; + QTextCharFormat format; + }; + + struct PaintContext + { + PaintContext() + : cursorPosition(-1) + {} + int cursorPosition; + QPalette palette; + QRectF clip; + QVector<Selection> selections; + }; + + virtual void draw(QPainter *painter, const PaintContext &context) = 0; + virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0; + QString anchorAt(const QPointF& pos) const; + + virtual int pageCount() const = 0; + virtual QSizeF documentSize() const = 0; + + virtual QRectF frameBoundingRect(QTextFrame *frame) const = 0; + virtual QRectF blockBoundingRect(const QTextBlock &block) const = 0; + + void setPaintDevice(QPaintDevice *device); + QPaintDevice *paintDevice() const; + + QTextDocument *document() const; + + void registerHandler(int objectType, QObject *component); + QTextObjectInterface *handlerForObject(int objectType) const; + +Q_SIGNALS: + void update(const QRectF & = QRectF(0., 0., 1000000000., 1000000000.)); + void updateBlock(const QTextBlock &block); + void documentSizeChanged(const QSizeF &newSize); + void pageCountChanged(int newPages); + +protected: + QAbstractTextDocumentLayout(QAbstractTextDocumentLayoutPrivate &, QTextDocument *); + + virtual void documentChanged(int from, int charsRemoved, int charsAdded) = 0; + + virtual void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format); + virtual void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format); + virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format); + + int formatIndex(int pos); + QTextCharFormat format(int pos); + +private: + friend class QTextControl; + friend class QTextDocument; + friend class QTextDocumentPrivate; + friend class QTextEngine; + friend class QTextLayout; + friend class QTextLine; + Q_PRIVATE_SLOT(d_func(), void _q_handlerDestroyed(QObject *obj)) + Q_PRIVATE_SLOT(d_func(), int _q_dynamicPageCountSlot()) + Q_PRIVATE_SLOT(d_func(), QSizeF _q_dynamicDocumentSizeSlot()) +}; + +class Q_GUI_EXPORT QTextObjectInterface +{ +public: + virtual ~QTextObjectInterface() {} + virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; + virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; +}; + +Q_DECLARE_INTERFACE(QTextObjectInterface, "com.trolltech.Qt.QTextObjectInterface") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QABSTRACTTEXTDOCUMENTLAYOUT_H diff --git a/qtinterface/qt4/Qt/qabstracttransition.h b/qtinterface/qt4/Qt/qabstracttransition.h new file mode 100644 index 0000000..e3ba940 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstracttransition.h @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTTRANSITION_H +#define QABSTRACTTRANSITION_H + +#include <QtCore/qobject.h> + +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QEvent; +class QAbstractState; +class QState; +class QStateMachine; + +#ifndef QT_NO_ANIMATION +class QAbstractAnimation; +#endif + +class QAbstractTransitionPrivate; +class Q_CORE_EXPORT QAbstractTransition : public QObject +{ + Q_OBJECT + Q_PROPERTY(QState* sourceState READ sourceState) + Q_PROPERTY(QAbstractState* targetState READ targetState WRITE setTargetState) + Q_PROPERTY(QList<QAbstractState*> targetStates READ targetStates WRITE setTargetStates) +public: + QAbstractTransition(QState *sourceState = 0); + virtual ~QAbstractTransition(); + + QState *sourceState() const; + QAbstractState *targetState() const; + void setTargetState(QAbstractState* target); + QList<QAbstractState*> targetStates() const; + void setTargetStates(const QList<QAbstractState*> &targets); + + QStateMachine *machine() const; + +#ifndef QT_NO_ANIMATION + void addAnimation(QAbstractAnimation *animation); + void removeAnimation(QAbstractAnimation *animation); + QList<QAbstractAnimation*> animations() const; +#endif + +Q_SIGNALS: +#if !defined(Q_MOC_RUN) && !defined(qdoc) +private: // can only be emitted by QAbstractTransition +#endif + void triggered(); + +protected: + virtual bool eventTest(QEvent *event) = 0; + + virtual void onTransition(QEvent *event) = 0; + + bool event(QEvent *e); + +protected: + QAbstractTransition(QAbstractTransitionPrivate &dd, QState *parent); + +private: + Q_DISABLE_COPY(QAbstractTransition) + Q_DECLARE_PRIVATE(QAbstractTransition) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstracturiresolver.h b/qtinterface/qt4/Qt/qabstracturiresolver.h new file mode 100644 index 0000000..4c7de72 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstracturiresolver.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTURIRESOLVER_H +#define QABSTRACTURIRESOLVER_H + +#include <QtCore/QObject> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QUrl; +class QAbstractUriResolverPrivate; + +class Q_XMLPATTERNS_EXPORT QAbstractUriResolver : public QObject +{ + Q_OBJECT +public: + QAbstractUriResolver(QObject *parent = 0); + virtual ~QAbstractUriResolver(); + + virtual QUrl resolve(const QUrl &relative, + const QUrl &baseURI) const = 0; + +private: + Q_DISABLE_COPY(QAbstractUriResolver) + Q_DECLARE_PRIVATE(QAbstractUriResolver) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractvideobuffer.h b/qtinterface/qt4/Qt/qabstractvideobuffer.h new file mode 100644 index 0000000..3182696 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractvideobuffer.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTVIDEOBUFFER_H +#define QABSTRACTVIDEOBUFFER_H + +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QVariant; + +class QAbstractVideoBufferPrivate; + +class Q_MULTIMEDIA_EXPORT QAbstractVideoBuffer +{ +public: + enum HandleType + { + NoHandle, + GLTextureHandle, + UserHandle = 1000 + }; + + enum MapMode + { + NotMapped = 0x00, + ReadOnly = 0x01, + WriteOnly = 0x02, + ReadWrite = ReadOnly | WriteOnly + }; + + QAbstractVideoBuffer(HandleType type); + virtual ~QAbstractVideoBuffer(); + + HandleType handleType() const; + + virtual MapMode mapMode() const = 0; + + virtual uchar *map(MapMode mode, int *numBytes, int *bytesPerLine) = 0; + virtual void unmap() = 0; + + virtual QVariant handle() const; + +protected: + QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type); + + QAbstractVideoBufferPrivate *d_ptr; + +private: + Q_DECLARE_PRIVATE(QAbstractVideoBuffer) + Q_DISABLE_COPY(QAbstractVideoBuffer) +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QAbstractVideoBuffer::HandleType) +Q_DECLARE_METATYPE(QAbstractVideoBuffer::MapMode) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractvideosurface.h b/qtinterface/qt4/Qt/qabstractvideosurface.h new file mode 100644 index 0000000..927df3f --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractvideosurface.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTVIDEOSURFACE_H +#define QABSTRACTVIDEOSURFACE_H + +#include <QtCore/qobject.h> +#include <QtMultimedia/qvideoframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QRectF; +class QVideoSurfaceFormat; + +class QAbstractVideoSurfacePrivate; + +class Q_MULTIMEDIA_EXPORT QAbstractVideoSurface : public QObject +{ + Q_OBJECT + +public: + enum Error + { + NoError, + UnsupportedFormatError, + IncorrectFormatError, + StoppedError, + ResourceError + }; + + explicit QAbstractVideoSurface(QObject *parent = 0); + ~QAbstractVideoSurface(); + + virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats( + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const = 0; + virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const; + virtual QVideoSurfaceFormat nearestFormat(const QVideoSurfaceFormat &format) const; + + QVideoSurfaceFormat surfaceFormat() const; + + virtual bool start(const QVideoSurfaceFormat &format); + virtual void stop(); + + bool isActive() const; + + virtual bool present(const QVideoFrame &frame) = 0; + + Error error() const; + +Q_SIGNALS: + void activeChanged(bool active); + void surfaceFormatChanged(const QVideoSurfaceFormat &format); + void supportedFormatsChanged(); + +protected: + QAbstractVideoSurface(QAbstractVideoSurfacePrivate &dd, QObject *parent); + + void setError(Error error); + +private: + Q_DECLARE_PRIVATE(QAbstractVideoSurface) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractxmlnodemodel.h b/qtinterface/qt4/Qt/qabstractxmlnodemodel.h new file mode 100644 index 0000000..702c3c7 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractxmlnodemodel.h @@ -0,0 +1,429 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTXMLNODEMODEL_H +#define QABSTRACTXMLNODEMODEL_H + +#include <QtXmlPatterns/QXmlName> +#include <QtCore/QSharedData> +#include <QtCore/QScopedPointer> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +/* This file contains the classes QXmlNodeModelIndex, QAbstractXmlNodeModel, + * QXmlItem and QPatternist::NodeIndexStorage. */ + +class QAbstractXmlNodeModel; +class QAbstractXmlNodeModelPrivate; +class QAbstractXmlReceiver; +class QSourceLocation; +class QUrl; +class QXmlName; +class QXmlNodeModelIndex; +template<typename T> class QAbstractXmlForwardIterator; +template<typename T> class QVector; + +/* The members in the namespace QPatternist are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ +namespace QPatternist +{ + class DynamicContext; + class Item; + class ItemType; + class XsdValidatedXmlNodeModel; + template<typename TResult, typename TSource, typename TMapper, typename Context> class ItemMappingIterator; + template<typename TResult, typename TSource, typename TMapper> class SequenceMappingIterator; + typedef QExplicitlySharedDataPointer<ItemType> ItemTypePtr; + typedef QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<Item> > ItemIteratorPtr; + typedef QVector<QXmlName> QXmlNameVector; + + class NodeIndexStorage + { + public: + typedef qint64 Data; + + /*! + \note Changing merely the order of these two members, ptr and data, + is a binary incompatible change on Mac Power PC. + */ + union + { + void *ptr; // Do not use ptr directy, use pointer() instead. + Data data; + }; + void *pointer() const + { + /* Constructing to qptrdiff means we avoid the warning "cast to pointer + * from integer of different size." + */ + return (void *)qptrdiff(data); + } + + Data additionalData; + const QAbstractXmlNodeModel *model; + + /* Implementation is in qabstractxmlnodemodel.cpp. */ + inline bool operator!=(const NodeIndexStorage &other) const; + }; +} + +class Q_XMLPATTERNS_EXPORT QXmlNodeModelIndex +{ + enum Constants + { + ForwardAxis = 8192, + ReverseAxis = 16384 + }; + +public: + inline QXmlNodeModelIndex() + { + reset(); + } + + inline QXmlNodeModelIndex(const QXmlNodeModelIndex &other) : m_storage(other.m_storage) + { + } + + bool operator==(const QXmlNodeModelIndex &other) const; + bool operator!=(const QXmlNodeModelIndex &other) const; + + typedef QAbstractXmlForwardIterator<QXmlNodeModelIndex> Iterator; + typedef QList<QXmlNodeModelIndex> List; + + enum NodeKind + { + Attribute = 1, + Comment = 2, + Document = 4, + Element = 8, + Namespace = 16, + ProcessingInstruction = 32, + Text = 64 + }; + + enum DocumentOrder + { + Precedes = -1, + Is = 0, + Follows = 1 + }; + + enum Axis + { + AxisChild = 1 | ForwardAxis, + AxisDescendant = 2 | ForwardAxis, + AxisAttribute = 4 | ForwardAxis, + AxisSelf = 8 | ForwardAxis, + AxisDescendantOrSelf = 16 | ForwardAxis, + AxisFollowingSibling = 32 | ForwardAxis, + AxisNamespace = 64 | ForwardAxis, + AxisFollowing = 128 | ReverseAxis, + AxisParent = 256 | ReverseAxis, + AxisAncestor = 512 | ReverseAxis, + AxisPrecedingSibling = 1024 | ReverseAxis, + AxisPreceding = 2048 | ReverseAxis, + AxisAncestorOrSelf = 4096 | ReverseAxis, + /* Note that we cannot clash with the values of ForwardAxis and + * ReverseAxis. */ + AxisChildOrTop = 32768 | ForwardAxis, + AxisAttributeOrTop = 65536 | ForwardAxis + }; + + inline qint64 data() const + { + return m_storage.data; + } + + inline void *internalPointer() const + { + return m_storage.pointer(); + } + + inline const QAbstractXmlNodeModel *model() const + { + return m_storage.model; + } + + inline qint64 additionalData() const + { + return m_storage.additionalData; + } + + inline bool isNull() const + { + return !m_storage.model; + } + + /* The members below are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ + + inline QXmlName name() const; + inline QXmlNodeModelIndex root() const; + inline QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QXmlNodeModelIndex> > iterate(const Axis axis) const; + inline QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QPatternist::Item> > sequencedTypedValue() const; + inline QUrl documentUri() const; + inline QUrl baseUri() const; + inline NodeKind kind() const; + inline bool isDeepEqual(const QXmlNodeModelIndex &other) const; + inline DocumentOrder compareOrder(const QXmlNodeModelIndex &other) const; + inline void sendNamespaces(QAbstractXmlReceiver *const receiver) const; + inline QVector<QXmlName> namespaceBindings() const; + inline QXmlName::NamespaceCode namespaceForPrefix(const QXmlName::PrefixCode prefix) const; + inline QString stringValue() const; + inline QPatternist::ItemTypePtr type() const; + inline bool is(const QXmlNodeModelIndex &other) const; + + inline void reset() + { + m_storage.data = 0; + m_storage.additionalData = 0; + m_storage.model = 0; + } + +private: + static inline QXmlNodeModelIndex create(const qint64 d, + const QAbstractXmlNodeModel *const nm) + { + QXmlNodeModelIndex n; + n.m_storage.data = d; + n.m_storage.model = nm; + n.m_storage.additionalData = 0; + return n; + } + + static inline QXmlNodeModelIndex create(const qint64 data, + const QAbstractXmlNodeModel *const nm, + const qint64 addData) + { + QXmlNodeModelIndex n; + n.m_storage.data = data; + n.m_storage.model = nm; + n.m_storage.additionalData = addData; + return n; + } + + inline QXmlNodeModelIndex(const QPatternist::NodeIndexStorage &storage) : m_storage(storage) + { + } + + friend class QAbstractXmlNodeModel; + friend class QPatternist::Item; + friend class QXmlItem; + inline operator int() const; // Disable + + QPatternist::NodeIndexStorage m_storage; +}; + +Q_XMLPATTERNS_EXPORT uint qHash(const QXmlNodeModelIndex &index); + +inline bool qIsForwardIteratorEnd(const QXmlNodeModelIndex &item) +{ + return item.isNull(); +} + +class Q_XMLPATTERNS_EXPORT QAbstractXmlNodeModel : public QSharedData +{ +public: + enum SimpleAxis + { + Parent, + FirstChild, + PreviousSibling, + NextSibling + }; + + typedef QExplicitlySharedDataPointer<QAbstractXmlNodeModel> Ptr; + typedef QList<Ptr> List; + + QAbstractXmlNodeModel(); + virtual ~QAbstractXmlNodeModel(); + + virtual QUrl baseUri(const QXmlNodeModelIndex &ni) const = 0; + virtual QUrl documentUri(const QXmlNodeModelIndex &ni) const = 0; + virtual QXmlNodeModelIndex::NodeKind kind(const QXmlNodeModelIndex &ni) const = 0; + virtual QXmlNodeModelIndex::DocumentOrder compareOrder(const QXmlNodeModelIndex &ni1, + const QXmlNodeModelIndex &ni2) const = 0; + virtual QXmlNodeModelIndex root(const QXmlNodeModelIndex &n) const = 0; + virtual QXmlName name(const QXmlNodeModelIndex &ni) const = 0; + virtual QString stringValue(const QXmlNodeModelIndex &n) const = 0; + virtual QVariant typedValue(const QXmlNodeModelIndex &n) const = 0; + + /* The members below are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ + virtual QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QXmlNodeModelIndex> > iterate(const QXmlNodeModelIndex &ni, QXmlNodeModelIndex::Axis axis) const; + virtual QPatternist::ItemIteratorPtr sequencedTypedValue(const QXmlNodeModelIndex &ni) const; + virtual QPatternist::ItemTypePtr type(const QXmlNodeModelIndex &ni) const; + virtual QXmlName::NamespaceCode namespaceForPrefix(const QXmlNodeModelIndex &ni, + const QXmlName::PrefixCode prefix) const; + virtual bool isDeepEqual(const QXmlNodeModelIndex &ni1, + const QXmlNodeModelIndex &ni2) const; + virtual void sendNamespaces(const QXmlNodeModelIndex &n, + QAbstractXmlReceiver *const receiver) const; + virtual QVector<QXmlName> namespaceBindings(const QXmlNodeModelIndex &n) const = 0; + + + virtual QXmlNodeModelIndex elementById(const QXmlName &NCName) const = 0; + virtual QVector<QXmlNodeModelIndex> nodesByIdref(const QXmlName &NCName) const = 0; + + enum NodeCopySetting + { + InheritNamespaces = 0x1, + PreserveNamespaces = 0x2 + }; + + typedef QFlags<NodeCopySetting> NodeCopySettings; + virtual void copyNodeTo(const QXmlNodeModelIndex &node, + QAbstractXmlReceiver *const receiver, + const NodeCopySettings &) const; + + QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const; + +protected: + + virtual QXmlNodeModelIndex nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const = 0; + virtual QVector<QXmlNodeModelIndex> attributes(const QXmlNodeModelIndex &element) const = 0; + + QAbstractXmlNodeModel(QAbstractXmlNodeModelPrivate *d); + + inline QXmlNodeModelIndex createIndex(qint64 data) const + { + return QXmlNodeModelIndex::create(data, this); + } + + inline QXmlNodeModelIndex createIndex(void * pointer, + qint64 additionalData = 0) const + { + return QXmlNodeModelIndex::create(qptrdiff(pointer), this, additionalData); + } + + inline QXmlNodeModelIndex createIndex(qint64 data, + qint64 additionalData) const + { + return QXmlNodeModelIndex::create(data, this, additionalData); + } + + QScopedPointer<QAbstractXmlNodeModelPrivate> d_ptr; +private: + friend class QPatternist::ItemMappingIterator<QXmlNodeModelIndex, QXmlNodeModelIndex, const QAbstractXmlNodeModel *, QExplicitlySharedDataPointer<QPatternist::DynamicContext> >; + friend class QPatternist::SequenceMappingIterator<QXmlNodeModelIndex, QXmlNodeModelIndex, const QAbstractXmlNodeModel *>; + friend class QPatternist::XsdValidatedXmlNodeModel; + + inline QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QXmlNodeModelIndex> > mapToSequence(const QXmlNodeModelIndex &ni, + const QExplicitlySharedDataPointer<QPatternist::DynamicContext> &) const; + + static inline bool isIgnorableInDeepEqual(const QXmlNodeModelIndex &n); + Q_DISABLE_COPY(QAbstractXmlNodeModel) +}; + +Q_DECLARE_TYPEINFO(QXmlNodeModelIndex, Q_MOVABLE_TYPE); + +template<typename T> class QAbstractXmlForwardIterator; +class QVariant; +class QXmlItemPrivate; + +namespace QPatternist +{ + class AtomicValue; + class VariableLoader; + class IteratorBridge; + class ToQXmlItemMapper; + class ToItemMapper; +} + +class Q_XMLPATTERNS_EXPORT QXmlItem +{ +public: + typedef QAbstractXmlForwardIterator<QXmlItem> Iterator; + + QXmlItem(); + QXmlItem(const QXmlItem &other); + QXmlItem(const QXmlNodeModelIndex &node); + QXmlItem(const QVariant &atomicValue); + ~QXmlItem(); + QXmlItem &operator=(const QXmlItem &other); + + bool isNull() const; + bool isNode() const; + bool isAtomicValue() const; + + QVariant toAtomicValue() const; + QXmlNodeModelIndex toNodeModelIndex() const; + +private: + friend class QPatternist::IteratorBridge; + friend class QPatternist::VariableLoader; + friend class QPatternist::ToQXmlItemMapper; + friend class QPatternist::ToItemMapper; + friend class QPatternist::Item; + + inline bool internalIsAtomicValue() const; + + inline QXmlItem(const QPatternist::Item &i); + + union + { + QPatternist::NodeIndexStorage m_node; + + /* These two sits at the position of NodeIndexStorage::data. + * NodeIndexStorage::{additionalData,model} are free. */ + const QPatternist::AtomicValue *m_atomicValue; + QXmlItemPrivate * m_ptr; /* Not currently used. */ + }; +}; + +inline bool qIsForwardIteratorEnd(const QXmlItem &item) +{ + return item.isNull(); +} + +Q_DECLARE_TYPEINFO(QXmlItem, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QXmlItem) /* This macro must appear after QT_END_NAMESPACE. */ + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qabstractxmlreceiver.h b/qtinterface/qt4/Qt/qabstractxmlreceiver.h new file mode 100644 index 0000000..477fb17 --- /dev/null +++ b/qtinterface/qt4/Qt/qabstractxmlreceiver.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTXMLRECEIVER_H +#define QABSTRACTXMLRECEIVER_H + +#include <QtCore/QVariant> +#include <QtCore/QScopedPointer> +#include <QtXmlPatterns/QXmlNodeModelIndex> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractXmlReceiverPrivate; +class QXmlName; + +namespace QPatternist +{ + class Item; +} + +class Q_XMLPATTERNS_EXPORT QAbstractXmlReceiver +{ +public: + QAbstractXmlReceiver(); + + virtual ~QAbstractXmlReceiver(); + + virtual void startElement(const QXmlName &name) = 0; + virtual void endElement() = 0; + virtual void attribute(const QXmlName &name, + const QStringRef &value) = 0; + virtual void comment(const QString &value) = 0; + virtual void characters(const QStringRef &value) = 0; + virtual void startDocument() = 0; + virtual void endDocument() = 0; + + virtual void processingInstruction(const QXmlName &target, + const QString &value) = 0; + + virtual void atomicValue(const QVariant &value) = 0; + virtual void namespaceBinding(const QXmlName &name) = 0; + virtual void startOfSequence() = 0; + virtual void endOfSequence() = 0; + + /* The members below are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ + virtual void whitespaceOnly(const QStringRef &value); + virtual void item(const QPatternist::Item &item); + +protected: + QAbstractXmlReceiver(QAbstractXmlReceiverPrivate *d); + QScopedPointer<QAbstractXmlReceiverPrivate> d_ptr; + + void sendAsNode(const QPatternist::Item &outputItem); +private: + template<const QXmlNodeModelIndex::Axis axis> + void sendFromAxis(const QXmlNodeModelIndex &node); + Q_DISABLE_COPY(QAbstractXmlReceiver) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qaccessible.h b/qtinterface/qt4/Qt/qaccessible.h new file mode 100644 index 0000000..c3f8c7a --- /dev/null +++ b/qtinterface/qt4/Qt/qaccessible.h @@ -0,0 +1,428 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACCESSIBLE_H +#define QACCESSIBLE_H + +#include <QtCore/qglobal.h> +#include <QtCore/qobject.h> +#include <QtCore/qrect.h> +#include <QtCore/qset.h> +#include <QtCore/qvector.h> +#include <QtCore/qvariant.h> +#include <QtGui/qcolor.h> +#include <QtGui/qevent.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACCESSIBILITY + +class QAccessibleInterface; + +class Q_GUI_EXPORT QAccessible +{ +public: + enum Event { + SoundPlayed = 0x0001, + Alert = 0x0002, + ForegroundChanged = 0x0003, + MenuStart = 0x0004, + MenuEnd = 0x0005, + PopupMenuStart = 0x0006, + PopupMenuEnd = 0x0007, + ContextHelpStart = 0x000C, + ContextHelpEnd = 0x000D, + DragDropStart = 0x000E, + DragDropEnd = 0x000F, + DialogStart = 0x0010, + DialogEnd = 0x0011, + ScrollingStart = 0x0012, + ScrollingEnd = 0x0013, + + MenuCommand = 0x0018, + + ObjectCreated = 0x8000, + 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 + }; + + 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, + Marqueed = 0x00002000, + Animated = 0x00004000, + Invisible = 0x00008000, + Offscreen = 0x00010000, + Sizeable = 0x00020000, + Movable = 0x00040000, +#ifdef QT3_SUPPORT + Moveable = Movable, +#endif + 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, + + HasInvokeExtension = 0x10000000 // internal + }; + Q_DECLARE_FLAGS(State, StateFlag) + + enum Role { + 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, + 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, + // Additional Qt roles where enum value does not map directly to MSAA: + LayeredPane = 0x0000003F, + UserRole = 0x0000ffff + }; + + enum Text { + Name = 0, + Description, + Value, + Help, + Accelerator, + UserText = 0x0000ffff + }; + + 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, + + FocusChild = 0x00010000, + Label = 0x00020000, + Labelled = 0x00040000, + Controller = 0x00080000, + Controlled = 0x00100000, + LogicalMask = 0x00ff0000 + }; + Q_DECLARE_FLAGS(Relation, RelationFlag) + + enum Action { + DefaultAction = 0, + Press = -1, + FirstStandardAction = Press, + SetFocus = -2, + Increase = -3, + Decrease = -4, + Accept = -5, + Cancel = -6, + Select = -7, + ClearSelection = -8, + RemoveSelection = -9, + ExtendSelection = -10, + AddToSelection = -11, + LastStandardAction = AddToSelection + }; + + enum Method { + ListSupportedMethods = 0, + SetCursorPosition = 1, + GetCursorPosition = 2, + ForegroundColor = 3, + BackgroundColor = 4 + }; + + typedef QAccessibleInterface*(*InterfaceFactory)(const QString &key, QObject*); + typedef void(*UpdateHandler)(QObject*, int who, Event reason); + typedef void(*RootObjectHandler)(QObject*); + + static void installFactory(InterfaceFactory); + static void removeFactory(InterfaceFactory); + static UpdateHandler installUpdateHandler(UpdateHandler); + static RootObjectHandler installRootObjectHandler(RootObjectHandler); + + static QAccessibleInterface *queryAccessibleInterface(QObject *); + static void updateAccessibility(QObject *, int who, Event reason); + static bool isActive(); + static void setRootObject(QObject*); + + static void initialize(); + static void cleanup(); + +private: + static UpdateHandler updateHandler; + static RootObjectHandler rootObjectHandler; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::State) +Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation) +QT_END_NAMESPACE +Q_DECLARE_METATYPE(QSet<QAccessible::Method>) +QT_BEGIN_NAMESPACE + +namespace QAccessible2 +{ + enum InterfaceType + { + TextInterface, + EditableTextInterface, + ValueInterface, + TableInterface, + ActionInterface, + ImageInterface + }; +} + +class QAccessible2Interface; +class QAccessibleTextInterface; +class QAccessibleEditableTextInterface; +class QAccessibleValueInterface; +class QAccessibleTableInterface; +class QAccessibleActionInterface; +class QAccessibleImageInterface; + +class Q_GUI_EXPORT QAccessibleInterface : public QAccessible +{ +public: + virtual ~QAccessibleInterface() {} + // check for valid pointers + virtual bool isValid() const = 0; + virtual QObject *object() const = 0; + + // hierarchy + virtual int childCount() const = 0; + virtual int indexOfChild(const QAccessibleInterface *) const = 0; + + // relations + virtual Relation relationTo(int child, const QAccessibleInterface *other, + int otherChild) const = 0; + virtual int childAt(int x, int y) const = 0; + + // navigation + virtual int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const = 0; + + // properties and state + virtual QString text(Text t, int child) const = 0; + virtual void setText(Text t, int child, const QString &text) = 0; + virtual QRect rect(int child) const = 0; + virtual Role role(int child) const = 0; + virtual State state(int child) const = 0; + + // action + virtual int userActionCount(int child) const = 0; + virtual QString actionText(int action, Text t, int child) const = 0; + virtual bool doAction(int action, int child, const QVariantList ¶ms = QVariantList()) = 0; + + QVariant invokeMethod(Method method, int child = 0, + const QVariantList ¶ms = QVariantList()); + + inline QSet<Method> supportedMethods() + { return qvariant_cast<QSet<Method> >(invokeMethod(ListSupportedMethods)); } + + inline QColor foregroundColor() + { return qvariant_cast<QColor>(invokeMethod(ForegroundColor)); } + + inline QColor backgroundColor() + { return qvariant_cast<QColor>(invokeMethod(BackgroundColor)); } + + inline QAccessibleTextInterface *textInterface() + { return reinterpret_cast<QAccessibleTextInterface *>(cast_helper(QAccessible2::TextInterface)); } + + inline QAccessibleEditableTextInterface *editableTextInterface() + { return reinterpret_cast<QAccessibleEditableTextInterface *>(cast_helper(QAccessible2::EditableTextInterface)); } + + inline QAccessibleValueInterface *valueInterface() + { return reinterpret_cast<QAccessibleValueInterface *>(cast_helper(QAccessible2::ValueInterface)); } + + inline QAccessibleTableInterface *tableInterface() + { return reinterpret_cast<QAccessibleTableInterface *>(cast_helper(QAccessible2::TableInterface)); } + + inline QAccessibleActionInterface *actionInterface() + { return reinterpret_cast<QAccessibleActionInterface *>(cast_helper(QAccessible2::ActionInterface)); } + + inline QAccessibleImageInterface *imageInterface() + { return reinterpret_cast<QAccessibleImageInterface *>(cast_helper(QAccessible2::ImageInterface)); } + +private: + QAccessible2Interface *cast_helper(QAccessible2::InterfaceType); +}; + +class Q_GUI_EXPORT QAccessibleInterfaceEx: public QAccessibleInterface +{ +public: + virtual QVariant invokeMethodEx(Method method, int child, const QVariantList ¶ms) = 0; + virtual QVariant virtual_hook(const QVariant &data); + virtual QAccessible2Interface *interface_cast(QAccessible2::InterfaceType) + { return 0; } +}; + + +class Q_GUI_EXPORT QAccessibleEvent : public QEvent +{ +public: + inline QAccessibleEvent(Type type, int child); + inline int child() const { return c; } + inline QString value() const { return val; } + inline void setValue(const QString &aText) { val = aText; } + +private: + int c; + QString val; +}; + +inline QAccessibleEvent::QAccessibleEvent(Type atype, int achild) + : QEvent(atype), c(achild) {} + +#define QAccessibleInterface_iid "com.trolltech.Qt.QAccessibleInterface" +Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid) + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACCESSIBLE_H diff --git a/qtinterface/qt4/Qt/qaccessible2.h b/qtinterface/qt4/Qt/qaccessible2.h new file mode 100644 index 0000000..297aea4 --- /dev/null +++ b/qtinterface/qt4/Qt/qaccessible2.h @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACCESSIBLE2_H +#define QACCESSIBLE2_H + +#include <QtGui/qaccessible.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACCESSIBILITY + +namespace QAccessible2 +{ + enum CoordinateType + { + RelativeToScreen = 0, + RelativeToParent = 1 + }; + + enum BoundaryType { + CharBoundary, + WordBoundary, + SentenceBoundary, + ParagraphBoundary, + LineBoundary, + NoBoundary + }; +} + +class Q_GUI_EXPORT QAccessible2Interface +{ +public: + virtual ~QAccessible2Interface() {} +}; + +// catch-all functions. If an accessible class doesn't implement interface T, return 0 +inline QAccessible2Interface *qAccessibleValueCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; } +inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; } + +#define Q_ACCESSIBLE_OBJECT \ + public: \ + QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \ + { \ + switch (t) { \ + case QAccessible2::TextInterface: \ + return qAccessibleTextCastHelper(); \ + case QAccessible2::EditableTextInterface: \ + return qAccessibleEditableTextCastHelper(); \ + case QAccessible2::ValueInterface: \ + return qAccessibleValueCastHelper(); \ + case QAccessible2::TableInterface: \ + return qAccessibleTableCastHelper(); \ + case QAccessible2::ActionInterface: \ + return qAccessibleActionCastHelper(); \ + case QAccessible2::ImageInterface: \ + return qAccessibleImageCastHelper(); \ + } \ + return 0; \ + } \ + private: + +class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; } + + 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 textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) = 0; + virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) = 0; + virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) = 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 void scrollToSubstring(int startIndex, int endIndex) = 0; +}; + +class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; } + + virtual ~QAccessibleEditableTextInterface() {} + + virtual void copyText(int startOffset, int endOffset) = 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; + virtual void pasteText(int offset) = 0; + virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0; + virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0; +}; + +class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface +{ +public: + QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); + + void copyText(int startOffset, int endOffset); + void deleteText(int startOffset, int endOffset); + void insertText(int offset, const QString &text); + void cutText(int startOffset, int endOffset); + void pasteText(int offset); + void replaceText(int startOffset, int endOffset, const QString &text); + inline void setAttributes(int, int, const QString &) {} + +private: + QAccessibleInterface *iface; +}; + +class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; } + + virtual ~QAccessibleValueInterface() {} + + virtual QVariant currentValue() = 0; + virtual void setCurrentValue(const QVariant &value) = 0; + virtual QVariant maximumValue() = 0; + virtual QVariant minimumValue() = 0; +}; + +class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; } + + virtual QAccessibleInterface *accessibleAt(int row, int column) = 0; + virtual QAccessibleInterface *caption() = 0; + virtual int childIndex(int rowIndex, int columnIndex) = 0; + virtual QString columnDescription(int column) = 0; + virtual int columnSpan(int row, int column) = 0; + virtual QAccessibleInterface *columnHeader() = 0; + virtual int columnIndex(int childIndex) = 0; + virtual int columnCount() = 0; + virtual int rowCount() = 0; + virtual int selectedColumnCount() = 0; + virtual int selectedRowCount() = 0; + virtual QString rowDescription(int row) = 0; + virtual int rowSpan(int row, int column) = 0; + virtual QAccessibleInterface *rowHeader() = 0; + virtual int rowIndex(int childIndex) = 0; + virtual int selectedRows(int maxRows, QList<int> *rows) = 0; + virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0; + virtual QAccessibleInterface *summary() = 0; + virtual bool isColumnSelected(int column) = 0; + virtual bool isRowSelected(int row) = 0; + virtual bool isSelected(int row, int column) = 0; + virtual void selectRow(int row) = 0; + virtual void selectColumn(int column) = 0; + virtual void unselectRow(int row) = 0; + virtual void unselectColumn(int column) = 0; + virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan, + int *columnSpan, bool *isSelected) = 0; +}; + +class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; } + + virtual int actionCount() = 0; + virtual void doAction(int actionIndex) = 0; + virtual QString description(int actionIndex) = 0; + virtual QString name(int actionIndex) = 0; + virtual QString localizedName(int actionIndex) = 0; + virtual QStringList keyBindings(int actionIndex) = 0; +}; + +class Q_GUI_EXPORT QAccessibleImageInterface : public QAccessible2Interface +{ +public: + inline QAccessible2Interface *qAccessibleImageCastHelper() { return this; } + + virtual QString imageDescription() = 0; + virtual QSize imageSize() = 0; + virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0; +}; + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qaccessiblebridge.h b/qtinterface/qt4/Qt/qaccessiblebridge.h new file mode 100644 index 0000000..171e9d5 --- /dev/null +++ b/qtinterface/qt4/Qt/qaccessiblebridge.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACCESSIBLEBRIDGE_H +#define QACCESSIBLEBRIDGE_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACCESSIBILITY + +class QAccessibleInterface; + +class QAccessibleBridge +{ +public: + virtual ~QAccessibleBridge() {} + virtual void setRootObject(QAccessibleInterface *) = 0; + virtual void notifyAccessibilityUpdate(int, QAccessibleInterface*, int) = 0; +}; + +struct Q_GUI_EXPORT QAccessibleBridgeFactoryInterface : public QFactoryInterface +{ + virtual QAccessibleBridge *create(const QString& name) = 0; +}; + +#define QAccessibleBridgeFactoryInterface_iid "com.trolltech.Qt.QAccessibleBridgeFactoryInterface" +Q_DECLARE_INTERFACE(QAccessibleBridgeFactoryInterface, QAccessibleBridgeFactoryInterface_iid) + +class Q_GUI_EXPORT QAccessibleBridgePlugin : public QObject, public QAccessibleBridgeFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QAccessibleBridgeFactoryInterface:QFactoryInterface) +public: + explicit QAccessibleBridgePlugin(QObject *parent = 0); + ~QAccessibleBridgePlugin(); + + virtual QStringList keys() const = 0; + virtual QAccessibleBridge *create(const QString &key) = 0; +}; + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACCESSIBLEBRIDGE_H diff --git a/qtinterface/qt4/Qt/qaccessibleobject.h b/qtinterface/qt4/Qt/qaccessibleobject.h new file mode 100644 index 0000000..fcc716f --- /dev/null +++ b/qtinterface/qt4/Qt/qaccessibleobject.h @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACCESSIBLEOBJECT_H +#define QACCESSIBLEOBJECT_H + +#include <QtGui/qaccessible.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACCESSIBILITY + +class QAccessibleObjectPrivate; +class QObject; + +class Q_GUI_EXPORT QAccessibleObject : public QAccessibleInterface +{ +public: + explicit QAccessibleObject(QObject *object); + + bool isValid() const; + QObject *object() const; + + // properties + QRect rect(int child) const; + void setText(Text t, int child, const QString &text); + + // actions + int userActionCount(int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); + QString actionText(int action, Text t, int child) const; + +protected: + virtual ~QAccessibleObject(); + +private: + friend class QAccessibleObjectEx; + QAccessibleObjectPrivate *d; + Q_DISABLE_COPY(QAccessibleObject) +}; + +class Q_GUI_EXPORT QAccessibleObjectEx : public QAccessibleInterfaceEx +{ +public: + explicit QAccessibleObjectEx(QObject *object); + + bool isValid() const; + QObject *object() const; + + // properties + QRect rect(int child) const; + void setText(Text t, int child, const QString &text); + + // actions + int userActionCount(int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); + QString actionText(int action, Text t, int child) const; + +protected: + virtual ~QAccessibleObjectEx(); + +private: + QAccessibleObjectPrivate *d; + Q_DISABLE_COPY(QAccessibleObjectEx) +}; + +class Q_GUI_EXPORT QAccessibleApplication : public QAccessibleObject +{ +public: + QAccessibleApplication(); + + // relations + int childCount() const; + int indexOfChild(const QAccessibleInterface*) const; + Relation relationTo(int, const QAccessibleInterface *, int) const; + + // navigation + int childAt(int x, int y) const; + int navigate(RelationFlag, int, QAccessibleInterface **) const; + + // properties and state + QString text(Text t, int child) const; + Role role(int child) const; + State state(int child) const; + + // actions + int userActionCount(int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); + QString actionText(int action, Text t, int child) const; +}; + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACCESSIBLEOBJECT_H diff --git a/qtinterface/qt4/Qt/qaccessibleplugin.h b/qtinterface/qt4/Qt/qaccessibleplugin.h new file mode 100644 index 0000000..556757f --- /dev/null +++ b/qtinterface/qt4/Qt/qaccessibleplugin.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACCESSIBLEPLUGIN_H +#define QACCESSIBLEPLUGIN_H + +#include <QtGui/qaccessible.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACCESSIBILITY + +class QStringList; +class QAccessibleInterface; + +struct Q_GUI_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFactoryInterface +{ + virtual QAccessibleInterface* create(const QString &key, QObject *object) = 0; +}; + +#define QAccessibleFactoryInterface_iid "com.trolltech.Qt.QAccessibleFactoryInterface" +Q_DECLARE_INTERFACE(QAccessibleFactoryInterface, QAccessibleFactoryInterface_iid) + +class QAccessiblePluginPrivate; + +class Q_GUI_EXPORT QAccessiblePlugin : public QObject, public QAccessibleFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QAccessibleFactoryInterface:QFactoryInterface) +public: + explicit QAccessiblePlugin(QObject *parent = 0); + ~QAccessiblePlugin(); + + virtual QStringList keys() const = 0; + virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0; +}; + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACCESSIBLEPLUGIN_H diff --git a/qtinterface/qt4/Qt/qaccessiblewidget.h b/qtinterface/qt4/Qt/qaccessiblewidget.h new file mode 100644 index 0000000..abf96a6 --- /dev/null +++ b/qtinterface/qt4/Qt/qaccessiblewidget.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACCESSIBLEWIDGET_H +#define QACCESSIBLEWIDGET_H + +#include <QtGui/qaccessibleobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACCESSIBILITY + +class QAccessibleWidgetPrivate; + +class Q_GUI_EXPORT QAccessibleWidget : public QAccessibleObject +{ +public: + explicit QAccessibleWidget(QWidget *o, Role r = Client, const QString& name = QString()); + + int childCount() const; + int indexOfChild(const QAccessibleInterface *child) const; + Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; + + int childAt(int x, int y) const; + QRect rect(int child) const; + int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const; + + QString text(Text t, int child) const; + Role role(int child) const; + State state(int child) const; + +#ifndef QT_NO_ACTION + int userActionCount(int child) const; + QString actionText(int action, Text t, int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); +#endif + +protected: + ~QAccessibleWidget(); + QWidget *widget() const; + QObject *parentObject() const; + + void addControllingSignal(const QString &signal); + void setValue(const QString &value); + void setDescription(const QString &desc); + void setHelp(const QString &help); + void setAccelerator(const QString &accel); + +private: + friend class QAccessibleWidgetEx; + QAccessibleWidgetPrivate *d; + Q_DISABLE_COPY(QAccessibleWidget) +}; + +class Q_GUI_EXPORT QAccessibleWidgetEx : public QAccessibleObjectEx +{ +public: + explicit QAccessibleWidgetEx(QWidget *o, Role r = Client, const QString& name = QString()); + + int childCount() const; + int indexOfChild(const QAccessibleInterface *child) const; + Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; + + int childAt(int x, int y) const; + QRect rect(int child) const; + int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const; + + QString text(Text t, int child) const; + Role role(int child) const; + State state(int child) const; + + QString actionText(int action, Text t, int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); + + QVariant invokeMethodEx(Method method, int child, const QVariantList ¶ms); + +protected: + ~QAccessibleWidgetEx(); + QWidget *widget() const; + QObject *parentObject() const; + + void addControllingSignal(const QString &signal); + void setValue(const QString &value); + void setDescription(const QString &desc); + void setHelp(const QString &help); + void setAccelerator(const QString &accel); + +private: + QAccessibleWidgetPrivate *d; + Q_DISABLE_COPY(QAccessibleWidgetEx) +}; + +#endif // QT_NO_ACCESSIBILITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACCESSIBLEWIDGET_H diff --git a/qtinterface/qt4/Qt/qaction.h b/qtinterface/qt4/Qt/qaction.h new file mode 100644 index 0000000..fca03cc --- /dev/null +++ b/qtinterface/qt4/Qt/qaction.h @@ -0,0 +1,261 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACTION_H +#define QACTION_H + +#include <QtGui/qkeysequence.h> +#include <QtCore/qstring.h> +#include <QtGui/qwidget.h> +#include <QtCore/qvariant.h> +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACTION + +class QMenu; +class QActionGroup; +class QActionPrivate; +class QGraphicsWidget; + +class Q_GUI_EXPORT QAction : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QAction) + + Q_ENUMS(MenuRole) + Q_ENUMS(SoftKeyRole) + Q_ENUMS(Priority) + Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed) + Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY changed) + Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed) + Q_PROPERTY(QString iconText READ iconText WRITE setIconText NOTIFY changed) + Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip NOTIFY changed) + Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip NOTIFY changed) + Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis NOTIFY changed) + Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) +#ifndef QT_NO_SHORTCUT + Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut NOTIFY changed) + Q_PROPERTY(Qt::ShortcutContext shortcutContext READ shortcutContext WRITE setShortcutContext NOTIFY changed) + Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY changed) +#endif + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed) + Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed) + Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole NOTIFY changed) + Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed) + Q_PROPERTY(Priority priority READ priority WRITE setPriority) + +public: + enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, + AboutRole, PreferencesRole, QuitRole }; + enum SoftKeyRole { + NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey }; + enum Priority { LowPriority = 0, + NormalPriority = 128, + HighPriority = 256}; + explicit QAction(QObject* parent); + QAction(const QString &text, QObject* parent); + QAction(const QIcon &icon, const QString &text, QObject* parent); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QAction(QObject* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QAction(const QString &text, const QKeySequence &shortcut, + QObject* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QAction(const QIcon &icon, const QString &text, + const QKeySequence &shortcut, + QObject* parent, const char* name); +#endif + ~QAction(); + + void setActionGroup(QActionGroup *group); + QActionGroup *actionGroup() const; + void setIcon(const QIcon &icon); + QIcon icon() const; + + void setText(const QString &text); + QString text() const; + + void setIconText(const QString &text); + QString iconText() const; + + void setToolTip(const QString &tip); + QString toolTip() const; + + void setStatusTip(const QString &statusTip); + QString statusTip() const; + + void setWhatsThis(const QString &what); + QString whatsThis() const; + + void setPriority(Priority priority); + Priority priority() const; + +#ifndef QT_NO_MENU + QMenu *menu() const; + void setMenu(QMenu *menu); +#endif + + void setSeparator(bool b); + bool isSeparator() const; + +#ifndef QT_NO_SHORTCUT + void setShortcut(const QKeySequence &shortcut); + QKeySequence shortcut() const; + + void setShortcuts(const QList<QKeySequence> &shortcuts); + void setShortcuts(QKeySequence::StandardKey); + QList<QKeySequence> shortcuts() const; + + void setShortcutContext(Qt::ShortcutContext context); + Qt::ShortcutContext shortcutContext() const; + + void setAutoRepeat(bool); + bool autoRepeat() const; +#endif + + void setFont(const QFont &font); + QFont font() const; + + void setCheckable(bool); + bool isCheckable() const; + + QVariant data() const; + void setData(const QVariant &var); + + bool isChecked() const; + + bool isEnabled() const; + + bool isVisible() const; + + enum ActionEvent { Trigger, Hover }; + void activate(ActionEvent event); + bool showStatusText(QWidget *widget=0); + + void setMenuRole(MenuRole menuRole); + MenuRole menuRole() const; + + void setSoftKeyRole(SoftKeyRole softKeyRole); + SoftKeyRole softKeyRole() const; + + void setIconVisibleInMenu(bool visible); + bool isIconVisibleInMenu() const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void setMenuText(const QString &text) { setText(text); } + inline QT3_SUPPORT QString menuText() const { return text(); } + inline QT3_SUPPORT bool isOn() const { return isChecked(); } + inline QT3_SUPPORT bool isToggleAction() const { return isCheckable(); } + inline QT3_SUPPORT void setToggleAction(bool b) { setCheckable(b); } + inline QT3_SUPPORT void setIconSet(const QIcon &i) { setIcon(i); } + inline QT3_SUPPORT QIcon iconSet() const { return icon(); } + inline QT3_SUPPORT bool addTo(QWidget *w) { w->addAction(this); return true; } + inline QT3_SUPPORT bool removeFrom(QWidget *w) { w->removeAction(this); return true; } + inline QT3_SUPPORT void setAccel(const QKeySequence &shortcut) { setShortcut(shortcut); } + inline QT3_SUPPORT QKeySequence accel() const { return shortcut(); } +#endif + + QWidget *parentWidget() const; + + QList<QWidget *> associatedWidgets() const; +#ifndef QT_NO_GRAPHICSVIEW + QList<QGraphicsWidget *> associatedGraphicsWidgets() const; // ### suboptimal +#endif + +protected: + bool event(QEvent *); + QAction(QActionPrivate &dd, QObject *parent); + +public Q_SLOTS: +#ifdef QT3_SUPPORT + inline QT_MOC_COMPAT void setOn(bool b) { setChecked(b); } +#endif + void trigger() { activate(Trigger); } + void hover() { activate(Hover); } + void setChecked(bool); + void toggle(); + void setEnabled(bool); + inline void setDisabled(bool b) { setEnabled(!b); } + void setVisible(bool); + +Q_SIGNALS: + void changed(); + void triggered(bool checked = false); + void hovered(); + void toggled(bool); +#ifdef QT3_SUPPORT + QT_MOC_COMPAT void activated(int = 0); +#endif + +private: + Q_DISABLE_COPY(QAction) + +#ifdef QT3_SUPPORT + friend class QMenuItem; +#endif + friend class QGraphicsWidget; + friend class QWidget; + friend class QActionGroup; + friend class QMenu; + friend class QMenuPrivate; + friend class QMenuBar; + friend class QShortcutMap; + friend class QToolButton; +}; + +QT_BEGIN_INCLUDE_NAMESPACE +#include <QtGui/qactiongroup.h> +QT_END_INCLUDE_NAMESPACE + +#endif // QT_NO_ACTION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACTION_H diff --git a/qtinterface/qt4/Qt/qactiongroup.h b/qtinterface/qt4/Qt/qactiongroup.h new file mode 100644 index 0000000..fa6370a --- /dev/null +++ b/qtinterface/qt4/Qt/qactiongroup.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QACTIONGROUP_H +#define QACTIONGROUP_H + +#include <QtGui/qaction.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACTION + +class QActionGroupPrivate; + +class Q_GUI_EXPORT QActionGroup : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QActionGroup) + + Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible) + +public: + explicit QActionGroup(QObject* parent); + ~QActionGroup(); + + QAction *addAction(QAction* a); + QAction *addAction(const QString &text); + QAction *addAction(const QIcon &icon, const QString &text); + void removeAction(QAction *a); + QList<QAction*> actions() const; + + QAction *checkedAction() const; + bool isExclusive() const; + bool isEnabled() const; + bool isVisible() const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void add(QAction* a) { addAction(a); } + inline QT3_SUPPORT void addSeparator() + { QAction *act = new QAction(this); act->setSeparator(true); addAction(act); } + inline QT3_SUPPORT bool addTo(QWidget *w) { w->addActions(actions()); return true; } +#endif + +public Q_SLOTS: + void setEnabled(bool); + inline void setDisabled(bool b) { setEnabled(!b); } + void setVisible(bool); + void setExclusive(bool); + +Q_SIGNALS: + void triggered(QAction *); + QT_MOC_COMPAT void selected(QAction *); + void hovered(QAction *); + +private: + Q_DISABLE_COPY(QActionGroup) + Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) + Q_PRIVATE_SLOT(d_func(), void _q_actionChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) +}; + +#endif // QT_NO_ACTION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QACTIONGROUP_H diff --git a/qtinterface/qt4/Qt/qalgorithms.h b/qtinterface/qt4/Qt/qalgorithms.h new file mode 100644 index 0000000..4207315 --- /dev/null +++ b/qtinterface/qt4/Qt/qalgorithms.h @@ -0,0 +1,526 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QALGORITHMS_H +#define QALGORITHMS_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +/* + Warning: The contents of QAlgorithmsPrivate is not a part of the public Qt API + and may be changed from version to version or even be completely removed. +*/ +namespace QAlgorithmsPrivate { + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan); +template <typename RandomAccessIterator, typename T> +inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy); + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan); +template <typename RandomAccessIterator, typename T> +inline void qStableSortHelper(RandomAccessIterator, RandomAccessIterator, const T &); + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan); +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan); +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan); + +} + +template <typename InputIterator, typename OutputIterator> +inline OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest) +{ + while (begin != end) + *dest++ = *begin++; + return dest; +} + +template <typename BiIterator1, typename BiIterator2> +inline BiIterator2 qCopyBackward(BiIterator1 begin, BiIterator1 end, BiIterator2 dest) +{ + while (begin != end) + *--dest = *--end; + return dest; +} + +template <typename InputIterator1, typename InputIterator2> +inline bool qEqual(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2) +{ + for (; first1 != last1; ++first1, ++first2) + if (!(*first1 == *first2)) + return false; + return true; +} + +template <typename ForwardIterator, typename T> +inline void qFill(ForwardIterator first, ForwardIterator last, const T &val) +{ + for (; first != last; ++first) + *first = val; +} + +template <typename Container, typename T> +inline void qFill(Container &container, const T &val) +{ + qFill(container.begin(), container.end(), val); +} + +template <typename InputIterator, typename T> +inline InputIterator qFind(InputIterator first, InputIterator last, const T &val) +{ + while (first != last && !(*first == val)) + ++first; + return first; +} + +template <typename Container, typename T> +inline typename Container::const_iterator qFind(const Container &container, const T &val) +{ + return qFind(container.constBegin(), container.constEnd(), val); +} + +template <typename InputIterator, typename T, typename Size> +inline void qCount(InputIterator first, InputIterator last, const T &value, Size &n) +{ + for (; first != last; ++first) + if (*first == value) + ++n; +} + +template <typename Container, typename T, typename Size> +inline void qCount(const Container &container, const T &value, Size &n) +{ + qCount(container.constBegin(), container.constEnd(), value, n); +} + +#ifdef qdoc +template <typename T> +LessThan qLess() +{ +} + +template <typename T> +LessThan qGreater() +{ +} +#else +template <typename T> +class qLess +{ +public: + inline bool operator()(const T &t1, const T &t2) const + { + return (t1 < t2); + } +}; + +template <typename T> +class qGreater +{ +public: + inline bool operator()(const T &t1, const T &t2) const + { + return (t2 < t1); + } +}; +#endif + +template <typename RandomAccessIterator> +inline void qSort(RandomAccessIterator start, RandomAccessIterator end) +{ + if (start != end) + QAlgorithmsPrivate::qSortHelper(start, end, *start); +} + +template <typename RandomAccessIterator, typename LessThan> +inline void qSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan) +{ + if (start != end) + QAlgorithmsPrivate::qSortHelper(start, end, *start, lessThan); +} + +template<typename Container> +inline void qSort(Container &c) +{ +#ifdef Q_CC_BOR + // Work around Borland 5.5 optimizer bug + c.detach(); +#endif + if (!c.empty()) + QAlgorithmsPrivate::qSortHelper(c.begin(), c.end(), *c.begin()); +} + +template <typename RandomAccessIterator> +inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end) +{ + if (start != end) + QAlgorithmsPrivate::qStableSortHelper(start, end, *start); +} + +template <typename RandomAccessIterator, typename LessThan> +inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan) +{ + if (start != end) + QAlgorithmsPrivate::qStableSortHelper(start, end, *start, lessThan); +} + +template<typename Container> +inline void qStableSort(Container &c) +{ +#ifdef Q_CC_BOR + // Work around Borland 5.5 optimizer bug + c.detach(); +#endif + if (!c.empty()) + QAlgorithmsPrivate::qStableSortHelper(c.begin(), c.end(), *c.begin()); +} + +template <typename RandomAccessIterator, typename T> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value) +{ + // Implementation is duplicated from QAlgorithmsPrivate to keep existing code + // compiling. We have to allow using *begin and value with different types, + // and then implementing operator< for those types. + RandomAccessIterator middle; + int n = end - begin; + int half; + + while (n > 0) { + half = n >> 1; + middle = begin + half; + if (*middle < value) { + begin = middle + 1; + n -= half + 1; + } else { + n = half; + } + } + return begin; +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +{ + return QAlgorithmsPrivate::qLowerBoundHelper(begin, end, value, lessThan); +} + +template <typename Container, typename T> +Q_OUTOFLINE_TEMPLATE typename Container::const_iterator qLowerBound(const Container &container, const T &value) +{ + return QAlgorithmsPrivate::qLowerBoundHelper(container.constBegin(), container.constEnd(), value, qLess<T>()); +} + +template <typename RandomAccessIterator, typename T> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value) +{ + // Implementation is duplicated from QAlgorithmsPrivate. + RandomAccessIterator middle; + int n = end - begin; + int half; + + while (n > 0) { + half = n >> 1; + middle = begin + half; + if (value < *middle) { + n = half; + } else { + begin = middle + 1; + n -= half + 1; + } + } + return begin; +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +{ + return QAlgorithmsPrivate::qUpperBoundHelper(begin, end, value, lessThan); +} + +template <typename Container, typename T> +Q_OUTOFLINE_TEMPLATE typename Container::const_iterator qUpperBound(const Container &container, const T &value) +{ + return QAlgorithmsPrivate::qUpperBoundHelper(container.constBegin(), container.constEnd(), value, qLess<T>()); +} + +template <typename RandomAccessIterator, typename T> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value) +{ + // Implementation is duplicated from QAlgorithmsPrivate. + RandomAccessIterator it = qLowerBound(begin, end, value); + + if (it == end || value < *it) + return end; + + return it; +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +{ + return QAlgorithmsPrivate::qBinaryFindHelper(begin, end, value, lessThan); +} + +template <typename Container, typename T> +Q_OUTOFLINE_TEMPLATE typename Container::const_iterator qBinaryFind(const Container &container, const T &value) +{ + return QAlgorithmsPrivate::qBinaryFindHelper(container.constBegin(), container.constEnd(), value, qLess<T>()); +} + +template <typename ForwardIterator> +Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end) +{ + while (begin != end) { + delete *begin; + ++begin; + } +} + +template <typename Container> +inline void qDeleteAll(const Container &c) +{ + qDeleteAll(c.begin(), c.end()); +} + +/* + Warning: The contents of QAlgorithmsPrivate is not a part of the public Qt API + and may be changed from version to version or even be completely removed. +*/ +namespace QAlgorithmsPrivate { + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan) +{ +top: + int span = int(end - start); + if (span < 2) + return; + + --end; + RandomAccessIterator low = start, high = end - 1; + RandomAccessIterator pivot = start + span / 2; + + if (lessThan(*end, *start)) + qSwap(*end, *start); + if (span == 2) + return; + + if (lessThan(*pivot, *start)) + qSwap(*pivot, *start); + if (lessThan(*end, *pivot)) + qSwap(*end, *pivot); + if (span == 3) + return; + + qSwap(*pivot, *end); + + while (low < high) { + while (low < high && lessThan(*low, *end)) + ++low; + + while (high > low && lessThan(*end, *high)) + --high; + + if (low < high) { + qSwap(*low, *high); + ++low; + --high; + } else { + break; + } + } + + if (lessThan(*low, *end)) + ++low; + + qSwap(*end, *low); + qSortHelper(start, low, t, lessThan); + + start = low + 1; + ++end; + goto top; +} + +template <typename RandomAccessIterator, typename T> +inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy) +{ + qSortHelper(begin, end, dummy, qLess<T>()); +} + +template <typename RandomAccessIterator> +Q_OUTOFLINE_TEMPLATE void qReverse(RandomAccessIterator begin, RandomAccessIterator end) +{ + --end; + while (begin < end) + qSwap(*begin++, *end--); +} + +template <typename RandomAccessIterator> +Q_OUTOFLINE_TEMPLATE void qRotate(RandomAccessIterator begin, RandomAccessIterator middle, RandomAccessIterator end) +{ + qReverse(begin, middle); + qReverse(middle, end); + qReverse(begin, end); +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qMerge(RandomAccessIterator begin, RandomAccessIterator pivot, RandomAccessIterator end, T &t, LessThan lessThan) +{ + const int len1 = pivot - begin; + const int len2 = end - pivot; + + if (len1 == 0 || len2 == 0) + return; + + if (len1 + len2 == 2) { + if (lessThan(*(begin + 1), *(begin))) + qSwap(*begin, *(begin + 1)); + return; + } + + RandomAccessIterator firstCut; + RandomAccessIterator secondCut; + int len2Half; + if (len1 > len2) { + const int len1Half = len1 / 2; + firstCut = begin + len1Half; + secondCut = qLowerBound(pivot, end, *firstCut, lessThan); + len2Half = secondCut - pivot; + } else { + len2Half = len2 / 2; + secondCut = pivot + len2Half; + firstCut = qUpperBound(begin, pivot, *secondCut, lessThan); + } + + qRotate(firstCut, pivot, secondCut); + const RandomAccessIterator newPivot = firstCut + len2Half; + qMerge(begin, firstCut, newPivot, t, lessThan); + qMerge(newPivot, secondCut, end, t, lessThan); +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &t, LessThan lessThan) +{ + const int span = end - begin; + if (span < 2) + return; + + const RandomAccessIterator middle = begin + span / 2; + qStableSortHelper(begin, middle, t, lessThan); + qStableSortHelper(middle, end, t, lessThan); + qMerge(begin, middle, end, t, lessThan); +} + +template <typename RandomAccessIterator, typename T> +inline void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy) +{ + qStableSortHelper(begin, end, dummy, qLess<T>()); +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +{ + RandomAccessIterator middle; + int n = int(end - begin); + int half; + + while (n > 0) { + half = n >> 1; + middle = begin + half; + if (lessThan(*middle, value)) { + begin = middle + 1; + n -= half + 1; + } else { + n = half; + } + } + return begin; +} + + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +{ + RandomAccessIterator middle; + int n = end - begin; + int half; + + while (n > 0) { + half = n >> 1; + middle = begin + half; + if (lessThan(value, *middle)) { + n = half; + } else { + begin = middle + 1; + n -= half + 1; + } + } + return begin; +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +{ + RandomAccessIterator it = qLowerBoundHelper(begin, end, value, lessThan); + + if (it == end || lessThan(value, *it)) + return end; + + return it; +} + +} //namespace QAlgorithmsPrivate + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QALGORITHMS_H diff --git a/qtinterface/qt4/Qt/qanimationgroup.h b/qtinterface/qt4/Qt/qanimationgroup.h new file mode 100644 index 0000000..7e78d95 --- /dev/null +++ b/qtinterface/qt4/Qt/qanimationgroup.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANIMATIONGROUP_H +#define QANIMATIONGROUP_H + +#include <QtCore/qabstractanimation.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QAnimationGroupPrivate; +class Q_CORE_EXPORT QAnimationGroup : public QAbstractAnimation +{ + Q_OBJECT + +public: + QAnimationGroup(QObject *parent = 0); + ~QAnimationGroup(); + + QAbstractAnimation *animationAt(int index) const; + int animationCount() const; + int indexOfAnimation(QAbstractAnimation *animation) const; + void addAnimation(QAbstractAnimation *animation); + void insertAnimation(int index, QAbstractAnimation *animation); + void removeAnimation(QAbstractAnimation *animation); + QAbstractAnimation *takeAnimation(int index); + void clear(); + +protected: + QAnimationGroup(QAnimationGroupPrivate &dd, QObject *parent); + bool event(QEvent *event); + +private: + Q_DISABLE_COPY(QAnimationGroup) + Q_DECLARE_PRIVATE(QAnimationGroup) +}; + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QANIMATIONGROUP_H diff --git a/qtinterface/qt4/Qt/qapplication.h b/qtinterface/qt4/Qt/qapplication.h new file mode 100644 index 0000000..37b010c --- /dev/null +++ b/qtinterface/qt4/Qt/qapplication.h @@ -0,0 +1,415 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAPPLICATION_H +#define QAPPLICATION_H + +#include <QtCore/qcoreapplication.h> +#include <QtGui/qwindowdefs.h> +#include <QtCore/qpoint.h> +#include <QtCore/qsize.h> +#include <QtGui/qcursor.h> +#ifdef QT_INCLUDE_COMPAT +# include <QtGui/qdesktopwidget.h> +#endif +#ifdef QT3_SUPPORT +# include <QtGui/qwidget.h> +# include <QtGui/qpalette.h> +#endif +#ifdef Q_WS_QWS +# include <QtGui/qrgb.h> +# include <QtGui/qtransportauth_qws.h> +#endif + +QT_BEGIN_HEADER + +#if defined(Q_WS_S60) +class CApaApplication; +#endif + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QSessionManager; +class QDesktopWidget; +class QStyle; +class QEventLoop; +class QIcon; +class QInputContext; +template <typename T> class QList; +class QLocale; +#if defined(Q_WS_QWS) +class QDecoration; +#endif +#if defined(Q_OS_SYMBIAN) +class QSymbianEvent; +#endif + +class QApplication; +class QApplicationPrivate; +#if defined(qApp) +#undef qApp +#endif +#define qApp (static_cast<QApplication *>(QCoreApplication::instance())) + + +class Q_GUI_EXPORT QApplication : public QCoreApplication +{ + Q_OBJECT + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection) + Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) + Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime) + Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval) + Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval) +#ifndef QT_NO_WHEELEVENT + Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines) +#endif + Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut) + Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime) + Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance) + Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed) +#ifndef QT_NO_STYLE_STYLESHEET + Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) +#endif +#ifdef Q_WS_WINCE + Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold) +#endif + Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled) + +public: + enum Type { Tty, GuiClient, GuiServer }; + +#ifdef Q_WS_S60 + typedef CApaApplication * (*QS60MainApplicationFactory)(); +#endif + +#ifndef qdoc + QApplication(int &argc, char **argv, int = QT_VERSION); + QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION); + QApplication(int &argc, char **argv, Type, int = QT_VERSION); +#if defined(Q_WS_X11) + QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION); + QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION); +#endif +#if defined(Q_WS_S60) + QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION); +#endif +#endif + virtual ~QApplication(); + + static Type type(); + + static QStyle *style(); + static void setStyle(QStyle*); + static QStyle *setStyle(const QString&); + enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 }; + static int colorSpec(); + static void setColorSpec(int); + static void setGraphicsSystem(const QString &); + +#ifndef QT_NO_CURSOR + static QCursor *overrideCursor(); + static void setOverrideCursor(const QCursor &); + static void changeOverrideCursor(const QCursor &); + static void restoreOverrideCursor(); +#endif + static QPalette palette(); + static QPalette palette(const QWidget *); + static QPalette palette(const char *className); + static void setPalette(const QPalette &, const char* className = 0); + static QFont font(); + static QFont font(const QWidget*); + static QFont font(const char *className); + static void setFont(const QFont &, const char* className = 0); + static QFontMetrics fontMetrics(); + + static void setWindowIcon(const QIcon &icon); + static QIcon windowIcon(); + + +#ifdef QT3_SUPPORT + static QT3_SUPPORT QWidget *mainWidget(); + static QT3_SUPPORT void setMainWidget(QWidget *); +#endif + + static QWidgetList allWidgets(); + static QWidgetList topLevelWidgets(); + + static QDesktopWidget *desktop(); + + static QWidget *activePopupWidget(); + static QWidget *activeModalWidget(); +#ifndef QT_NO_CLIPBOARD + static QClipboard *clipboard(); +#endif + static QWidget *focusWidget(); + + static QWidget *activeWindow(); + static void setActiveWindow(QWidget* act); + + static QWidget *widgetAt(const QPoint &p); + static inline QWidget *widgetAt(int x, int y) { return widgetAt(QPoint(x, y)); } + static QWidget *topLevelAt(const QPoint &p); + static inline QWidget *topLevelAt(int x, int y) { return topLevelAt(QPoint(x, y)); } + + static void syncX(); + static void beep(); + static void alert(QWidget *widget, int duration = 0); + + static Qt::KeyboardModifiers keyboardModifiers(); + static Qt::MouseButtons mouseButtons(); + + static void setDesktopSettingsAware(bool); + static bool desktopSettingsAware(); + + static void setCursorFlashTime(int); + static int cursorFlashTime(); + + static void setDoubleClickInterval(int); + static int doubleClickInterval(); + + static void setKeyboardInputInterval(int); + static int keyboardInputInterval(); + +#ifndef QT_NO_WHEELEVENT + static void setWheelScrollLines(int); + static int wheelScrollLines(); +#endif + static void setGlobalStrut(const QSize &); + static QSize globalStrut(); + + static void setStartDragTime(int ms); + static int startDragTime(); + static void setStartDragDistance(int l); + static int startDragDistance(); + + static void setLayoutDirection(Qt::LayoutDirection direction); + static Qt::LayoutDirection layoutDirection(); + + static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; } + static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; } + + static bool isEffectEnabled(Qt::UIEffect); + static void setEffectEnabled(Qt::UIEffect, bool enable = true); + +#if defined(Q_WS_MAC) + virtual bool macEventFilter(EventHandlerCallRef, EventRef); +#endif +#if defined(Q_WS_X11) + virtual bool x11EventFilter(XEvent *); + virtual int x11ClientMessage(QWidget*, XEvent*, bool passive_only); + int x11ProcessEvent(XEvent*); +#endif +#if defined(Q_OS_SYMBIAN) + int symbianProcessEvent(const QSymbianEvent *event); + virtual bool symbianEventFilter(const QSymbianEvent *event); +#endif +#if defined(Q_WS_QWS) + virtual bool qwsEventFilter(QWSEvent *); + int qwsProcessEvent(QWSEvent*); + void qwsSetCustomColors(QRgb *colortable, int start, int numColors); +#ifndef QT_NO_QWS_MANAGER + static QDecoration &qwsDecoration(); + static void qwsSetDecoration(QDecoration *); + static QDecoration *qwsSetDecoration(const QString &decoration); +#endif +#endif + + +#if defined(Q_WS_WIN) + void winFocus(QWidget *, bool); + static void winMouseButtonUp(); +#endif +#ifndef QT_NO_SESSIONMANAGER + // session management + bool isSessionRestored() const; + QString sessionId() const; + QString sessionKey() const; + virtual void commitData(QSessionManager& sm); + virtual void saveState(QSessionManager& sm); +#endif + void setInputContext(QInputContext *); + QInputContext *inputContext() const; + + static QLocale keyboardInputLocale(); + static Qt::LayoutDirection keyboardInputDirection(); + + static int exec(); + bool notify(QObject *, QEvent *); + + + static void setQuitOnLastWindowClosed(bool quit); + static bool quitOnLastWindowClosed(); + +#ifdef QT_KEYPAD_NAVIGATION + static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool); + static bool keypadNavigationEnabled(); + static void setNavigationMode(Qt::NavigationMode mode); + static Qt::NavigationMode navigationMode(); +#endif + +Q_SIGNALS: + void lastWindowClosed(); + void focusChanged(QWidget *old, QWidget *now); + void fontDatabaseChanged(); +#ifndef QT_NO_SESSIONMANAGER + void commitDataRequest(QSessionManager &sessionManager); + void saveStateRequest(QSessionManager &sessionManager); +#endif + +public: + QString styleSheet() const; +public Q_SLOTS: +#ifndef QT_NO_STYLE_STYLESHEET + void setStyleSheet(const QString& sheet); +#endif +#ifdef Q_WS_WINCE + void setAutoMaximizeThreshold(const int threshold); + int autoMaximizeThreshold() const; +#endif + void setAutoSipEnabled(const bool enabled); + bool autoSipEnabled() const; + static void closeAllWindows(); + static void aboutQt(); + +protected: +#if defined(Q_WS_QWS) + void setArgs(int, char **); +#endif + bool event(QEvent *); + bool compressEvent(QEvent *, QObject *receiver, QPostEventList *); + +#ifdef QT3_SUPPORT +public: + static inline QT3_SUPPORT void setReverseLayout(bool b) { setLayoutDirection(b?Qt::RightToLeft:Qt::LeftToRight); } + static inline bool QT3_SUPPORT reverseLayout() { return layoutDirection() == Qt::RightToLeft; } + static QT3_SUPPORT Qt::Alignment horizontalAlignment(Qt::Alignment align); + typedef int ColorMode; + enum { NormalColors = NormalColor, CustomColors = CustomColor }; + static inline QT3_SUPPORT ColorMode colorMode() { return static_cast<ColorMode>(colorSpec()); } + static inline QT3_SUPPORT void setColorMode(ColorMode mode) { setColorSpec(int(mode)); } +#if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN) + static QT3_SUPPORT Qt::WindowsVersion winVersion() { return (Qt::WindowsVersion)QSysInfo::WindowsVersion; } +#endif +#if defined(Q_OS_MAC) + static QT3_SUPPORT Qt::MacintoshVersion macVersion() { return (Qt::MacintoshVersion)QSysInfo::MacintoshVersion; } +#endif +# ifndef QT_NO_CURSOR + inline static QT3_SUPPORT void setOverrideCursor(const QCursor &cursor, bool replace) + { if (replace) changeOverrideCursor(cursor); else setOverrideCursor(cursor); } +# endif + inline static QT3_SUPPORT bool hasGlobalMouseTracking() {return true;} + inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {} + inline static QT3_SUPPORT void flushX() { flush(); } + static inline QT3_SUPPORT void setWinStyleHighlightColor(const QColor &c) { + QPalette p(palette()); + p.setColor(QPalette::Highlight, c); + setPalette(p); + } + static inline QT3_SUPPORT const QColor &winStyleHighlightColor() + { return palette().color(QPalette::Active, QPalette::Highlight); } + static inline QT3_SUPPORT void setPalette(const QPalette &pal, bool, const char* className = 0) + { setPalette(pal, className); } + static inline QT3_SUPPORT void setFont(const QFont &font, bool, const char* className = 0) + { setFont(font, className); } + + static inline QT3_SUPPORT QWidget *widgetAt(int x, int y, bool child) + { QWidget *w = widgetAt(x, y); return child ? w : (w ? w->window() : 0); } + static inline QT3_SUPPORT QWidget *widgetAt(const QPoint &p, bool child) + { QWidget *w = widgetAt(p); return child ? w : (w ? w->window() : 0); } +#endif // QT3_SUPPORT + +#if defined(Q_INTERNAL_QAPP_SRC) || defined(qdoc) + QApplication(int &argc, char **argv); + QApplication(int &argc, char **argv, bool GUIenabled); + QApplication(int &argc, char **argv, Type); +#if defined(Q_WS_X11) + QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); + QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); +#endif +#if defined(Q_WS_S60) || defined(qdoc) + QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv); +#endif +#endif + +private: + Q_DISABLE_COPY(QApplication) + Q_DECLARE_PRIVATE(QApplication) + + friend class QGraphicsWidget; + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; + friend class QWidget; + friend class QWidgetPrivate; + friend class QETWidget; + friend class Q3AccelManager; + friend class QTranslator; + friend class QWidgetAnimator; +#ifndef QT_NO_SHORTCUT + friend class QShortcut; + friend class QLineEdit; + friend class QTextControl; +#endif + friend class QAction; + friend class QFontDatabasePrivate; + +#if defined(Q_WS_QWS) + friend class QInputContext; + friend class QWSDirectPainterSurface; + friend class QDirectPainter; + friend class QDirectPainterPrivate; +#endif + friend class QGestureManager; + +#if defined(Q_WS_MAC) || defined(Q_WS_X11) + Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut()) +#endif +#if defined(QT_RX71_MULTITOUCH) + Q_PRIVATE_SLOT(d_func(), void _q_readRX71MultiTouchEvents()) +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QAPPLICATION_H diff --git a/qtinterface/qt4/Qt/qatomic.h b/qtinterface/qt4/Qt/qatomic.h new file mode 100644 index 0000000..e9e4703 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic.h @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_H +#define QATOMIC_H + +#include <QtCore/qglobal.h> +#include <QtCore/qbasicatomic.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// High-level atomic integer operations +class Q_CORE_EXPORT QAtomicInt : public QBasicAtomicInt +{ +public: + inline QAtomicInt(int value = 0) + { +#ifdef QT_ARCH_PARISC + this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#endif + _q_value = value; + } + inline QAtomicInt(const QAtomicInt &other) + { +#ifdef QT_ARCH_PARISC + this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#endif + _q_value = other._q_value; + } + + inline QAtomicInt &operator=(int value) + { + (void) QBasicAtomicInt::operator=(value); + return *this; + } + + inline QAtomicInt &operator=(const QAtomicInt &other) + { + (void) QBasicAtomicInt::operator=(other); + return *this; + } + +#ifdef qdoc + bool operator==(int value) const; + bool operator!=(int value) const; + bool operator!() const; + operator int() const; + + static bool isReferenceCountingNative(); + static bool isReferenceCountingWaitFree(); + + bool ref(); + bool deref(); + + static bool isTestAndSetNative(); + static bool isTestAndSetWaitFree(); + + bool testAndSetRelaxed(int expectedValue, int newValue); + bool testAndSetAcquire(int expectedValue, int newValue); + bool testAndSetRelease(int expectedValue, int newValue); + bool testAndSetOrdered(int expectedValue, int newValue); + + static bool isFetchAndStoreNative(); + static bool isFetchAndStoreWaitFree(); + + int fetchAndStoreRelaxed(int newValue); + int fetchAndStoreAcquire(int newValue); + int fetchAndStoreRelease(int newValue); + int fetchAndStoreOrdered(int newValue); + + static bool isFetchAndAddNative(); + static bool isFetchAndAddWaitFree(); + + int fetchAndAddRelaxed(int valueToAdd); + int fetchAndAddAcquire(int valueToAdd); + int fetchAndAddRelease(int valueToAdd); + int fetchAndAddOrdered(int valueToAdd); +#endif +}; + +// High-level atomic pointer operations +template <typename T> +class QAtomicPointer : public QBasicAtomicPointer<T> +{ +public: + inline QAtomicPointer(T *value = 0) + { +#ifdef QT_ARCH_PARISC + this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#endif + QBasicAtomicPointer<T>::_q_value = value; + } + inline QAtomicPointer(const QAtomicPointer<T> &other) + { +#ifdef QT_ARCH_PARISC + this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#endif + QBasicAtomicPointer<T>::_q_value = other._q_value; + } + + inline QAtomicPointer<T> &operator=(T *value) + { + (void) QBasicAtomicPointer<T>::operator=(value); + return *this; + } + + inline QAtomicPointer<T> &operator=(const QAtomicPointer<T> &other) + { + (void) QBasicAtomicPointer<T>::operator=(other); + return *this; + } + +#ifdef qdoc + bool operator==(T *value) const; + bool operator!=(T *value) const; + bool operator!() const; + operator T *() const; + T *operator->() const; + + static bool isTestAndSetNative(); + static bool isTestAndSetWaitFree(); + + bool testAndSetRelaxed(T *expectedValue, T *newValue); + bool testAndSetAcquire(T *expectedValue, T *newValue); + bool testAndSetRelease(T *expectedValue, T *newValue); + bool testAndSetOrdered(T *expectedValue, T *newValue); + + static bool isFetchAndStoreNative(); + static bool isFetchAndStoreWaitFree(); + + T *fetchAndStoreRelaxed(T *newValue); + T *fetchAndStoreAcquire(T *newValue); + T *fetchAndStoreRelease(T *newValue); + T *fetchAndStoreOrdered(T *newValue); + + static bool isFetchAndAddNative(); + static bool isFetchAndAddWaitFree(); + + T *fetchAndAddRelaxed(qptrdiff valueToAdd); + T *fetchAndAddAcquire(qptrdiff valueToAdd); + T *fetchAndAddRelease(qptrdiff valueToAdd); + T *fetchAndAddOrdered(qptrdiff valueToAdd); +#endif +}; + +/*! + This is a helper for the assignment operators of implicitly + shared classes. Your assignment operator should look like this: + + \snippet doc/src/snippets/code/src.corelib.thread.qatomic.h 0 +*/ +template <typename T> +inline void qAtomicAssign(T *&d, T *x) +{ + if (d == x) + return; + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; +} + +/*! + This is a helper for the detach method of implicitly shared + classes. Your private class needs a copy constructor which copies + the members and sets the refcount to 1. After that, your detach + function should look like this: + + \snippet doc/src/snippets/code/src.corelib.thread.qatomic.h 1 +*/ +template <typename T> +inline void qAtomicDetach(T *&d) +{ + if (d->ref == 1) + return; + T *x = d; + d = new T(*d); + if (!x->ref.deref()) + delete x; +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QATOMIC_H diff --git a/qtinterface/qt4/Qt/qatomic_alpha.h b/qtinterface/qt4/Qt/qatomic_alpha.h new file mode 100644 index 0000000..deb358d --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_alpha.h @@ -0,0 +1,642 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_ALPHA_H +#define QATOMIC_ALPHA_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#if defined(Q_CC_GNU) + +inline bool QBasicAtomicInt::ref() +{ + register int old, tmp; + asm volatile("1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "addl %0,1,%1\n" /* tmp=old+1; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : + : "memory"); + return old != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + register int old, tmp; + asm volatile("1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "subl %0,1,%1\n" /* tmp=old-1; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : + : "memory"); + return old != 1; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + register int ret; + asm volatile("1:\n" + "ldl_l %0,%1\n" /* ret=*ptr; */ + "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ + "beq %0,3f\n" /* if (ret==0) goto 3; */ + "mov %3,%0\n" /* ret=newval; */ + "stl_c %0,%1\n" /* if ((*ptr=ret)!=ret) ret=0; else ret=1; */ + "beq %0,2f\n" /* if (ret==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + register int ret; + asm volatile("1:\n" + "ldl_l %0,%1\n" /* ret=*ptr; */ + "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ + "beq %0,3f\n" /* if (ret==0) goto 3; */ + "mov %3,%0\n" /* ret=newval; */ + "stl_c %0,%1\n" /* if ((*ptr=ret)!=ret) ret=0; else ret=1; */ + "beq %0,2f\n" /* if (ret==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + "mb\n" + : "=&r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + register int ret; + asm volatile("mb\n" + "1:\n" + "ldl_l %0,%1\n" /* ret=*ptr; */ + "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ + "beq %0,3f\n" /* if (ret==0) goto 3; */ + "mov %3,%0\n" /* ret=newval; */ + "stl_c %0,%1\n" /* if ((*ptr=ret)!=ret) ret=0; else ret=1; */ + "beq %0,2f\n" /* if (ret==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + register int old, tmp; + asm volatile("1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "mov %3,%1\n" /* tmp=newval; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return old; +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + register int old, tmp; + asm volatile("1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "mov %3,%1\n" /* tmp=newval; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + "mb\n" + : "=&r" (old), "=&r" (tmp), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return old; +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + register int old, tmp; + asm volatile("mb\n" + "1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "mov %3,%1\n" /* tmp=newval; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return old; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + register int old, tmp; + asm volatile("1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "addl %0,%3,%1\n"/* tmp=old+value; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : "r" (valueToAdd) + : "memory"); + return old; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + register int old, tmp; + asm volatile("1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "addl %0,%3,%1\n"/* tmp=old+value; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + "mb\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : "r" (valueToAdd) + : "memory"); + return old; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + register int old, tmp; + asm volatile("mb\n" + "1:\n" + "ldl_l %0,%2\n" /* old=*ptr; */ + "addl %0,%3,%1\n"/* tmp=old+value; */ + "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : "r" (valueToAdd) + : "memory"); + return old; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + register void *ret; + asm volatile("1:\n" + "ldq_l %0,%1\n" /* ret=*ptr; */ + "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ + "beq %0,3f\n" /* if (tmp==0) goto 3; */ + "mov %3,%0\n" /* tmp=newval; */ + "stq_c %0,%1\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %0,2f\n" /* if (ret==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + register void *ret; + asm volatile("1:\n" + "ldq_l %0,%1\n" /* ret=*ptr; */ + "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ + "beq %0,3f\n" /* if (tmp==0) goto 3; */ + "mov %3,%0\n" /* tmp=newval; */ + "stq_c %0,%1\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %0,2f\n" /* if (ret==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + "mb\n" + : "=&r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + register void *ret; + asm volatile("mb\n" + "1:\n" + "ldq_l %0,%1\n" /* ret=*ptr; */ + "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ + "beq %0,3f\n" /* if (tmp==0) goto 3; */ + "mov %3,%0\n" /* tmp=newval; */ + "stq_c %0,%1\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %0,2f\n" /* if (ret==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + register void *old, *tmp; + asm volatile("1:\n" + "ldq_l %0,%2\n" /* old=*ptr; */ + "mov %3,%1\n" /* tmp=newval; */ + "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return old; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + register void *old, *tmp; + asm volatile("1:\n" + "ldq_l %0,%2\n" /* old=*ptr; */ + "mov %3,%1\n" /* tmp=newval; */ + "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + "mb\n" + : "=&r" (old), "=&r" (tmp), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return old; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + register void *old, *tmp; + asm volatile("mb\n" + "1:\n" + "ldq_l %0,%2\n" /* old=*ptr; */ + "mov %3,%1\n" /* tmp=newval; */ + "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp==0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return old; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + register void *old, *tmp; + asm volatile("1:\n" + "ldq_l %0,%2\n" /* old=*ptr; */ + "addq %0,%3,%1\n"/* tmp=old+value; */ + "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : "r" (valueToAdd) + : "memory"); + return reinterpret_cast<T *>(old); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + register void *old, *tmp; + asm volatile("1:\n" + "ldq_l %0,%2\n" /* old=*ptr; */ + "addq %0,%3,%1\n"/* tmp=old+value; */ + "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + "mb\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : "r" (valueToAdd) + : "memory"); + return reinterpret_cast<T *>(old); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + register void *old, *tmp; + asm volatile("mb\n" + "1:\n" + "ldq_l %0,%2\n" /* old=*ptr; */ + "addq %0,%3,%1\n"/* tmp=old+value; */ + "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ + "beq %1,2f\n" /* if (tmp == 0) goto 2; */ + "br 3f\n" /* goto 3; */ + "2: br 1b\n" /* goto 1; */ + "3:\n" + : "=&r" (old), "=&r" (tmp), "+m"(_q_value) + : "r" (valueToAdd) + : "memory"); + return reinterpret_cast<T *>(old); +} + +#else // !Q_CC_GNU + +extern "C" { + Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_acquire_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_release_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval); + Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); + Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, void *newval); + Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value); + Q_CORE_EXPORT int q_atomic_fetch_and_add_acquire_int(volatile int *ptr, int value); + Q_CORE_EXPORT int q_atomic_fetch_and_add_release_int(volatile int *ptr, int value); +} // extern "C" + +inline bool QBasicAtomicInt::ref() +{ + return q_atomic_increment(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return q_atomic_decrement(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_release_int(&_q_value, expectedValue, newValue) != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return q_atomic_set_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return q_atomic_fetch_and_store_acquire_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return q_atomic_fetch_and_store_release_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return q_atomic_fetch_and_add_int(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return q_atomic_fetch_and_add_acquire_int(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return q_atomic_fetch_and_add_release_int(&_q_value, valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_release_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_acquire_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_release_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_ptr(&_q_value, newValue)); +} +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_acquire_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_release_ptr(&_q_value, newValue)); +} + +#endif // Q_CC_GNU + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_ALPHA_H diff --git a/qtinterface/qt4/Qt/qatomic_arch.h b/qtinterface/qt4/Qt/qatomic_arch.h new file mode 100644 index 0000000..344b053 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_arch.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_ARCH_H +#define QATOMIC_ARCH_H + +QT_BEGIN_HEADER + +#include "QtCore/qglobal.h" + +#if defined(QT_ARCH_VXWORKS) +# include "QtCore/qatomic_vxworks.h" +#elif defined(QT_ARCH_ALPHA) +# include "QtCore/qatomic_alpha.h" +#elif defined(QT_ARCH_ARM) +# include "QtCore/qatomic_arm.h" +#elif defined(QT_ARCH_ARMV6) +# include "QtCore/qatomic_armv6.h" +#elif defined(QT_ARCH_AVR32) +# include "QtCore/qatomic_avr32.h" +#elif defined(QT_ARCH_BFIN) +# include "QtCore/qatomic_bfin.h" +#elif defined(QT_ARCH_GENERIC) +# include "QtCore/qatomic_generic.h" +#elif defined(QT_ARCH_I386) +# include "QtCore/qatomic_i386.h" +#elif defined(QT_ARCH_IA64) +# include "QtCore/qatomic_ia64.h" +#elif defined(QT_ARCH_MACOSX) +# include "QtCore/qatomic_macosx.h" +#elif defined(QT_ARCH_MIPS) +# include "QtCore/qatomic_mips.h" +#elif defined(QT_ARCH_PARISC) +# include "QtCore/qatomic_parisc.h" +#elif defined(QT_ARCH_POWERPC) +# include "QtCore/qatomic_powerpc.h" +#elif defined(QT_ARCH_S390) +# include "QtCore/qatomic_s390.h" +#elif defined(QT_ARCH_SPARC) +# include "QtCore/qatomic_sparc.h" +#elif defined(QT_ARCH_WINDOWS) +# include "QtCore/qatomic_windows.h" +#elif defined(QT_ARCH_WINDOWSCE) +# include "QtCore/qatomic_windowsce.h" +#elif defined(QT_ARCH_X86_64) +# include "QtCore/qatomic_x86_64.h" +#elif defined(QT_ARCH_SYMBIAN) +# include "QtCore/qatomic_symbian.h" +#elif defined(QT_ARCH_SH) +# include "QtCore/qatomic_sh.h" +#elif defined(QT_ARCH_SH4A) +# include "QtCore/qatomic_sh4a.h" +#else +# error "Qt has not been ported to this architecture" +#endif + +QT_END_HEADER + +#endif // QATOMIC_ARCH_H diff --git a/qtinterface/qt4/Qt/qatomic_arm.h b/qtinterface/qt4/Qt/qatomic_arm.h new file mode 100644 index 0000000..d6e2292 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_arm.h @@ -0,0 +1,431 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_ARM_H +#define QATOMIC_ARM_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#ifndef QT_NO_ARM_EABI + +// kernel places a restartable cmpxchg implementation at a fixed address +extern "C" typedef int (qt_atomic_eabi_cmpxchg_int_t)(int oldval, int newval, volatile int *ptr); +extern "C" typedef int (qt_atomic_eabi_cmpxchg_ptr_t)(void *oldval, void *newval, volatile void *ptr); +#define qt_atomic_eabi_cmpxchg_int (*(qt_atomic_eabi_cmpxchg_int_t *)0xffff0fc0) +#define qt_atomic_eabi_cmpxchg_ptr (*(qt_atomic_eabi_cmpxchg_ptr_t *)0xffff0fc0) + +#else + +extern Q_CORE_EXPORT char q_atomic_lock; +Q_CORE_EXPORT void qt_atomic_yield(int *); + +#ifdef Q_CC_RVCT + +Q_CORE_EXPORT __asm char q_atomic_swp(volatile char *ptr, char newval); + +#else + +inline char q_atomic_swp(volatile char *ptr, char newval) +{ + register char ret; + asm volatile("swpb %0,%2,[%3]" + : "=&r"(ret), "=m" (*ptr) + : "r"(newval), "r"(ptr) + : "cc", "memory"); + return ret; +} + +#endif // Q_CC_RVCT + +#endif // QT_NO_ARM_EABI + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ +#ifndef QT_NO_ARM_EABI + register int originalValue; + register int newValue; + do { + originalValue = _q_value; + newValue = originalValue + 1; + } while (qt_atomic_eabi_cmpxchg_int(originalValue, newValue, &_q_value) != 0); + return newValue != 0; +#else + int count = 0; + while (q_atomic_swp(&q_atomic_lock, ~0) != 0) + qt_atomic_yield(&count); + int originalValue = _q_value++; + q_atomic_swp(&q_atomic_lock, 0); + return originalValue != -1; +#endif +} + +inline bool QBasicAtomicInt::deref() +{ +#ifndef QT_NO_ARM_EABI + register int originalValue; + register int newValue; + do { + originalValue = _q_value; + newValue = originalValue - 1; + } while (qt_atomic_eabi_cmpxchg_int(originalValue, newValue, &_q_value) != 0); + return newValue != 0; +#else + int count = 0; + while (q_atomic_swp(&q_atomic_lock, ~0) != 0) + qt_atomic_yield(&count); + int originalValue = _q_value--; + q_atomic_swp(&q_atomic_lock, 0); + return originalValue != 1; +#endif +} + +// Test and set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ +#ifndef QT_NO_ARM_EABI + register int originalValue; + do { + originalValue = _q_value; + if (originalValue != expectedValue) + return false; + } while (qt_atomic_eabi_cmpxchg_int(expectedValue, newValue, &_q_value) != 0); + return true; +#else + bool returnValue = false; + int count = 0; + while (q_atomic_swp(&q_atomic_lock, ~0) != 0) + qt_atomic_yield(&count); + if (_q_value == expectedValue) { + _q_value = newValue; + returnValue = true; + } + q_atomic_swp(&q_atomic_lock, 0); + return returnValue; +#endif +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for integers + +#ifndef Q_CC_RVCT + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + int originalValue; + asm volatile("swp %0,%2,[%3]" + : "=&r"(originalValue), "=m" (_q_value) + : "r"(newValue), "r"(&_q_value) + : "cc", "memory"); + return originalValue; +} + +#endif + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ +#ifndef QT_NO_ARM_EABI + register int originalValue; + register int newValue; + do { + originalValue = _q_value; + newValue = originalValue + valueToAdd; + } while (qt_atomic_eabi_cmpxchg_int(originalValue, newValue, &_q_value) != 0); + return originalValue; +#else + int count = 0; + while (q_atomic_swp(&q_atomic_lock, ~0) != 0) + qt_atomic_yield(&count); + int originalValue = _q_value; + _q_value += valueToAdd; + q_atomic_swp(&q_atomic_lock, 0); + return originalValue; +#endif +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ +#ifndef QT_NO_ARM_EABI + register T *originalValue; + do { + originalValue = _q_value; + if (originalValue != expectedValue) + return false; + } while (qt_atomic_eabi_cmpxchg_ptr(expectedValue, newValue, &_q_value) != 0); + return true; +#else + bool returnValue = false; + int count = 0; + while (q_atomic_swp(&q_atomic_lock, ~0) != 0) + qt_atomic_yield(&count); + if (_q_value == expectedValue) { + _q_value = newValue; + returnValue = true; + } + q_atomic_swp(&q_atomic_lock, 0); + return returnValue; +#endif +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +#ifdef Q_CC_RVCT + +template <typename T> +__asm T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + add r2, pc, #0 + bx r2 + arm + swp r2,r1,[r0] + mov r0, r2 + bx lr + thumb +} + +#else + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + T *originalValue; + asm volatile("swp %0,%2,[%3]" + : "=&r"(originalValue), "=m" (_q_value) + : "r"(newValue), "r"(&_q_value) + : "cc", "memory"); + return originalValue; +} + +#endif // Q_CC_RVCT + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ +#ifndef QT_NO_ARM_EABI + register T *originalValue; + register T *newValue; + do { + originalValue = _q_value; + newValue = originalValue + valueToAdd; + } while (qt_atomic_eabi_cmpxchg_ptr(originalValue, newValue, &_q_value) != 0); + return originalValue; +#else + int count = 0; + while (q_atomic_swp(&q_atomic_lock, ~0) != 0) + qt_atomic_yield(&count); + T *originalValue = (_q_value); + _q_value += valueToAdd; + q_atomic_swp(&q_atomic_lock, 0); + return originalValue; +#endif +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_ARM_H diff --git a/qtinterface/qt4/Qt/qatomic_armv6.h b/qtinterface/qt4/Qt/qatomic_armv6.h new file mode 100644 index 0000000..063aa56 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_armv6.h @@ -0,0 +1,500 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_ARMV6_H +#define QATOMIC_ARMV6_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#ifndef Q_CC_RVCT + +inline bool QBasicAtomicInt::ref() +{ + register int newValue; + register int result; + asm volatile("0:\n" + "ldrex %[newValue], [%[_q_value]]\n" + "add %[newValue], %[newValue], #1\n" + "strex %[result], %[newValue], [%[_q_value]]\n" + "teq %[result], #0\n" + "bne 0b\n" + : [newValue] "=&r" (newValue), + [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value) + : "cc", "memory"); + return newValue != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + register int newValue; + register int result; + asm volatile("0:\n" + "ldrex %[newValue], [%[_q_value]]\n" + "sub %[newValue], %[newValue], #1\n" + "strex %[result], %[newValue], [%[_q_value]]\n" + "teq %[result], #0\n" + "bne 0b\n" + : [newValue] "=&r" (newValue), + [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value) + : "cc", "memory"); + return newValue != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + register int result; + asm volatile("0:\n" + "ldrex %[result], [%[_q_value]]\n" + "eors %[result], %[result], %[expectedValue]\n" + "strexeq %[result], %[newValue], [%[_q_value]]\n" + "teqeq %[result], #1\n" + "beq 0b\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue), + [_q_value] "r" (&_q_value) + : "cc", "memory"); + return result == 0; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + register int originalValue; + register int result; + asm volatile("0:\n" + "ldrex %[originalValue], [%[_q_value]]\n" + "strex %[result], %[newValue], [%[_q_value]]\n" + "teq %[result], #0\n" + "bne 0b\n" + : [originalValue] "=&r" (originalValue), + [result] "=&r" (result), + "+m" (_q_value) + : [newValue] "r" (newValue), + [_q_value] "r" (&_q_value) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + register int originalValue; + register int newValue; + register int result; + asm volatile("0:\n" + "ldrex %[originalValue], [%[_q_value]]\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + "strex %[result], %[newValue], [%[_q_value]]\n" + "teq %[result], #0\n" + "bne 0b\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + [result] "=&r" (result), + "+m" (_q_value) + : [valueToAdd] "r" (valueToAdd), + [_q_value] "r" (&_q_value) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + register T *result; + asm volatile("0:\n" + "ldrex %[result], [%[_q_value]]\n" + "eors %[result], %[result], %[expectedValue]\n" + "strexeq %[result], %[newValue], [%[_q_value]]\n" + "teqeq %[result], #1\n" + "beq 0b\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue), + [_q_value] "r" (&_q_value) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + register T *originalValue; + register int result; + asm volatile("0:\n" + "ldrex %[originalValue], [%[_q_value]]\n" + "strex %[result], %[newValue], [%[_q_value]]\n" + "teq %[result], #0\n" + "bne 0b\n" + : [originalValue] "=&r" (originalValue), + [result] "=&r" (result), + "+m" (_q_value) + : [newValue] "r" (newValue), + [_q_value] "r" (&_q_value) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + register int result; + asm volatile("0:\n" + "ldrex %[originalValue], [%[_q_value]]\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + "strex %[result], %[newValue], [%[_q_value]]\n" + "teq %[result], #0\n" + "bne 0b\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + [result] "=&r" (result), + "+m" (_q_value) + : [valueToAdd] "r" (valueToAdd * sizeof(T)), + [_q_value] "r" (&_q_value) + : "cc", "memory"); + return originalValue; +} + +#else +// This is Q_CC_RVCT + +// RVCT inline assembly documentation: +// http://www.keil.com/support/man/docs/armcc/armcc_chdcffdb.htm +// RVCT embedded assembly documentation: +// http://www.keil.com/support/man/docs/armcc/armcc_chddbeib.htm + +// save our pragma state and switch to ARM mode +#pragma push +#pragma arm + +inline bool QBasicAtomicInt::ref() +{ + register int newValue; + register int result; + retry: + __asm { + ldrex newValue, [&_q_value] + add newValue, newValue, #1 + strex result, newValue, [&_q_value] + teq result, #0 + bne retry + } + return newValue != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + register int newValue; + register int result; + retry: + __asm { + ldrex newValue, [&_q_value] + sub newValue, newValue, #1 + strex result, newValue, [&_q_value] + teq result, #0 + bne retry + } + return newValue != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + register int result; + retry: + __asm { + ldrex result, [&_q_value] + eors result, result, expectedValue + strexeq result, newValue, [&_q_value] + teqeq result, #1 + beq retry + } + return result == 0; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + register int originalValue; + register int result; + retry: + __asm { + ldrex originalValue, [&_q_value] + strex result, newValue, [&_q_value] + teq result, #0 + bne retry + } + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + register int originalValue; + register int newValue; + register int result; + retry: + __asm { + ldrex originalValue, [&_q_value] + add newValue, originalValue, valueToAdd + strex result, newValue, [&_q_value] + teq result, #0 + bne retry + } + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + register T *result; + retry: + __asm { + ldrex result, [&_q_value] + eors result, result, expectedValue + strexeq result, newValue, [&_q_value] + teqeq result, #1 + beq retry + } + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + register T *originalValue; + register int result; + retry: + __asm { + ldrex originalValue, [&_q_value] + strex result, newValue, [&_q_value] + teq result, #0 + bne retry + } + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + register int result; + retry: + __asm { + ldrex originalValue, [&_q_value] + add newValue, originalValue, valueToAdd * sizeof(T) + strex result, newValue, [&_q_value] + teq result, #0 + bne retry + } + return originalValue; +} + +// go back to the previous pragma state (probably Thumb mode) +#pragma pop +#endif + +// common code + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_ARMV6_H diff --git a/qtinterface/qt4/Qt/qatomic_avr32.h b/qtinterface/qt4/Qt/qatomic_avr32.h new file mode 100644 index 0000000..c5951f4 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_avr32.h @@ -0,0 +1,252 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_AVR32_H +#define QATOMIC_AVR32_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +inline bool QBasicAtomicInt::ref() +{ + return __sync_add_and_fetch(&_q_value, 1); +} + +inline bool QBasicAtomicInt::deref() +{ + return __sync_sub_and_fetch(&_q_value, 1); +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return __sync_bool_compare_and_swap(&_q_value, expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return __sync_lock_test_and_set(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return __sync_fetch_and_add(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return __sync_bool_compare_and_swap(&_q_value, expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return __sync_lock_test_and_set(&_q_value, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return __sync_fetch_and_add(&_q_value, valueToAdd * sizeof(T)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_AVR32_H diff --git a/qtinterface/qt4/Qt/qatomic_bfin.h b/qtinterface/qt4/Qt/qatomic_bfin.h new file mode 100644 index 0000000..2c0456a --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_bfin.h @@ -0,0 +1,343 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_BFIN_H +#define QATOMIC_BFIN_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) + +QT_BEGIN_INCLUDE_NAMESPACE +#include <asm/fixed_code.h> +QT_END_INCLUDE_NAMESPACE + +inline bool QBasicAtomicInt::ref() +{ + int ret; + asm volatile("R0 = 1;\n\t" + "P0 = %3;\n\t" + "CALL (%2);\n\t" + "%0 = R0;" + : "=da" (ret), "=m" (_q_value) + : "a" (ATOMIC_ADD32), "da" (&_q_value), "m" (_q_value) + : "R0", "R1", "P0", "RETS", "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + int ret; + asm volatile("R0 = 1;\n\t" + "P0 = %3;\n\t" + "CALL (%2);\n\t" + "%0 = R0;" + : "=da" (ret), "=m" (_q_value) + : "a" (ATOMIC_SUB32), "da" (&_q_value), "m" (_q_value) + : "R0", "R1", "P0", "RETS", "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + long int readval; + asm volatile ("P0 = %2;\n\t" + "R1 = %3;\n\t" + "R2 = %4;\n\t" + "CALL (%5);\n\t" + "%0 = R0;\n\t" + : "=da" (readval), "=m" (_q_value) + : "da" (&_q_value), + "da" (expectedValue), + "da" (newValue), + "a" (ATOMIC_CAS32), + "m" (_q_value) + : "P0", "R0", "R1", "R2", "RETS", "memory", "cc"); + return readval == expectedValue; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + asm volatile("R1 = %2;\n\t" + "P0 = %4;\n\t" + "CALL (%3);\n\t" + "%0 = R0;" + : "=da" (newValue), "=m" (_q_value) + : "da" (newValue), "a" (ATOMIC_XCHG32), "da" (&_q_value), "m" (_q_value) + : "R0", "R1", "P0", "RETS", "memory"); + return newValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + int ret; + asm volatile("R0 = %[val];\n\t" + "P0 = %[qvalp];\n\t" + "CALL (%[addr]);\n\t" + "%[ret] = R1;" + : [ret] "=da" (ret), "=m" (_q_value) + : [addr] "a" (ATOMIC_ADD32), [qvalp] "da" (&_q_value), "m" (_q_value), [val] "da" (valueToAdd) + : "R0", "R1", "P0", "RETS", "memory"); + return ret; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + T *readval; + asm volatile ("P0 = %2;\n\t" + "R1 = %3;\n\t" + "R2 = %4;\n\t" + "CALL (%5);\n\t" + "%0 = R0;\n\t" + : "=da" (readval), "=m" (_q_value) + : "da" (&_q_value), + "da" (expectedValue), + "da" (newValue), + "a" (ATOMIC_CAS32), + "m" (_q_value) + : "P0", "R0", "R1", "R2", "RETS", "memory", "cc"); + return readval == expectedValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + asm volatile("R1 = %2;\n\t" + "P0 = %4;\n\t" + "CALL (%3);\n\t" + "%0 = R0;" + : "=da" (newValue), "=m" (_q_value) + : "da" (newValue), "a" (ATOMIC_XCHG32), "da" (&_q_value), "m" (_q_value) + : "R0", "R1", "P0", "RETS", "memory"); + return newValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + T* ret; + asm volatile("R0 = %[val];\n\t" + "P0 = %[qvalp];\n\t" + "CALL (%[addr]);\n\t" + "%[ret] = R1;" + : [ret] "=da" (ret), "=m" (_q_value) + : [addr] "a" (ATOMIC_ADD32), [qvalp] "da" (&_q_value), "m" (_q_value), [val] "da" (valueToAdd * sizeof(T)) + : "R0", "R1", "P0", "RETS", "memory"); + return ret; +} + + +#endif // Q_OS_LINUX && Q_CC_GNU + +// Test and set for integers + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for integers + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for integers + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_BFIN_H diff --git a/qtinterface/qt4/Qt/qatomic_bootstrap.h b/qtinterface/qt4/Qt/qatomic_bootstrap.h new file mode 100644 index 0000000..4e3fc82 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_bootstrap.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_BOOTSTRAP_H +#define QATOMIC_BOOTSTRAP_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +inline bool QBasicAtomicInt::ref() +{ + return ++_q_value != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return --_q_value != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + if (_q_value == expectedValue) { + _q_value = newValue; + return true; + } + return false; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + int returnValue = _q_value; + _q_value += valueToAdd; + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + if (_q_value == expectedValue) { + _q_value = newValue; + return true; + } + return false; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_BOOTSTRAP_H diff --git a/qtinterface/qt4/Qt/qatomic_generic.h b/qtinterface/qt4/Qt/qatomic_generic.h new file mode 100644 index 0000000..336d446 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_generic.h @@ -0,0 +1,282 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_GENERIC_H +#define QATOMIC_GENERIC_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int); + +Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff); + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ + return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, 1) != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, -1) != 1; +} + +// Test and set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return QBasicAtomicInt_testAndSetOrdered(&_q_value, expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return QBasicAtomicInt_fetchAndStoreOrdered(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + union { T * volatile * typed; void * volatile * voidp; } pointer; + pointer.typed = &_q_value; + return QBasicAtomicPointer_testAndSetOrdered(pointer.voidp, expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + union { T * volatile * typed; void * volatile * voidp; } pointer; + union { T *typed; void *voidp; } returnValue; + pointer.typed = &_q_value; + returnValue.voidp = QBasicAtomicPointer_fetchAndStoreOrdered(pointer.voidp, newValue); + return returnValue.typed; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + union { T * volatile *typed; void * volatile *voidp; } pointer; + union { T *typed; void *voidp; } returnValue; + pointer.typed = &_q_value; + returnValue.voidp = QBasicAtomicPointer_fetchAndAddOrdered(pointer.voidp, valueToAdd * sizeof(T)); + return returnValue.typed; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_GENERIC_H diff --git a/qtinterface/qt4/Qt/qatomic_i386.h b/qtinterface/qt4/Qt/qatomic_i386.h new file mode 100644 index 0000000..473b178 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_i386.h @@ -0,0 +1,361 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_I386_H +#define QATOMIC_I386_H + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return true; } + +#if defined(Q_CC_GNU) || defined(Q_CC_INTEL) + +inline bool QBasicAtomicInt::ref() +{ + unsigned char ret; + asm volatile("lock\n" + "incl %0\n" + "setne %1" + : "=m" (_q_value), "=qm" (ret) + : "m" (_q_value) + : "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + unsigned char ret; + asm volatile("lock\n" + "decl %0\n" + "setne %1" + : "=m" (_q_value), "=qm" (ret) + : "m" (_q_value) + : "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + unsigned char ret; + asm volatile("lock\n" + "cmpxchgl %3,%2\n" + "sete %1\n" + : "=a" (newValue), "=qm" (ret), "+m" (_q_value) + : "r" (newValue), "0" (expectedValue) + : "memory"); + return ret != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + asm volatile("xchgl %0,%1" + : "=r" (newValue), "+m" (_q_value) + : "0" (newValue) + : "memory"); + return newValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + asm volatile("lock\n" + "xaddl %0,%1" + : "=r" (valueToAdd), "+m" (_q_value) + : "0" (valueToAdd) + : "memory"); + return valueToAdd; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + unsigned char ret; + asm volatile("lock\n" + "cmpxchgl %3,%2\n" + "sete %1\n" + : "=a" (newValue), "=qm" (ret), "+m" (_q_value) + : "r" (newValue), "0" (expectedValue) + : "memory"); + return ret != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + asm volatile("xchgl %0,%1" + : "=r" (newValue), "+m" (_q_value) + : "0" (newValue) + : "memory"); + return newValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + asm volatile("lock\n" + "xaddl %0,%1" + : "=r" (valueToAdd), "+m" (_q_value) + : "0" (valueToAdd * sizeof(T)) + : "memory"); + return reinterpret_cast<T *>(valueToAdd); +} + +#else + +extern "C" { + Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval); + Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); + Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, void *newval); + Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value); + Q_CORE_EXPORT void *q_atomic_fetch_and_add_ptr(volatile void *ptr, int value); +} // extern "C" + +inline bool QBasicAtomicInt::ref() +{ + return q_atomic_increment(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return q_atomic_decrement(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_int(&_q_value, expectedValue, newValue) != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return q_atomic_set_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return q_atomic_fetch_and_add_int(&_q_value, valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +#endif + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QATOMIC_I386_H diff --git a/qtinterface/qt4/Qt/qatomic_ia64.h b/qtinterface/qt4/Qt/qatomic_ia64.h new file mode 100644 index 0000000..fd71657 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_ia64.h @@ -0,0 +1,813 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_IA64_H +#define QATOMIC_IA64_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +inline bool _q_ia64_fetchadd_immediate(register int value) +{ + return value == 1 || value == -1 + || value == 4 || value == -4 + || value == 8 || value == -8 + || value == 16 || value == -16; +} + +#if defined(Q_CC_INTEL) + +// intrinsics provided by the Intel C++ Compiler +#include <ia64intrin.h> + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return static_cast<int>(_InterlockedExchange(&_q_value, newValue)); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + __memory_barrier(); + return static_cast<int>(_InterlockedExchange(&_q_value, newValue)); +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + register int expectedValueCopy = expectedValue; + return (static_cast<int>(_InterlockedCompareExchange(&_q_value, + newValue, + expectedValueCopy)) + == expectedValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + register int expectedValueCopy = expectedValue; + return (static_cast<int>(_InterlockedCompareExchange_acq(reinterpret_cast<volatile uint *>(&_q_value), + newValue, + expectedValueCopy)) + == expectedValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + register int expectedValueCopy = expectedValue; + return (static_cast<int>(_InterlockedCompareExchange_rel(reinterpret_cast<volatile uint *>(&_q_value), + newValue, + expectedValueCopy)) + == expectedValue); +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + __memory_barrier(); + return testAndSetAcquire(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + if (__builtin_constant_p(valueToAdd)) { + if (valueToAdd == 1) + return __fetchadd4_acq((unsigned int *)&_q_value, 1); + if (valueToAdd == -1) + return __fetchadd4_acq((unsigned int *)&_q_value, -1); + } + return _InterlockedExchangeAdd(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + if (__builtin_constant_p(valueToAdd)) { + if (valueToAdd == 1) + return __fetchadd4_rel((unsigned int *)&_q_value, 1); + if (valueToAdd == -1) + return __fetchadd4_rel((unsigned int *)&_q_value, -1); + } + __memory_barrier(); + return _InterlockedExchangeAdd(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + __memory_barrier(); + return fetchAndAddAcquire(valueToAdd); +} + +inline bool QBasicAtomicInt::ref() +{ + return _InterlockedIncrement(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return _InterlockedDecrement(&_q_value) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return (T *)_InterlockedExchangePointer(reinterpret_cast<void * volatile*>(&_q_value), newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + __memory_barrier(); + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + register T *expectedValueCopy = expectedValue; + return (_InterlockedCompareExchangePointer(reinterpret_cast<void * volatile*>(&_q_value), + newValue, + expectedValueCopy) + == expectedValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + union { + volatile void *x; + volatile unsigned long *p; + }; + x = &_q_value; + register T *expectedValueCopy = expectedValue; + return (_InterlockedCompareExchange64_acq(p, quintptr(newValue), quintptr(expectedValueCopy)) + == quintptr(expectedValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + union { + volatile void *x; + volatile unsigned long *p; + }; + x = &_q_value; + register T *expectedValueCopy = expectedValue; + return (_InterlockedCompareExchange64_rel(p, quintptr(newValue), quintptr(expectedValueCopy)) + == quintptr(expectedValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + __memory_barrier(); + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return (T *)_InterlockedExchangeAdd64((volatile long *)&_q_value, + valueToAdd * sizeof(T)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + __memory_barrier(); + return (T *)_InterlockedExchangeAdd64((volatile long *)&_q_value, + valueToAdd * sizeof(T)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + __memory_barrier(); + return fetchAndAddAcquire(valueToAdd); +} + +#else // !Q_CC_INTEL + +# if defined(Q_CC_GNU) + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + int ret; + asm volatile("xchg4 %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return ret; +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + int ret; + asm volatile("mf\n" + "xchg4 %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return ret; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + int ret; + asm volatile("mov ar.ccv=%2\n" + ";;\n" + "cmpxchg4.acq %0=%1,%3,ar.ccv\n" + : "=r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret == expectedValue; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + int ret; + asm volatile("mov ar.ccv=%2\n" + ";;\n" + "cmpxchg4.rel %0=%1,%3,ar.ccv\n" + : "=r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret == expectedValue; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + int ret; + +#if (__GNUC__ >= 4) + // We implement a fast fetch-and-add when we can + if (__builtin_constant_p(valueToAdd) && _q_ia64_fetchadd_immediate(valueToAdd)) { + asm volatile("fetchadd4.acq %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "i" (valueToAdd) + : "memory"); + return ret; + } +#endif + + // otherwise, use a loop around test-and-set + ret = _q_value; + asm volatile("0:\n" + " mov r9=%0\n" + " mov ar.ccv=%0\n" + " add %0=%0, %2\n" + " ;;\n" + " cmpxchg4.acq %0=%1,%0,ar.ccv\n" + " ;;\n" + " cmp.ne p6,p0 = %0, r9\n" + "(p6) br.dptk 0b\n" + "1:\n" + : "+r" (ret), "+m" (_q_value) + : "r" (valueToAdd) + : "r9", "p6", "memory"); + return ret; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + int ret; + +#if (__GNUC__ >= 4) + // We implement a fast fetch-and-add when we can + if (__builtin_constant_p(valueToAdd) && _q_ia64_fetchadd_immediate(valueToAdd)) { + asm volatile("fetchadd4.rel %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "i" (valueToAdd) + : "memory"); + return ret; + } +#endif + + // otherwise, use a loop around test-and-set + ret = _q_value; + asm volatile("0:\n" + " mov r9=%0\n" + " mov ar.ccv=%0\n" + " add %0=%0, %2\n" + " ;;\n" + " cmpxchg4.rel %0=%1,%0,ar.ccv\n" + " ;;\n" + " cmp.ne p6,p0 = %0, r9\n" + "(p6) br.dptk 0b\n" + "1:\n" + : "+r" (ret), "+m" (_q_value) + : "r" (valueToAdd) + : "r9", "p6", "memory"); + return ret; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + asm volatile("mf" ::: "memory"); + return fetchAndAddRelease(valueToAdd); +} + +inline bool QBasicAtomicInt::ref() +{ + int ret; + asm volatile("fetchadd4.acq %0=%1,1\n" + : "=r" (ret), "+m" (_q_value) + : + : "memory"); + return ret != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + int ret; + asm volatile("fetchadd4.rel %0=%1,-1\n" + : "=r" (ret), "+m" (_q_value) + : + : "memory"); + return ret != 1; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + T *ret; + asm volatile("xchg8 %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return ret; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + T *ret; + asm volatile("mf\n" + "xchg8 %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "r" (newValue) + : "memory"); + return ret; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + T *ret; + asm volatile("mov ar.ccv=%2\n" + ";;\n" + "cmpxchg8.acq %0=%1,%3,ar.ccv\n" + : "=r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret == expectedValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + T *ret; + asm volatile("mov ar.ccv=%2\n" + ";;\n" + "cmpxchg8.rel %0=%1,%3,ar.ccv\n" + : "=r" (ret), "+m" (_q_value) + : "r" (expectedValue), "r" (newValue) + : "memory"); + return ret == expectedValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + T *ret; + +#if (__GNUC__ >= 4) + // We implement a fast fetch-and-add when we can + if (__builtin_constant_p(valueToAdd) && _q_ia64_fetchadd_immediate(valueToAdd * sizeof(T))) { + asm volatile("fetchadd8.acq %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "i" (valueToAdd * sizeof(T)) + : "memory"); + return ret; + } +#endif + + // otherwise, use a loop around test-and-set + ret = _q_value; + asm volatile("0:\n" + " mov r9=%0\n" + " mov ar.ccv=%0\n" + " add %0=%0, %2\n" + " ;;\n" + " cmpxchg8.acq %0=%1,%0,ar.ccv\n" + " ;;\n" + " cmp.ne p6,p0 = %0, r9\n" + "(p6) br.dptk 0b\n" + "1:\n" + : "+r" (ret), "+m" (_q_value) + : "r" (valueToAdd * sizeof(T)) + : "r9", "p6", "memory"); + return ret; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + T *ret; + +#if (__GNUC__ >= 4) + // We implement a fast fetch-and-add when we can + if (__builtin_constant_p(valueToAdd) && _q_ia64_fetchadd_immediate(valueToAdd * sizeof(T))) { + asm volatile("fetchadd8.rel %0=%1,%2\n" + : "=r" (ret), "+m" (_q_value) + : "i" (valueToAdd * sizeof(T)) + : "memory"); + return ret; + } +#endif + + // otherwise, use a loop around test-and-set + ret = _q_value; + asm volatile("0:\n" + " mov r9=%0\n" + " mov ar.ccv=%0\n" + " add %0=%0, %2\n" + " ;;\n" + " cmpxchg8.rel %0=%1,%0,ar.ccv\n" + " ;;\n" + " cmp.ne p6,p0 = %0, r9\n" + "(p6) br.dptk 0b\n" + "1:\n" + : "+r" (ret), "+m" (_q_value) + : "r" (valueToAdd * sizeof(T)) + : "r9", "p6", "memory"); + return ret; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + asm volatile("mf" ::: "memory"); + return fetchAndAddRelease(valueToAdd); +} + +#elif defined Q_CC_HPACC + +QT_BEGIN_INCLUDE_NAMESPACE +#include <ia64/sys/inline.h> +QT_END_INCLUDE_NAMESPACE + +#define FENCE (_Asm_fence)(_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE) + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return _Asm_xchg((_Asm_sz)_SZ_W, &_q_value, (unsigned)newValue, + (_Asm_ldhint)_LDHINT_NONE, FENCE); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + _Asm_mf(FENCE); + return _Asm_xchg((_Asm_sz)_SZ_W, &_q_value, (unsigned)newValue, + (_Asm_ldhint)_LDHINT_NONE, FENCE); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)expectedValue, FENCE); + int ret = _Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, (unsigned)newValue, (_Asm_ldhint)_LDHINT_NONE); + return ret == expectedValue; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)expectedValue, FENCE); + int ret = _Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_REL, + &_q_value, newValue, (_Asm_ldhint)_LDHINT_NONE); + return ret == expectedValue; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + if (valueToAdd == 1) + return _Asm_fetchadd((_Asm_fasz)_FASZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, 1, (_Asm_ldhint)_LDHINT_NONE, FENCE); + else if (valueToAdd == -1) + return _Asm_fetchadd((_Asm_fasz)_FASZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, -1, (_Asm_ldhint)_LDHINT_NONE, FENCE); + + // implement the test-and-set loop + register int old, ret; + do { + old = _q_value; + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)old, FENCE); + ret = _Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, old + valueToAdd, (_Asm_ldhint)_LDHINT_NONE); + } while (ret != old); + return old; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + if (valueToAdd == 1) + return _Asm_fetchadd((_Asm_fasz)_FASZ_W, (_Asm_sem)_SEM_REL, + &_q_value, 1, (_Asm_ldhint)_LDHINT_NONE, FENCE); + else if (valueToAdd == -1) + return _Asm_fetchadd((_Asm_fasz)_FASZ_W, (_Asm_sem)_SEM_REL, + &_q_value, -1, (_Asm_ldhint)_LDHINT_NONE, FENCE); + + // implement the test-and-set loop + register int old, ret; + do { + old = _q_value; + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)old, FENCE); + ret = _Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_REL, + &_q_value, old + valueToAdd, (_Asm_ldhint)_LDHINT_NONE); + } while (ret != old); + return old; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + _Asm_mf(FENCE); + return fetchAndAddAcquire(valueToAdd); +} + +inline bool QBasicAtomicInt::ref() +{ + return (int)_Asm_fetchadd((_Asm_fasz)_FASZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, 1, (_Asm_ldhint)_LDHINT_NONE, FENCE) != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + return (int)_Asm_fetchadd((_Asm_fasz)_FASZ_W, (_Asm_sem)_SEM_REL, + &_q_value, -1, (_Asm_ldhint)_LDHINT_NONE, FENCE) != 1; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ +#ifdef __LP64__ + return (T *)_Asm_xchg((_Asm_sz)_SZ_D, &_q_value, (quint64)newValue, + (_Asm_ldhint)_LDHINT_NONE, FENCE); +#else + return (T *)_Asm_xchg((_Asm_sz)_SZ_W, &_q_value, (quint32)newValue, + (_Asm_ldhint)_LDHINT_NONE, FENCE); +#endif +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + _Asm_mf(FENCE); + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ +#ifdef __LP64__ + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)expectedValue, FENCE); + T *ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_D, (_Asm_sem)_SEM_ACQ, + &_q_value, (quint64)newValue, (_Asm_ldhint)_LDHINT_NONE); +#else + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint32)expectedValue, FENCE); + T *ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, (quint32)newValue, (_Asm_ldhint)_LDHINT_NONE); +#endif + return ret == expectedValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ +#ifdef __LP64__ + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)expectedValue, FENCE); + T *ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_D, (_Asm_sem)_SEM_REL, + &_q_value, (quint64)newValue, (_Asm_ldhint)_LDHINT_NONE); +#else + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint32)expectedValue, FENCE); + T *ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_REL, + &_q_value, (quint32)newValue, (_Asm_ldhint)_LDHINT_NONE); +#endif + return ret == expectedValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + // implement the test-and-set loop + register T *old, *ret; + do { + old = _q_value; +#ifdef __LP64__ + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)old, FENCE); + ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_D, (_Asm_sem)_SEM_ACQ, + &_q_value, (quint64)(old + valueToAdd), + (_Asm_ldhint)_LDHINT_NONE); +#else + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint32)old, FENCE); + ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_ACQ, + &_q_value, (quint32)(old + valueToAdd), + (_Asm_ldhint)_LDHINT_NONE); +#endif + } while (old != ret); + return old; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + // implement the test-and-set loop + register T *old, *ret; + do { + old = _q_value; +#ifdef __LP64__ + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)old, FENCE); + ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_D, (_Asm_sem)_SEM_REL, + &_q_value, (quint64)(old + valueToAdd), + (_Asm_ldhint)_LDHINT_NONE); +#else + _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint32)old, FENCE); + ret = (T *)_Asm_cmpxchg((_Asm_sz)_SZ_W, (_Asm_sem)_SEM_REL, + &_q_value, (quint32)(old + valueToAdd), + (_Asm_ldhint)_LDHINT_NONE); +#endif + } while (old != ret); + return old; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + _Asm_mf(FENCE); + return fetchAndAddAcquire(valueToAdd); +} + +#else + +extern "C" { + Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval); +} // extern "C" + +#endif + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +#endif // Q_CC_INTEL + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return fetchAndStoreRelease(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return fetchAndStoreRelaxed(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_IA64_H diff --git a/qtinterface/qt4/Qt/qatomic_macosx.h b/qtinterface/qt4/Qt/qatomic_macosx.h new file mode 100644 index 0000000..a9cfe80 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_macosx.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_MACOSX_H +#define QATOMIC_MACOSX_H + +QT_BEGIN_HEADER + +#if defined(__x86_64__) +# include <QtCore/qatomic_x86_64.h> +#elif defined(__i386__) +# include <QtCore/qatomic_i386.h> +#else // !__x86_64 && !__i386__ +# include <QtCore/qatomic_powerpc.h> +#endif // !__x86_64__ && !__i386__ + +QT_END_HEADER + +#endif // QATOMIC_MACOSX_H diff --git a/qtinterface/qt4/Qt/qatomic_mips.h b/qtinterface/qt4/Qt/qatomic_mips.h new file mode 100644 index 0000000..f934c0d --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_mips.h @@ -0,0 +1,892 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_MIPS_H +#define QATOMIC_MIPS_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#if defined(Q_CC_GNU) && !defined(Q_OS_IRIX) + +#if _MIPS_SIM == _ABIO32 +#define SET_MIPS2 ".set mips2\n\t" +#else +#define SET_MIPS2 +#endif + +inline bool QBasicAtomicInt::ref() +{ + register int originalValue; + register int newValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "addiu %[newValue], %[originalValue], %[one]\n" + "sc %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [one] "i" (1) + : "cc", "memory"); + return originalValue != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + register int originalValue; + register int newValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "addiu %[newValue], %[originalValue], %[minusOne]\n" + "sc %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [minusOne] "i" (-1) + : "cc", "memory"); + return originalValue != 1; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + register int result; + register int tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[result], %[_q_value]\n" + "xor %[result], %[result], %[expectedValue]\n" + "bnez %[result], 0f\n" + "nop\n" + "move %[tempValue], %[newValue]\n" + "sc %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "0:\n" + ".set pop\n" + : [result] "=&r" (result), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + register int result; + register int tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[result], %[_q_value]\n" + "xor %[result], %[result], %[expectedValue]\n" + "bnez %[result], 0f\n" + "nop\n" + "move %[tempValue], %[newValue]\n" + "sc %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "sync\n" + "0:\n" + ".set pop\n" + : [result] "=&r" (result), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + register int result; + register int tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" + "0:\n" + "ll %[result], %[_q_value]\n" + "xor %[result], %[result], %[expectedValue]\n" + "bnez %[result], 0f\n" + "nop\n" + "move %[tempValue], %[newValue]\n" + "sc %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "0:\n" + ".set pop\n" + : [result] "=&r" (result), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + register int originalValue; + register int tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "move %[tempValue], %[newValue]\n" + "sc %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + register int originalValue; + register int tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "move %[tempValue], %[newValue]\n" + "sc %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "sync\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + register int originalValue; + register int tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "move %[tempValue], %[newValue]\n" + "sc %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + register int originalValue; + register int newValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "addu %[newValue], %[originalValue], %[valueToAdd]\n" + "sc %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [valueToAdd] "r" (valueToAdd) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + register int originalValue; + register int newValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "addu %[newValue], %[originalValue], %[valueToAdd]\n" + "sc %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + "sync\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [valueToAdd] "r" (valueToAdd) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + register int originalValue; + register int newValue; + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" + "0:\n" + "ll %[originalValue], %[_q_value]\n" + "addu %[newValue], %[originalValue], %[valueToAdd]\n" + "sc %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [valueToAdd] "r" (valueToAdd) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +#if defined(__LP64__) +# define LLP "lld" +# define SCP "scd" +#else +# define LLP "ll" +# define SCP "sc" +#endif + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + register T *result; + register T *tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + LLP" %[result], %[_q_value]\n" + "xor %[result], %[result], %[expectedValue]\n" + "bnez %[result], 0f\n" + "nop\n" + "move %[tempValue], %[newValue]\n" + SCP" %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "0:\n" + ".set pop\n" + : [result] "=&r" (result), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + register T *result; + register T *tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + LLP" %[result], %[_q_value]\n" + "xor %[result], %[result], %[expectedValue]\n" + "bnez %[result], 0f\n" + "nop\n" + "move %[tempValue], %[newValue]\n" + SCP" %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "sync\n" + "0:\n" + ".set pop\n" + : [result] "=&r" (result), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + register T *result; + register T *tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" + "0:\n" + LLP" %[result], %[_q_value]\n" + "xor %[result], %[result], %[expectedValue]\n" + "bnez %[result], 0f\n" + "nop\n" + "move %[tempValue], %[newValue]\n" + SCP" %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "0:\n" + ".set pop\n" + : [result] "=&r" (result), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + register T *originalValue; + register T *tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + LLP" %[originalValue], %[_q_value]\n" + "move %[tempValue], %[newValue]\n" + SCP" %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + register T *originalValue; + register T *tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + LLP" %[originalValue], %[_q_value]\n" + "move %[tempValue], %[newValue]\n" + SCP" %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + "sync\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + register T *originalValue; + register T *tempValue; + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" + "0:\n" + LLP" %[originalValue], %[_q_value]\n" + "move %[tempValue], %[newValue]\n" + SCP" %[tempValue], %[_q_value]\n" + "beqz %[tempValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [tempValue] "=&r" (tempValue), + [_q_value] "+m" (_q_value) + : [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + LLP" %[originalValue], %[_q_value]\n" + "addu %[newValue], %[originalValue], %[valueToAdd]\n" + SCP" %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" + LLP" %[originalValue], %[_q_value]\n" + "addu %[newValue], %[originalValue], %[valueToAdd]\n" + SCP" %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + "sync\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" + "0:\n" + LLP" %[originalValue], %[_q_value]\n" + "addu %[newValue], %[originalValue], %[valueToAdd]\n" + SCP" %[newValue], %[_q_value]\n" + "beqz %[newValue], 0b\n" + "nop\n" + ".set pop\n" + : [originalValue] "=&r" (originalValue), + [_q_value] "+m" (_q_value), + [newValue] "=&r" (newValue) + : [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +#else // !Q_CC_GNU + +extern "C" { + Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_acquire_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_release_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval); + Q_CORE_EXPORT int q_atomic_test_and_set_acquire_ptr(volatile void *ptr, void *expected, void *newval); + Q_CORE_EXPORT int q_atomic_test_and_set_release_ptr(volatile void *ptr, void *expected, void *newval); +} // extern "C" + +inline bool QBasicAtomicInt::ref() +{ + register int expected; + for (;;) { + expected = _q_value; + if (q_atomic_test_and_set_int(&_q_value, expected, expected + 1)) + break; + } + return expected != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + register int expected; + for (;;) { + expected = _q_value; + if (q_atomic_test_and_set_int(&_q_value, expected, expected - 1)) + break; + } + return expected != 1; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_release_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetRelaxed(returnValue, newValue)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetAcquire(returnValue, newValue)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetRelease(returnValue, newValue)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetOrdered(returnValue, newValue)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetRelaxed(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetAcquire(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetRelease(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + int returnValue; + for (;;) { + returnValue = _q_value; + if (testAndSetOrdered(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_release_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetRelaxed(returnValue, newValue)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetAcquire(returnValue, newValue)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetRelease(returnValue, newValue)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetOrdered(returnValue, newValue)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetRelaxed(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE +T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetAcquire(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetRelease(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + T *returnValue; + for (;;) { + returnValue = (_q_value); + if (testAndSetOrdered(returnValue, returnValue + valueToAdd)) + break; + } + return returnValue; +} + +#endif // Q_CC_GNU + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_MIPS_H diff --git a/qtinterface/qt4/Qt/qatomic_parisc.h b/qtinterface/qt4/Qt/qatomic_parisc.h new file mode 100644 index 0000000..fd1e07e --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_parisc.h @@ -0,0 +1,305 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_PARISC_H +#define QATOMIC_PARISC_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +extern "C" { + Q_CORE_EXPORT void q_atomic_lock(int *lock); + Q_CORE_EXPORT void q_atomic_unlock(int *lock); +} + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ + q_atomic_lock(_q_lock); + bool ret = (++_q_value != 0); + q_atomic_unlock(_q_lock); + return ret; +} + +inline bool QBasicAtomicInt::deref() +{ + q_atomic_lock(_q_lock); + bool ret = (--_q_value != 0); + q_atomic_unlock(_q_lock); + return ret; +} + +// Test-and-set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + q_atomic_lock(_q_lock); + if (_q_value == expectedValue) { + _q_value = newValue; + q_atomic_unlock(_q_lock); + return true; + } + q_atomic_unlock(_q_lock); + return false; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch-and-store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + q_atomic_lock(_q_lock); + int returnValue = _q_value; + _q_value = newValue; + q_atomic_unlock(_q_lock); + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch-and-add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + q_atomic_lock(_q_lock); + int originalValue = _q_value; + _q_value += valueToAdd; + q_atomic_unlock(_q_lock); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + q_atomic_lock(_q_lock); + if (_q_value == expectedValue) { + _q_value = newValue; + q_atomic_unlock(_q_lock); + return true; + } + q_atomic_unlock(_q_lock); + return false; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + q_atomic_lock(_q_lock); + T *returnValue = (_q_value); + _q_value = newValue; + q_atomic_unlock(_q_lock); + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + q_atomic_lock(_q_lock); + T *returnValue = (_q_value); + _q_value += valueToAdd; + q_atomic_unlock(_q_lock); + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_PARISC_H diff --git a/qtinterface/qt4/Qt/qatomic_powerpc.h b/qtinterface/qt4/Qt/qatomic_powerpc.h new file mode 100644 index 0000000..d9e03e9 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_powerpc.h @@ -0,0 +1,648 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_POWERPC_H +#define QATOMIC_POWERPC_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#if defined(Q_CC_GNU) + +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) \ + || (!defined(__64BIT__) && !defined(__powerpc64__) && !defined(__ppc64__)) +# define _Q_VALUE "0, %[_q_value]" +# define _Q_VALUE_MEMORY_OPERAND "+m" (_q_value) +# define _Q_VALUE_REGISTER_OPERAND [_q_value] "r" (&_q_value), +#else +// On 64-bit with gcc >= 4.2 +# define _Q_VALUE "%y[_q_value]" +# define _Q_VALUE_MEMORY_OPERAND [_q_value] "+Z" (_q_value) +# define _Q_VALUE_REGISTER_OPERAND +#endif + +inline bool QBasicAtomicInt::ref() +{ + register int originalValue; + register int newValue; + asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" + "addi %[newValue], %[originalValue], %[one]\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + : [originalValue] "=&b" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [one] "i" (1) + : "cc", "memory"); + return newValue != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + register int originalValue; + register int newValue; + asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" + "addi %[newValue], %[originalValue], %[minusOne]\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + : [originalValue] "=&b" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [minusOne] "i" (-1) + : "cc", "memory"); + return newValue != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + register int result; + asm volatile("lwarx %[result]," _Q_VALUE "\n" + "xor. %[result], %[result], %[expectedValue]\n" + "bne $+12\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-16\n" + : [result] "=&r" (result), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + register int result; + asm volatile("lwarx %[result]," _Q_VALUE "\n" + "xor. %[result], %[result], %[expectedValue]\n" + "bne $+16\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-16\n" + "isync\n" + : [result] "=&r" (result), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + register int result; + asm volatile("eieio\n" + "lwarx %[result]," _Q_VALUE "\n" + "xor. %[result], %[result], %[expectedValue]\n" + "bne $+12\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-16\n" + : [result] "=&r" (result), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + register int originalValue; + asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-8\n" + : [originalValue] "=&r" (originalValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + register int originalValue; + asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-8\n" + "isync\n" + : [originalValue] "=&r" (originalValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + register int originalValue; + asm volatile("eieio\n" + "lwarx %[originalValue]," _Q_VALUE "\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-8\n" + : [originalValue] "=&r" (originalValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + register int originalValue; + register int newValue; + asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [valueToAdd] "r" (valueToAdd) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + register int originalValue; + register int newValue; + asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + "isync\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [valueToAdd] "r" (valueToAdd) + : "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + register int originalValue; + register int newValue; + asm volatile("eieio\n" + "lwarx %[originalValue]," _Q_VALUE "\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + "stwcx. %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [valueToAdd] "r" (valueToAdd) + : "cc", "memory"); + return originalValue; +} + +#if defined(__64BIT__) || defined(__powerpc64__) || defined(__ppc64__) +# define LPARX "ldarx" +# define STPCX "stdcx." +#else +# define LPARX "lwarx" +# define STPCX "stwcx." +#endif + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + register void *result; + asm volatile(LPARX" %[result]," _Q_VALUE "\n" + "xor. %[result], %[result], %[expectedValue]\n" + "bne $+12\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-16\n" + : [result] "=&r" (result), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + register void *result; + asm volatile(LPARX" %[result]," _Q_VALUE "\n" + "xor. %[result], %[result], %[expectedValue]\n" + "bne $+16\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-16\n" + "isync\n" + : [result] "=&r" (result), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + register void *result; + asm volatile("eieio\n" + LPARX" %[result]," _Q_VALUE "\n" + "xor. %[result], %[result], %[expectedValue]\n" + "bne $+12\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-16\n" + : [result] "=&r" (result), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + register T *originalValue; + asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-8\n" + : [originalValue] "=&r" (originalValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + register T *originalValue; + asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-8\n" + "isync\n" + : [originalValue] "=&r" (originalValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + register T *originalValue; + asm volatile("eieio\n" + LPARX" %[originalValue]," _Q_VALUE "\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-8\n" + : [originalValue] "=&r" (originalValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [newValue] "r" (newValue) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + "isync\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + register T *originalValue; + register T *newValue; + asm volatile("eieio\n" + LPARX" %[originalValue]," _Q_VALUE "\n" + "add %[newValue], %[originalValue], %[valueToAdd]\n" + STPCX" %[newValue]," _Q_VALUE "\n" + "bne- $-12\n" + : [originalValue] "=&r" (originalValue), + [newValue] "=&r" (newValue), + _Q_VALUE_MEMORY_OPERAND + : _Q_VALUE_REGISTER_OPERAND + [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "cc", "memory"); + return originalValue; +} + +#undef LPARX +#undef STPCX +#undef _Q_VALUE +#undef _Q_VALUE_MEMORY_OPERAND +#undef _Q_VALUE_REGISTER_OPERAND + +#else + +extern "C" { + int q_atomic_test_and_set_int(volatile int *ptr, int expectedValue, int newValue); + int q_atomic_test_and_set_acquire_int(volatile int *ptr, int expectedValue, int newValue); + int q_atomic_test_and_set_release_int(volatile int *ptr, int expectedValue, int newValue); + int q_atomic_test_and_set_ptr(volatile void *ptr, void *expectedValue, void *newValue); + int q_atomic_test_and_set_acquire_ptr(volatile void *ptr, void *expectedValue, void *newValue); + int q_atomic_test_and_set_release_ptr(volatile void *ptr, void *expectedValue, void *newValue); + int q_atomic_increment(volatile int *); + int q_atomic_decrement(volatile int *); + int q_atomic_set_int(volatile int *, int); + int q_atomic_fetch_and_store_acquire_int(volatile int *ptr, int newValue); + int q_atomic_fetch_and_store_release_int(volatile int *ptr, int newValue); + void *q_atomic_set_ptr(volatile void *, void *); + int q_atomic_fetch_and_store_acquire_ptr(volatile void *ptr, void *newValue); + int q_atomic_fetch_and_store_release_ptr(volatile void *ptr, void *newValue); + int q_atomic_fetch_and_add_int(volatile int *ptr, int valueToAdd); + int q_atomic_fetch_and_add_acquire_int(volatile int *ptr, int valueToAdd); + int q_atomic_fetch_and_add_release_int(volatile int *ptr, int valueToAdd); + void *q_atomic_fetch_and_add_ptr(volatile void *ptr, qptrdiff valueToAdd); + void *q_atomic_fetch_and_add_acquire_ptr(volatile void *ptr, qptrdiff valueToAdd); + void *q_atomic_fetch_and_add_release_ptr(volatile void *ptr, qptrdiff valueToAdd); +} // extern "C" + + +inline bool QBasicAtomicInt::ref() +{ + return q_atomic_increment(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return q_atomic_decrement(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_release_int(&_q_value, expectedValue, newValue) != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return q_atomic_set_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return q_atomic_fetch_and_store_acquire_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return q_atomic_fetch_and_store_release_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return q_atomic_fetch_and_add_int(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return q_atomic_fetch_and_add_acquire_int(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return q_atomic_fetch_and_add_release_int(&_q_value, valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_release_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_acquire_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_release_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_ptr(&_q_value, valueToAdd * sizeof(T))); +} +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_acquire_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_release_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +#endif + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_POWERPC_H diff --git a/qtinterface/qt4/Qt/qatomic_s390.h b/qtinterface/qt4/Qt/qatomic_s390.h new file mode 100644 index 0000000..4c3311c --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_s390.h @@ -0,0 +1,430 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_S390_H +#define QATOMIC_S390_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +#ifdef __GNUC__ +#define __GNU_EXTENSION __extension__ +#else +#define __GNU_EXTENSION +#endif + +#define __CS_LOOP(ptr, op_val, op_string, pre, post) __GNU_EXTENSION ({ \ + volatile int old_val, new_val; \ + __asm__ __volatile__(pre \ + " l %0,0(%3)\n" \ + "0: lr %1,%0\n" \ + op_string " %1,%4\n" \ + " cs %0,%1,0(%3)\n" \ + " jl 0b\n" \ + post \ + : "=&d" (old_val), "=&d" (new_val), \ + "=m" (*ptr) \ + : "a" (ptr), "d" (op_val), \ + "m" (*ptr) \ + : "cc", "memory" ); \ + new_val; \ +}) + +#define __CS_OLD_LOOP(ptr, op_val, op_string, pre, post ) __GNU_EXTENSION ({ \ + volatile int old_val, new_val; \ + __asm__ __volatile__(pre \ + " l %0,0(%3)\n" \ + "0: lr %1,%0\n" \ + op_string " %1,%4\n" \ + " cs %0,%1,0(%3)\n" \ + " jl 0b\n" \ + post \ + : "=&d" (old_val), "=&d" (new_val), \ + "=m" (*ptr) \ + : "a" (ptr), "d" (op_val), \ + "m" (*ptr) \ + : "cc", "memory" ); \ + old_val; \ +}) + +#ifdef __s390x__ +#define __CSG_OLD_LOOP(ptr, op_val, op_string, pre, post) __GNU_EXTENSION ({ \ + long old_val, new_val; \ + __asm__ __volatile__(pre \ + " lg %0,0(%3)\n" \ + "0: lgr %1,%0\n" \ + op_string " %1,%4\n" \ + " csg %0,%1,0(%3)\n" \ + " jl 0b\n" \ + post \ + : "=&d" (old_val), "=&d" (new_val), \ + "=m" (*ptr) \ + : "a" (ptr), "d" (op_val), \ + "m" (*ptr) \ + : "cc", "memory" ); \ + old_val; \ +}) +#endif + +inline bool QBasicAtomicInt::ref() +{ + return __CS_LOOP(&_q_value, 1, "ar", "", "") != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return __CS_LOOP(&_q_value, 1, "sr", "", "") != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + int retval; + __asm__ __volatile__( + " lr %0,%3\n" + " cs %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); + return retval == 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + int retval; + __asm__ __volatile__( + " lr %0,%3\n" + " cs %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:\n" + " bcr 15,0\n" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); + return retval == 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + int retval; + __asm__ __volatile__( + " bcr 15,0\n" + " lr %0,%3\n" + " cs %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); + return retval == 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return __CS_OLD_LOOP(&_q_value, newValue, "lr", "", ""); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return __CS_OLD_LOOP(&_q_value, newValue, "lr", "", "bcr 15,0\n"); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return __CS_OLD_LOOP(&_q_value, newValue, "lr", "bcr 15,0\n", ""); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return __CS_OLD_LOOP(&_q_value, valueToAdd, "ar", "", "bcr 15,0\n"); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + int retval; + +#ifndef __s390x__ + __asm__ __volatile__( + " lr %0,%3\n" + " cs %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); +#else + __asm__ __volatile__( + " lgr %0,%3\n" + " csg %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); +#endif + + return retval == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + int retval; + +#ifndef __s390x__ + __asm__ __volatile__( + " lr %0,%3\n" + " cs %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:\n" + " bcr 15,0\n" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); +#else + __asm__ __volatile__( + " lgr %0,%3\n" + " csg %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:\n" + " bcr 15,0\n" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); +#endif + + return retval == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + int retval; + +#ifndef __s390x__ + __asm__ __volatile__( + " bcr 15,0\n" + " lr %0,%3\n" + " cs %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); +#else + __asm__ __volatile__( + " bcr 15,0\n" + " lgr %0,%3\n" + " csg %0,%4,0(%2)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&d" (retval), "=m" (_q_value) + : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), + "m" (_q_value) : "cc", "memory" ); +#endif + + return retval == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ +#ifndef __s390x__ + return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", + "", "bcr 15,0\n"); +#else + return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", + "", "bcr 15,0\n"); +#endif +} + +template <typename T> +Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ +#ifndef __s390x__ + return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", "", ""); +#else + return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", "", ""); +#endif +} + +template <typename T> +Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ +#ifndef __s390x__ + return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", + "bcr 15,0 \n", ""); +#else + return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", + "bcr 15,0\n", ""); +#endif +} + +template <typename T> +Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return fetchAndStoreAcquire(newValue); +} + + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +#undef __GNU_EXTENSION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_S390_H diff --git a/qtinterface/qt4/Qt/qatomic_sh.h b/qtinterface/qt4/Qt/qatomic_sh.h new file mode 100644 index 0000000..89c08f3 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_sh.h @@ -0,0 +1,330 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_SH_H +#define QATOMIC_SH_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +extern Q_CORE_EXPORT volatile char qt_atomic_lock; +Q_CORE_EXPORT void qt_atomic_yield(int *count); + +inline int qt_atomic_tasb(volatile char *ptr) +{ + register int ret; + asm volatile("tas.b @%2\n" + "movt %0" + : "=&r"(ret), "=m"(*ptr) + : "r"(ptr) + : "cc", "memory"); + return ret; +} + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + int originalValue = _q_value++; + qt_atomic_lock = 0; + return originalValue != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + int originalValue = _q_value--; + qt_atomic_lock = 0; + return originalValue != 1; +} + +// Test and set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + bool returnValue = false; + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + if (_q_value == expectedValue) { + _q_value = newValue; + returnValue = true; + } + qt_atomic_lock = 0; + return returnValue; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + int originalValue = _q_value; + _q_value = newValue; + qt_atomic_lock = 0; + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + int originalValue = _q_value; + _q_value += valueToAdd; + qt_atomic_lock = 0; + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + bool returnValue = false; + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + if (_q_value == expectedValue) { + _q_value = newValue; + returnValue = true; + } + qt_atomic_lock = 0; + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + T *originalValue = _q_value; + _q_value = newValue; + qt_atomic_lock = 0; + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + int count = 0; + while (qt_atomic_tasb(&qt_atomic_lock) == 0) + qt_atomic_yield(&count); + T *originalValue = (_q_value); + _q_value += valueToAdd; + qt_atomic_lock = 0; + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_SH_H diff --git a/qtinterface/qt4/Qt/qatomic_sh4a.h b/qtinterface/qt4/Qt/qatomic_sh4a.h new file mode 100644 index 0000000..d8a95bc --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_sh4a.h @@ -0,0 +1,537 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_SH4A_H +#define QATOMIC_SH4A_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + + +QT_END_NAMESPACE + +QT_END_HEADER + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +QT_BEGIN_NAMESPACE + +#if !defined(Q_CC_GNU) +# error "SH-4A support has not been added for this compiler" +#else + +inline bool QBasicAtomicInt::ref() +{ + register int newValue asm("r0"); + asm volatile("0:\n" + "movli.l @%[_q_value], %[newValue]\n" + "add #1,%[newValue]\n" + "movco.l %[newValue], @%[_q_value]\n" + "bf 0b\n" + : [newValue] "=&r" (newValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value) + : "cc", "memory"); + return newValue != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + register int newValue asm("r0"); + asm volatile("0:\n" + "movli.l @%[_q_value], %[newValue]\n" + "add #-1,%[newValue]\n" + "movco.l %[newValue], @%[_q_value]\n" + "bf 0b\n" + : [newValue] "=&r" (newValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value) + : "cc", "memory"); + return newValue != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + register int result; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "xor %[expectedValue], r0\n" + "cmp/eq #0, r0\n" + "bf/s 0f\n" + "mov r0, %[result]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "0:\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + register int result; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "xor %[expectedValue], r0\n" + "cmp/eq #0, r0\n" + "bf/s 0f\n" + "mov r0, %[result]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "synco\n" + "0:\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + register int result; + asm volatile("synco\n" + "0:\n" + "movli.l @%[_q_value], r0\n" + "xor %[expectedValue], r0\n" + "cmp/eq #0, r0\n" + "bf/s 0f\n" + "mov r0, %[result]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "0:\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return result == 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + register int originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + register int originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "synco\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + register int originalValue; + asm volatile("synco\n" + "0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + register int originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "add %[valueToAdd], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [valueToAdd] "r" (valueToAdd) + : "r0", "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + register int originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "add %[valueToAdd], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "synco\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [valueToAdd] "r" (valueToAdd) + : "r0", "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + register int originalValue; + asm volatile("synco\n" + "0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "add %[valueToAdd], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [valueToAdd] "r" (valueToAdd) + : "r0", "cc", "memory"); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + register T *result; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "xor %[expectedValue], r0\n" + "cmp/eq #0, r0\n" + "bf/s 0f\n" + "mov r0, %[result]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "0:\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + register T *result; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "xor %[expectedValue], r0\n" + "cmp/eq #0, r0\n" + "bf/s 0f\n" + "mov r0, %[result]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "synco\n" + "0:\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + register T *result; + asm volatile("synco\n" + "0:\n" + "movli.l @%[_q_value], r0\n" + "xor %[expectedValue], r0\n" + "cmp/eq #0, r0\n" + "bf/s 0f\n" + "mov r0, %[result]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "0:\n" + : [result] "=&r" (result), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [expectedValue] "r" (expectedValue), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return result == 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return testAndSetAcquire(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + register T *originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + register T *originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "synco\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + register T *originalValue; + asm volatile("synco\n" + "0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "mov %[newValue], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [newValue] "r" (newValue) + : "r0", "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return fetchAndStoreAcquire(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + register T *originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "add %[valueToAdd], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "r0", "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + register T *originalValue; + asm volatile("0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "add %[valueToAdd], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + "synco\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "r0", "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + register T *originalValue; + asm volatile("synco\n" + "0:\n" + "movli.l @%[_q_value], r0\n" + "mov r0, %[originalValue]\n" + "add %[valueToAdd], r0\n" + "movco.l r0, @%[_q_value]\n" + "bf 0b\n" + : [originalValue] "=&r" (originalValue), + "+m" (_q_value) + : [_q_value] "r" (&_q_value), + [valueToAdd] "r" (valueToAdd * sizeof(T)) + : "r0", "cc", "memory"); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return fetchAndAddAcquire(valueToAdd); +} + +#endif // Q_CC_GNU + +#endif // QATOMIC_SH4A_H diff --git a/qtinterface/qt4/Qt/qatomic_sparc.h b/qtinterface/qt4/Qt/qatomic_sparc.h new file mode 100644 index 0000000..e9024bb --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_sparc.h @@ -0,0 +1,525 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_SPARC_H +#define QATOMIC_SPARC_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#if defined(_LP64) + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +extern "C" { + Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr); + + Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_acquire_int(volatile int *ptr, + int expected, + int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_release_int(volatile int *ptr, + int expected, + int newval); + + Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); + Q_CORE_EXPORT int q_atomic_fetch_and_store_acquire_int(volatile int *ptr, int newval); + Q_CORE_EXPORT int q_atomic_fetch_and_store_release_int(volatile int *ptr, int newval); + + Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value); + Q_CORE_EXPORT int q_atomic_fetch_and_add_acquire_int(volatile int *ptr, int value); + Q_CORE_EXPORT int q_atomic_fetch_and_add_release_int(volatile int *ptr, int value); + + Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval); + Q_CORE_EXPORT int q_atomic_test_and_set_acquire_ptr(volatile void *ptr, + void *expected, + void *newval); + Q_CORE_EXPORT int q_atomic_test_and_set_release_ptr(volatile void *ptr, + void *expected, + void *newval); + + Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, void *newval); + Q_CORE_EXPORT void *q_atomic_fetch_and_store_acquire_ptr(volatile void *ptr, void *newval); + Q_CORE_EXPORT void *q_atomic_fetch_and_store_release_ptr(volatile void *ptr, void *newval); + + Q_CORE_EXPORT void *q_atomic_fetch_and_add_ptr(volatile void *ptr, int value); + Q_CORE_EXPORT void *q_atomic_fetch_and_add_acquire_ptr(volatile void *ptr, int value); + Q_CORE_EXPORT void *q_atomic_fetch_and_add_release_ptr(volatile void *ptr, int value); +} + +inline bool QBasicAtomicInt::ref() +{ + return fetchAndAddRelaxed(1) != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + return fetchAndAddRelaxed(-1) != 1; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_release_int(&_q_value, expectedValue, newValue) != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return q_atomic_set_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return q_atomic_fetch_and_store_acquire_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return q_atomic_fetch_and_store_release_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return q_atomic_fetch_and_store_acquire_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int newValue) +{ + return q_atomic_fetch_and_add_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int newValue) +{ + return q_atomic_fetch_and_add_acquire_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int newValue) +{ + return q_atomic_fetch_and_add_release_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int newValue) +{ + return q_atomic_fetch_and_add_acquire_int(&_q_value, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_release_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_acquire_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_release_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_store_acquire_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +template <typename T> +Q_INLINE_TEMPLATE +T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_acquire_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_release_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_acquire_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +#else + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +extern "C" { + Q_CORE_EXPORT int q_atomic_lock_int(volatile int *addr); + Q_CORE_EXPORT int q_atomic_lock_ptr(volatile void *addr); + Q_CORE_EXPORT void q_atomic_unlock(volatile void *addr, int value); + Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); + Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, void *newval); +} // extern "C" + +inline bool QBasicAtomicInt::ref() +{ + const int val = q_atomic_lock_int(&_q_value); + q_atomic_unlock(&_q_value, val + 1); + return val != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + const int val = q_atomic_lock_int(&_q_value); + q_atomic_unlock(&_q_value, val - 1); + return val != 1; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + int val = q_atomic_lock_int(&_q_value); + if (val == expectedValue) { + q_atomic_unlock(&_q_value, newValue); + return true; + } + q_atomic_unlock(&_q_value, val); + return false; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return q_atomic_set_int(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + const int originalValue = q_atomic_lock_int(&_q_value); + q_atomic_unlock(&_q_value, originalValue + valueToAdd); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + T *val = reinterpret_cast<T *>(q_atomic_lock_ptr(&_q_value)); + if (val == expectedValue) { + q_atomic_unlock(&_q_value, reinterpret_cast<int>(newValue)); + return true; + } + q_atomic_unlock(&_q_value, reinterpret_cast<int>(val)); + return false; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + T *originalValue = reinterpret_cast<T *>(q_atomic_lock_ptr(&_q_value)); + q_atomic_unlock(&_q_value, int(originalValue + valueToAdd)); + return originalValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +#endif // _LP64 + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_SPARC_H diff --git a/qtinterface/qt4/Qt/qatomic_symbian.h b/qtinterface/qt4/Qt/qatomic_symbian.h new file mode 100644 index 0000000..a2e7539 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_symbian.h @@ -0,0 +1,285 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_SYMBIAN_H +#define QATOMIC_SYMBIAN_H + +#include <qglobal.h> +#include <e32std.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_SOMETIMES_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_SOMETIMES_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_SOMETIMES_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_SOMETIMES_NATIVE + +Q_CORE_EXPORT bool QBasicAtomicPointer_isTestAndSetNative(); +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return QBasicAtomicPointer_isTestAndSetNative(); } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_SOMETIMES_NATIVE + +Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndStoreNative(); +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return QBasicAtomicPointer_isFetchAndStoreNative(); } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_SOMETIMES_NATIVE + +Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndAddNative(); +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return QBasicAtomicPointer_isFetchAndAddNative(); } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int); +Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int); + +Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *); +Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff); + +// Reference counting + +//LockedInc and LockedDec are machine coded for ARMv6 (and future proof) +inline bool QBasicAtomicInt::ref() +{ + int original = User::LockedInc((TInt&)_q_value); + return original != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + int original = User::LockedDec((TInt&)_q_value); + return original != 1; +} + +// Test and set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return QBasicAtomicInt_testAndSetOrdered(&_q_value, expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return QBasicAtomicInt_fetchAndStoreOrdered(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + union { T * volatile * typed; void * volatile * voidp; } pointer; + pointer.typed = &_q_value; + return QBasicAtomicPointer_testAndSetOrdered(pointer.voidp, expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + union { T * volatile * typed; void * volatile * voidp; } pointer; + union { T *typed; void *voidp; } returnValue; + pointer.typed = &_q_value; + returnValue.voidp = QBasicAtomicPointer_fetchAndStoreOrdered(pointer.voidp, newValue); + return returnValue.typed; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + union { T * volatile *typed; void * volatile *voidp; } pointer; + union { T *typed; void *voidp; } returnValue; + pointer.typed = &_q_value; + returnValue.voidp = QBasicAtomicPointer_fetchAndAddOrdered(pointer.voidp, valueToAdd * sizeof(T)); + return returnValue.typed; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_SYMBIAN_H diff --git a/qtinterface/qt4/Qt/qatomic_vxworks.h b/qtinterface/qt4/Qt/qatomic_vxworks.h new file mode 100644 index 0000000..05f8009 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_vxworks.h @@ -0,0 +1,318 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_VXWORKS_H +#define QATOMIC_VXWORKS_H + +QT_BEGIN_HEADER + +#if defined(__ppc) +# include <QtCore/qatomic_powerpc.h> +#else // generic implementation with taskLock() + +#if 0 +// we don't want to include the system header here for two function prototypes, +// because it pulls in a _lot_ of stuff that pollutes the global namespace +# include <vxWorksCommon.h> +# include <taskLib.h> +#else +extern "C" int taskLock(); +extern "C" int taskUnlock(); +#endif + + + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return false; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return false; } + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ + taskLock(); + bool ret = (++_q_value != 0); + taskUnlock(); + return ret; +} + +inline bool QBasicAtomicInt::deref() +{ + taskLock(); + bool ret = (--_q_value != 0); + taskUnlock(); + return ret; +} + +// Test-and-set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + taskLock(); + if (_q_value == expectedValue) { + _q_value = newValue; + taskUnlock(); + return true; + } + taskUnlock(); + return false; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch-and-store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + taskLock(); + int returnValue = _q_value; + _q_value = newValue; + taskUnlock(); + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch-and-add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + taskLock(); + int originalValue = _q_value; + _q_value += valueToAdd; + taskUnlock(); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + taskLock(); + if (_q_value == expectedValue) { + _q_value = newValue; + taskUnlock(); + return true; + } + taskUnlock(); + return false; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + taskLock(); + T *returnValue = (_q_value); + _q_value = newValue; + taskUnlock(); + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + taskLock(); + T *returnValue = (_q_value); + _q_value += valueToAdd; + taskUnlock(); + return returnValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +#endif // generic implementation with taskLock() + +QT_END_HEADER + +#endif // QATOMIC_VXWORKS_H diff --git a/qtinterface/qt4/Qt/qatomic_windows.h b/qtinterface/qt4/Qt/qatomic_windows.h new file mode 100644 index 0000000..c56fb40 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_windows.h @@ -0,0 +1,496 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_WINDOWS_H +#define QATOMIC_WINDOWS_H + +#ifndef Q_CC_MSVC + +// Mingw and other GCC platforms get inline assembly + +# ifdef __i386__ +# include "QtCore/qatomic_i386.h" +# else +# include "QtCore/qatomic_x86_64.h" +# endif + +#else // Q_CC_MSVC + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef Q_OS_WINCE + +// use compiler intrinsics for all atomic functions +# define QT_INTERLOCKED_PREFIX _ +# define QT_INTERLOCKED_PROTOTYPE __cdecl +# define QT_INTERLOCKED_DECLARE_PROTOTYPES +# define QT_INTERLOCKED_INTRINSIC + +#else // Q_OS_WINCE + +# if _WIN32_WCE < 0x600 && defined(_X86_) +// For X86 Windows CE, include winbase.h to catch inline functions which +// override the regular definitions inside of coredll.dll. +// Though one could use the original version of Increment/Decrement, others are +// not exported at all. +# include <winbase.h> + +// It's safer to remove the volatile and let the compiler add it as needed. +# define QT_INTERLOCKED_NO_VOLATILE + +# else // _WIN32_WCE >= 0x600 || !_X86_ + +# define QT_INTERLOCKED_PROTOTYPE __cdecl +# define QT_INTERLOCKED_DECLARE_PROTOTYPES + +# if _WIN32_WCE >= 0x600 +# if defined(_X86_) +# define QT_INTERLOCKED_PREFIX _ +# define QT_INTERLOCKED_INTRINSIC +# endif +# else +# define QT_INTERLOCKED_NO_VOLATILE +# endif + +# endif // _WIN32_WCE >= 0x600 || !_X86_ + +#endif // Q_OS_WINCE + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Prototype declaration + +#define QT_INTERLOCKED_CONCAT_I(prefix, suffix) \ + prefix ## suffix +#define QT_INTERLOCKED_CONCAT(prefix, suffix) \ + QT_INTERLOCKED_CONCAT_I(prefix, suffix) + +// MSVC intrinsics prefix function names with an underscore. Also, if platform +// SDK headers have been included, the Interlocked names may be defined as +// macros. +// To avoid double underscores, we paste the prefix with Interlocked first and +// then the remainder of the function name. +#define QT_INTERLOCKED_FUNCTION(name) \ + QT_INTERLOCKED_CONCAT( \ + QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, Interlocked), name) + +#ifdef QT_INTERLOCKED_NO_VOLATILE +# define QT_INTERLOCKED_VOLATILE +# define QT_INTERLOCKED_REMOVE_VOLATILE(a) qt_interlocked_remove_volatile(a) +#else +# define QT_INTERLOCKED_VOLATILE volatile +# define QT_INTERLOCKED_REMOVE_VOLATILE(a) a +#endif + +#ifndef QT_INTERLOCKED_PREFIX +#define QT_INTERLOCKED_PREFIX +#endif + +#ifndef QT_INTERLOCKED_PROTOTYPE +#define QT_INTERLOCKED_PROTOTYPE +#endif + +#ifdef QT_INTERLOCKED_DECLARE_PROTOTYPES +#undef QT_INTERLOCKED_DECLARE_PROTOTYPES + +extern "C" { + + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment )(long QT_INTERLOCKED_VOLATILE *); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement )(long QT_INTERLOCKED_VOLATILE *); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long); + long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long); + +# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *); + void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *); + __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64); +# endif + +} + +#endif // QT_INTERLOCKED_DECLARE_PROTOTYPES + +#undef QT_INTERLOCKED_PROTOTYPE + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef QT_INTERLOCKED_INTRINSIC +#undef QT_INTERLOCKED_INTRINSIC + +# pragma intrinsic (_InterlockedIncrement) +# pragma intrinsic (_InterlockedDecrement) +# pragma intrinsic (_InterlockedExchange) +# pragma intrinsic (_InterlockedCompareExchange) +# pragma intrinsic (_InterlockedExchangeAdd) + +# if !defined(Q_OS_WINCE) && !defined(_M_IX86) +# pragma intrinsic (_InterlockedCompareExchangePointer) +# pragma intrinsic (_InterlockedExchangePointer) +# pragma intrinsic (_InterlockedExchangeAdd64) +# endif + +#endif // QT_INTERLOCKED_INTRINSIC + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interlocked* replacement macros + +#define QT_INTERLOCKED_INCREMENT(value) \ + QT_INTERLOCKED_FUNCTION( Increment )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ) ) + +#define QT_INTERLOCKED_DECREMENT(value) \ + QT_INTERLOCKED_FUNCTION( Decrement )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ) ) + +#define QT_INTERLOCKED_COMPARE_EXCHANGE(value, newValue, expectedValue) \ + QT_INTERLOCKED_FUNCTION( CompareExchange )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ + newValue, \ + expectedValue ) + +#define QT_INTERLOCKED_EXCHANGE(value, newValue) \ + QT_INTERLOCKED_FUNCTION( Exchange )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ + newValue ) + +#define QT_INTERLOCKED_EXCHANGE_ADD(value, valueToAdd) \ + QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ), \ + valueToAdd ) + +#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86) + +# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ + reinterpret_cast<void *>( \ + QT_INTERLOCKED_FUNCTION( CompareExchange )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ + (long)( newValue ), \ + (long)( expectedValue ) )) + +# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \ + QT_INTERLOCKED_FUNCTION( Exchange )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ + (quintptr)( newValue ) ) + +# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \ + QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ + valueToAdd ) + +#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + +# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \ + QT_INTERLOCKED_FUNCTION( CompareExchangePointer )( \ + reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \ + newValue, \ + expectedValue ) + +# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \ + QT_INTERLOCKED_FUNCTION( ExchangePointer )( \ + reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \ + newValue ) + +# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \ + QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )( \ + QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \ + valueToAdd ) + +#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return true; } + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef QT_INTERLOCKED_NO_VOLATILE +template <class T> +Q_INLINE_TEMPLATE T *qt_interlocked_remove_volatile(T volatile *t) +{ + return const_cast<T *>(t); +} +#endif // !QT_INTERLOCKED_NO_VOLATILE + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +inline bool QBasicAtomicInt::ref() +{ + return QT_INTERLOCKED_INCREMENT(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return QT_INTERLOCKED_DECREMENT(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return QT_INTERLOCKED_COMPARE_EXCHANGE(&_q_value, newValue, expectedValue) + == expectedValue; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + return QT_INTERLOCKED_EXCHANGE(&_q_value, newValue); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + return QT_INTERLOCKED_EXCHANGE_ADD(&_q_value, valueToAdd); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue) + == expectedValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T* newValue) +{ + return reinterpret_cast<T *>( + QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>( + QT_INTERLOCKED_EXCHANGE_ADD_POINTER(&_q_value, valueToAdd * sizeof(T))); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Cleanup + +#undef QT_INTERLOCKED_CONCAT_I +#undef QT_INTERLOCKED_CONCAT +#undef QT_INTERLOCKED_FUNCTION +#undef QT_INTERLOCKED_PREFIX + +#undef QT_INTERLOCKED_NO_VOLATILE +#undef QT_INTERLOCKED_VOLATILE +#undef QT_INTERLOCKED_REMOVE_VOLATILE + +#undef QT_INTERLOCKED_INCREMENT +#undef QT_INTERLOCKED_DECREMENT +#undef QT_INTERLOCKED_COMPARE_EXCHANGE +#undef QT_INTERLOCKED_EXCHANGE +#undef QT_INTERLOCKED_EXCHANGE_ADD +#undef QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER +#undef QT_INTERLOCKED_EXCHANGE_POINTER +#undef QT_INTERLOCKED_EXCHANGE_ADD_POINTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_CC_MSVC + +#endif // QATOMIC_WINDOWS_H diff --git a/qtinterface/qt4/Qt/qatomic_windowsce.h b/qtinterface/qt4/Qt/qatomic_windowsce.h new file mode 100644 index 0000000..98344b0 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_windowsce.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOWSCE_QATOMIC_H +#define WINDOWSCE_QATOMIC_H + +#include <QtCore/qglobal.h> +QT_BEGIN_HEADER + +#if defined(QT_ARCH_WINDOWSCE) +#include "QtCore/qatomic_windows.h" +#endif + +QT_END_HEADER + +#endif // QATOMIC_ARCH_H + + diff --git a/qtinterface/qt4/Qt/qatomic_x86_64.h b/qtinterface/qt4/Qt/qatomic_x86_64.h new file mode 100644 index 0000000..54ebef7 --- /dev/null +++ b/qtinterface/qt4/Qt/qatomic_x86_64.h @@ -0,0 +1,363 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_X86_64_H +#define QATOMIC_X86_64_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return true; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return true; } + +#if defined(Q_CC_GNU) || defined(Q_CC_INTEL) + +inline bool QBasicAtomicInt::ref() +{ + unsigned char ret; + asm volatile("lock\n" + "incl %0\n" + "setne %1" + : "=m" (_q_value), "=qm" (ret) + : "m" (_q_value) + : "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + unsigned char ret; + asm volatile("lock\n" + "decl %0\n" + "setne %1" + : "=m" (_q_value), "=qm" (ret) + : "m" (_q_value) + : "memory"); + return ret != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + unsigned char ret; + asm volatile("lock\n" + "cmpxchgl %3,%2\n" + "sete %1\n" + : "=a" (newValue), "=qm" (ret), "+m" (_q_value) + : "r" (newValue), "0" (expectedValue) + : "memory"); + return ret != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + asm volatile("xchgl %0,%1" + : "=r" (newValue), "+m" (_q_value) + : "0" (newValue) + : "memory"); + return newValue; +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + asm volatile("lock\n" + "xaddl %0,%1" + : "=r" (valueToAdd), "+m" (_q_value) + : "0" (valueToAdd) + : "memory"); + return valueToAdd; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + unsigned char ret; + asm volatile("lock\n" + "cmpxchgq %3,%2\n" + "sete %1\n" + : "=a" (newValue), "=qm" (ret), "+m" (_q_value) + : "r" (newValue), "0" (expectedValue) + : "memory"); + return ret != 0; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + asm volatile("xchgq %0,%1" + : "=r" (newValue), "+m" (_q_value) + : "0" (newValue) + : "memory"); + return newValue; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + asm volatile("lock\n" + "xaddq %0,%1" + : "=r" (valueToAdd), "+m" (_q_value) + : "0" (valueToAdd * sizeof(T)) + : "memory"); + return reinterpret_cast<T *>(valueToAdd); +} + +#else // !Q_CC_INTEL && !Q_CC_GNU + +extern "C" { + Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); + Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval); + Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr); + Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); + Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, void *newval); + Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value); + Q_CORE_EXPORT void *q_atomic_fetch_and_add_ptr(volatile void *ptr, qptrdiff value); +} // extern "C" + +inline bool QBasicAtomicInt::ref() +{ + return q_atomic_increment(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::deref() +{ + return q_atomic_decrement(&_q_value) != 0; +} + +inline bool QBasicAtomicInt::testAndSetOrdered(int expected, int newval) +{ + return q_atomic_test_and_set_int(&_q_value, expected, newval) != 0; +} + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newval) +{ + return q_atomic_set_int(&_q_value, newval); +} + +inline int QBasicAtomicInt::fetchAndAddOrdered(int aValue) +{ + return q_atomic_fetch_and_add_int(&_q_value, aValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + return reinterpret_cast<T *>(q_atomic_fetch_and_add_ptr(&_q_value, valueToAdd * sizeof(T))); +} + +#endif // Q_CC_GNU || Q_CC_INTEL + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_X86_64_H diff --git a/qtinterface/qt4/Qt/qaudio.h b/qtinterface/qt4/Qt/qaudio.h new file mode 100644 index 0000000..3d1dd1d --- /dev/null +++ b/qtinterface/qt4/Qt/qaudio.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QAUDIO_H +#define QAUDIO_H + + +#include <QtCore/qglobal.h> +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +namespace QAudio +{ + enum Error { NoError, OpenError, IOError, UnderrunError, FatalError }; + enum State { ActiveState, SuspendedState, StoppedState, IdleState }; + enum Mode { AudioInput, AudioOutput }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +Q_DECLARE_METATYPE(QAudio::Error) +Q_DECLARE_METATYPE(QAudio::State) +Q_DECLARE_METATYPE(QAudio::Mode) + +#endif // QAUDIO_H diff --git a/qtinterface/qt4/Qt/qaudiodeviceinfo.h b/qtinterface/qt4/Qt/qaudiodeviceinfo.h new file mode 100644 index 0000000..fd13ba9 --- /dev/null +++ b/qtinterface/qt4/Qt/qaudiodeviceinfo.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QAUDIODEVICEINFO_H +#define QAUDIODEVICEINFO_H + +#include <QtCore/qobject.h> +#include <QtCore/qglobal.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qlist.h> + +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudioformat.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QAudioDeviceFactory; + +class QAudioDeviceInfoPrivate; +class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo +{ + friend class QAudioDeviceFactory; + +public: + QAudioDeviceInfo(); + QAudioDeviceInfo(const QAudioDeviceInfo& other); + ~QAudioDeviceInfo(); + + QAudioDeviceInfo& operator=(const QAudioDeviceInfo& other); + + bool isNull() const; + + QString deviceName() const; + + bool isFormatSupported(const QAudioFormat &format) const; + QAudioFormat preferredFormat() const; + QAudioFormat nearestFormat(const QAudioFormat &format) const; + + QStringList supportedCodecs() const; + QList<int> supportedFrequencies() const; + QList<int> supportedChannels() const; + QList<int> supportedSampleSizes() const; + QList<QAudioFormat::Endian> supportedByteOrders() const; + QList<QAudioFormat::SampleType> supportedSampleTypes() const; + + static QAudioDeviceInfo defaultInputDevice(); + static QAudioDeviceInfo defaultOutputDevice(); + + static QList<QAudioDeviceInfo> availableDevices(QAudio::Mode mode); + +private: + QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode); + QString realm() const; + QByteArray handle() const; + QAudio::Mode mode() const; + + QSharedDataPointer<QAudioDeviceInfoPrivate> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +Q_DECLARE_METATYPE(QAudioDeviceInfo) + +#endif // QAUDIODEVICEINFO_H diff --git a/qtinterface/qt4/Qt/qaudioengine.h b/qtinterface/qt4/Qt/qaudioengine.h new file mode 100644 index 0000000..d63e453 --- /dev/null +++ b/qtinterface/qt4/Qt/qaudioengine.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAUDIOENGINE_H +#define QAUDIOENGINE_H + +#include <QtCore/qglobal.h> +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudioformat.h> +#include <QtMultimedia/qaudiodeviceinfo.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class Q_MULTIMEDIA_EXPORT QAbstractAudioDeviceInfo : public QObject +{ + Q_OBJECT + +public: + virtual QAudioFormat preferredFormat() const = 0; + virtual bool isFormatSupported(const QAudioFormat &format) const = 0; + virtual QAudioFormat nearestFormat(const QAudioFormat &format) const = 0; + virtual QString deviceName() const = 0; + virtual QStringList codecList() = 0; + virtual QList<int> frequencyList() = 0; + virtual QList<int> channelsList() = 0; + virtual QList<int> sampleSizeList() = 0; + virtual QList<QAudioFormat::Endian> byteOrderList() = 0; + virtual QList<QAudioFormat::SampleType> sampleTypeList() = 0; +}; + +class Q_MULTIMEDIA_EXPORT QAbstractAudioOutput : public QObject +{ + Q_OBJECT + +public: + virtual QIODevice* start(QIODevice* device) = 0; + virtual void stop() = 0; + virtual void reset() = 0; + virtual void suspend() = 0; + virtual void resume() = 0; + virtual int bytesFree() const = 0; + virtual int periodSize() const = 0; + virtual void setBufferSize(int value) = 0; + virtual int bufferSize() const = 0; + virtual void setNotifyInterval(int milliSeconds) = 0; + virtual int notifyInterval() const = 0; + virtual qint64 processedUSecs() const = 0; + virtual qint64 elapsedUSecs() const = 0; + virtual QAudio::Error error() const = 0; + virtual QAudio::State state() const = 0; + virtual QAudioFormat format() const = 0; + +Q_SIGNALS: + void stateChanged(QAudio::State); + void notify(); +}; + +class Q_MULTIMEDIA_EXPORT QAbstractAudioInput : public QObject +{ + Q_OBJECT + +public: + virtual QIODevice* start(QIODevice* device) = 0; + virtual void stop() = 0; + virtual void reset() = 0; + virtual void suspend() = 0; + virtual void resume() = 0; + virtual int bytesReady() const = 0; + virtual int periodSize() const = 0; + virtual void setBufferSize(int value) = 0; + virtual int bufferSize() const = 0; + virtual void setNotifyInterval(int milliSeconds) = 0; + virtual int notifyInterval() const = 0; + virtual qint64 processedUSecs() const = 0; + virtual qint64 elapsedUSecs() const = 0; + virtual QAudio::Error error() const = 0; + virtual QAudio::State state() const = 0; + virtual QAudioFormat format() const = 0; + +Q_SIGNALS: + void stateChanged(QAudio::State); + void notify(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QAUDIOENGINE_H diff --git a/qtinterface/qt4/Qt/qaudioengineplugin.h b/qtinterface/qt4/Qt/qaudioengineplugin.h new file mode 100644 index 0000000..37b0c73 --- /dev/null +++ b/qtinterface/qt4/Qt/qaudioengineplugin.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QAUDIOENGINEPLUGIN_H +#define QAUDIOENGINEPLUGIN_H + +#include <QtCore/qstring.h> +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +#include <QtMultimedia/qaudioformat.h> +#include <QtMultimedia/qaudiodeviceinfo.h> +#include <QtMultimedia/qaudioengine.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +struct Q_MULTIMEDIA_EXPORT QAudioEngineFactoryInterface : public QFactoryInterface +{ + virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0; + virtual QAbstractAudioInput* createInput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; + virtual QAbstractAudioOutput* createOutput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; + virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0; +}; + +#define QAudioEngineFactoryInterface_iid \ + "com.nokia.qt.QAudioEngineFactoryInterface" +Q_DECLARE_INTERFACE(QAudioEngineFactoryInterface, QAudioEngineFactoryInterface_iid) + +class Q_MULTIMEDIA_EXPORT QAudioEnginePlugin : public QObject, public QAudioEngineFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QAudioEngineFactoryInterface:QFactoryInterface) + +public: + QAudioEnginePlugin(QObject *parent = 0); + ~QAudioEnginePlugin(); + + virtual QStringList keys() const = 0; + virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0; + virtual QAbstractAudioInput* createInput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; + virtual QAbstractAudioOutput* createOutput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; + virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QAUDIOENGINEPLUGIN_H diff --git a/qtinterface/qt4/Qt/qaudioformat.h b/qtinterface/qt4/Qt/qaudioformat.h new file mode 100644 index 0000000..d428637 --- /dev/null +++ b/qtinterface/qt4/Qt/qaudioformat.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QAUDIOFORMAT_H +#define QAUDIOFORMAT_H + +#include <QtCore/qobject.h> +#include <QtCore/qglobal.h> +#include <QtCore/qshareddata.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + + +class QAudioFormatPrivate; + +class Q_MULTIMEDIA_EXPORT QAudioFormat +{ +public: + enum SampleType { Unknown, SignedInt, UnSignedInt, Float }; + enum Endian { BigEndian = QSysInfo::BigEndian, LittleEndian = QSysInfo::LittleEndian }; + + QAudioFormat(); + QAudioFormat(const QAudioFormat &other); + ~QAudioFormat(); + + QAudioFormat& operator=(const QAudioFormat &other); + bool operator==(const QAudioFormat &other) const; + bool operator!=(const QAudioFormat &other) const; + + bool isValid() const; + + void setFrequency(int frequency); + int frequency() const; + + void setChannels(int channels); + int channels() const; + + void setSampleSize(int sampleSize); + int sampleSize() const; + + void setCodec(const QString &codec); + QString codec() const; + + void setByteOrder(QAudioFormat::Endian byteOrder); + QAudioFormat::Endian byteOrder() const; + + void setSampleType(QAudioFormat::SampleType sampleType); + QAudioFormat::SampleType sampleType() const; + +private: + QSharedDataPointer<QAudioFormatPrivate> d; +}; + + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QAUDIOFORMAT_H diff --git a/qtinterface/qt4/Qt/qaudioinput.h b/qtinterface/qt4/Qt/qaudioinput.h new file mode 100644 index 0000000..79aa080 --- /dev/null +++ b/qtinterface/qt4/Qt/qaudioinput.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QAUDIOINPUT_H +#define QAUDIOINPUT_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qglobal.h> + +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudioformat.h> +#include <QtMultimedia/qaudiodeviceinfo.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + + +class QAbstractAudioInput; + +class Q_MULTIMEDIA_EXPORT QAudioInput : public QObject +{ + Q_OBJECT + +public: + explicit QAudioInput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + explicit QAudioInput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + ~QAudioInput(); + + QAudioFormat format() const; + + void start(QIODevice *device); + QIODevice* start(); + + void stop(); + void reset(); + void suspend(); + void resume(); + + void setBufferSize(int bytes); + int bufferSize() const; + + int bytesReady() const; + int periodSize() const; + + void setNotifyInterval(int milliSeconds); + int notifyInterval() const; + + qint64 processedUSecs() const; + qint64 elapsedUSecs() const; + + QAudio::Error error() const; + QAudio::State state() const; + +Q_SIGNALS: + void stateChanged(QAudio::State); + void notify(); + +private: + Q_DISABLE_COPY(QAudioInput) + + QAbstractAudioInput* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QAUDIOINPUT_H diff --git a/qtinterface/qt4/Qt/qaudiooutput.h b/qtinterface/qt4/Qt/qaudiooutput.h new file mode 100644 index 0000000..a498c00 --- /dev/null +++ b/qtinterface/qt4/Qt/qaudiooutput.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QAUDIOOUTPUT_H +#define QAUDIOOUTPUT_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qglobal.h> + +#include <QtMultimedia/qaudio.h> +#include <QtMultimedia/qaudioformat.h> +#include <QtMultimedia/qaudiodeviceinfo.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + + +class QAbstractAudioOutput; + +class Q_MULTIMEDIA_EXPORT QAudioOutput : public QObject +{ + Q_OBJECT + +public: + explicit QAudioOutput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + explicit QAudioOutput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + ~QAudioOutput(); + + QAudioFormat format() const; + + void start(QIODevice *device); + QIODevice* start(); + + void stop(); + void reset(); + void suspend(); + void resume(); + + void setBufferSize(int bytes); + int bufferSize() const; + + int bytesFree() const; + int periodSize() const; + + void setNotifyInterval(int milliSeconds); + int notifyInterval() const; + + qint64 processedUSecs() const; + qint64 elapsedUSecs() const; + + QAudio::Error error() const; + QAudio::State state() const; + +Q_SIGNALS: + void stateChanged(QAudio::State); + void notify(); + +private: + Q_DISABLE_COPY(QAudioOutput) + + QAbstractAudioOutput* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QAUDIOOUTPUT_H diff --git a/qtinterface/qt4/Qt/qauthenticator.h b/qtinterface/qt4/Qt/qauthenticator.h new file mode 100644 index 0000000..fdbe8dc --- /dev/null +++ b/qtinterface/qt4/Qt/qauthenticator.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAUTHENTICATOR_H +#define QAUTHENTICATOR_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QAuthenticatorPrivate; +class QUrl; + +class Q_NETWORK_EXPORT QAuthenticator +{ +public: + QAuthenticator(); + ~QAuthenticator(); + + QAuthenticator(const QAuthenticator &other); + QAuthenticator &operator=(const QAuthenticator &other); + + bool operator==(const QAuthenticator &other) const; + inline bool operator!=(const QAuthenticator &other) const { return !operator==(other); } + + QString user() const; + void setUser(const QString &user); + + QString password() const; + void setPassword(const QString &password); + + QString realm() const; + + bool isNull() const; + void detach(); +private: + friend class QAuthenticatorPrivate; + QAuthenticatorPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qbasicatomic.h b/qtinterface/qt4/Qt/qbasicatomic.h new file mode 100644 index 0000000..b92f8e8 --- /dev/null +++ b/qtinterface/qt4/Qt/qbasicatomic.h @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBASICATOMIC_H +#define QBASICATOMIC_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QBasicAtomicInt +{ +public: +#ifdef QT_ARCH_PARISC + int _q_lock[4]; +#endif +#if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE) + union { // needed for Q_BASIC_ATOMIC_INITIALIZER + volatile long _q_value; + }; +#else + volatile int _q_value; +#endif + + // Non-atomic API + inline bool operator==(int value) const + { + return _q_value == value; + } + + inline bool operator!=(int value) const + { + return _q_value != value; + } + + inline bool operator!() const + { + return _q_value == 0; + } + + inline operator int() const + { + return _q_value; + } + + inline QBasicAtomicInt &operator=(int value) + { +#ifdef QT_ARCH_PARISC + this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#endif + _q_value = value; + return *this; + } + + // Atomic API, implemented in qatomic_XXX.h + + static bool isReferenceCountingNative(); + static bool isReferenceCountingWaitFree(); + + bool ref(); + bool deref(); + + static bool isTestAndSetNative(); + static bool isTestAndSetWaitFree(); + + bool testAndSetRelaxed(int expectedValue, int newValue); + bool testAndSetAcquire(int expectedValue, int newValue); + bool testAndSetRelease(int expectedValue, int newValue); + bool testAndSetOrdered(int expectedValue, int newValue); + + static bool isFetchAndStoreNative(); + static bool isFetchAndStoreWaitFree(); + + int fetchAndStoreRelaxed(int newValue); + int fetchAndStoreAcquire(int newValue); + int fetchAndStoreRelease(int newValue); + int fetchAndStoreOrdered(int newValue); + + static bool isFetchAndAddNative(); + static bool isFetchAndAddWaitFree(); + + int fetchAndAddRelaxed(int valueToAdd); + int fetchAndAddAcquire(int valueToAdd); + int fetchAndAddRelease(int valueToAdd); + int fetchAndAddOrdered(int valueToAdd); +}; + +template <typename T> +class QBasicAtomicPointer +{ +public: +#ifdef QT_ARCH_PARISC + int _q_lock[4]; +#endif +#if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE) + union { + T * volatile _q_value; +# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + qint64 +# else + long +# endif + volatile _q_value_integral; + }; +#else + T * volatile _q_value; +#endif + + // Non-atomic API + inline bool operator==(T *value) const + { + return _q_value == value; + } + + inline bool operator!=(T *value) const + { + return !operator==(value); + } + + inline bool operator!() const + { + return operator==(0); + } + + inline operator T *() const + { + return _q_value; + } + + inline T *operator->() const + { + return _q_value; + } + + inline QBasicAtomicPointer<T> &operator=(T *value) + { +#ifdef QT_ARCH_PARISC + this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#endif + _q_value = value; + return *this; + } + + // Atomic API, implemented in qatomic_XXX.h + + static bool isTestAndSetNative(); + static bool isTestAndSetWaitFree(); + + bool testAndSetRelaxed(T *expectedValue, T *newValue); + bool testAndSetAcquire(T *expectedValue, T *newValue); + bool testAndSetRelease(T *expectedValue, T *newValue); + bool testAndSetOrdered(T *expectedValue, T *newValue); + + static bool isFetchAndStoreNative(); + static bool isFetchAndStoreWaitFree(); + + T *fetchAndStoreRelaxed(T *newValue); + T *fetchAndStoreAcquire(T *newValue); + T *fetchAndStoreRelease(T *newValue); + T *fetchAndStoreOrdered(T *newValue); + + static bool isFetchAndAddNative(); + static bool isFetchAndAddWaitFree(); + + T *fetchAndAddRelaxed(qptrdiff valueToAdd); + T *fetchAndAddAcquire(qptrdiff valueToAdd); + T *fetchAndAddRelease(qptrdiff valueToAdd); + T *fetchAndAddOrdered(qptrdiff valueToAdd); +}; + +#ifdef QT_ARCH_PARISC +# define Q_BASIC_ATOMIC_INITIALIZER(a) {{-1,-1,-1,-1},(a)} +#elif defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE) +# define Q_BASIC_ATOMIC_INITIALIZER(a) { {(a)} } +#else +# define Q_BASIC_ATOMIC_INITIALIZER(a) { (a) } +#endif + +QT_END_NAMESPACE +QT_END_HEADER + +#if defined(QT_MOC) || defined(QT_BUILD_QMAKE) || defined(QT_RCC) || defined(QT_UIC) || defined(QT_BOOTSTRAPPED) +# include <QtCore/qatomic_bootstrap.h> +#else +# include <QtCore/qatomic_arch.h> +#endif + +#endif // QBASIC_ATOMIC diff --git a/qtinterface/qt4/Qt/qbasictimer.h b/qtinterface/qt4/Qt/qbasictimer.h new file mode 100644 index 0000000..f1cd329 --- /dev/null +++ b/qtinterface/qt4/Qt/qbasictimer.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBASICTIMER_H +#define QBASICTIMER_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QObject; + +class Q_CORE_EXPORT QBasicTimer +{ + int id; +public: + inline QBasicTimer() : id(0) {} + inline ~QBasicTimer() { if (id) stop(); } + + inline bool isActive() const { return id != 0; } + inline int timerId() const { return id; } + + void start(int msec, QObject *obj); + void stop(); +}; +Q_DECLARE_TYPEINFO(QBasicTimer, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBASICTIMER_H diff --git a/qtinterface/qt4/Qt/qbenchmark.h b/qtinterface/qt4/Qt/qbenchmark.h new file mode 100644 index 0000000..d0057bb --- /dev/null +++ b/qtinterface/qt4/Qt/qbenchmark.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBENCHMARK_H +#define QBENCHMARK_H + +#include <QtTest/qtest_global.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +namespace QTest +{ + +// +// W A R N I N G +// ------------- +// +// The QBenchmarkIterationController class is not a part of the +// QTestlib API. It exists purely as an implementation detail. +// +// +class Q_TESTLIB_EXPORT QBenchmarkIterationController +{ +public: + enum RunMode { RepeatUntilValidMeasurement, RunOnce }; + QBenchmarkIterationController(); + QBenchmarkIterationController(RunMode runMode); + ~QBenchmarkIterationController(); + bool isDone(); + void next(); + int i; +}; + +} + +#define QBENCHMARK \ + for (QTest::QBenchmarkIterationController __iteration_controller; \ + __iteration_controller.isDone() == false; __iteration_controller.next()) + +#define QBENCHMARK_ONCE \ + for (QTest::QBenchmarkIterationController __iteration_controller(QTest::QBenchmarkIterationController::RunOnce); \ + __iteration_controller.isDone() == false; __iteration_controller.next()) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBENCHMARK_H diff --git a/qtinterface/qt4/Qt/qbitarray.h b/qtinterface/qt4/Qt/qbitarray.h new file mode 100644 index 0000000..25ac433 --- /dev/null +++ b/qtinterface/qt4/Qt/qbitarray.h @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBITARRAY_H +#define QBITARRAY_H + +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QBitRef; +class Q_CORE_EXPORT QBitArray +{ + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &); + friend Q_CORE_EXPORT uint qHash(const QBitArray &key); + QByteArray d; + +public: + inline QBitArray() {} + explicit QBitArray(int size, bool val = false); + QBitArray(const QBitArray &other) : d(other.d) {} + inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; } + + inline int size() const { return (d.size() << 3) - *d.constData(); } + inline int count() const { return (d.size() << 3) - *d.constData(); } + int count(bool on) const; + // ### Qt 5: Store the number of set bits separately + + inline bool isEmpty() const { return d.isEmpty(); } + inline bool isNull() const { return d.isNull(); } + + void resize(int size); + + inline void detach() { d.detach(); } + inline bool isDetached() const { return d.isDetached(); } + inline void clear() { d.clear(); } + + bool testBit(int i) const; + void setBit(int i); + void setBit(int i, bool val); + void clearBit(int i); + bool toggleBit(int i); + + bool at(int i) const; + QBitRef operator[](int i); + bool operator[](int i) const; + QBitRef operator[](uint i); + bool operator[](uint i) const; + + QBitArray& operator&=(const QBitArray &); + QBitArray& operator|=(const QBitArray &); + QBitArray& operator^=(const QBitArray &); + QBitArray operator~() const; + + inline bool operator==(const QBitArray& a) const { return d == a.d; } + inline bool operator!=(const QBitArray& a) const { return d != a.d; } + + inline bool fill(bool val, int size = -1); + void fill(bool val, int first, int last); + + inline void truncate(int pos) { if (pos < size()) resize(pos); } + +public: + typedef QByteArray::DataPtr DataPtr; + inline DataPtr &data_ptr() { return d.data_ptr(); } +}; + +inline bool QBitArray::fill(bool aval, int asize) +{ *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; } + +Q_CORE_EXPORT QBitArray operator&(const QBitArray &, const QBitArray &); +Q_CORE_EXPORT QBitArray operator|(const QBitArray &, const QBitArray &); +Q_CORE_EXPORT QBitArray operator^(const QBitArray &, const QBitArray &); + +inline bool QBitArray::testBit(int i) const +{ Q_ASSERT(i >= 0 && i < size()); + return (*(reinterpret_cast<const uchar*>(d.constData())+1+(i>>3)) & (1 << (i & 7))) != 0; } + +inline void QBitArray::setBit(int i) +{ Q_ASSERT(i >= 0 && i < size()); + *(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) |= uchar(1 << (i & 7)); } + +inline void QBitArray::clearBit(int i) +{ Q_ASSERT(i >= 0 && i < size()); + *(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) &= ~uchar(1 << (i & 7)); } + +inline void QBitArray::setBit(int i, bool val) +{ if (val) setBit(i); else clearBit(i); } + +inline bool QBitArray::toggleBit(int i) +{ Q_ASSERT(i >= 0 && i < size()); + uchar b = uchar(1<<(i&7)); uchar* p = reinterpret_cast<uchar*>(d.data())+1+(i>>3); + uchar c = uchar(*p&b); *p^=b; return c!=0; } + +inline bool QBitArray::operator[](int i) const { return testBit(i); } +inline bool QBitArray::operator[](uint i) const { return testBit(i); } +inline bool QBitArray::at(int i) const { return testBit(i); } + +class Q_CORE_EXPORT QBitRef +{ +private: + QBitArray& a; + int i; + inline QBitRef(QBitArray& array, int idx) : a(array), i(idx) {} + friend class QBitArray; +public: + inline operator bool() const { return a.testBit(i); } + inline bool operator!() const { return !a.testBit(i); } + QBitRef& operator=(const QBitRef& val) { a.setBit(i, val); return *this; } + QBitRef& operator=(bool val) { a.setBit(i, val); return *this; } +}; + +inline QBitRef QBitArray::operator[](int i) +{ Q_ASSERT(i >= 0); return QBitRef(*this, i); } +inline QBitRef QBitArray::operator[](uint i) +{ return QBitRef(*this, i); } + + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &); +#endif + +Q_DECLARE_TYPEINFO(QBitArray, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QBitArray) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBITARRAY_H diff --git a/qtinterface/qt4/Qt/qbitmap.h b/qtinterface/qt4/Qt/qbitmap.h new file mode 100644 index 0000000..39ae209 --- /dev/null +++ b/qtinterface/qt4/Qt/qbitmap.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBITMAP_H +#define QBITMAP_H + +#include <QtGui/qpixmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QVariant; + +class Q_GUI_EXPORT QBitmap : public QPixmap +{ +public: + QBitmap(); + QBitmap(const QPixmap &); + QBitmap(int w, int h); + explicit QBitmap(const QSize &); + explicit QBitmap(const QString &fileName, const char *format=0); + ~QBitmap(); + + QBitmap &operator=(const QPixmap &); + operator QVariant() const; + + inline void clear() { fill(Qt::color0); } + + static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + static QBitmap fromData(const QSize &size, const uchar *bits, + QImage::Format monoFormat = QImage::Format_MonoLSB); + + QBitmap transformed(const QMatrix &) const; + QBitmap transformed(const QTransform &matrix) const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, bool clear); + inline QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, bool clear); + QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, const uchar *bits, bool isXbitmap=false); + QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, const uchar *bits, bool isXbitmap=false); + inline QT3_SUPPORT QBitmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } + QT3_SUPPORT_CONSTRUCTOR QBitmap(const QImage &image) { *this = fromImage(image); } + QT3_SUPPORT QBitmap &operator=(const QImage &image) { *this = fromImage(image); return *this; } +#endif + + typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr; +}; +Q_DECLARE_SHARED(QBitmap) + +#ifdef QT3_SUPPORT +inline QBitmap::QBitmap(int w, int h, bool clear) + : QPixmap(QSize(w, h), 1) +{ + if (clear) this->clear(); +} + +inline QBitmap::QBitmap(const QSize &size, bool clear) + : QPixmap(size, 1) +{ + if (clear) this->clear(); +} +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBITMAP_H diff --git a/qtinterface/qt4/Qt/qboxlayout.h b/qtinterface/qt4/Qt/qboxlayout.h new file mode 100644 index 0000000..06ace10 --- /dev/null +++ b/qtinterface/qt4/Qt/qboxlayout.h @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBOXLAYOUT_H +#define QBOXLAYOUT_H + +#include <QtGui/qlayout.h> +#ifdef QT_INCLUDE_COMPAT +#include <QtGui/qwidget.h> +#endif + +#include <limits.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QBoxLayoutPrivate; + +class Q_GUI_EXPORT QBoxLayout : public QLayout +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QBoxLayout) +public: + enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop, + Down = TopToBottom, Up = BottomToTop }; + + explicit QBoxLayout(Direction, QWidget *parent = 0); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QBoxLayout(QWidget *parent, Direction, int border = 0, int spacing = -1, + const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QBoxLayout(QLayout *parentLayout, Direction, int spacing = -1, + const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QBoxLayout(Direction, int spacing, const char *name = 0); +#endif + ~QBoxLayout(); + + Direction direction() const; + void setDirection(Direction); + + void addSpacing(int size); + void addStretch(int stretch = 0); + void addSpacerItem(QSpacerItem *spacerItem); + void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = 0); + void addLayout(QLayout *layout, int stretch = 0); + void addStrut(int); + void addItem(QLayoutItem *); + + void insertSpacing(int index, int size); + void insertStretch(int index, int stretch = 0); + void insertSpacerItem(int index, QSpacerItem *spacerItem); + void insertWidget(int index, QWidget *widget, int stretch = 0, Qt::Alignment alignment = 0); + void insertLayout(int index, QLayout *layout, int stretch = 0); + + int spacing() const; + void setSpacing(int spacing); + + bool setStretchFactor(QWidget *w, int stretch); + bool setStretchFactor(QLayout *l, int stretch); + void setStretch(int index, int stretch); + int stretch(int index) const; + + QSize sizeHint() const; + QSize minimumSize() const; + QSize maximumSize() const; + + bool hasHeightForWidth() const; + int heightForWidth(int) const; + int minimumHeightForWidth(int) const; + + Qt::Orientations expandingDirections() const; + void invalidate(); + QLayoutItem *itemAt(int) const; + QLayoutItem *takeAt(int); + int count() const; + void setGeometry(const QRect&); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT int findWidget(QWidget* w) {return indexOf(w);} +#endif +protected: + // ### Qt 5: make public + void insertItem(int index, QLayoutItem *); + +private: + Q_DISABLE_COPY(QBoxLayout) +}; + +class Q_GUI_EXPORT QHBoxLayout : public QBoxLayout +{ + Q_OBJECT +public: + QHBoxLayout(); + explicit QHBoxLayout(QWidget *parent); + ~QHBoxLayout(); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(QWidget *parent, int border, + int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(QLayout *parentLayout, + int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(int spacing, const char *name = 0); +#endif + +private: + Q_DISABLE_COPY(QHBoxLayout) +}; + +class Q_GUI_EXPORT QVBoxLayout : public QBoxLayout +{ + Q_OBJECT +public: + QVBoxLayout(); + explicit QVBoxLayout(QWidget *parent); + ~QVBoxLayout(); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(QWidget *parent, int border, + int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(QLayout *parentLayout, + int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(int spacing, const char *name = 0); +#endif + +private: + Q_DISABLE_COPY(QVBoxLayout) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBOXLAYOUT_H diff --git a/qtinterface/qt4/Qt/qbrush.h b/qtinterface/qt4/Qt/qbrush.h new file mode 100644 index 0000000..6ffb70a --- /dev/null +++ b/qtinterface/qt4/Qt/qbrush.h @@ -0,0 +1,332 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBRUSH_H +#define QBRUSH_H + +#include <QtCore/qpair.h> +#include <QtCore/qpoint.h> +#include <QtCore/qvector.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qcolor.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qtransform.h> +#include <QtGui/qimage.h> +#include <QtGui/qpixmap.h> + +#if defined(Q_OS_VXWORKS) +# if defined(m_data) +# undef m_data +# endif +# if defined(m_type) +# undef m_type +# endif +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +struct QBrushData; +class QPixmap; +class QGradient; +class QVariant; +struct QBrushDataPointerDeleter; + +class Q_GUI_EXPORT QBrush +{ +public: + QBrush(); + QBrush(Qt::BrushStyle bs); + QBrush(const QColor &color, Qt::BrushStyle bs=Qt::SolidPattern); + QBrush(Qt::GlobalColor color, Qt::BrushStyle bs=Qt::SolidPattern); + + QBrush(const QColor &color, const QPixmap &pixmap); + QBrush(Qt::GlobalColor color, const QPixmap &pixmap); + QBrush(const QPixmap &pixmap); + QBrush(const QImage &image); + + QBrush(const QBrush &brush); + + QBrush(const QGradient &gradient); + + ~QBrush(); + QBrush &operator=(const QBrush &brush); + operator QVariant() const; + + inline Qt::BrushStyle style() const; + void setStyle(Qt::BrushStyle); + + inline const QMatrix &matrix() const; + void setMatrix(const QMatrix &mat); + + inline QTransform transform() const; + void setTransform(const QTransform &); + + QPixmap texture() const; + void setTexture(const QPixmap &pixmap); + + QImage textureImage() const; + void setTextureImage(const QImage &image); + + inline const QColor &color() const; + void setColor(const QColor &color); + inline void setColor(Qt::GlobalColor color); + + const QGradient *gradient() const; + + bool isOpaque() const; + + bool operator==(const QBrush &b) const; + inline bool operator!=(const QBrush &b) const { return !(operator==(b)); } + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT operator const QColor&() const; + QT3_SUPPORT QPixmap *pixmap() const; + inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap) { setTexture(pixmap); } +#endif + +private: +#if defined(Q_WS_X11) + friend class QX11PaintEngine; +#endif + friend class QRasterPaintEngine; + friend class QRasterPaintEnginePrivate; + friend struct QSpanData; + friend class QPainter; + friend bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush); + void detach(Qt::BrushStyle newStyle); + void init(const QColor &color, Qt::BrushStyle bs); + QScopedPointer<QBrushData, QBrushDataPointerDeleter> d; + void cleanUp(QBrushData *x); + +public: + inline bool isDetached() const; + typedef QScopedPointer<QBrushData, QBrushDataPointerDeleter> DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +inline void QBrush::setColor(Qt::GlobalColor acolor) +{ setColor(QColor(acolor)); } + +Q_DECLARE_TYPEINFO(QBrush, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QBrush) + +/***************************************************************************** + QBrush stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QBrush &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QBrush &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QBrush &); +#endif + +struct QBrushData +{ + QAtomicInt ref; + Qt::BrushStyle style; + QColor color; + QTransform transform; +}; + +inline Qt::BrushStyle QBrush::style() const { return d->style; } +inline const QColor &QBrush::color() const { return d->color; } +inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); } +inline QTransform QBrush::transform() const { return d->transform; } +inline bool QBrush::isDetached() const { return d->ref == 1; } + +#ifdef QT3_SUPPORT +inline QBrush::operator const QColor&() const { return d->color; } +#endif + + +/******************************************************************************* + * QGradients + */ +class QGradientPrivate; + +typedef QPair<qreal, QColor> QGradientStop; +typedef QVector<QGradientStop> QGradientStops; + +class Q_GUI_EXPORT QGradient +{ + Q_GADGET + Q_ENUMS(Type Spread CoordinateMode) +public: + enum Type { + LinearGradient, + RadialGradient, + ConicalGradient, + NoGradient + }; + + enum Spread { + PadSpread, + ReflectSpread, + RepeatSpread + }; + + enum CoordinateMode { + LogicalMode, + StretchToDeviceMode, + ObjectBoundingMode + }; + + enum InterpolationMode { + ColorInterpolation, + ComponentInterpolation + }; + + QGradient(); + + Type type() const { return m_type; } + + inline void setSpread(Spread spread); + Spread spread() const { return m_spread; } + + void setColorAt(qreal pos, const QColor &color); + + void setStops(const QGradientStops &stops); + QGradientStops stops() const; + + CoordinateMode coordinateMode() const; + void setCoordinateMode(CoordinateMode mode); + + InterpolationMode interpolationMode() const; + void setInterpolationMode(InterpolationMode mode); + + bool operator==(const QGradient &gradient) const; + inline bool operator!=(const QGradient &other) const + { return !operator==(other); } + + bool operator==(const QGradient &gradient); // ### Qt 5: remove + +private: + friend class QLinearGradient; + friend class QRadialGradient; + friend class QConicalGradient; + + Type m_type; + Spread m_spread; + QGradientStops m_stops; + union { + struct { + qreal x1, y1, x2, y2; + } linear; + struct { + qreal cx, cy, fx, fy, radius; + } radial; + struct { + qreal cx, cy, angle; + } conical; + } m_data; + void *dummy; +}; + +inline void QGradient::setSpread(Spread aspread) +{ m_spread = aspread; } + +class Q_GUI_EXPORT QLinearGradient : public QGradient +{ +public: + QLinearGradient(); + QLinearGradient(const QPointF &start, const QPointF &finalStop); + QLinearGradient(qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop); + + QPointF start() const; + void setStart(const QPointF &start); + inline void setStart(qreal x, qreal y) { setStart(QPointF(x, y)); } + + QPointF finalStop() const; + void setFinalStop(const QPointF &stop); + inline void setFinalStop(qreal x, qreal y) { setFinalStop(QPointF(x, y)); } +}; + + +class Q_GUI_EXPORT QRadialGradient : public QGradient +{ +public: + QRadialGradient(); + QRadialGradient(const QPointF ¢er, qreal radius, const QPointF &focalPoint); + QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy); + + QRadialGradient(const QPointF ¢er, qreal radius); + QRadialGradient(qreal cx, qreal cy, qreal radius); + + QPointF center() const; + void setCenter(const QPointF ¢er); + inline void setCenter(qreal x, qreal y) { setCenter(QPointF(x, y)); } + + QPointF focalPoint() const; + void setFocalPoint(const QPointF &focalPoint); + inline void setFocalPoint(qreal x, qreal y) { setFocalPoint(QPointF(x, y)); } + + qreal radius() const; + void setRadius(qreal radius); +}; + + +class Q_GUI_EXPORT QConicalGradient : public QGradient +{ +public: + QConicalGradient(); + QConicalGradient(const QPointF ¢er, qreal startAngle); + QConicalGradient(qreal cx, qreal cy, qreal startAngle); + + QPointF center() const; + void setCenter(const QPointF ¢er); + inline void setCenter(qreal x, qreal y) { setCenter(QPointF(x, y)); } + + qreal angle() const; + void setAngle(qreal angle); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBRUSH_H diff --git a/qtinterface/qt4/Qt/qbuffer.h b/qtinterface/qt4/Qt/qbuffer.h new file mode 100644 index 0000000..a0dcef5 --- /dev/null +++ b/qtinterface/qt4/Qt/qbuffer.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBUFFER_H +#define QBUFFER_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QObject; +class QBufferPrivate; + +class Q_CORE_EXPORT QBuffer : public QIODevice +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + +public: +#ifndef QT_NO_QOBJECT + explicit QBuffer(QObject *parent = 0); + QBuffer(QByteArray *buf, QObject *parent = 0); +#else + QBuffer(); + explicit QBuffer(QByteArray *buf); +#endif + ~QBuffer(); + + QByteArray &buffer(); + const QByteArray &buffer() const; + void setBuffer(QByteArray *a); + + void setData(const QByteArray &data); + inline void setData(const char *data, int len); + const QByteArray &data() const; + + bool open(OpenMode openMode); + + void close(); + qint64 size() const; + qint64 pos() const; + bool seek(qint64 off); + bool atEnd() const; + bool canReadLine() const; + +protected: +#ifndef QT_NO_QOBJECT + void connectNotify(const char*); + void disconnectNotify(const char*); +#endif + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + +private: + Q_DECLARE_PRIVATE(QBuffer) + Q_DISABLE_COPY(QBuffer) + + Q_PRIVATE_SLOT(d_func(), void _q_emitSignals()) +}; + +inline void QBuffer::setData(const char *adata, int alen) +{ setData(QByteArray(adata, alen)); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBUFFER_H diff --git a/qtinterface/qt4/Qt/qbuttongroup.h b/qtinterface/qt4/Qt/qbuttongroup.h new file mode 100644 index 0000000..bf9cf2b --- /dev/null +++ b/qtinterface/qt4/Qt/qbuttongroup.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBUTTONGROUP_H +#define QBUTTONGROUP_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_BUTTONGROUP + +class QAbstractButton; +class QAbstractButtonPrivate; +class QButtonGroupPrivate; + +class Q_GUI_EXPORT QButtonGroup : public QObject +{ + Q_OBJECT + + Q_PROPERTY(bool exclusive READ exclusive WRITE setExclusive) +public: + explicit QButtonGroup(QObject *parent = 0); + ~QButtonGroup(); + + void setExclusive(bool); + bool exclusive() const; + + void addButton(QAbstractButton *); + void addButton(QAbstractButton *, int id); + void removeButton(QAbstractButton *); + + QList<QAbstractButton*> buttons() const; + + QAbstractButton * checkedButton() const; + // no setter on purpose! + + QAbstractButton *button(int id) const; + void setId(QAbstractButton *button, int id); + int id(QAbstractButton *button) const; + int checkedId() const; + +Q_SIGNALS: + void buttonClicked(QAbstractButton *); + void buttonClicked(int); + void buttonPressed(QAbstractButton *); + void buttonPressed(int); + void buttonReleased(QAbstractButton *); + void buttonReleased(int); + +#ifdef QT3_SUPPORT +public: + inline QT3_SUPPORT void insert(QAbstractButton *b) { addButton(b); } + inline QT3_SUPPORT void remove(QAbstractButton *b) { removeButton(b); } +#endif + +private: + Q_DISABLE_COPY(QButtonGroup) + Q_DECLARE_PRIVATE(QButtonGroup) + friend class QAbstractButton; + friend class QAbstractButtonPrivate; +}; + +#endif // QT_NO_BUTTONGROUP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBUTTONGROUP_H diff --git a/qtinterface/qt4/Qt/qbytearray.h b/qtinterface/qt4/Qt/qbytearray.h new file mode 100644 index 0000000..f7c0cd3 --- /dev/null +++ b/qtinterface/qt4/Qt/qbytearray.h @@ -0,0 +1,596 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBYTEARRAY_H +#define QBYTEARRAY_H + +#include <QtCore/qatomic.h> +#include <QtCore/qnamespace.h> + +#include <string.h> +#include <stdarg.h> + +#ifdef truncate +#error qbytearray.h must be included before any header file that defines truncate +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +/***************************************************************************** + Safe and portable C string functions; extensions to standard string.h + *****************************************************************************/ + +Q_CORE_EXPORT char *qstrdup(const char *); + +inline uint qstrlen(const char *str) +{ return str ? uint(strlen(str)) : 0; } + +inline uint qstrnlen(const char *str, uint maxlen) +{ + uint length = 0; + if (str) { + while (length < maxlen && *str++) + length++; + } + return length; +} + +Q_CORE_EXPORT char *qstrcpy(char *dst, const char *src); +Q_CORE_EXPORT char *qstrncpy(char *dst, const char *src, uint len); + +Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2); +Q_CORE_EXPORT int qstrcmp(const QByteArray &str1, const QByteArray &str2); +Q_CORE_EXPORT int qstrcmp(const QByteArray &str1, const char *str2); +static inline int qstrcmp(const char *str1, const QByteArray &str2) +{ return -qstrcmp(str2, str1); } + +inline int qstrncmp(const char *str1, const char *str2, uint len) +{ + return (str1 && str2) ? strncmp(str1, str2, len) + : (str1 ? 1 : (str2 ? -1 : 0)); +} +Q_CORE_EXPORT int qstricmp(const char *, const char *); +Q_CORE_EXPORT int qstrnicmp(const char *, const char *, uint len); + +// implemented in qvsnprintf.cpp +Q_CORE_EXPORT int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap); +Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt, ...); + +#ifdef QT3_SUPPORT +inline QT3_SUPPORT void *qmemmove(void *dst, const void *src, uint len) +{ return memmove(dst, src, len); } +inline QT3_SUPPORT uint cstrlen(const char *str) +{ return uint(strlen(str)); } +inline QT3_SUPPORT char *cstrcpy(char *dst, const char *src) +{ return qstrcpy(dst,src); } +inline QT3_SUPPORT int cstrcmp(const char *str1, const char *str2) +{ return strcmp(str1,str2); } +inline QT3_SUPPORT int cstrncmp(const char *str1, const char *str2, uint len) +{ return strncmp(str1,str2,len); } +#endif + +// qChecksum: Internet checksum + +Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len); + +class QByteRef; +class QString; +class QDataStream; +template <typename T> class QList; + +class Q_CORE_EXPORT QByteArray +{ +private: + struct Data { + QBasicAtomicInt ref; + int alloc, size; + // ### Qt 5.0: We need to add the missing capacity bit + // (like other tool classes have), to maintain the + // reserved memory on resize. + char *data; + char array[1]; + }; + +public: + inline QByteArray(); + QByteArray(const char *); + QByteArray(const char *, int size); + QByteArray(int size, char c); + QByteArray(int size, Qt::Initialization); + inline QByteArray(const QByteArray &); + inline ~QByteArray(); + + QByteArray &operator=(const QByteArray &); + QByteArray &operator=(const char *str); + + inline int size() const; + bool isEmpty() const; + void resize(int size); + + QByteArray &fill(char c, int size = -1); + + int capacity() const; + void reserve(int size); + void squeeze(); + +#ifndef QT_NO_CAST_FROM_BYTEARRAY + operator const char *() const; + operator const void *() const; +#endif + char *data(); + const char *data() const; + inline const char *constData() const; + inline void detach(); + bool isDetached() const; + void clear(); + +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + const char at(int i) const; + const char operator[](int i) const; + const char operator[](uint i) const; +#else + char at(int i) const; + char operator[](int i) const; + char operator[](uint i) const; +#endif + QByteRef operator[](int i); + QByteRef operator[](uint i); + + int indexOf(char c, int from = 0) const; + int indexOf(const char *c, int from = 0) const; + int indexOf(const QByteArray &a, int from = 0) const; + int lastIndexOf(char c, int from = -1) const; + int lastIndexOf(const char *c, int from = -1) const; + int lastIndexOf(const QByteArray &a, int from = -1) const; + + QBool contains(char c) const; + QBool contains(const char *a) const; + QBool contains(const QByteArray &a) const; + int count(char c) const; + int count(const char *a) const; + int count(const QByteArray &a) const; + + QByteArray left(int len) const; + QByteArray right(int len) const; + QByteArray mid(int index, int len = -1) const; + + bool startsWith(const QByteArray &a) const; + bool startsWith(char c) const; + bool startsWith(const char *c) const; + + bool endsWith(const QByteArray &a) const; + bool endsWith(char c) const; + bool endsWith(const char *c) const; + + void truncate(int pos); + void chop(int n); + + QByteArray toLower() const; + QByteArray toUpper() const; + + QByteArray trimmed() const; + QByteArray simplified() const; + QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const; + QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QByteArray leftJustify(uint width, char aFill = ' ', bool aTruncate = false) const + { return leftJustified(int(width), aFill, aTruncate); } + inline QT3_SUPPORT QByteArray rightJustify(uint width, char aFill = ' ', bool aTruncate = false) const + { return rightJustified(int(width), aFill, aTruncate); } +#endif + + QByteArray &prepend(char c); + QByteArray &prepend(const char *s); + QByteArray &prepend(const char *s, int len); + QByteArray &prepend(const QByteArray &a); + QByteArray &append(char c); + QByteArray &append(const char *s); + QByteArray &append(const char *s, int len); + QByteArray &append(const QByteArray &a); + QByteArray &insert(int i, char c); + QByteArray &insert(int i, const char *s); + QByteArray &insert(int i, const char *s, int len); + QByteArray &insert(int i, const QByteArray &a); + QByteArray &remove(int index, int len); + QByteArray &replace(int index, int len, const char *s); + QByteArray &replace(int index, int len, const QByteArray &s); + QByteArray &replace(char before, const char *after); + QByteArray &replace(char before, const QByteArray &after); + QByteArray &replace(const char *before, const char *after); + QByteArray &replace(const char *before, int bsize, const char *after, int asize); + QByteArray &replace(const QByteArray &before, const QByteArray &after); + QByteArray &replace(const QByteArray &before, const char *after); + QByteArray &replace(const char *before, const QByteArray &after); + QByteArray &replace(char before, char after); + QByteArray &operator+=(char c); + QByteArray &operator+=(const char *s); + QByteArray &operator+=(const QByteArray &a); + + QList<QByteArray> split(char sep) const; + + QByteArray repeated(int times) const; + +#ifndef QT_NO_CAST_TO_ASCII + QT_ASCII_CAST_WARN QByteArray &append(const QString &s); + QT_ASCII_CAST_WARN QByteArray &insert(int i, const QString &s); + QT_ASCII_CAST_WARN QByteArray &replace(const QString &before, const char *after); + QT_ASCII_CAST_WARN QByteArray &replace(char c, const QString &after); + QT_ASCII_CAST_WARN QByteArray &replace(const QString &before, const QByteArray &after); + + QT_ASCII_CAST_WARN QByteArray &operator+=(const QString &s); + QT_ASCII_CAST_WARN int indexOf(const QString &s, int from = 0) const; + QT_ASCII_CAST_WARN int lastIndexOf(const QString &s, int from = -1) const; +#endif +#ifndef QT_NO_CAST_FROM_ASCII + inline QT_ASCII_CAST_WARN bool operator==(const QString &s2) const; + inline QT_ASCII_CAST_WARN bool operator!=(const QString &s2) const; + inline QT_ASCII_CAST_WARN bool operator<(const QString &s2) const; + inline QT_ASCII_CAST_WARN bool operator>(const QString &s2) const; + inline QT_ASCII_CAST_WARN bool operator<=(const QString &s2) const; + inline QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const; +#endif + + short toShort(bool *ok = 0, int base = 10) const; + ushort toUShort(bool *ok = 0, int base = 10) const; + int toInt(bool *ok = 0, int base = 10) const; + uint toUInt(bool *ok = 0, int base = 10) const; + long toLong(bool *ok = 0, int base = 10) const; + ulong toULong(bool *ok = 0, int base = 10) const; + qlonglong toLongLong(bool *ok = 0, int base = 10) const; + qulonglong toULongLong(bool *ok = 0, int base = 10) const; + float toFloat(bool *ok = 0) const; + double toDouble(bool *ok = 0) const; + QByteArray toBase64() const; + QByteArray toHex() const; + QByteArray toPercentEncoding(const QByteArray &exclude = QByteArray(), + const QByteArray &include = QByteArray(), + char percent = '%') const; + + QByteArray &setNum(short, int base = 10); + QByteArray &setNum(ushort, int base = 10); + QByteArray &setNum(int, int base = 10); + QByteArray &setNum(uint, int base = 10); + QByteArray &setNum(qlonglong, int base = 10); + QByteArray &setNum(qulonglong, int base = 10); + QByteArray &setNum(float, char f = 'g', int prec = 6); + QByteArray &setNum(double, char f = 'g', int prec = 6); + + static QByteArray number(int, int base = 10); + static QByteArray number(uint, int base = 10); + static QByteArray number(qlonglong, int base = 10); + static QByteArray number(qulonglong, int base = 10); + static QByteArray number(double, char f = 'g', int prec = 6); + static QByteArray fromRawData(const char *, int size); + static QByteArray fromBase64(const QByteArray &base64); + static QByteArray fromHex(const QByteArray &hexEncoded); + static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%'); + + + typedef char *iterator; + typedef const char *const_iterator; + typedef iterator Iterator; + typedef const_iterator ConstIterator; + iterator begin(); + const_iterator begin() const; + const_iterator constBegin() const; + iterator end(); + const_iterator end() const; + const_iterator constEnd() const; + + // stl compatibility + typedef const char & const_reference; + typedef char & reference; + typedef char value_type; + void push_back(char c); + void push_back(const char *c); + void push_back(const QByteArray &a); + void push_front(char c); + void push_front(const char *c); + void push_front(const QByteArray &a); + + inline int count() const { return d->size; } + int length() const { return d->size; } + bool isNull() const; + + // compatibility +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QByteArray(int size); + inline QT3_SUPPORT QByteArray& duplicate(const QByteArray& a) { *this = a; return *this; } + inline QT3_SUPPORT QByteArray& duplicate(const char *a, uint n) + { *this = QByteArray(a, n); return *this; } + inline QT3_SUPPORT QByteArray& setRawData(const char *a, uint n) + { *this = fromRawData(a, n); return *this; } + inline QT3_SUPPORT void resetRawData(const char *, uint) { clear(); } + inline QT3_SUPPORT QByteArray lower() const { return toLower(); } + inline QT3_SUPPORT QByteArray upper() const { return toUpper(); } + inline QT3_SUPPORT QByteArray stripWhiteSpace() const { return trimmed(); } + inline QT3_SUPPORT QByteArray simplifyWhiteSpace() const { return simplified(); } + inline QT3_SUPPORT int find(char c, int from = 0) const { return indexOf(c, from); } + inline QT3_SUPPORT int find(const char *c, int from = 0) const { return indexOf(c, from); } + inline QT3_SUPPORT int find(const QByteArray &ba, int from = 0) const { return indexOf(ba, from); } + inline QT3_SUPPORT int findRev(char c, int from = -1) const { return lastIndexOf(c, from); } + inline QT3_SUPPORT int findRev(const char *c, int from = -1) const { return lastIndexOf(c, from); } + inline QT3_SUPPORT int findRev(const QByteArray &ba, int from = -1) const { return lastIndexOf(ba, from); } +#ifndef QT_NO_CAST_TO_ASCII + QT3_SUPPORT int find(const QString &s, int from = 0) const; + QT3_SUPPORT int findRev(const QString &s, int from = -1) const; +#endif +#endif + +private: + operator QNoImplicitBoolCast() const; + static Data shared_null; + static Data shared_empty; + Data *d; + QByteArray(Data *dd, int /*dummy*/, int /*dummy*/) : d(dd) {} + void realloc(int alloc); + void expand(int i); + QByteArray nulTerminated() const; + + friend class QByteRef; + friend class QString; + friend Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, int nbytes); +public: + typedef Data * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +inline QByteArray::QByteArray(): d(&shared_null) { d->ref.ref(); } +inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); } +inline int QByteArray::size() const +{ return d->size; } + +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +inline const char QByteArray::at(int i) const +{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } +inline const char QByteArray::operator[](int i) const +{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } +inline const char QByteArray::operator[](uint i) const +{ Q_ASSERT(i < uint(size())); return d->data[i]; } +#else +inline char QByteArray::at(int i) const +{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } +inline char QByteArray::operator[](int i) const +{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } +inline char QByteArray::operator[](uint i) const +{ Q_ASSERT(i < uint(size())); return d->data[i]; } +#endif + +inline bool QByteArray::isEmpty() const +{ return d->size == 0; } +#ifndef QT_NO_CAST_FROM_BYTEARRAY +inline QByteArray::operator const char *() const +{ return d->data; } +inline QByteArray::operator const void *() const +{ return d->data; } +#endif +inline char *QByteArray::data() +{ detach(); return d->data; } +inline const char *QByteArray::data() const +{ return d->data; } +inline const char *QByteArray::constData() const +{ return d->data; } +inline void QByteArray::detach() +{ if (d->ref != 1 || d->data != d->array) realloc(d->size); } +inline bool QByteArray::isDetached() const +{ return d->ref == 1; } +inline QByteArray::QByteArray(const QByteArray &a) : d(a.d) +{ d->ref.ref(); } +#ifdef QT3_SUPPORT +inline QByteArray::QByteArray(int aSize) : d(&shared_null) +{ d->ref.ref(); if (aSize > 0) fill('\0', aSize); } +#endif + +inline int QByteArray::capacity() const +{ return d->alloc; } + +inline void QByteArray::reserve(int asize) +{ if (d->ref != 1 || asize > d->alloc) realloc(asize); } + +inline void QByteArray::squeeze() +{ if (d->size < d->alloc) realloc(d->size); } + +class Q_CORE_EXPORT QByteRef { + QByteArray &a; + int i; + inline QByteRef(QByteArray &array, int idx) + : a(array),i(idx) {} + friend class QByteArray; +public: +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + inline operator const char() const + { return i < a.d->size ? a.d->data[i] : char(0); } +#else + inline operator char() const + { return i < a.d->size ? a.d->data[i] : char(0); } +#endif + inline QByteRef &operator=(char c) + { if (i >= a.d->size) a.expand(i); else a.detach(); + a.d->data[i] = c; return *this; } + inline QByteRef &operator=(const QByteRef &c) + { if (i >= a.d->size) a.expand(i); else a.detach(); + a.d->data[i] = c.a.d->data[c.i]; return *this; } + inline bool operator==(char c) const + { return a.d->data[i] == c; } + inline bool operator!=(char c) const + { return a.d->data[i] != c; } + inline bool operator>(char c) const + { return a.d->data[i] > c; } + inline bool operator>=(char c) const + { return a.d->data[i] >= c; } + inline bool operator<(char c) const + { return a.d->data[i] < c; } + inline bool operator<=(char c) const + { return a.d->data[i] <= c; } +}; + +inline QByteRef QByteArray::operator[](int i) +{ Q_ASSERT(i >= 0); return QByteRef(*this, i); } +inline QByteRef QByteArray::operator[](uint i) +{ return QByteRef(*this, i); } +inline QByteArray::iterator QByteArray::begin() +{ detach(); return d->data; } +inline QByteArray::const_iterator QByteArray::begin() const +{ return d->data; } +inline QByteArray::const_iterator QByteArray::constBegin() const +{ return d->data; } +inline QByteArray::iterator QByteArray::end() +{ detach(); return d->data + d->size; } +inline QByteArray::const_iterator QByteArray::end() const +{ return d->data + d->size; } +inline QByteArray::const_iterator QByteArray::constEnd() const +{ return d->data + d->size; } +inline QByteArray &QByteArray::operator+=(char c) +{ return append(c); } +inline QByteArray &QByteArray::operator+=(const char *s) +{ return append(s); } +inline QByteArray &QByteArray::operator+=(const QByteArray &a) +{ return append(a); } +inline void QByteArray::push_back(char c) +{ append(c); } +inline void QByteArray::push_back(const char *c) +{ append(c); } +inline void QByteArray::push_back(const QByteArray &a) +{ append(a); } +inline void QByteArray::push_front(char c) +{ prepend(c); } +inline void QByteArray::push_front(const char *c) +{ prepend(c); } +inline void QByteArray::push_front(const QByteArray &a) +{ prepend(a); } +inline QBool QByteArray::contains(const QByteArray &a) const +{ return QBool(indexOf(a) != -1); } +inline QBool QByteArray::contains(char c) const +{ return QBool(indexOf(c) != -1); } +inline bool operator==(const QByteArray &a1, const QByteArray &a2) +{ return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); } +inline bool operator==(const QByteArray &a1, const char *a2) +{ return a2 ? qstrcmp(a1,a2) == 0 : a1.isEmpty(); } +inline bool operator==(const char *a1, const QByteArray &a2) +{ return a1 ? qstrcmp(a1,a2) == 0 : a2.isEmpty(); } +inline bool operator!=(const QByteArray &a1, const QByteArray &a2) +{ return !(a1==a2); } +inline bool operator!=(const QByteArray &a1, const char *a2) +{ return a2 ? qstrcmp(a1,a2) != 0 : !a1.isEmpty(); } +inline bool operator!=(const char *a1, const QByteArray &a2) +{ return a1 ? qstrcmp(a1,a2) != 0 : !a2.isEmpty(); } +inline bool operator<(const QByteArray &a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) < 0; } + inline bool operator<(const QByteArray &a1, const char *a2) +{ return qstrcmp(a1, a2) < 0; } +inline bool operator<(const char *a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) < 0; } +inline bool operator<=(const QByteArray &a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) <= 0; } +inline bool operator<=(const QByteArray &a1, const char *a2) +{ return qstrcmp(a1, a2) <= 0; } +inline bool operator<=(const char *a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) <= 0; } +inline bool operator>(const QByteArray &a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) > 0; } +inline bool operator>(const QByteArray &a1, const char *a2) +{ return qstrcmp(a1, a2) > 0; } +inline bool operator>(const char *a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) > 0; } +inline bool operator>=(const QByteArray &a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) >= 0; } +inline bool operator>=(const QByteArray &a1, const char *a2) +{ return qstrcmp(a1, a2) >= 0; } +inline bool operator>=(const char *a1, const QByteArray &a2) +{ return qstrcmp(a1, a2) >= 0; } +inline const QByteArray operator+(const QByteArray &a1, const QByteArray &a2) +{ return QByteArray(a1) += a2; } +inline const QByteArray operator+(const QByteArray &a1, const char *a2) +{ return QByteArray(a1) += a2; } +inline const QByteArray operator+(const QByteArray &a1, char a2) +{ return QByteArray(a1) += a2; } +inline const QByteArray operator+(const char *a1, const QByteArray &a2) +{ return QByteArray(a1) += a2; } +inline const QByteArray operator+(char a1, const QByteArray &a2) +{ return QByteArray(&a1, 1) += a2; } +inline QBool QByteArray::contains(const char *c) const +{ return QBool(indexOf(c) != -1); } +inline QByteArray &QByteArray::replace(char before, const char *c) +{ return replace(&before, 1, c, qstrlen(c)); } +inline QByteArray &QByteArray::replace(const QByteArray &before, const char *c) +{ return replace(before.constData(), before.size(), c, qstrlen(c)); } +inline QByteArray &QByteArray::replace(const char *before, const char *after) +{ return replace(before, qstrlen(before), after, qstrlen(after)); } + +inline QByteArray &QByteArray::setNum(short n, int base) +{ return setNum(qlonglong(n), base); } +inline QByteArray &QByteArray::setNum(ushort n, int base) +{ return setNum(qulonglong(n), base); } +inline QByteArray &QByteArray::setNum(int n, int base) +{ return setNum(qlonglong(n), base); } +inline QByteArray &QByteArray::setNum(uint n, int base) +{ return setNum(qulonglong(n), base); } +inline QByteArray &QByteArray::setNum(float n, char f, int prec) +{ return setNum(double(n),f,prec); } + + +#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QByteArray &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QByteArray &); +#endif + +#ifndef QT_NO_COMPRESS +Q_CORE_EXPORT QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel = -1); +Q_CORE_EXPORT QByteArray qUncompress(const uchar* data, int nbytes); +inline QByteArray qCompress(const QByteArray& data, int compressionLevel = -1) +{ return qCompress(reinterpret_cast<const uchar *>(data.constData()), data.size(), compressionLevel); } +inline QByteArray qUncompress(const QByteArray& data) +{ return qUncompress(reinterpret_cast<const uchar*>(data.constData()), data.size()); } +#endif + +Q_DECLARE_TYPEINFO(QByteArray, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QByteArray) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBYTEARRAY_H diff --git a/qtinterface/qt4/Qt/qbytearraymatcher.h b/qtinterface/qt4/Qt/qbytearraymatcher.h new file mode 100644 index 0000000..690241f --- /dev/null +++ b/qtinterface/qt4/Qt/qbytearraymatcher.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBYTEARRAYMATCHER_H +#define QBYTEARRAYMATCHER_H + +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QByteArrayMatcherPrivate; + +class Q_CORE_EXPORT QByteArrayMatcher +{ +public: + QByteArrayMatcher(); + explicit QByteArrayMatcher(const QByteArray &pattern); + explicit QByteArrayMatcher(const char *pattern, int length); + QByteArrayMatcher(const QByteArrayMatcher &other); + ~QByteArrayMatcher(); + + QByteArrayMatcher &operator=(const QByteArrayMatcher &other); + + void setPattern(const QByteArray &pattern); + + int indexIn(const QByteArray &ba, int from = 0) const; + int indexIn(const char *str, int len, int from = 0) const; + inline QByteArray pattern() const + { + if (q_pattern.isNull()) + return QByteArray(reinterpret_cast<const char*>(p.p), p.l); + return q_pattern; + } + +private: + QByteArrayMatcherPrivate *d; + QByteArray q_pattern; +#ifdef Q_CC_RVCT +// explicitely allow anonymous unions for RVCT to prevent compiler warnings +# pragma push +# pragma anon_unions +#endif + struct Data { + uchar q_skiptable[256]; + const uchar *p; + int l; + }; + union { + uint dummy[256]; + Data p; + }; +#ifdef Q_CC_RVCT +# pragma pop +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QBYTEARRAYMATCHER_H diff --git a/qtinterface/qt4/Qt/qcache.h b/qtinterface/qt4/Qt/qcache.h new file mode 100644 index 0000000..14a955a --- /dev/null +++ b/qtinterface/qt4/Qt/qcache.h @@ -0,0 +1,217 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCACHE_H +#define QCACHE_H + +#include <QtCore/qhash.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class Key, class T> +class QCache +{ + struct Node { + inline Node() : keyPtr(0) {} + inline Node(T *data, int cost) + : keyPtr(0), t(data), c(cost), p(0), n(0) {} + const Key *keyPtr; T *t; int c; Node *p,*n; + }; + Node *f, *l; + QHash<Key, Node> hash; + void *unused; + int mx, total; + + inline void unlink(Node &n) { + if (n.p) n.p->n = n.n; + if (n.n) n.n->p = n.p; + if (l == &n) l = n.p; + if (f == &n) f = n.n; + total -= n.c; + T *obj = n.t; + hash.remove(*n.keyPtr); + delete obj; + } + inline T *relink(const Key &key) { + typename QHash<Key, Node>::iterator i = hash.find(key); + if (typename QHash<Key, Node>::const_iterator(i) == hash.constEnd()) + return 0; + + Node &n = *i; + if (f != &n) { + if (n.p) n.p->n = n.n; + if (n.n) n.n->p = n.p; + if (l == &n) l = n.p; + n.p = 0; + n.n = f; + f->p = &n; + f = &n; + } + return n.t; + } + + Q_DISABLE_COPY(QCache) + +public: + inline explicit QCache(int maxCost = 100); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT_CONSTRUCTOR QCache(int maxCost, int /* dummy */) + : f(0), l(0), mx(maxCost), total(0) {} +#endif + inline ~QCache() { clear(); } + + inline int maxCost() const { return mx; } + void setMaxCost(int m); + inline int totalCost() const { return total; } + + inline int size() const { return hash.size(); } + inline int count() const { return hash.size(); } + inline bool isEmpty() const { return hash.isEmpty(); } + inline QList<Key> keys() const { return hash.keys(); } + + void clear(); + + bool insert(const Key &key, T *object, int cost = 1); + T *object(const Key &key) const; + inline bool contains(const Key &key) const { return hash.contains(key); } + T *operator[](const Key &key) const; + + bool remove(const Key &key); + T *take(const Key &key); + +private: + void trim(int m); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT T *find(const Key &key) const { return object(key); } +#endif + +}; + +template <class Key, class T> +inline QCache<Key, T>::QCache(int amaxCost) + : f(0), l(0), unused(0), mx(amaxCost), total(0) {} + +template <class Key, class T> +inline void QCache<Key,T>::clear() +{ while (f) { delete f->t; f = f->n; } + hash.clear(); l = 0; total = 0; } + +template <class Key, class T> +inline void QCache<Key,T>::setMaxCost(int m) +{ mx = m; trim(mx); } + +template <class Key, class T> +inline T *QCache<Key,T>::object(const Key &key) const +{ return const_cast<QCache<Key,T>*>(this)->relink(key); } + +template <class Key, class T> +inline T *QCache<Key,T>::operator[](const Key &key) const +{ return object(key); } + +template <class Key, class T> +inline bool QCache<Key,T>::remove(const Key &key) +{ + typename QHash<Key, Node>::iterator i = hash.find(key); + if (typename QHash<Key, Node>::const_iterator(i) == hash.constEnd()) { + return false; + } else { + unlink(*i); + return true; + } +} + +template <class Key, class T> +inline T *QCache<Key,T>::take(const Key &key) +{ + typename QHash<Key, Node>::iterator i = hash.find(key); + if (i == hash.end()) + return 0; + + Node &n = *i; + T *t = n.t; + n.t = 0; + unlink(n); + return t; +} + +template <class Key, class T> +bool QCache<Key,T>::insert(const Key &akey, T *aobject, int acost) +{ + remove(akey); + if (acost > mx) { + delete aobject; + return false; + } + trim(mx - acost); + Node sn(aobject, acost); + typename QHash<Key, Node>::iterator i = hash.insert(akey, sn); + total += acost; + Node *n = &i.value(); + n->keyPtr = &i.key(); + if (f) f->p = n; + n->n = f; + f = n; + if (!l) l = f; + return true; +} + +template <class Key, class T> +void QCache<Key,T>::trim(int m) +{ + Node *n = l; + while (n && total > m) { + Node *u = n; + n = n->p; + if (qIsDetached(*u->t)) + unlink(*u); + } +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCACHE_H diff --git a/qtinterface/qt4/Qt/qcalendarwidget.h b/qtinterface/qt4/Qt/qcalendarwidget.h new file mode 100644 index 0000000..bc00977 --- /dev/null +++ b/qtinterface/qt4/Qt/qcalendarwidget.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCALENDARWIDGET_H +#define QCALENDARWIDGET_H + +#include <QtGui/qwidget.h> +#include <QtCore/qdatetime.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_CALENDARWIDGET + +class QDate; +class QTextCharFormat; +class QCalendarWidgetPrivate; + +class Q_GUI_EXPORT QCalendarWidget : public QWidget +{ + Q_OBJECT + Q_ENUMS(Qt::DayOfWeek) + Q_ENUMS(HorizontalHeaderFormat) + Q_ENUMS(VerticalHeaderFormat) + Q_ENUMS(SelectionMode) + Q_PROPERTY(QDate selectedDate READ selectedDate WRITE setSelectedDate) + Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate) + Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate) + Q_PROPERTY(Qt::DayOfWeek firstDayOfWeek READ firstDayOfWeek WRITE setFirstDayOfWeek) + Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible) + Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode) + Q_PROPERTY(HorizontalHeaderFormat horizontalHeaderFormat READ horizontalHeaderFormat WRITE setHorizontalHeaderFormat) + Q_PROPERTY(VerticalHeaderFormat verticalHeaderFormat READ verticalHeaderFormat WRITE setVerticalHeaderFormat) + Q_PROPERTY(bool headerVisible READ isHeaderVisible WRITE setHeaderVisible STORED false DESIGNABLE false) // obsolete + Q_PROPERTY(bool navigationBarVisible READ isNavigationBarVisible WRITE setNavigationBarVisible) + Q_PROPERTY(bool dateEditEnabled READ isDateEditEnabled WRITE setDateEditEnabled) + Q_PROPERTY(int dateEditAcceptDelay READ dateEditAcceptDelay WRITE setDateEditAcceptDelay) + +public: + enum HorizontalHeaderFormat { + NoHorizontalHeader, + SingleLetterDayNames, + ShortDayNames, + LongDayNames + }; + + enum VerticalHeaderFormat { + NoVerticalHeader, + ISOWeekNumbers + }; + + enum SelectionMode { + NoSelection, + SingleSelection + }; + + explicit QCalendarWidget(QWidget *parent = 0); + ~QCalendarWidget(); + + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + + QDate selectedDate() const; + + int yearShown() const; + int monthShown() const; + + QDate minimumDate() const; + void setMinimumDate(const QDate &date); + + QDate maximumDate() const; + void setMaximumDate(const QDate &date); + + Qt::DayOfWeek firstDayOfWeek() const; + void setFirstDayOfWeek(Qt::DayOfWeek dayOfWeek); + + // ### Qt 5: eliminate these two + bool isHeaderVisible() const; + void setHeaderVisible(bool show); + + inline bool isNavigationBarVisible() const { return isHeaderVisible(); } + + bool isGridVisible() const; + + SelectionMode selectionMode() const; + void setSelectionMode(SelectionMode mode); + + HorizontalHeaderFormat horizontalHeaderFormat() const; + void setHorizontalHeaderFormat(HorizontalHeaderFormat format); + + VerticalHeaderFormat verticalHeaderFormat() const; + void setVerticalHeaderFormat(VerticalHeaderFormat format); + + QTextCharFormat headerTextFormat() const; + void setHeaderTextFormat(const QTextCharFormat &format); + + QTextCharFormat weekdayTextFormat(Qt::DayOfWeek dayOfWeek) const; + void setWeekdayTextFormat(Qt::DayOfWeek dayOfWeek, const QTextCharFormat &format); + + QMap<QDate, QTextCharFormat> dateTextFormat() const; + QTextCharFormat dateTextFormat(const QDate &date) const; + void setDateTextFormat(const QDate &date, const QTextCharFormat &format); + + bool isDateEditEnabled() const; + void setDateEditEnabled(bool enable); + + int dateEditAcceptDelay() const; + void setDateEditAcceptDelay(int delay); + +protected: + bool event(QEvent *event); + bool eventFilter(QObject *watched, QEvent *event); + void mousePressEvent(QMouseEvent *event); + void resizeEvent(QResizeEvent * event); + void keyPressEvent(QKeyEvent * event); + + virtual void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const; + void updateCell(const QDate &date); + void updateCells(); + +public Q_SLOTS: + void setSelectedDate(const QDate &date); + void setDateRange(const QDate &min, const QDate &max); + void setCurrentPage(int year, int month); + void setGridVisible(bool show); + void setNavigationBarVisible(bool visible); + void showNextMonth(); + void showPreviousMonth(); + void showNextYear(); + void showPreviousYear(); + void showSelectedDate(); + void showToday(); + +Q_SIGNALS: + void selectionChanged(); + void clicked(const QDate &date); + void activated(const QDate &date); + void currentPageChanged(int year, int month); + +private: + Q_DECLARE_PRIVATE(QCalendarWidget) + Q_DISABLE_COPY(QCalendarWidget) + + Q_PRIVATE_SLOT(d_func(), void _q_slotShowDate(const QDate &date)) + Q_PRIVATE_SLOT(d_func(), void _q_slotChangeDate(const QDate &date)) + Q_PRIVATE_SLOT(d_func(), void _q_slotChangeDate(const QDate &date, bool changeMonth)) + Q_PRIVATE_SLOT(d_func(), void _q_editingFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_prevMonthClicked()) + Q_PRIVATE_SLOT(d_func(), void _q_nextMonthClicked()) + Q_PRIVATE_SLOT(d_func(), void _q_yearEditingFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_yearClicked()) + Q_PRIVATE_SLOT(d_func(), void _q_monthChanged(QAction *act)) + +}; + +#endif // QT_NO_CALENDARWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCALENDARWIDGET_H + diff --git a/qtinterface/qt4/Qt/qcdestyle.h b/qtinterface/qt4/Qt/qcdestyle.h new file mode 100644 index 0000000..feb1391 --- /dev/null +++ b/qtinterface/qt4/Qt/qcdestyle.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QCDESTYLE_H +#define QCDESTYLE_H + +#include <QtGui/qmotifstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_CDE) + +class Q_GUI_EXPORT QCDEStyle : public QMotifStyle +{ + Q_OBJECT +public: + explicit QCDEStyle(bool useHighlightCols = false); + virtual ~QCDEStyle(); + + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, + const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + QPalette standardPalette() const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; +}; + +#endif // QT_NO_STYLE_CDE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCDESTYLE_H diff --git a/qtinterface/qt4/Qt/qchar.h b/qtinterface/qt4/Qt/qchar.h new file mode 100644 index 0000000..6e0794b --- /dev/null +++ b/qtinterface/qt4/Qt/qchar.h @@ -0,0 +1,397 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCHAR_H +#define QCHAR_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QString; + +struct QLatin1Char +{ +public: + inline explicit QLatin1Char(char c) : ch(c) {} +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + inline const char toLatin1() const { return ch; } + inline const ushort unicode() const { return ushort(uchar(ch)); } +#else + inline char toLatin1() const { return ch; } + inline ushort unicode() const { return ushort(uchar(ch)); } +#endif + +private: + char ch; +}; + + +class Q_CORE_EXPORT QChar { +public: + QChar(); +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN_CONSTRUCTOR QChar(char c); + QT_ASCII_CAST_WARN_CONSTRUCTOR QChar(uchar c); +#endif + QChar(QLatin1Char ch); + QChar(uchar c, uchar r); + inline QChar(ushort rc) : ucs(rc){} + QChar(short rc); + QChar(uint rc); + QChar(int rc); + enum SpecialCharacter { + Null = 0x0000, + Nbsp = 0x00a0, + ReplacementCharacter = 0xfffd, + ObjectReplacementCharacter = 0xfffc, + ByteOrderMark = 0xfeff, + ByteOrderSwapped = 0xfffe, +#ifdef QT3_SUPPORT + null = Null, + replacement = ReplacementCharacter, + byteOrderMark = ByteOrderMark, + byteOrderSwapped = ByteOrderSwapped, + nbsp = Nbsp, +#endif + ParagraphSeparator = 0x2029, + LineSeparator = 0x2028 + }; + QChar(SpecialCharacter sc); + + // Unicode information + + enum Category + { + NoCategory, + + Mark_NonSpacing, // Mn + Mark_SpacingCombining, // Mc + Mark_Enclosing, // Me + + Number_DecimalDigit, // Nd + Number_Letter, // Nl + Number_Other, // No + + Separator_Space, // Zs + Separator_Line, // Zl + Separator_Paragraph, // Zp + + Other_Control, // Cc + Other_Format, // Cf + Other_Surrogate, // Cs + Other_PrivateUse, // Co + Other_NotAssigned, // Cn + + Letter_Uppercase, // Lu + Letter_Lowercase, // Ll + Letter_Titlecase, // Lt + Letter_Modifier, // Lm + Letter_Other, // Lo + + Punctuation_Connector, // Pc + Punctuation_Dash, // Pd + Punctuation_Open, // Ps + Punctuation_Close, // Pe + Punctuation_InitialQuote, // Pi + Punctuation_FinalQuote, // Pf + Punctuation_Other, // Po + + Symbol_Math, // Sm + Symbol_Currency, // Sc + Symbol_Modifier, // Sk + Symbol_Other, // So + + Punctuation_Dask = Punctuation_Dash // oops + }; + + enum Direction + { + DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON, + DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN + }; + + enum Decomposition + { + NoDecomposition, + Canonical, + Font, + NoBreak, + Initial, + Medial, + Final, + Isolated, + Circle, + Super, + Sub, + Vertical, + Wide, + Narrow, + Small, + Square, + Compat, + Fraction + +#ifdef QT3_SUPPORT + , Single = NoDecomposition +#endif + }; + + enum Joining + { + OtherJoining, Dual, Right, Center + }; + + enum CombiningClass + { + Combining_BelowLeftAttached = 200, + Combining_BelowAttached = 202, + Combining_BelowRightAttached = 204, + Combining_LeftAttached = 208, + Combining_RightAttached = 210, + Combining_AboveLeftAttached = 212, + Combining_AboveAttached = 214, + Combining_AboveRightAttached = 216, + + Combining_BelowLeft = 218, + Combining_Below = 220, + Combining_BelowRight = 222, + Combining_Left = 224, + Combining_Right = 226, + Combining_AboveLeft = 228, + Combining_Above = 230, + Combining_AboveRight = 232, + + Combining_DoubleBelow = 233, + Combining_DoubleAbove = 234, + Combining_IotaSubscript = 240 + }; + + enum UnicodeVersion { + Unicode_Unassigned, + Unicode_1_1, + Unicode_2_0, + Unicode_2_1_2, + Unicode_3_0, + Unicode_3_1, + Unicode_3_2, + Unicode_4_0, + Unicode_4_1, + Unicode_5_0 + }; + // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO + + Category category() const; + Direction direction() const; + Joining joining() const; + bool hasMirrored() const; + unsigned char combiningClass() const; + + QChar mirroredChar() const; + QString decomposition() const; + Decomposition decompositionTag() const; + + int digitValue() const; + QChar toLower() const; + QChar toUpper() const; + QChar toTitleCase() const; + QChar toCaseFolded() const; + + UnicodeVersion unicodeVersion() const; + +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + const char toAscii() const; + inline const char toLatin1() const; + inline const ushort unicode() const { return ucs; } +#else + char toAscii() const; + inline char toLatin1() const; + inline ushort unicode() const { return ucs; } +#endif +#ifdef Q_NO_PACKED_REFERENCE + inline ushort &unicode() { return const_cast<ushort&>(ucs); } +#else + inline ushort &unicode() { return ucs; } +#endif + + static QChar fromAscii(char c); + static QChar fromLatin1(char c); + + inline bool isNull() const { return ucs == 0; } + bool isPrint() const; + bool isPunct() const; + bool isSpace() const; + bool isMark() const; + bool isLetter() const; + bool isNumber() const; + bool isLetterOrNumber() const; + bool isDigit() const; + bool isSymbol() const; + inline bool isLower() const { return category() == Letter_Lowercase; } + inline bool isUpper() const { return category() == Letter_Uppercase; } + inline bool isTitleCase() const { return category() == Letter_Titlecase; } + + inline bool isHighSurrogate() const { + return ((ucs & 0xfc00) == 0xd800); + } + inline bool isLowSurrogate() const { + return ((ucs & 0xfc00) == 0xdc00); + } + + inline uchar cell() const { return uchar(ucs & 0xff); } + inline uchar row() const { return uchar((ucs>>8)&0xff); } + inline void setCell(uchar cell); + inline void setRow(uchar row); + + static inline uint surrogateToUcs4(ushort high, ushort low) { + return (uint(high)<<10) + low - 0x35fdc00; + } + static inline uint surrogateToUcs4(QChar high, QChar low) { + return (uint(high.ucs)<<10) + low.ucs - 0x35fdc00; + } + static inline ushort highSurrogate(uint ucs4) { + return ushort((ucs4>>10) + 0xd7c0); + } + static inline ushort lowSurrogate(uint ucs4) { + return ushort(ucs4%0x400 + 0xdc00); + } + + static Category QT_FASTCALL category(uint ucs4); + static Category QT_FASTCALL category(ushort ucs2); + static Direction QT_FASTCALL direction(uint ucs4); + static Direction QT_FASTCALL direction(ushort ucs2); + static Joining QT_FASTCALL joining(uint ucs4); + static Joining QT_FASTCALL joining(ushort ucs2); + static unsigned char QT_FASTCALL combiningClass(uint ucs4); + static unsigned char QT_FASTCALL combiningClass(ushort ucs2); + + static uint QT_FASTCALL mirroredChar(uint ucs4); + static ushort QT_FASTCALL mirroredChar(ushort ucs2); + static Decomposition QT_FASTCALL decompositionTag(uint ucs4); + + static int QT_FASTCALL digitValue(uint ucs4); + static int QT_FASTCALL digitValue(ushort ucs2); + static uint QT_FASTCALL toLower(uint ucs4); + static ushort QT_FASTCALL toLower(ushort ucs2); + static uint QT_FASTCALL toUpper(uint ucs4); + static ushort QT_FASTCALL toUpper(ushort ucs2); + static uint QT_FASTCALL toTitleCase(uint ucs4); + static ushort QT_FASTCALL toTitleCase(ushort ucs2); + static uint QT_FASTCALL toCaseFolded(uint ucs4); + static ushort QT_FASTCALL toCaseFolded(ushort ucs2); + + static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4); + static UnicodeVersion QT_FASTCALL unicodeVersion(ushort ucs2); + + static QString QT_FASTCALL decomposition(uint ucs4); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool mirrored() const { return hasMirrored(); } + inline QT3_SUPPORT QChar lower() const { return toLower(); } + inline QT3_SUPPORT QChar upper() const { return toUpper(); } + static inline QT3_SUPPORT bool networkOrdered() { + return QSysInfo::ByteOrder == QSysInfo::BigEndian; + } +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + inline QT3_SUPPORT const char latin1() const { return toLatin1(); } + inline QT3_SUPPORT const char ascii() const { return toAscii(); } +#else + inline QT3_SUPPORT char latin1() const { return toLatin1(); } + inline QT3_SUPPORT char ascii() const { return toAscii(); } +#endif +#endif + +private: +#ifdef QT_NO_CAST_FROM_ASCII + QChar(char c); + QChar(uchar c); +#endif + ushort ucs; +} +#if (defined(__arm__) || defined(__ARMEL__)) + Q_PACKED +#endif + ; + +Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE); + +inline QChar::QChar() : ucs(0) {} + +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +inline const char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); } +#else +inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); } +#endif +inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); } + +inline QChar::QChar(uchar c, uchar r) : ucs(ushort((r << 8) | c)){} +inline QChar::QChar(short rc) : ucs(ushort(rc)){} +inline QChar::QChar(uint rc) : ucs(ushort(rc & 0xffff)){} +inline QChar::QChar(int rc) : ucs(ushort(rc & 0xffff)){} +inline QChar::QChar(SpecialCharacter s) : ucs(ushort(s)) {} +inline QChar::QChar(QLatin1Char ch) : ucs(ch.unicode()) {} + +inline void QChar::setCell(uchar acell) +{ ucs = ushort((ucs & 0xff00) + acell); } +inline void QChar::setRow(uchar arow) +{ ucs = ushort((ushort(arow)<<8) + (ucs&0xff)); } + +inline bool operator==(QChar c1, QChar c2) { return c1.unicode() == c2.unicode(); } +inline bool operator!=(QChar c1, QChar c2) { return c1.unicode() != c2.unicode(); } +inline bool operator<=(QChar c1, QChar c2) { return c1.unicode() <= c2.unicode(); } +inline bool operator>=(QChar c1, QChar c2) { return c1.unicode() >= c2.unicode(); } +inline bool operator<(QChar c1, QChar c2) { return c1.unicode() < c2.unicode(); } +inline bool operator>(QChar c1, QChar c2) { return c1.unicode() > c2.unicode(); } + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QChar &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QChar &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCHAR_H diff --git a/qtinterface/qt4/Qt/qcheckbox.h b/qtinterface/qt4/Qt/qcheckbox.h new file mode 100644 index 0000000..696c759 --- /dev/null +++ b/qtinterface/qt4/Qt/qcheckbox.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCHECKBOX_H +#define QCHECKBOX_H + +#include <QtGui/qabstractbutton.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QCheckBoxPrivate; +class QStyleOptionButton; + +class Q_GUI_EXPORT QCheckBox : public QAbstractButton +{ + Q_OBJECT + + Q_PROPERTY(bool tristate READ isTristate WRITE setTristate) + +public: + explicit QCheckBox(QWidget *parent=0); + explicit QCheckBox(const QString &text, QWidget *parent=0); + + + QSize sizeHint() const; + + void setTristate(bool y = true); + bool isTristate() const; + + Qt::CheckState checkState() const; + void setCheckState(Qt::CheckState state); + +Q_SIGNALS: + void stateChanged(int); + +protected: + bool event(QEvent *e); + bool hitButton(const QPoint &pos) const; + void checkStateSet(); + void nextCheckState(); + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent *); + void initStyleOption(QStyleOptionButton *option) const; + +#ifdef QT3_SUPPORT +public: + enum ToggleState { + Off = Qt::Unchecked, + NoChange = Qt::PartiallyChecked, + On = Qt::Checked + }; + inline QT3_SUPPORT ToggleState state() const + { return static_cast<QCheckBox::ToggleState>(static_cast<int>(checkState())); } + inline QT3_SUPPORT void setState(ToggleState state) + { setCheckState(static_cast<Qt::CheckState>(static_cast<int>(state))); } + inline QT3_SUPPORT void setNoChange() + { setCheckState(Qt::PartiallyChecked); } + QT3_SUPPORT_CONSTRUCTOR QCheckBox(QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QCheckBox(const QString &text, QWidget *parent, const char* name); +#endif + +private: + Q_DECLARE_PRIVATE(QCheckBox) + Q_DISABLE_COPY(QCheckBox) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCHECKBOX_H diff --git a/qtinterface/qt4/Qt/qcleanlooksstyle.h b/qtinterface/qt4/Qt/qcleanlooksstyle.h new file mode 100644 index 0000000..86d8eeb --- /dev/null +++ b/qtinterface/qt4/Qt/qcleanlooksstyle.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCLEANLOOKSSTYLE_H +#define QCLEANLOOKSSTYLE_H + +#include <QtGui/qwindowsstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_CLEANLOOKS) + +class QCleanlooksStylePrivate; +class Q_GUI_EXPORT QCleanlooksStyle : public QWindowsStyle +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QCleanlooksStyle) + +public: + QCleanlooksStyle(); + ~QCleanlooksStyle(); + + QPalette standardPalette () const; + void drawPrimitive(PrimitiveElement elem, + const QStyleOption *option, + QPainter *painter, const QWidget *widget = 0) const; + void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter, + const QWidget *widget) const; + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, + QPainter *painter, const QWidget *widget) const; + QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, + const QPoint &pt, const QWidget *w = 0) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget) const; + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, + const QStyleOption *opt) const; + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + void drawItemPixmap(QPainter *painter, const QRect &rect, + int alignment, const QPixmap &pixmap) const; + void drawItemText(QPainter *painter, const QRect &rect, + int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + void polish(QWidget *widget); + void polish(QApplication *app); + void polish(QPalette &pal); + void unpolish(QWidget *widget); + void unpolish(QApplication *app); + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; + +protected: + QCleanlooksStyle(QCleanlooksStylePrivate &dd); + +}; + +#endif // QT_NO_STYLE_CLEANLOOKS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCLEANLOOKSSTYLE_H diff --git a/qtinterface/qt4/Qt/qclipboard.h b/qtinterface/qt4/Qt/qclipboard.h new file mode 100644 index 0000000..ceed32a --- /dev/null +++ b/qtinterface/qt4/Qt/qclipboard.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCLIPBOARD_H +#define QCLIPBOARD_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_CLIPBOARD + +class QMimeSource; +class QMimeData; +class QImage; +class QPixmap; + +class QClipboardPrivate; + +class Q_GUI_EXPORT QClipboard : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QClipboard) +private: + QClipboard(QObject *parent); + ~QClipboard(); + +public: + enum Mode { Clipboard, Selection, FindBuffer, LastMode = FindBuffer }; + + void clear(Mode mode = Clipboard); + + bool supportsSelection() const; + bool supportsFindBuffer() const; + + bool ownsSelection() const; + bool ownsClipboard() const; + bool ownsFindBuffer() const; + + QString text(Mode mode = Clipboard) const; + QString text(QString& subtype, Mode mode = Clipboard) const; + void setText(const QString &, Mode mode = Clipboard); + +#ifdef QT3_SUPPORT + QT3_SUPPORT QMimeSource *data(Mode mode = Clipboard) const; + QT3_SUPPORT void setData(QMimeSource*, Mode mode = Clipboard); +#endif + const QMimeData *mimeData(Mode mode = Clipboard ) const; + void setMimeData(QMimeData *data, Mode mode = Clipboard); + + QImage image(Mode mode = Clipboard) const; + QPixmap pixmap(Mode mode = Clipboard) const; + void setImage(const QImage &, Mode mode = Clipboard); + void setPixmap(const QPixmap &, Mode mode = Clipboard); + +Q_SIGNALS: + void changed(QClipboard::Mode mode); + void selectionChanged(); + void findBufferChanged(); + void dataChanged(); +private Q_SLOTS: + void ownerDestroyed(); + +protected: + void connectNotify(const char *); + bool event(QEvent *); + + friend class QApplication; + friend class QApplicationPrivate; + friend class QBaseApplication; + friend class QDragManager; + friend class QMimeSource; + +private: + Q_DISABLE_COPY(QClipboard) + + bool supportsMode(Mode mode) const; + bool ownsMode(Mode mode) const; + void emitChanged(Mode mode); +}; + +#endif // QT_NO_CLIPBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCLIPBOARD_H diff --git a/qtinterface/qt4/Qt/qcolor.h b/qtinterface/qt4/Qt/qcolor.h new file mode 100644 index 0000000..ecffb94 --- /dev/null +++ b/qtinterface/qt4/Qt/qcolor.h @@ -0,0 +1,305 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOLOR_H +#define QCOLOR_H + +#include <QtGui/qrgb.h> +#include <QtCore/qnamespace.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QColor; +class QColormap; +class QVariant; + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QColor &); +#endif +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QColor &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &); +#endif + +class Q_GUI_EXPORT QColor +{ +public: + enum Spec { Invalid, Rgb, Hsv, Cmyk, Hsl }; + + QColor(); + QColor(Qt::GlobalColor color); + QColor(int r, int g, int b, int a = 255); + QColor(QRgb rgb); + QColor(const QString& name); + QColor(const char *name); + QColor(const QColor &color); + QColor(Spec spec); + + bool isValid() const; + + QString name() const; + void setNamedColor(const QString& name); + + static QStringList colorNames(); + + inline Spec spec() const + { return cspec; } + + int alpha() const; + void setAlpha(int alpha); + + qreal alphaF() const; + void setAlphaF(qreal alpha); + + int red() const; + int green() const; + int blue() const; + void setRed(int red); + void setGreen(int green); + void setBlue(int blue); + + qreal redF() const; + qreal greenF() const; + qreal blueF() const; + void setRedF(qreal red); + void setGreenF(qreal green); + void setBlueF(qreal blue); + + void getRgb(int *r, int *g, int *b, int *a = 0) const; + void setRgb(int r, int g, int b, int a = 255); + + void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = 0) const; + void setRgbF(qreal r, qreal g, qreal b, qreal a = 1.0); + + QRgb rgba() const; + void setRgba(QRgb rgba); + + QRgb rgb() const; + void setRgb(QRgb rgb); + + int hue() const; // 0 <= hue < 360 + int saturation() const; + int hsvHue() const; // 0 <= hue < 360 + int hsvSaturation() const; + int value() const; + + qreal hueF() const; // 0.0 <= hueF < 360.0 + qreal saturationF() const; + qreal hsvHueF() const; // 0.0 <= hueF < 360.0 + qreal hsvSaturationF() const; + qreal valueF() const; + + void getHsv(int *h, int *s, int *v, int *a = 0) const; + void setHsv(int h, int s, int v, int a = 255); + + void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = 0) const; + void setHsvF(qreal h, qreal s, qreal v, qreal a = 1.0); + + int cyan() const; + int magenta() const; + int yellow() const; + int black() const; + + qreal cyanF() const; + qreal magentaF() const; + qreal yellowF() const; + qreal blackF() const; + + void getCmyk(int *c, int *m, int *y, int *k, int *a = 0); + void setCmyk(int c, int m, int y, int k, int a = 255); + + void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = 0); + void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0); + + int hslHue() const; // 0 <= hue < 360 + int hslSaturation() const; + int lightness() const; + + qreal hslHueF() const; // 0.0 <= hueF < 360.0 + qreal hslSaturationF() const; + qreal lightnessF() const; + + void getHsl(int *h, int *s, int *l, int *a = 0) const; + void setHsl(int h, int s, int l, int a = 255); + + void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = 0) const; + void setHslF(qreal h, qreal s, qreal l, qreal a = 1.0); + + QColor toRgb() const; + QColor toHsv() const; + QColor toCmyk() const; + QColor toHsl() const; + + QColor convertTo(Spec colorSpec) const; + + static QColor fromRgb(QRgb rgb); + static QColor fromRgba(QRgb rgba); + + static QColor fromRgb(int r, int g, int b, int a = 255); + static QColor fromRgbF(qreal r, qreal g, qreal b, qreal a = 1.0); + + static QColor fromHsv(int h, int s, int v, int a = 255); + static QColor fromHsvF(qreal h, qreal s, qreal v, qreal a = 1.0); + + static QColor fromCmyk(int c, int m, int y, int k, int a = 255); + static QColor fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0); + + static QColor fromHsl(int h, int s, int l, int a = 255); + static QColor fromHslF(qreal h, qreal s, qreal l, qreal a = 1.0); + + QColor light(int f = 150) const; + QColor lighter(int f = 150) const; + QColor dark(int f = 200) const; + QColor darker(int f = 200) const; + + QColor &operator=(const QColor &); + QColor &operator=(Qt::GlobalColor color); + + bool operator==(const QColor &c) const; + bool operator!=(const QColor &c) const; + + operator QVariant() const; + +#ifdef Q_WS_X11 + static bool allowX11ColorNames(); + static void setAllowX11ColorNames(bool enabled); +#endif + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT_CONSTRUCTOR QColor(int x, int y, int z, Spec colorSpec) + { if (colorSpec == Hsv) setHsv(x, y, z); else setRgb(x, y, z); } + + inline QT3_SUPPORT void rgb(int *r, int *g, int *b) const + { getRgb(r, g, b); } + inline QT3_SUPPORT void hsv(int *h, int *s, int *v) const + { getHsv(h, s, v); } + + inline QT3_SUPPORT void setRgba(int r, int g, int b, int a) + { setRgb(r, g, b, a); } + inline QT3_SUPPORT void getRgba(int *r, int *g, int *b, int *a) const + { getRgb(r, g, b, a); } + + QT3_SUPPORT uint pixel(int screen = -1) const; +#endif + +private: +#ifndef QT3_SUPPORT + // do not allow a spec to be used as an alpha value + QColor(int, int, int, Spec); +#endif + + void invalidate(); + + Spec cspec; + union { + struct { + ushort alpha; + ushort red; + ushort green; + ushort blue; + ushort pad; + } argb; + struct { + ushort alpha; + ushort hue; + ushort saturation; + ushort value; + ushort pad; + } ahsv; + struct { + ushort alpha; + ushort cyan; + ushort magenta; + ushort yellow; + ushort black; + } acmyk; + struct { + ushort alpha; + ushort hue; + ushort saturation; + ushort lightness; + ushort pad; + } ahsl; + ushort array[5]; + } ct; + + friend class QColormap; +#ifndef QT_NO_DATASTREAM + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QColor &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &); +#endif +}; + +inline QColor::QColor() +{ invalidate(); } + +inline QColor::QColor(int r, int g, int b, int a) +{ setRgb(r, g, b, a); } + +inline QColor::QColor(const char *aname) +{ setNamedColor(QLatin1String(aname)); } + +inline QColor::QColor(const QString& aname) +{ setNamedColor(aname); } + +inline QColor::QColor(const QColor &acolor) + : cspec(acolor.cspec) +{ ct.argb = acolor.ct.argb; } + +inline bool QColor::isValid() const +{ return cspec != Invalid; } + +inline QColor QColor::lighter(int f) const +{ return light(f); } + +inline QColor QColor::darker(int f) const +{ return dark(f); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOLOR_H diff --git a/qtinterface/qt4/Qt/qcolordialog.h b/qtinterface/qt4/Qt/qcolordialog.h new file mode 100644 index 0000000..b54cf97 --- /dev/null +++ b/qtinterface/qt4/Qt/qcolordialog.h @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOLORDIALOG_H +#define QCOLORDIALOG_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_COLORDIALOG + +class QColorDialogPrivate; + +class Q_GUI_EXPORT QColorDialog : public QDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QColorDialog) + Q_ENUMS(ColorDialogOption) + Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor + NOTIFY currentColorChanged) + Q_PROPERTY(ColorDialogOptions options READ options WRITE setOptions) + +public: + enum ColorDialogOption { + ShowAlphaChannel = 0x00000001, + NoButtons = 0x00000002, + DontUseNativeDialog = 0x00000004 + }; + + Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) + + explicit QColorDialog(QWidget *parent = 0); + explicit QColorDialog(const QColor &initial, QWidget *parent = 0); + ~QColorDialog(); + + void setCurrentColor(const QColor &color); + QColor currentColor() const; + + QColor selectedColor() const; + + void setOption(ColorDialogOption option, bool on = true); + bool testOption(ColorDialogOption option) const; + void setOptions(ColorDialogOptions options); + ColorDialogOptions options() const; + +#ifdef Q_NO_USING_KEYWORD + void open() { QDialog::open(); } +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + + void setVisible(bool visible); + + // ### Qt 5: merge overloads with title = QString() + static QColor getColor(const QColor &initial, QWidget *parent, const QString &title, + ColorDialogOptions options = 0); + static QColor getColor(const QColor &initial = Qt::white, QWidget *parent = 0); + + // obsolete + static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = 0, QWidget *parent = 0); + + // ### Qt 5: use QColor in signatures + static int customCount(); + static QRgb customColor(int index); + static void setCustomColor(int index, QRgb color); + static void setStandardColor(int index, QRgb color); + +#ifdef QT3_SUPPORT + static QColor getColor(const QColor &init, QWidget *parent, const char *name) + { Q_UNUSED(name); return getColor(init, parent); } + static QRgb getRgba(QRgb rgba, bool *ok, QWidget *parent, const char *name) + { Q_UNUSED(name); return getRgba(rgba, ok, parent); } +#endif + +Q_SIGNALS: + void currentColorChanged(const QColor &color); + void colorSelected(const QColor &color); + +protected: + void changeEvent(QEvent *event); + void done(int result); + +private: + Q_DISABLE_COPY(QColorDialog) + + Q_PRIVATE_SLOT(d_func(), void _q_addCustom()) + Q_PRIVATE_SLOT(d_func(), void _q_newHsv(int h, int s, int v)) + Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb)) + Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int)) +#if defined(Q_WS_MAC) + Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel()) +#endif + + friend class QColorShower; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions) + +#endif // QT_NO_COLORDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOLORDIALOG_H diff --git a/qtinterface/qt4/Qt/qcolormap.h b/qtinterface/qt4/Qt/qcolormap.h new file mode 100644 index 0000000..7dceb11 --- /dev/null +++ b/qtinterface/qt4/Qt/qcolormap.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOLORMAP_H +#define QCOLORMAP_H + +#include <QtCore/qatomic.h> +#include <QtGui/qrgb.h> +#include <QtCore/qvector.h> +#include <QtGui/qwindowdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QColor; +class QColormapPrivate; + +class Q_GUI_EXPORT QColormap +{ +public: + enum Mode { Direct, Indexed, Gray }; + + static void initialize(); + static void cleanup(); + + static QColormap instance(int screen = -1); + + QColormap(const QColormap &colormap); + ~QColormap(); + + QColormap &operator=(const QColormap &colormap); + + Mode mode() const; + + int depth() const; + int size() const; + + uint pixel(const QColor &color) const; + const QColor colorAt(uint pixel) const; + + const QVector<QColor> colormap() const; + +#ifdef Q_WS_WIN + static HPALETTE hPal(); +#endif + +private: + QColormap(); + QColormapPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOLORMAP_H diff --git a/qtinterface/qt4/Qt/qcolumnview.h b/qtinterface/qt4/Qt/qcolumnview.h new file mode 100644 index 0000000..767c166 --- /dev/null +++ b/qtinterface/qt4/Qt/qcolumnview.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOLUMNVIEW_H +#define QCOLUMNVIEW_H + +#include <QtGui/qabstractitemview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_COLUMNVIEW + +class QColumnViewPrivate; + +class Q_GUI_EXPORT QColumnView : public QAbstractItemView { + +Q_OBJECT + Q_PROPERTY(bool resizeGripsVisible READ resizeGripsVisible WRITE setResizeGripsVisible) + +Q_SIGNALS: + void updatePreviewWidget(const QModelIndex &index); + +public: + explicit QColumnView(QWidget *parent = 0); + ~QColumnView(); + + // QAbstractItemView overloads + QModelIndex indexAt(const QPoint &point) const; + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); + QSize sizeHint() const; + QRect visualRect(const QModelIndex &index) const; + void setModel(QAbstractItemModel *model); + void setSelectionModel(QItemSelectionModel * selectionModel); + void setRootIndex(const QModelIndex &index); + void selectAll(); + + // QColumnView functions + void setResizeGripsVisible(bool visible); + bool resizeGripsVisible() const; + + QWidget *previewWidget() const; + void setPreviewWidget(QWidget *widget); + + void setColumnWidths(const QList<int> &list); + QList<int> columnWidths() const; + +protected: + QColumnView(QColumnViewPrivate &dd, QWidget *parent = 0); + + // QAbstractItemView overloads + bool isIndexHidden(const QModelIndex &index) const; + QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + void resizeEvent(QResizeEvent *event); + void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command); + QRegion visualRegionForSelection(const QItemSelection &selection) const; + int horizontalOffset() const; + int verticalOffset() const; + void rowsInserted(const QModelIndex &parent, int start, int end); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + + // QColumnView functions + void scrollContentsBy(int dx, int dy); + virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex); + void initializeColumn(QAbstractItemView *column) const; + +private: + Q_DECLARE_PRIVATE(QColumnView) + Q_DISABLE_COPY(QColumnView) + Q_PRIVATE_SLOT(d_func(), void _q_gripMoved(int)) + Q_PRIVATE_SLOT(d_func(), void _q_changeCurrentColumn()) + Q_PRIVATE_SLOT(d_func(), void _q_clicked(const QModelIndex &)) +}; + +#endif // QT_NO_COLUMNVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOLUMNVIEW_H + diff --git a/qtinterface/qt4/Qt/qcombobox.h b/qtinterface/qt4/Qt/qcombobox.h new file mode 100644 index 0000000..41bc749 --- /dev/null +++ b/qtinterface/qt4/Qt/qcombobox.h @@ -0,0 +1,337 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOMBOBOX_H +#define QCOMBOBOX_H + +#include <QtGui/qwidget.h> +#include <QtGui/qabstractitemdelegate.h> +#include <QtCore/qabstractitemmodel.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) +#ifndef QT_NO_COMBOBOX + +class QAbstractItemView; +class QLineEdit; +class QComboBoxPrivate; +class QCompleter; + +class Q_GUI_EXPORT QComboBox : public QWidget +{ + Q_OBJECT + + Q_ENUMS(InsertPolicy) + Q_ENUMS(SizeAdjustPolicy) + Q_PROPERTY(bool editable READ isEditable WRITE setEditable) + Q_PROPERTY(int count READ count) + Q_PROPERTY(QString currentText READ currentText) + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) + Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems) + Q_PROPERTY(int maxCount READ maxCount WRITE setMaxCount) + Q_PROPERTY(InsertPolicy insertPolicy READ insertPolicy WRITE setInsertPolicy) + Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy READ sizeAdjustPolicy WRITE setSizeAdjustPolicy) + Q_PROPERTY(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + +#ifndef QT_NO_COMPLETER + Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false) + Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false) +#endif // QT_NO_COMPLETER + + Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled) + Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) + Q_PROPERTY(int modelColumn READ modelColumn WRITE setModelColumn) + +public: + explicit QComboBox(QWidget *parent = 0); + ~QComboBox(); + + int maxVisibleItems() const; + void setMaxVisibleItems(int maxItems); + + int count() const; + void setMaxCount(int max); + int maxCount() const; + +#ifndef QT_NO_COMPLETER + bool autoCompletion() const; + void setAutoCompletion(bool enable); + + Qt::CaseSensitivity autoCompletionCaseSensitivity() const; + void setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity); +#endif + + bool duplicatesEnabled() const; + void setDuplicatesEnabled(bool enable); + + void setFrame(bool); + bool hasFrame() const; + + inline int findText(const QString &text, + Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const + { return findData(text, Qt::DisplayRole, flags); } + int findData(const QVariant &data, int role = Qt::UserRole, + Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const; + + enum InsertPolicy { + NoInsert, + InsertAtTop, + InsertAtCurrent, + InsertAtBottom, + InsertAfterCurrent, + InsertBeforeCurrent, + InsertAlphabetically +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , + NoInsertion = NoInsert, + AtTop = InsertAtTop, + AtCurrent = InsertAtCurrent, + AtBottom = InsertAtBottom, + AfterCurrent = InsertAfterCurrent, + BeforeCurrent = InsertBeforeCurrent +#endif + }; +#ifdef QT3_SUPPORT + typedef InsertPolicy Policy; +#endif + + InsertPolicy insertPolicy() const; + void setInsertPolicy(InsertPolicy policy); + + enum SizeAdjustPolicy { + AdjustToContents, + AdjustToContentsOnFirstShow, + AdjustToMinimumContentsLength, // ### Qt 5: remove + AdjustToMinimumContentsLengthWithIcon + }; + + SizeAdjustPolicy sizeAdjustPolicy() const; + void setSizeAdjustPolicy(SizeAdjustPolicy policy); + int minimumContentsLength() const; + void setMinimumContentsLength(int characters); + QSize iconSize() const; + void setIconSize(const QSize &size); + + bool isEditable() const; + void setEditable(bool editable); + void setLineEdit(QLineEdit *edit); + QLineEdit *lineEdit() const; +#ifndef QT_NO_VALIDATOR + void setValidator(const QValidator *v); + const QValidator *validator() const; +#endif + +#ifndef QT_NO_COMPLETER + void setCompleter(QCompleter *c); + QCompleter *completer() const; +#endif + + QAbstractItemDelegate *itemDelegate() const; + void setItemDelegate(QAbstractItemDelegate *delegate); + + QAbstractItemModel *model() const; + void setModel(QAbstractItemModel *model); + + QModelIndex rootModelIndex() const; + void setRootModelIndex(const QModelIndex &index); + + int modelColumn() const; + void setModelColumn(int visibleColumn); + + int currentIndex() const; + + QString currentText() const; + + QString itemText(int index) const; + QIcon itemIcon(int index) const; + QVariant itemData(int index, int role = Qt::UserRole) const; + + inline void addItem(const QString &text, const QVariant &userData = QVariant()); + inline void addItem(const QIcon &icon, const QString &text, + const QVariant &userData = QVariant()); + inline void addItems(const QStringList &texts) + { insertItems(count(), texts); } + + inline void insertItem(int index, const QString &text, const QVariant &userData = QVariant()); + void insertItem(int index, const QIcon &icon, const QString &text, + const QVariant &userData = QVariant()); + void insertItems(int index, const QStringList &texts); + void insertSeparator(int index); + + void removeItem(int index); + + void setItemText(int index, const QString &text); + void setItemIcon(int index, const QIcon &icon); + void setItemData(int index, const QVariant &value, int role = Qt::UserRole); + + QAbstractItemView *view() const; + void setView(QAbstractItemView *itemView); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + virtual void showPopup(); + virtual void hidePopup(); + + bool event(QEvent *event); + +public Q_SLOTS: + void clear(); + void clearEditText(); + void setEditText(const QString &text); + void setCurrentIndex(int index); + +Q_SIGNALS: + void editTextChanged(const QString &); + void activated(int index); + void activated(const QString &); + void highlighted(int index); + void highlighted(const QString &); + void currentIndexChanged(int index); + void currentIndexChanged(const QString &); + +protected: + void focusInEvent(QFocusEvent *e); + void focusOutEvent(QFocusEvent *e); + void changeEvent(QEvent *e); + void resizeEvent(QResizeEvent *e); + void paintEvent(QPaintEvent *e); + void showEvent(QShowEvent *e); + void hideEvent(QHideEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void keyPressEvent(QKeyEvent *e); + void keyReleaseEvent(QKeyEvent *e); + void wheelEvent(QWheelEvent *e); + void contextMenuEvent(QContextMenuEvent *e); + void inputMethodEvent(QInputMethodEvent *); + QVariant inputMethodQuery(Qt::InputMethodQuery) const; + void initStyleOption(QStyleOptionComboBox *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QComboBox(QWidget *parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QComboBox(bool rw, QWidget *parent, const char *name = 0); + inline QT3_SUPPORT int currentItem() const { return currentIndex(); } + inline QT3_SUPPORT void setCurrentItem(int index) { setCurrentIndex(index); } + inline QT3_SUPPORT InsertPolicy insertionPolicy() const { return insertPolicy(); } + inline QT3_SUPPORT void setInsertionPolicy(InsertPolicy policy) { setInsertPolicy(policy); } + inline QT3_SUPPORT bool editable() const { return isEditable(); } + inline QT3_SUPPORT void popup() { showPopup(); } + inline QT3_SUPPORT void setCurrentText(const QString& text) { + int i = findText(text); + if (i != -1) + setCurrentIndex(i); + else if (isEditable()) + setEditText(text); + else + setItemText(currentIndex(), text); + } + inline QT3_SUPPORT QString text(int index) const { return itemText(index); } + + inline QT3_SUPPORT QPixmap pixmap(int index) const + { return itemIcon(index).pixmap(iconSize(), isEnabled() ? QIcon::Normal : QIcon::Disabled); } + inline QT3_SUPPORT void insertStringList(const QStringList &list, int index = -1) + { insertItems((index < 0 ? count() : index), list); } + inline QT3_SUPPORT void insertItem(const QString &text, int index = -1) + { insertItem((index < 0 ? count() : index), text); } + inline QT3_SUPPORT void insertItem(const QPixmap &pix, int index = -1) + { insertItem((index < 0 ? count() : index), QIcon(pix), QString()); } + inline QT3_SUPPORT void insertItem(const QPixmap &pix, const QString &text, int index = -1) + { insertItem((index < 0 ? count() : index), QIcon(pix), text); } + inline QT3_SUPPORT void changeItem(const QString &text, int index) + { setItemText(index, text); } + inline QT3_SUPPORT void changeItem(const QPixmap &pix, int index) + { setItemIcon(index, QIcon(pix)); } + inline QT3_SUPPORT void changeItem(const QPixmap &pix, const QString &text, int index) + { setItemIcon(index, QIcon(pix)); setItemText(index, text); } + inline QT3_SUPPORT void clearValidator() { setValidator(0); } + inline QT3_SUPPORT void clearEdit() { clearEditText(); } + +Q_SIGNALS: + QT_MOC_COMPAT void textChanged(const QString &); +#endif + +protected: + QComboBox(QComboBoxPrivate &, QWidget *); + +private: + Q_DECLARE_PRIVATE(QComboBox) + Q_DISABLE_COPY(QComboBox) + Q_PRIVATE_SLOT(d_func(), void _q_itemSelected(const QModelIndex &item)) + Q_PRIVATE_SLOT(d_func(), void _q_emitHighlighted(const QModelIndex &)) + Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentIndexChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_editingFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_returnPressed()) + Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) + Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &, const QModelIndex &)) + Q_PRIVATE_SLOT(d_func(), void _q_updateIndexBeforeChange()) + Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex & parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex & parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) + Q_PRIVATE_SLOT(d_func(), void _q_modelReset()) +#ifdef QT_KEYPAD_NAVIGATION + Q_PRIVATE_SLOT(d_func(), void _q_completerActivated()) +#endif +}; + +inline void QComboBox::addItem(const QString &atext, const QVariant &auserData) +{ insertItem(count(), atext, auserData); } +inline void QComboBox::addItem(const QIcon &aicon, const QString &atext, + const QVariant &auserData) +{ insertItem(count(), aicon, atext, auserData); } + +inline void QComboBox::insertItem(int aindex, const QString &atext, + const QVariant &auserData) +{ insertItem(aindex, QIcon(), atext, auserData); } + +#endif // QT_NO_COMBOBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOMBOBOX_H diff --git a/qtinterface/qt4/Qt/qcommandlinkbutton.h b/qtinterface/qt4/Qt/qcommandlinkbutton.h new file mode 100644 index 0000000..2be5326 --- /dev/null +++ b/qtinterface/qt4/Qt/qcommandlinkbutton.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOMMANDLINKBUTTON_H +#define QCOMMANDLINKBUTTON_H + +#include <QtGui/qpushbutton.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QCommandLinkButtonPrivate; + +class Q_GUI_EXPORT QCommandLinkButton: public QPushButton +{ + Q_OBJECT + + Q_PROPERTY(QString description READ description WRITE setDescription) + Q_PROPERTY(bool flat READ isFlat WRITE setFlat DESIGNABLE false) + +public: + explicit QCommandLinkButton(QWidget *parent=0); + explicit QCommandLinkButton(const QString &text, QWidget *parent=0); + QCommandLinkButton(const QString &text, const QString &description, QWidget *parent=0); + QString description() const; + void setDescription(const QString &description); + +protected: + QSize sizeHint() const; + int heightForWidth(int) const; + QSize minimumSizeHint() const; + bool event(QEvent *e); + void paintEvent(QPaintEvent *); + +private: + Q_DISABLE_COPY(QCommandLinkButton) + Q_DECLARE_PRIVATE(QCommandLinkButton) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOMMANDLINKBUTTON diff --git a/qtinterface/qt4/Qt/qcommonstyle.h b/qtinterface/qt4/Qt/qcommonstyle.h new file mode 100644 index 0000000..a49abc5 --- /dev/null +++ b/qtinterface/qt4/Qt/qcommonstyle.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOMMONSTYLE_H +#define QCOMMONSTYLE_H + +#include <QtGui/qstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + +class QCommonStylePrivate; + +class Q_GUI_EXPORT QCommonStyle: public QStyle +{ + Q_OBJECT + +public: + QCommonStyle(); + ~QCommonStyle(); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, + const QWidget *w = 0) const; + SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, + const QPoint &pt, const QWidget *w = 0) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, + const QWidget *w = 0) const; + QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, + const QSize &contentsSize, const QWidget *widget = 0) const; + + int pixelMetric(PixelMetric m, const QStyleOption *opt = 0, const QWidget *widget = 0) const; + + int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0, + QStyleHintReturn *shret = 0) const; + + QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; + + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, + const QStyleOption *opt) const; + + void polish(QPalette &); + void polish(QApplication *app); + void polish(QWidget *widget); + void unpolish(QWidget *widget); + void unpolish(QApplication *application); + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; + +protected: + QCommonStyle(QCommonStylePrivate &dd); + +private: + Q_DECLARE_PRIVATE(QCommonStyle) + Q_DISABLE_COPY(QCommonStyle) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOMMONSTYLE_H diff --git a/qtinterface/qt4/Qt/qcompleter.h b/qtinterface/qt4/Qt/qcompleter.h new file mode 100644 index 0000000..e2345d9 --- /dev/null +++ b/qtinterface/qt4/Qt/qcompleter.h @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOMPLETER_H +#define QCOMPLETER_H + +#include <QtCore/qobject.h> +#include <QtCore/qpoint.h> +#include <QtCore/qstring.h> +#include <QtCore/qabstractitemmodel.h> +#include <QtCore/qrect.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_COMPLETER + +class QCompleterPrivate; +class QAbstractItemView; +class QAbstractProxyModel; +class QWidget; + +class Q_GUI_EXPORT QCompleter : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString completionPrefix READ completionPrefix WRITE setCompletionPrefix) + Q_PROPERTY(ModelSorting modelSorting READ modelSorting WRITE setModelSorting) + Q_PROPERTY(CompletionMode completionMode READ completionMode WRITE setCompletionMode) + Q_PROPERTY(int completionColumn READ completionColumn WRITE setCompletionColumn) + Q_PROPERTY(int completionRole READ completionRole WRITE setCompletionRole) + Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems) + Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity) + Q_PROPERTY(bool wrapAround READ wrapAround WRITE setWrapAround) + +public: + enum CompletionMode { + PopupCompletion, + UnfilteredPopupCompletion, + InlineCompletion + }; + + enum ModelSorting { + UnsortedModel = 0, + CaseSensitivelySortedModel, + CaseInsensitivelySortedModel + }; + + QCompleter(QObject *parent = 0); + QCompleter(QAbstractItemModel *model, QObject *parent = 0); +#ifndef QT_NO_STRINGLISTMODEL + QCompleter(const QStringList& completions, QObject *parent = 0); +#endif + ~QCompleter(); + + void setWidget(QWidget *widget); + QWidget *widget() const; + + void setModel(QAbstractItemModel *c); + QAbstractItemModel *model() const; + + void setCompletionMode(CompletionMode mode); + CompletionMode completionMode() const; + + QAbstractItemView *popup() const; + void setPopup(QAbstractItemView *popup); + + void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity); + Qt::CaseSensitivity caseSensitivity() const; + + void setModelSorting(ModelSorting sorting); + ModelSorting modelSorting() const; + + void setCompletionColumn(int column); + int completionColumn() const; + + void setCompletionRole(int role); + int completionRole() const; + + bool wrapAround() const; + + int maxVisibleItems() const; + void setMaxVisibleItems(int maxItems); + + int completionCount() const; + bool setCurrentRow(int row); + int currentRow() const; + + QModelIndex currentIndex() const; + QString currentCompletion() const; + + QAbstractItemModel *completionModel() const; + + QString completionPrefix() const; + +public Q_SLOTS: + void setCompletionPrefix(const QString &prefix); + void complete(const QRect& rect = QRect()); + void setWrapAround(bool wrap); + +public: + virtual QString pathFromIndex(const QModelIndex &index) const; + virtual QStringList splitPath(const QString &path) const; + +protected: + bool eventFilter(QObject *o, QEvent *e); + bool event(QEvent *); + +Q_SIGNALS: + void activated(const QString &text); + void activated(const QModelIndex &index); + void highlighted(const QString &text); + void highlighted(const QModelIndex &index); + +private: + Q_DISABLE_COPY(QCompleter) + Q_DECLARE_PRIVATE(QCompleter) + + Q_PRIVATE_SLOT(d_func(), void _q_complete(QModelIndex)) + Q_PRIVATE_SLOT(d_func(), void _q_completionSelected(const QItemSelection&)) + Q_PRIVATE_SLOT(d_func(), void _q_autoResizePopup()) +}; + +#endif // QT_NO_COMPLETER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOMPLETER_H diff --git a/qtinterface/qt4/Qt/qconfig-dist.h b/qtinterface/qt4/Qt/qconfig-dist.h new file mode 100644 index 0000000..730ef89 --- /dev/null +++ b/qtinterface/qt4/Qt/qconfig-dist.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +/* + Empty leaves all features enabled. See doc/html/emb-features.html for choices. + + Note that disabling some features will produce a libqt that is not + compatible with other libqt builds. Such modifications are only + supported on Qt for Embedded Linux where reducing the library size is + important and where the application suite is often a fixed set. +*/ diff --git a/qtinterface/qt4/Qt/qconfig-large.h b/qtinterface/qt4/Qt/qconfig-large.h new file mode 100644 index 0000000..355d4d0 --- /dev/null +++ b/qtinterface/qt4/Qt/qconfig-large.h @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* Dialogs */ +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_FONTDIALOG +# define QT_NO_FONTDIALOG +#endif +#ifndef QT_NO_INPUTDIALOG +# define QT_NO_INPUTDIALOG +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PROGRESSDIALOG +# define QT_NO_PROGRESSDIALOG +#endif + +/* Fonts */ +#ifndef QT_NO_QWS_QPF +# define QT_NO_QWS_QPF +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMAT_BMP +# define QT_NO_IMAGEFORMAT_BMP +#endif +#ifndef QT_NO_IMAGEFORMAT_PPM +# define QT_NO_IMAGEFORMAT_PPM +#endif + +/* Internationalization */ +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ +#ifndef QT_NO_TABLEVIEW +# define QT_NO_TABLEVIEW +#endif +#ifndef QT_NO_TREEVIEW +# define QT_NO_TREEVIEW +#endif + +/* Kernel */ +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_PROPERTIES +# define QT_NO_PROPERTIES +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif + +/* Networking */ +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif +#ifndef QT_NO_UDPSOCKET +# define QT_NO_UDPSOCKET +#endif +#ifndef QT_NO_URLINFO +# define QT_NO_URLINFO +#endif +#ifndef QT_NO_FTP +# define QT_NO_FTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif + +/* Widgets */ +#ifndef QT_NO_CALENDARWIDGET +# define QT_NO_CALENDARWIDGET +#endif +#ifndef QT_NO_DATETIMEEDIT +# define QT_NO_DATETIMEEDIT +#endif +#ifndef QT_NO_WORKSPACE +# define QT_NO_WORKSPACE +#endif +#ifndef QT_NO_DIAL +# define QT_NO_DIAL +#endif +#ifndef QT_NO_TABLEWIDGET +# define QT_NO_TABLEWIDGET +#endif +#ifndef QT_NO_TREEWIDGET +# define QT_NO_TREEWIDGET +#endif diff --git a/qtinterface/qt4/Qt/qconfig-medium.h b/qtinterface/qt4/Qt/qconfig-medium.h new file mode 100644 index 0000000..3178ef2 --- /dev/null +++ b/qtinterface/qt4/Qt/qconfig-medium.h @@ -0,0 +1,294 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* Dialogs */ +#ifndef QT_NO_COLORDIALOG +# define QT_NO_COLORDIALOG +#endif +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_FONTDIALOG +# define QT_NO_FONTDIALOG +#endif +#ifndef QT_NO_INPUTDIALOG +# define QT_NO_INPUTDIALOG +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PROGRESSDIALOG +# define QT_NO_PROGRESSDIALOG +#endif +#ifndef QT_NO_TABDIALOG +# define QT_NO_TABDIALOG +#endif + +/* Fonts */ +#ifndef QT_NO_QWS_QPF +# define QT_NO_QWS_QPF +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMAT_BMP +# define QT_NO_IMAGEFORMAT_BMP +#endif +#ifndef QT_NO_IMAGEFORMAT_PPM +# define QT_NO_IMAGEFORMAT_PPM +#endif +#ifndef QT_NO_IMAGE_TEXT +# define QT_NO_IMAGE_TEXT +#endif +#ifndef QT_NO_MOVIE +# define QT_NO_MOVIE +#endif + +/* Internationalization */ +#ifndef QT_NO_BIG_CODECS +# define QT_NO_BIG_CODECS +#endif +#ifndef QT_NO_TEXTCODEC +# define QT_NO_TEXTCODEC +#endif +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TEXTCODECPLUGIN +# define QT_NO_TEXTCODECPLUGIN +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ +#ifndef QT_NO_TABLEVIEW +# define QT_NO_TABLEVIEW +#endif +#ifndef QT_NO_TREEVIEW +# define QT_NO_TREEVIEW +#endif + +/* Kernel */ +#ifndef QT_NO_ACTION +# define QT_NO_ACTION +#endif +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_PROPERTIES +# define QT_NO_PROPERTIES +#endif +#ifndef QT_NO_SESSIONMANAGER +# define QT_NO_SESSIONMANAGER +#endif +#ifndef QT_NO_SHORTCUT +# define QT_NO_SHORTCUT +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif +#ifndef QT_NO_WHEELEVENT +# define QT_NO_WHEELEVENT +#endif + +/* Networking */ +#ifndef QT_NO_COP +# define QT_NO_COP +#endif +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif +#ifndef QT_NO_NETWORKPROXY +# define QT_NO_NETWORKPROXY +#endif +#ifndef QT_NO_SOCKS5 +# define QT_NO_SOCKS5 +#endif +#ifndef QT_NO_UDPSOCKET +# define QT_NO_UDPSOCKET +#endif +#ifndef QT_NO_URLINFO +# define QT_NO_URLINFO +#endif +#ifndef QT_NO_FTP +# define QT_NO_FTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWSEMBEDWIDGET +# define QT_NO_QWSEMBEDWIDGET +#endif +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif +#ifndef QT_NO_QWS_PROPERTIES +# define QT_NO_QWS_PROPERTIES +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif + +/* Utilities */ +#ifndef QT_NO_UNDOCOMMAND +# define QT_NO_UNDOCOMMAND +#endif +#ifndef QT_NO_UNDOGROUP +# define QT_NO_UNDOGROUP +#endif +#ifndef QT_NO_UNDOSTACK +# define QT_NO_UNDOSTACK +#endif +#ifndef QT_NO_UNDOVIEW +# define QT_NO_UNDOVIEW +#endif + +/* Widgets */ +#ifndef QT_NO_LCDNUMBER +# define QT_NO_LCDNUMBER +#endif +#ifndef QT_NO_CALENDARWIDGET +# define QT_NO_CALENDARWIDGET +#endif +#ifndef QT_NO_DATETIMEEDIT +# define QT_NO_DATETIMEEDIT +#endif +#ifndef QT_NO_MENU +# define QT_NO_MENU +#endif +#ifndef QT_NO_CONTEXTMENU +# define QT_NO_CONTEXTMENU +#endif +#ifndef QT_NO_MAINWINDOW +# define QT_NO_MAINWINDOW +#endif +#ifndef QT_NO_DOCKWIDGET +# define QT_NO_DOCKWIDGET +#endif +#ifndef QT_NO_TOOLBAR +# define QT_NO_TOOLBAR +#endif +#ifndef QT_NO_MENUBAR +# define QT_NO_MENUBAR +#endif +#ifndef QT_NO_WORKSPACE +# define QT_NO_WORKSPACE +#endif +#ifndef QT_NO_PROGRESSBAR +# define QT_NO_PROGRESSBAR +#endif +#ifndef QT_NO_SIZEGRIP +# define QT_NO_SIZEGRIP +#endif +#ifndef QT_NO_DIAL +# define QT_NO_DIAL +#endif +#ifndef QT_NO_STACKEDWIDGET +# define QT_NO_STACKEDWIDGET +#endif +#ifndef QT_NO_TABWIDGET +# define QT_NO_TABWIDGET +#endif +#ifndef QT_NO_STATUSBAR +# define QT_NO_STATUSBAR +#endif +#ifndef QT_NO_STATUSTIP +# define QT_NO_STATUSTIP +#endif +#ifndef QT_NO_TABLEWIDGET +# define QT_NO_TABLEWIDGET +#endif +#ifndef QT_NO_TOOLBUTTON +# define QT_NO_TOOLBUTTON +#endif +#ifndef QT_NO_TABBAR +# define QT_NO_TABBAR +#endif +#ifndef QT_NO_TOOLBOX +# define QT_NO_TOOLBOX +#endif +#ifndef QT_NO_WHATSTHIS +# define QT_NO_WHATSTHIS +#endif +#ifndef QT_NO_TOOLTIP +# define QT_NO_TOOLTIP +#endif +#ifndef QT_NO_TREEWIDGET +# define QT_NO_TREEWIDGET +#endif + +/* Windows */ +#ifndef QT_NO_WIN_ACTIVEQT +# define QT_NO_WIN_ACTIVEQT +#endif diff --git a/qtinterface/qt4/Qt/qconfig-minimal.h b/qtinterface/qt4/Qt/qconfig-minimal.h new file mode 100644 index 0000000..bb83242 --- /dev/null +++ b/qtinterface/qt4/Qt/qconfig-minimal.h @@ -0,0 +1,597 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* Data structures */ +#ifndef QT_NO_QUUID_STRING +# define QT_NO_QUUID_STRING +#endif +#ifndef QT_NO_STL +# define QT_NO_STL +#endif +#ifndef QT_NO_TEXTDATE +# define QT_NO_TEXTDATE +#endif +#ifndef QT_NO_DATESTRING +# define QT_NO_DATESTRING +#endif + +/* Dialogs */ +#ifndef QT_NO_COLORDIALOG +# define QT_NO_COLORDIALOG +#endif +#ifndef QT_NO_ERRORMESSAGE +# define QT_NO_ERRORMESSAGE +#endif +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_FONTDIALOG +# define QT_NO_FONTDIALOG +#endif +#ifndef QT_NO_INPUTDIALOG +# define QT_NO_INPUTDIALOG +#endif +#ifndef QT_NO_MESSAGEBOX +# define QT_NO_MESSAGEBOX +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PRINTPREVIEWDIALOG +# define QT_NO_PRINTPREVIEWDIALOG +#endif +#ifndef QT_NO_PROGRESSDIALOG +# define QT_NO_PROGRESSDIALOG +#endif +#ifndef QT_NO_TABDIALOG +# define QT_NO_TABDIALOG +#endif +#ifndef QT_NO_WIZARD +# define QT_NO_WIZARD +#endif + +/* File I/O */ +#ifndef QT_NO_DOM +# define QT_NO_DOM +#endif +#ifndef QT_NO_FILESYSTEMWATCHER +# define QT_NO_FILESYSTEMWATCHER +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_PROCESS +# define QT_NO_PROCESS +#endif +#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 +#ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY +#endif + +/* Fonts */ +#ifndef QT_NO_FREETYPE +# define QT_NO_FREETYPE +#endif +#ifndef QT_NO_QWS_QPF2 +# define QT_NO_QWS_QPF2 +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMATPLUGIN +# define QT_NO_IMAGEFORMATPLUGIN +#endif +#ifndef QT_NO_IMAGEFORMAT_BMP +# define QT_NO_IMAGEFORMAT_BMP +#endif +#ifndef QT_NO_IMAGEFORMAT_JPEG +# define QT_NO_IMAGEFORMAT_JPEG +#endif +#ifndef QT_NO_IMAGEFORMAT_PNG +# define QT_NO_IMAGEFORMAT_PNG +#endif +#ifndef QT_NO_IMAGEFORMAT_PPM +# define QT_NO_IMAGEFORMAT_PPM +#endif +#ifndef QT_NO_IMAGEFORMAT_XBM +# define QT_NO_IMAGEFORMAT_XBM +#endif +#ifndef QT_NO_IMAGEFORMAT_XPM +# define QT_NO_IMAGEFORMAT_XPM +#endif +#ifndef QT_NO_IMAGE_HEURISTIC_MASK +# define QT_NO_IMAGE_HEURISTIC_MASK +#endif +#ifndef QT_NO_IMAGE_TEXT +# define QT_NO_IMAGE_TEXT +#endif +#ifndef QT_NO_MOVIE +# define QT_NO_MOVIE +#endif + +/* Internationalization */ +#ifndef QT_NO_BIG_CODECS +# define QT_NO_BIG_CODECS +#endif +#ifndef QT_NO_QWS_INPUTMETHODS +# define QT_NO_QWS_INPUTMETHODS +#endif +#ifndef QT_NO_TEXTCODEC +# define QT_NO_TEXTCODEC +#endif +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TEXTCODECPLUGIN +# define QT_NO_TEXTCODECPLUGIN +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ +#ifndef QT_NO_ITEMVIEWS +# define QT_NO_ITEMVIEWS +#endif +#ifndef QT_NO_DATAWIDGETMAPPER +# define QT_NO_DATAWIDGETMAPPER +#endif +#ifndef QT_NO_DIRMODEL +# define QT_NO_DIRMODEL +#endif +#ifndef QT_NO_LISTVIEW +# define QT_NO_LISTVIEW +#endif +#ifndef QT_NO_COLUMNVIEW +# define QT_NO_COLUMNVIEW +#endif +#ifndef QT_NO_PROXYMODEL +# define QT_NO_PROXYMODEL +#endif +#ifndef QT_NO_SORTFILTERPROXYMODEL +# define QT_NO_SORTFILTERPROXYMODEL +#endif +#ifndef QT_NO_STANDARDITEMMODEL +# define QT_NO_STANDARDITEMMODEL +#endif +#ifndef QT_NO_STRINGLISTMODEL +# define QT_NO_STRINGLISTMODEL +#endif +#ifndef QT_NO_TABLEVIEW +# define QT_NO_TABLEVIEW +#endif +#ifndef QT_NO_TREEVIEW +# define QT_NO_TREEVIEW +#endif + +/* Kernel */ +#ifndef QT_NO_ACTION +# define QT_NO_ACTION +#endif +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_CSSPARSER +# define QT_NO_CSSPARSER +#endif +#ifndef QT_NO_CURSOR +# define QT_NO_CURSOR +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_PROPERTIES +# define QT_NO_PROPERTIES +#endif +#ifndef QT_NO_SESSIONMANAGER +# define QT_NO_SESSIONMANAGER +#endif +#ifndef QT_NO_SHAREDMEMORY +# define QT_NO_SHAREDMEMORY +#endif +#ifndef QT_NO_SHORTCUT +# define QT_NO_SHORTCUT +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif +#ifndef QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_TABLETEVENT +# define QT_NO_TABLETEVENT +#endif +#ifndef QT_NO_TEXTHTMLPARSER +# define QT_NO_TEXTHTMLPARSER +#endif +#ifndef QT_NO_CONCURRENT +# define QT_NO_CONCURRENT +#endif +#ifndef QT_NO_WHEELEVENT +# define QT_NO_WHEELEVENT +#endif +#ifndef QT_NO_XMLSTREAM +# define QT_NO_XMLSTREAM +#endif +#ifndef QT_NO_XMLSTREAMREADER +# define QT_NO_XMLSTREAMREADER +#endif +#ifndef QT_NO_XMLSTREAMWRITER +# define QT_NO_XMLSTREAMWRITER +#endif + +/* Networking */ +#ifndef QT_NO_COP +# define QT_NO_COP +#endif +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif +#ifndef QT_NO_NETWORKPROXY +# define QT_NO_NETWORKPROXY +#endif +#ifndef QT_NO_SOCKS5 +# define QT_NO_SOCKS5 +#endif +#ifndef QT_NO_UDPSOCKET +# define QT_NO_UDPSOCKET +#endif +#ifndef QT_NO_URLINFO +# define QT_NO_URLINFO +#endif +#ifndef QT_NO_FTP +# define QT_NO_FTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_DIRECTPAINTER +# define QT_NO_DIRECTPAINTER +#endif +#ifndef QT_NO_PAINTONSCREEN +# define QT_NO_PAINTONSCREEN +#endif +#ifndef QT_NO_PAINT_DEBUG +# define QT_NO_PAINT_DEBUG +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWSEMBEDWIDGET +# define QT_NO_QWSEMBEDWIDGET +#endif +#ifndef QT_NO_QWS_ALPHA_CURSOR +# define QT_NO_QWS_ALPHA_CURSOR +#endif +#ifndef QT_NO_QWS_CURSOR +# define QT_NO_QWS_CURSOR +#endif +#ifndef QT_NO_QWS_DECORATION_DEFAULT +# define QT_NO_QWS_DECORATION_DEFAULT +#endif +#ifndef QT_NO_QWS_DECORATION_STYLED +# define QT_NO_QWS_DECORATION_STYLED +#endif +#ifndef QT_NO_QWS_DECORATION_WINDOWS +# define QT_NO_QWS_DECORATION_WINDOWS +#endif +#ifndef QT_NO_QWS_MANAGER +# define QT_NO_QWS_MANAGER +#endif +#ifndef QT_NO_QWS_KEYBOARD +# define QT_NO_QWS_KEYBOARD +#endif +#ifndef QT_NO_QWS_MOUSE +# define QT_NO_QWS_MOUSE +#endif +#ifndef QT_NO_QWS_MOUSE_AUTO +# define QT_NO_QWS_MOUSE_AUTO +#endif +#ifndef QT_NO_QWS_MOUSE_MANUAL +# define QT_NO_QWS_MOUSE_MANUAL +#endif +#ifndef QT_NO_QWS_MULTIPROCESS +# define QT_NO_QWS_MULTIPROCESS +#endif +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif +#ifndef QT_NO_SXE +# define QT_NO_SXE +#endif +#ifndef QT_NO_QWS_PROPERTIES +# define QT_NO_QWS_PROPERTIES +#endif +#ifndef QT_NO_QWS_PROXYSCREEN +# define QT_NO_QWS_PROXYSCREEN +#endif +#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +#endif + +/* SVG */ +#ifndef QT_NO_SVG +# define QT_NO_SVG +#endif +#ifndef QT_NO_GRAPHICSSVGITEM +# define QT_NO_GRAPHICSSVGITEM +#endif +#ifndef QT_NO_SVGGENERATOR +# define QT_NO_SVGGENERATOR +#endif +#ifndef QT_NO_SVGRENDERER +# define QT_NO_SVGRENDERER +#endif +#ifndef QT_NO_SVGWIDGET +# define QT_NO_SVGWIDGET +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_CLEANLOOKS +# define QT_NO_STYLE_CLEANLOOKS +#endif +#ifndef QT_NO_STYLE_PLASTIQUE +# define QT_NO_STYLE_PLASTIQUE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif +#ifndef QT_NO_STYLE_WINDOWSCE +# define QT_NO_STYLE_WINDOWSCE +#endif +#ifndef QT_NO_STYLE_WINDOWSMOBILE +# define QT_NO_STYLE_WINDOWSMOBILE +#endif +#ifndef QT_NO_STYLE_WINDOWSVISTA +# define QT_NO_STYLE_WINDOWSVISTA +#endif +#ifndef QT_NO_STYLE_WINDOWSXP +# define QT_NO_STYLE_WINDOWSXP +#endif + +/* Utilities */ +#ifndef QT_NO_ACCESSIBILITY +# define QT_NO_ACCESSIBILITY +#endif +#ifndef QT_NO_COMPLETER +# define QT_NO_COMPLETER +#endif +#ifndef QT_NO_DESKTOPSERVICES +# define QT_NO_DESKTOPSERVICES +#endif +#ifndef QT_NO_SCRIPT +# define QT_NO_SCRIPT +#endif +#ifndef QT_NO_SYSTEMTRAYICON +# define QT_NO_SYSTEMTRAYICON +#endif +#ifndef QT_NO_UNDOCOMMAND +# define QT_NO_UNDOCOMMAND +#endif +#ifndef QT_NO_UNDOGROUP +# define QT_NO_UNDOGROUP +#endif +#ifndef QT_NO_UNDOSTACK +# define QT_NO_UNDOSTACK +#endif +#ifndef QT_NO_UNDOVIEW +# define QT_NO_UNDOVIEW +#endif + +/* Widgets */ +#ifndef QT_NO_GROUPBOX +# define QT_NO_GROUPBOX +#endif +#ifndef QT_NO_BUTTONGROUP +# define QT_NO_BUTTONGROUP +#endif +#ifndef QT_NO_LCDNUMBER +# define QT_NO_LCDNUMBER +#endif +#ifndef QT_NO_LINEEDIT +# define QT_NO_LINEEDIT +#endif +#ifndef QT_NO_COMBOBOX +# define QT_NO_COMBOBOX +#endif +#ifndef QT_NO_FONTCOMBOBOX +# define QT_NO_FONTCOMBOBOX +#endif +#ifndef QT_NO_SPINBOX +# define QT_NO_SPINBOX +#endif +#ifndef QT_NO_CALENDARWIDGET +# define QT_NO_CALENDARWIDGET +#endif +#ifndef QT_NO_DATETIMEEDIT +# define QT_NO_DATETIMEEDIT +#endif +#ifndef QT_NO_LISTWIDGET +# define QT_NO_LISTWIDGET +#endif +#ifndef QT_NO_MENU +# define QT_NO_MENU +#endif +#ifndef QT_NO_CONTEXTMENU +# define QT_NO_CONTEXTMENU +#endif +#ifndef QT_NO_MAINWINDOW +# define QT_NO_MAINWINDOW +#endif +#ifndef QT_NO_DOCKWIDGET +# define QT_NO_DOCKWIDGET +#endif +#ifndef QT_NO_TOOLBAR +# define QT_NO_TOOLBAR +#endif +#ifndef QT_NO_MENUBAR +# define QT_NO_MENUBAR +#endif +#ifndef QT_NO_WORKSPACE +# define QT_NO_WORKSPACE +#endif +#ifndef QT_NO_PROGRESSBAR +# define QT_NO_PROGRESSBAR +#endif +#ifndef QT_NO_RESIZEHANDLER +# define QT_NO_RESIZEHANDLER +#endif +#ifndef QT_NO_RUBBERBAND +# define QT_NO_RUBBERBAND +#endif +#ifndef QT_NO_SPLITTER +# define QT_NO_SPLITTER +#endif +#ifndef QT_NO_SIGNALMAPPER +# define QT_NO_SIGNALMAPPER +#endif +#ifndef QT_NO_SIZEGRIP +# define QT_NO_SIZEGRIP +#endif +#ifndef QT_NO_SLIDER +# define QT_NO_SLIDER +#endif +#ifndef QT_NO_DIAL +# define QT_NO_DIAL +#endif +#ifndef QT_NO_SCROLLBAR +# define QT_NO_SCROLLBAR +#endif +#ifndef QT_NO_SCROLLAREA +# define QT_NO_SCROLLAREA +#endif +#ifndef QT_NO_GRAPHICSVIEW +# define QT_NO_GRAPHICSVIEW +#endif +#ifndef QT_NO_PRINTPREVIEWWIDGET +# define QT_NO_PRINTPREVIEWWIDGET +#endif +#ifndef QT_NO_MDIAREA +# define QT_NO_MDIAREA +#endif +#ifndef QT_NO_TEXTEDIT +# define QT_NO_TEXTEDIT +#endif +#ifndef QT_NO_SYNTAXHIGHLIGHTER +# define QT_NO_SYNTAXHIGHLIGHTER +#endif +#ifndef QT_NO_TEXTBROWSER +# define QT_NO_TEXTBROWSER +#endif +#ifndef QT_NO_SPINWIDGET +# define QT_NO_SPINWIDGET +#endif +#ifndef QT_NO_SPLASHSCREEN +# define QT_NO_SPLASHSCREEN +#endif +#ifndef QT_NO_STACKEDWIDGET +# define QT_NO_STACKEDWIDGET +#endif +#ifndef QT_NO_TABWIDGET +# define QT_NO_TABWIDGET +#endif +#ifndef QT_NO_STATUSBAR +# define QT_NO_STATUSBAR +#endif +#ifndef QT_NO_STATUSTIP +# define QT_NO_STATUSTIP +#endif +#ifndef QT_NO_TABLEWIDGET +# define QT_NO_TABLEWIDGET +#endif +#ifndef QT_NO_TOOLBUTTON +# define QT_NO_TOOLBUTTON +#endif +#ifndef QT_NO_TABBAR +# define QT_NO_TABBAR +#endif +#ifndef QT_NO_TOOLBOX +# define QT_NO_TOOLBOX +#endif +#ifndef QT_NO_WHATSTHIS +# define QT_NO_WHATSTHIS +#endif +#ifndef QT_NO_TOOLTIP +# define QT_NO_TOOLTIP +#endif +#ifndef QT_NO_TREEWIDGET +# define QT_NO_TREEWIDGET +#endif +#ifndef QT_NO_VALIDATOR +# define QT_NO_VALIDATOR +#endif + +/* Windows */ +#ifndef QT_NO_WIN_ACTIVEQT +# define QT_NO_WIN_ACTIVEQT +#endif diff --git a/qtinterface/qt4/Qt/qconfig-small.h b/qtinterface/qt4/Qt/qconfig-small.h new file mode 100644 index 0000000..85f961b --- /dev/null +++ b/qtinterface/qt4/Qt/qconfig-small.h @@ -0,0 +1,332 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* Data structures */ +#ifndef QT_NO_QUUID_STRING +# define QT_NO_QUUID_STRING +#endif +#ifndef QT_NO_STL +# define QT_NO_STL +#endif + +/* Dialogs */ +#ifndef QT_NO_COLORDIALOG +# define QT_NO_COLORDIALOG +#endif +#ifndef QT_NO_ERRORMESSAGE +# define QT_NO_ERRORMESSAGE +#endif +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_FONTDIALOG +# define QT_NO_FONTDIALOG +#endif +#ifndef QT_NO_INPUTDIALOG +# define QT_NO_INPUTDIALOG +#endif +#ifndef QT_NO_MESSAGEBOX +# define QT_NO_MESSAGEBOX +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PROGRESSDIALOG +# define QT_NO_PROGRESSDIALOG +#endif +#ifndef QT_NO_TABDIALOG +# define QT_NO_TABDIALOG +#endif + +/* File I/O */ +#ifndef QT_NO_TEXTSTREAM +# define QT_NO_TEXTSTREAM +#endif +#ifndef QT_NO_SETTINGS +# define QT_NO_SETTINGS +#endif +#ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY +#endif + +/* Fonts */ +#ifndef QT_NO_FREETYPE +# define QT_NO_FREETYPE +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMATPLUGIN +# define QT_NO_IMAGEFORMATPLUGIN +#endif +#ifndef QT_NO_IMAGEFORMAT_BMP +# define QT_NO_IMAGEFORMAT_BMP +#endif +#ifndef QT_NO_IMAGEFORMAT_JPEG +# define QT_NO_IMAGEFORMAT_JPEG +#endif +#ifndef QT_NO_IMAGEFORMAT_PPM +# define QT_NO_IMAGEFORMAT_PPM +#endif +#ifndef QT_NO_IMAGEFORMAT_XBM +# define QT_NO_IMAGEFORMAT_XBM +#endif +#ifndef QT_NO_IMAGEFORMAT_XPM +# define QT_NO_IMAGEFORMAT_XPM +#endif +#ifndef QT_NO_IMAGE_TEXT +# define QT_NO_IMAGE_TEXT +#endif +#ifndef QT_NO_MOVIE +# define QT_NO_MOVIE +#endif + +/* Internationalization */ +#ifndef QT_NO_QWS_INPUTMETHODS +# define QT_NO_QWS_INPUTMETHODS +#endif +#ifndef QT_NO_TEXTCODEC +# define QT_NO_TEXTCODEC +#endif +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TEXTCODECPLUGIN +# define QT_NO_TEXTCODECPLUGIN +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ +#ifndef QT_NO_DIRMODEL +# define QT_NO_DIRMODEL +#endif +#ifndef QT_NO_PROXYMODEL +# define QT_NO_PROXYMODEL +#endif +#ifndef QT_NO_SORTFILTERPROXYMODEL +# define QT_NO_SORTFILTERPROXYMODEL +#endif +#ifndef QT_NO_STRINGLISTMODEL +# define QT_NO_STRINGLISTMODEL +#endif +#ifndef QT_NO_TABLEVIEW +# define QT_NO_TABLEVIEW +#endif +#ifndef QT_NO_TREEVIEW +# define QT_NO_TREEVIEW +#endif + +/* Kernel */ +#ifndef QT_NO_ACTION +# define QT_NO_ACTION +#endif +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_PROPERTIES +# define QT_NO_PROPERTIES +#endif +#ifndef QT_NO_SESSIONMANAGER +# define QT_NO_SESSIONMANAGER +#endif +#ifndef QT_NO_SHORTCUT +# define QT_NO_SHORTCUT +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif +#ifndef QT_NO_WHEELEVENT +# define QT_NO_WHEELEVENT +#endif + +/* Networking */ +#ifndef QT_NO_COP +# define QT_NO_COP +#endif +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif +#ifndef QT_NO_QWS_PROPERTIES +# define QT_NO_QWS_PROPERTIES +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_CLEANLOOKS +# define QT_NO_STYLE_CLEANLOOKS +#endif +#ifndef QT_NO_STYLE_PLASTIQUE +# define QT_NO_STYLE_PLASTIQUE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif +#ifndef QT_NO_STYLE_WINDOWSXP +# define QT_NO_STYLE_WINDOWSXP +#endif + +/* Utilities */ +#ifndef QT_NO_COMPLETER +# define QT_NO_COMPLETER +#endif +#ifndef QT_NO_DESKTOPSERVICES +# define QT_NO_DESKTOPSERVICES +#endif +#ifndef QT_NO_SYSTEMTRAYICON +# define QT_NO_SYSTEMTRAYICON +#endif + +/* Widgets */ +#ifndef QT_NO_LCDNUMBER +# define QT_NO_LCDNUMBER +#endif +#ifndef QT_NO_FONTCOMBOBOX +# define QT_NO_FONTCOMBOBOX +#endif +#ifndef QT_NO_SPINBOX +# define QT_NO_SPINBOX +#endif +#ifndef QT_NO_CALENDARWIDGET +# define QT_NO_CALENDARWIDGET +#endif +#ifndef QT_NO_DATETIMEEDIT +# define QT_NO_DATETIMEEDIT +#endif +#ifndef QT_NO_MENU +# define QT_NO_MENU +#endif +#ifndef QT_NO_CONTEXTMENU +# define QT_NO_CONTEXTMENU +#endif +#ifndef QT_NO_MAINWINDOW +# define QT_NO_MAINWINDOW +#endif +#ifndef QT_NO_DOCKWIDGET +# define QT_NO_DOCKWIDGET +#endif +#ifndef QT_NO_TOOLBAR +# define QT_NO_TOOLBAR +#endif +#ifndef QT_NO_MENUBAR +# define QT_NO_MENUBAR +#endif +#ifndef QT_NO_WORKSPACE +# define QT_NO_WORKSPACE +#endif +#ifndef QT_NO_PROGRESSBAR +# define QT_NO_PROGRESSBAR +#endif +#ifndef QT_NO_SPLITTER +# define QT_NO_SPLITTER +#endif +#ifndef QT_NO_SIZEGRIP +# define QT_NO_SIZEGRIP +#endif +#ifndef QT_NO_STACKEDWIDGET +# define QT_NO_STACKEDWIDGET +#endif +#ifndef QT_NO_TABWIDGET +# define QT_NO_TABWIDGET +#endif +#ifndef QT_NO_STATUSBAR +# define QT_NO_STATUSBAR +#endif +#ifndef QT_NO_TABLEWIDGET +# define QT_NO_TABLEWIDGET +#endif +#ifndef QT_NO_TOOLBUTTON +# define QT_NO_TOOLBUTTON +#endif +#ifndef QT_NO_TABBAR +# define QT_NO_TABBAR +#endif +#ifndef QT_NO_TOOLBOX +# define QT_NO_TOOLBOX +#endif +#ifndef QT_NO_WHATSTHIS +# define QT_NO_WHATSTHIS +#endif +#ifndef QT_NO_TOOLTIP +# define QT_NO_TOOLTIP +#endif +#ifndef QT_NO_TREEWIDGET +# define QT_NO_TREEWIDGET +#endif +#ifndef QT_NO_VALIDATOR +# define QT_NO_VALIDATOR +#endif diff --git a/qtinterface/qt4/Qt/qconfig.h b/qtinterface/qt4/Qt/qconfig.h new file mode 100644 index 0000000..e1d756c --- /dev/null +++ b/qtinterface/qt4/Qt/qconfig.h @@ -0,0 +1,126 @@ +/* Everything */ + +/* Qt Edition */ +#ifndef QT_EDITION +# define QT_EDITION QT_EDITION_OPENSOURCE +#endif + +/* Machine byte-order */ +#define Q_BIG_ENDIAN 4321 +#define Q_LITTLE_ENDIAN 1234 +#define QT_BUILD_KEY "x86_64 linux g++-4 full-config" +#define QT_BUILD_KEY_COMPAT "x86_64 Linux g++-4 full-config" + +#ifdef QT_BOOTSTRAPPED +#define Q_BYTE_ORDER Q_LITTLE_ENDIAN +#else +#define Q_BYTE_ORDER Q_LITTLE_ENDIAN +#endif +/* Machine Architecture */ +#ifndef QT_BOOTSTRAPPED +# define QT_ARCH_X86_64 +#else +# define QT_ARCH_X86_64 +#endif +/* Compile time features */ +#define QT_LARGEFILE_SUPPORT 64 +#define QT_POINTER_SIZE 8 + +#if defined(QT_BUILTIN_GIF_READER) && defined(QT_NO_BUILTIN_GIF_READER) +# undef QT_BUILTIN_GIF_READER +#elif !defined(QT_BUILTIN_GIF_READER) && !defined(QT_NO_BUILTIN_GIF_READER) +# define QT_BUILTIN_GIF_READER 1 +#endif + +#if defined(QT_NO_DECLARATIVE) && defined(QT_DECLARATIVE) +# undef QT_NO_DECLARATIVE +#elif !defined(QT_NO_DECLARATIVE) && !defined(QT_DECLARATIVE) +# define QT_NO_DECLARATIVE +#endif + +#if defined(QT_NO_EGL) && defined(QT_EGL) +# undef QT_NO_EGL +#elif !defined(QT_NO_EGL) && !defined(QT_EGL) +# define QT_NO_EGL +#endif + +#if defined(QT_NO_GSTREAMER) && defined(QT_GSTREAMER) +# undef QT_NO_GSTREAMER +#elif !defined(QT_NO_GSTREAMER) && !defined(QT_GSTREAMER) +# define QT_NO_GSTREAMER +#endif + +#if defined(QT_NO_IMAGEFORMAT_JPEG) && defined(QT_IMAGEFORMAT_JPEG) +# undef QT_NO_IMAGEFORMAT_JPEG +#elif !defined(QT_NO_IMAGEFORMAT_JPEG) && !defined(QT_IMAGEFORMAT_JPEG) +# define QT_NO_IMAGEFORMAT_JPEG +#endif + +#if defined(QT_NO_IMAGEFORMAT_MNG) && defined(QT_IMAGEFORMAT_MNG) +# undef QT_NO_IMAGEFORMAT_MNG +#elif !defined(QT_NO_IMAGEFORMAT_MNG) && !defined(QT_IMAGEFORMAT_MNG) +# define QT_NO_IMAGEFORMAT_MNG +#endif + +#if defined(QT_NO_IMAGEFORMAT_TIFF) && defined(QT_IMAGEFORMAT_TIFF) +# undef QT_NO_IMAGEFORMAT_TIFF +#elif !defined(QT_NO_IMAGEFORMAT_TIFF) && !defined(QT_IMAGEFORMAT_TIFF) +# define QT_NO_IMAGEFORMAT_TIFF +#endif + +#if defined(QT_NO_OPENVG) && defined(QT_OPENVG) +# undef QT_NO_OPENVG +#elif !defined(QT_NO_OPENVG) && !defined(QT_OPENVG) +# define QT_NO_OPENVG +#endif + +#if defined(QT_NO_SXE) && defined(QT_SXE) +# undef QT_NO_SXE +#elif !defined(QT_NO_SXE) && !defined(QT_SXE) +# define QT_NO_SXE +#endif + +#if defined(QT_NO_ZLIB) && defined(QT_ZLIB) +# undef QT_NO_ZLIB +#elif !defined(QT_NO_ZLIB) && !defined(QT_ZLIB) +# define QT_NO_ZLIB +#endif + +#if defined(QT_RUNTIME_XCURSOR) && defined(QT_NO_RUNTIME_XCURSOR) +# undef QT_RUNTIME_XCURSOR +#elif !defined(QT_RUNTIME_XCURSOR) && !defined(QT_NO_RUNTIME_XCURSOR) +# define QT_RUNTIME_XCURSOR +#endif + +#if defined(QT_RUNTIME_XFIXES) && defined(QT_NO_RUNTIME_XFIXES) +# undef QT_RUNTIME_XFIXES +#elif !defined(QT_RUNTIME_XFIXES) && !defined(QT_NO_RUNTIME_XFIXES) +# define QT_RUNTIME_XFIXES +#endif + +#if defined(QT_RUNTIME_XINERAMA) && defined(QT_NO_RUNTIME_XINERAMA) +# undef QT_RUNTIME_XINERAMA +#elif !defined(QT_RUNTIME_XINERAMA) && !defined(QT_NO_RUNTIME_XINERAMA) +# define QT_RUNTIME_XINERAMA +#endif + +#if defined(QT_RUNTIME_XINPUT) && defined(QT_NO_RUNTIME_XINPUT) +# undef QT_RUNTIME_XINPUT +#elif !defined(QT_RUNTIME_XINPUT) && !defined(QT_NO_RUNTIME_XINPUT) +# define QT_RUNTIME_XINPUT +#endif + +#if defined(QT_RUNTIME_XRANDR) && defined(QT_NO_RUNTIME_XRANDR) +# undef QT_RUNTIME_XRANDR +#elif !defined(QT_RUNTIME_XRANDR) && !defined(QT_NO_RUNTIME_XRANDR) +# define QT_RUNTIME_XRANDR +#endif + +#if defined(QT_USE_MATH_H_FLOATS) && defined(QT_NO_USE_MATH_H_FLOATS) +# undef QT_USE_MATH_H_FLOATS +#elif !defined(QT_USE_MATH_H_FLOATS) && !defined(QT_NO_USE_MATH_H_FLOATS) +# define QT_USE_MATH_H_FLOATS +#endif + +#define QT_VISIBILITY_AVAILABLE + diff --git a/qtinterface/qt4/Qt/qcontainerfwd.h b/qtinterface/qt4/Qt/qcontainerfwd.h new file mode 100644 index 0000000..da0bdc4 --- /dev/null +++ b/qtinterface/qt4/Qt/qcontainerfwd.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCONTAINERFWD_H +#define QCONTAINERFWD_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class Key, class T> class QCache; +template <class Key, class T> class QHash; +template <class T> class QLinkedList; +template <class T> class QList; +template <class Key, class T> class QMap; +template <class Key, class T> class QMultiHash; +template <class Key, class T> class QMultiMap; +template <class T1, class T2> struct QPair; +template <class T> class QQueue; +template <class T> class QSet; +template <class T> class QStack; +template<class T, int Prealloc = 256> class QVarLengthArray; +template <class T> class QVector; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCONTAINERFWD_H diff --git a/qtinterface/qt4/Qt/qcontiguouscache.h b/qtinterface/qt4/Qt/qcontiguouscache.h new file mode 100644 index 0000000..5e20f37 --- /dev/null +++ b/qtinterface/qt4/Qt/qcontiguouscache.h @@ -0,0 +1,454 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCONTIGUOUSCACHE_H +#define QCONTIGUOUSCACHE_H + +#include <QtCore/qatomic.h> +#include <limits.h> +#include <new> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#undef QT_QCONTIGUOUSCACHE_DEBUG +QT_MODULE(Core) + + +struct Q_CORE_EXPORT QContiguousCacheData +{ + QBasicAtomicInt ref; + int alloc; + int count; + int start; + int offset; + uint sharable : 1; + uint reserved : 31; + + // total is 24 bytes (HP-UX aCC: 40 bytes) + // the next entry is already aligned to 8 bytes + // there will be an 8 byte gap here if T requires 16-byte alignment + // (such as long double on 64-bit platforms, __int128, __float128) + + static QContiguousCacheData *allocate(int size, int alignment); + static void free(QContiguousCacheData *data); + +#ifdef QT_QCONTIGUOUSCACHE_DEBUG + void dump() const; +#endif +}; + +template <typename T> +struct QContiguousCacheTypedData: private QContiguousCacheData +{ + // private inheritance to avoid aliasing warningss + T array[1]; + + static inline void free(QContiguousCacheTypedData *data) { QContiguousCacheData::free(data); } +}; + +template<typename T> +class QContiguousCache { + typedef QContiguousCacheTypedData<T> Data; + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; }; +public: + // STL compatibility + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef ptrdiff_t difference_type; + typedef int size_type; + + explicit QContiguousCache(int capacity = 0); + QContiguousCache(const QContiguousCache<T> &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } + + inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(p); } + + inline void detach() { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + QContiguousCache<T> &operator=(const QContiguousCache<T> &other); + bool operator==(const QContiguousCache<T> &other) const; + inline bool operator!=(const QContiguousCache<T> &other) const { return !(*this == other); } + + inline int capacity() const {return d->alloc; } + inline int count() const { return d->count; } + inline int size() const { return d->count; } + + inline bool isEmpty() const { return d->count == 0; } + inline bool isFull() const { return d->count == d->alloc; } + inline int available() const { return d->alloc - d->count; } + + void clear(); + void setCapacity(int size); + + const T &at(int pos) const; + T &operator[](int i); + const T &operator[](int i) const; + + void append(const T &value); + void prepend(const T &value); + void insert(int pos, const T &value); + + inline bool containsIndex(int pos) const { return pos >= d->offset && pos - d->offset < d->count; } + inline int firstIndex() const { return d->offset; } + inline int lastIndex() const { return d->offset + d->count - 1; } + + inline const T &first() const { Q_ASSERT(!isEmpty()); return p->array[d->start]; } + inline const T &last() const { Q_ASSERT(!isEmpty()); return p->array[(d->start + d->count -1) % d->alloc]; } + inline T &first() { Q_ASSERT(!isEmpty()); detach(); return p->array[d->start]; } + inline T &last() { Q_ASSERT(!isEmpty()); detach(); return p->array[(d->start + d->count -1) % d->alloc]; } + + void removeFirst(); + T takeFirst(); + void removeLast(); + T takeLast(); + + inline bool areIndexesValid() const + { return d->offset >= 0 && d->offset < INT_MAX - d->count && (d->offset % d->alloc) == d->start; } + + inline void normalizeIndexes() { d->offset = d->start; } + +#ifdef QT_QCONTIGUOUSCACHE_DEBUG + void dump() const { p->dump(); } +#endif +private: + void detach_helper(); + + QContiguousCacheData *malloc(int aalloc); + void free(Data *x); + int sizeOfTypedData() { + // this is more or less the same as sizeof(Data), except that it doesn't + // count the padding at the end + return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this); + } + int alignOfTypedData() const + { +#ifdef Q_ALIGNOF + return qMax<int>(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } +}; + +template <typename T> +void QContiguousCache<T>::detach_helper() +{ + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; + + x.d = malloc(d->alloc); + x.d->ref = 1; + x.d->count = d->count; + x.d->start = d->start; + x.d->offset = d->offset; + x.d->alloc = d->alloc; + x.d->sharable = true; + x.d->reserved = 0; + + T *dest = x.p->array + x.d->start; + T *src = p->array + d->start; + int oldcount = x.d->count; + while (oldcount--) { + if (QTypeInfo<T>::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + dest++; + if (dest == x.p->array + x.d->alloc) + dest = x.p->array; + src++; + if (src == p->array + d->alloc) + src = p->array; + } + + if (!d->ref.deref()) + free(p); + d = x.d; +} + +template <typename T> +void QContiguousCache<T>::setCapacity(int asize) +{ + if (asize == d->alloc) + return; + detach(); + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; + x.d = malloc(asize); + x.d->alloc = asize; + x.d->count = qMin(d->count, asize); + x.d->offset = d->offset + d->count - x.d->count; + x.d->start = x.d->offset % x.d->alloc; + T *dest = x.p->array + (x.d->start + x.d->count-1) % x.d->alloc; + T *src = p->array + (d->start + d->count-1) % d->alloc; + int oldcount = x.d->count; + while (oldcount--) { + if (QTypeInfo<T>::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + if (dest == x.p->array) + dest = x.p->array + x.d->alloc; + dest--; + if (src == p->array) + src = p->array + d->alloc; + src--; + } + /* free old */ + free(p); + d = x.d; +} + +template <typename T> +void QContiguousCache<T>::clear() +{ + if (d->ref == 1) { + if (QTypeInfo<T>::isComplex) { + int oldcount = d->count; + T * i = p->array + d->start; + T * e = p->array + d->alloc; + while (oldcount--) { + i->~T(); + i++; + if (i == e) + i = p->array; + } + } + d->count = d->start = d->offset = 0; + } else { + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; + x.d = malloc(d->alloc); + x.d->ref = 1; + x.d->alloc = d->alloc; + x.d->count = x.d->start = x.d->offset = 0; + x.d->sharable = true; + if (!d->ref.deref()) free(p); + d = x.d; + } +} + +template <typename T> +inline QContiguousCacheData *QContiguousCache<T>::malloc(int aalloc) +{ + return QContiguousCacheData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); +} + +template <typename T> +QContiguousCache<T>::QContiguousCache(int cap) +{ + d = malloc(cap); + d->ref = 1; + d->alloc = cap; + d->count = d->start = d->offset = 0; + d->sharable = true; +} + +template <typename T> +QContiguousCache<T> &QContiguousCache<T>::operator=(const QContiguousCache<T> &other) +{ + other.d->ref.ref(); + if (!d->ref.deref()) + free(d); + d = other.d; + if (!d->sharable) + detach_helper(); + return *this; +} + +template <typename T> +bool QContiguousCache<T>::operator==(const QContiguousCache<T> &other) const +{ + if (other.d == d) + return true; + if (other.d->start != d->start + || other.d->count != d->count + || other.d->offset != d->offset + || other.d->alloc != d->alloc) + return false; + for (int i = firstIndex(); i <= lastIndex(); ++i) + if (!(at(i) == other.at(i))) + return false; + return true; +} + +template <typename T> +void QContiguousCache<T>::free(Data *x) +{ + if (QTypeInfo<T>::isComplex) { + int oldcount = d->count; + T * i = p->array + d->start; + T * e = p->array + d->alloc; + while (oldcount--) { + i->~T(); + i++; + if (i == e) + i = p->array; + } + } + x->free(x); +} +template <typename T> +void QContiguousCache<T>::append(const T &value) +{ + detach(); + if (QTypeInfo<T>::isComplex) { + if (d->count == d->alloc) + (p->array + (d->start+d->count) % d->alloc)->~T(); + new (p->array + (d->start+d->count) % d->alloc) T(value); + } else { + p->array[(d->start+d->count) % d->alloc] = value; + } + + if (d->count == d->alloc) { + d->start++; + d->start %= d->alloc; + d->offset++; + } else { + d->count++; + } +} + +template<typename T> +void QContiguousCache<T>::prepend(const T &value) +{ + detach(); + if (d->start) + d->start--; + else + d->start = d->alloc-1; + d->offset--; + + if (d->count != d->alloc) + d->count++; + else + if (d->count == d->alloc) + (p->array + d->start)->~T(); + + if (QTypeInfo<T>::isComplex) + new (p->array + d->start) T(value); + else + p->array[d->start] = value; +} + +template<typename T> +void QContiguousCache<T>::insert(int pos, const T &value) +{ + Q_ASSERT_X(pos >= 0 && pos < INT_MAX, "QContiguousCache<T>::insert", "index out of range"); + detach(); + if (containsIndex(pos)) { + if(QTypeInfo<T>::isComplex) + new (p->array + pos % d->alloc) T(value); + else + p->array[pos % d->alloc] = value; + } else if (pos == d->offset-1) + prepend(value); + else if (pos == d->offset+d->count) + append(value); + else { + // we don't leave gaps. + clear(); + d->offset = pos; + d->start = pos % d->alloc; + d->count = 1; + if (QTypeInfo<T>::isComplex) + new (p->array + d->start) T(value); + else + p->array[d->start] = value; + } +} + +template <typename T> +inline const T &QContiguousCache<T>::at(int pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache<T>::at", "index out of range"); return p->array[pos % d->alloc]; } +template <typename T> +inline const T &QContiguousCache<T>::operator[](int pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache<T>::at", "index out of range"); return p->array[pos % d->alloc]; } + +template <typename T> +inline T &QContiguousCache<T>::operator[](int pos) +{ + detach(); + if (!containsIndex(pos)) + insert(pos, T()); + return p->array[pos % d->alloc]; +} + +template <typename T> +inline void QContiguousCache<T>::removeFirst() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo<T>::isComplex) + (p->array + d->start)->~T(); + d->start = (d->start + 1) % d->alloc; + d->offset++; +} + +template <typename T> +inline void QContiguousCache<T>::removeLast() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo<T>::isComplex) + (p->array + (d->start + d->count) % d->alloc)->~T(); +} + +template <typename T> +inline T QContiguousCache<T>::takeFirst() +{ T t = first(); removeFirst(); return t; } + +template <typename T> +inline T QContiguousCache<T>::takeLast() +{ T t = last(); removeLast(); return t; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qcopchannel_qws.h b/qtinterface/qt4/Qt/qcopchannel_qws.h new file mode 100644 index 0000000..9b2e092 --- /dev/null +++ b/qtinterface/qt4/Qt/qcopchannel_qws.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOPCHANNEL_QWS_H +#define QCOPCHANNEL_QWS_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_COP + +class QWSClient; +class QCopChannelPrivate; + +class Q_GUI_EXPORT QCopChannel : public QObject +{ + Q_OBJECT +public: + explicit QCopChannel(const QString& channel, QObject *parent=0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QCopChannel(const QString& channel, QObject *parent, const char *name); +#endif + virtual ~QCopChannel(); + + QString channel() const; + + static bool isRegistered(const QString& channel); + static bool send(const QString& channel, const QString& msg); + static bool send(const QString& channel, const QString& msg, + const QByteArray &data); + + static bool flush(); + + static void sendLocally( const QString& ch, const QString& msg, + const QByteArray &data); + static void reregisterAll(); + + virtual void receive(const QString& msg, const QByteArray &data); + +Q_SIGNALS: + void received(const QString& msg, const QByteArray &data); + +private: + void init(const QString& channel); + + // server side + static void registerChannel(const QString& ch, QWSClient *cl); + static void detach(QWSClient *cl); + static void answer(QWSClient *cl, const QString& ch, + const QString& msg, const QByteArray &data); + // client side + QCopChannelPrivate* d; + + friend class QWSServer; + friend class QWSServerPrivate; + friend class QApplication; +}; + +#endif // QT_NO_COP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOPCHANNEL_QWS_H diff --git a/qtinterface/qt4/Qt/qcoreapplication.h b/qtinterface/qt4/Qt/qcoreapplication.h new file mode 100644 index 0000000..e1adece --- /dev/null +++ b/qtinterface/qt4/Qt/qcoreapplication.h @@ -0,0 +1,281 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOREAPPLICATION_H +#define QCOREAPPLICATION_H + +#include <QtCore/qobject.h> +#include <QtCore/qcoreevent.h> +#include <QtCore/qeventloop.h> + +#ifdef QT_INCLUDE_COMPAT +#include <QtCore/qstringlist.h> +#endif + +#if defined(Q_WS_WIN) && !defined(tagMSG) +typedef struct tagMSG MSG; +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QCoreApplicationPrivate; +class QTextCodec; +class QTranslator; +class QPostEventList; +class QStringList; + +#define qApp QCoreApplication::instance() + +class Q_CORE_EXPORT QCoreApplication : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName) + Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion) + Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName) + Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain) + + Q_DECLARE_PRIVATE(QCoreApplication) +public: + QCoreApplication(int &argc, char **argv); + ~QCoreApplication(); + +#ifdef QT_DEPRECATED + QT_DEPRECATED static int argc(); + QT_DEPRECATED static char **argv(); +#endif + static QStringList arguments(); + + static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true); + static bool testAttribute(Qt::ApplicationAttribute attribute); + + static void setOrganizationDomain(const QString &orgDomain); + static QString organizationDomain(); + static void setOrganizationName(const QString &orgName); + static QString organizationName(); + static void setApplicationName(const QString &application); + static QString applicationName(); + static void setApplicationVersion(const QString &version); + static QString applicationVersion(); + + static QCoreApplication *instance() { return self; } + + static int exec(); + static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents); + static void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime); + static void exit(int retcode=0); + + static bool sendEvent(QObject *receiver, QEvent *event); + static void postEvent(QObject *receiver, QEvent *event); + static void postEvent(QObject *receiver, QEvent *event, int priority); + static void sendPostedEvents(QObject *receiver, int event_type); + static void sendPostedEvents(); + static void removePostedEvents(QObject *receiver); + static void removePostedEvents(QObject *receiver, int eventType); + static bool hasPendingEvents(); + + virtual bool notify(QObject *, QEvent *); + + static bool startingUp(); + static bool closingDown(); + + static QString applicationDirPath(); + static QString applicationFilePath(); + static qint64 applicationPid(); + +#ifndef QT_NO_LIBRARY + static void setLibraryPaths(const QStringList &); + static QStringList libraryPaths(); + static void addLibraryPath(const QString &); + static void removeLibraryPath(const QString &); +#endif // QT_NO_LIBRARY + +#ifndef QT_NO_TRANSLATION + static void installTranslator(QTranslator * messageFile); + static void removeTranslator(QTranslator * messageFile); +#endif + enum Encoding { CodecForTr, UnicodeUTF8, DefaultCodec = CodecForTr }; + // ### Qt 5: merge + static QString translate(const char * context, + const char * key, + const char * disambiguation = 0, + Encoding encoding = CodecForTr); + static QString translate(const char * context, + const char * key, + const char * disambiguation, + Encoding encoding, int n); + + static void flush(); + +#if defined(QT3_SUPPORT) + inline QT3_SUPPORT void lock() {} + inline QT3_SUPPORT void unlock(bool = true) {} + inline QT3_SUPPORT bool locked() { return false; } + inline QT3_SUPPORT bool tryLock() { return false; } + + static inline QT3_SUPPORT void processOneEvent() + { processEvents(QEventLoop::WaitForMoreEvents); } + static QT3_SUPPORT int enter_loop(); + static QT3_SUPPORT void exit_loop(); + static QT3_SUPPORT int loopLevel(); +#endif + +#if defined(Q_WS_WIN) + virtual bool winEventFilter(MSG *message, long *result); +#endif + +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) + static void watchUnixSignal(int signal, bool watch); +#endif + + typedef bool (*EventFilter)(void *message, long *result); + EventFilter setEventFilter(EventFilter filter); + bool filterEvent(void *message, long *result); + +public Q_SLOTS: + static void quit(); + +Q_SIGNALS: + void aboutToQuit(); + void unixSignal(int); + +protected: + bool event(QEvent *); + + virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *); + +protected: + QCoreApplication(QCoreApplicationPrivate &p); + +private: + static bool sendSpontaneousEvent(QObject *receiver, QEvent *event); + bool notifyInternal(QObject *receiver, QEvent *event); + + void init(); + + static QCoreApplication *self; + + Q_DISABLE_COPY(QCoreApplication) + + friend class QEventDispatcherUNIXPrivate; + friend class QApplication; + friend class QApplicationPrivate; + friend class QETWidget; + friend class Q3AccelManager; + friend class QShortcutMap; + friend class QWidget; + friend class QWidgetPrivate; + friend bool qt_sendSpontaneousEvent(QObject*, QEvent*); + friend Q_CORE_EXPORT QString qAppName(); + friend class QClassFactory; +}; + +inline bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event) +{ if (event) event->spont = false; return self ? self->notifyInternal(receiver, event) : false; } + +inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event) +{ if (event) event->spont = true; return self ? self->notifyInternal(receiver, event) : false; } + +inline void QCoreApplication::sendPostedEvents() { sendPostedEvents(0, 0); } + +#ifdef QT_NO_TRANSLATION +// Simple versions +inline QString QCoreApplication::translate(const char *, const char *sourceText, + const char *, Encoding encoding) +{ +#ifndef QT_NO_TEXTCODEC + if (encoding == UnicodeUTF8) + return QString::fromUtf8(sourceText); +#else + Q_UNUSED(encoding) +#endif + return QString::fromLatin1(sourceText); +} + +// Simple versions +inline QString QCoreApplication::translate(const char *, const char *sourceText, + const char *, Encoding encoding, int) +{ +#ifndef QT_NO_TEXTCODEC + if (encoding == UnicodeUTF8) + return QString::fromUtf8(sourceText); +#else + Q_UNUSED(encoding) +#endif + return QString::fromLatin1(sourceText); +} +#endif + +// ### merge the four functions into two (using "int n = -1") +#define Q_DECLARE_TR_FUNCTIONS(context) \ +public: \ + static inline QString tr(const char *sourceText, const char *disambiguation = 0) \ + { return QCoreApplication::translate(#context, sourceText, disambiguation); } \ + static inline QString trUtf8(const char *sourceText, const char *disambiguation = 0) \ + { return QCoreApplication::translate(#context, sourceText, disambiguation, \ + QCoreApplication::UnicodeUTF8); } \ + static inline QString tr(const char *sourceText, const char *disambiguation, int n) \ + { return QCoreApplication::translate(#context, sourceText, disambiguation, \ + QCoreApplication::CodecForTr, n); } \ + static inline QString trUtf8(const char *sourceText, const char *disambiguation, int n) \ + { return QCoreApplication::translate(#context, sourceText, disambiguation, \ + QCoreApplication::UnicodeUTF8, n); } \ +private: + +typedef void (*QtCleanUpFunction)(); + +Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction); +Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction); +Q_CORE_EXPORT QString qAppName(); // get application name + +#if defined(Q_WS_WIN) && !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT QString decodeMSG(const MSG &); +Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOREAPPLICATION_H diff --git a/qtinterface/qt4/Qt/qcoreevent.h b/qtinterface/qt4/Qt/qcoreevent.h new file mode 100644 index 0000000..9ead292 --- /dev/null +++ b/qtinterface/qt4/Qt/qcoreevent.h @@ -0,0 +1,389 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOREEVENT_H +#define QCOREEVENT_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qobjectdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QEventPrivate; +class Q_CORE_EXPORT QEvent // event base class +{ + Q_GADGET + QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + Q_ENUMS(Type) +public: + enum Type { + /* + If you get a strange compiler error on the line with None, + it's probably because you're also including X11 headers, + which #define the symbol None. Put the X11 includes after + the Qt includes to solve this problem. + */ + None = 0, // invalid event + Timer = 1, // timer event + MouseButtonPress = 2, // mouse button pressed + MouseButtonRelease = 3, // mouse button released + MouseButtonDblClick = 4, // mouse button double click + MouseMove = 5, // mouse move + KeyPress = 6, // key pressed + KeyRelease = 7, // key released + FocusIn = 8, // keyboard focus received + FocusOut = 9, // keyboard focus lost + Enter = 10, // mouse enters widget + Leave = 11, // mouse leaves widget + Paint = 12, // paint widget + Move = 13, // move widget + Resize = 14, // resize widget + Create = 15, // after widget creation + Destroy = 16, // during widget destruction + Show = 17, // widget is shown + Hide = 18, // widget is hidden + Close = 19, // request to close widget + Quit = 20, // request to quit application + ParentChange = 21, // widget has been reparented + ParentAboutToChange = 131, // sent just before the parent change is done +#ifdef QT3_SUPPORT + Reparent = ParentChange, +#endif + ThreadChange = 22, // object has changed threads + WindowActivate = 24, // window was activated + WindowDeactivate = 25, // window was deactivated + ShowToParent = 26, // widget is shown to parent + HideToParent = 27, // widget is hidden to parent + Wheel = 31, // wheel event + WindowTitleChange = 33, // window title changed + WindowIconChange = 34, // icon changed + ApplicationWindowIconChange = 35, // application icon changed + ApplicationFontChange = 36, // application font changed + ApplicationLayoutDirectionChange = 37, // application layout direction changed + ApplicationPaletteChange = 38, // application palette changed + PaletteChange = 39, // widget palette changed + Clipboard = 40, // internal clipboard event + Speech = 42, // reserved for speech input + MetaCall = 43, // meta call event + SockAct = 50, // socket activation + WinEventAct = 132, // win event activation + DeferredDelete = 52, // deferred delete event + DragEnter = 60, // drag moves into widget + DragMove = 61, // drag moves in widget + DragLeave = 62, // drag leaves or is cancelled + Drop = 63, // actual drop + DragResponse = 64, // drag accepted/rejected + ChildAdded = 68, // new child widget + ChildPolished = 69, // polished child widget +#ifdef QT3_SUPPORT + ChildInsertedRequest = 67, // send ChildInserted compatibility events to receiver + ChildInserted = 70, // compatibility child inserted + LayoutHint = 72, // compatibility relayout request +#endif + ChildRemoved = 71, // deleted child widget + ShowWindowRequest = 73, // widget's window should be mapped + PolishRequest = 74, // widget should be polished + Polish = 75, // widget is polished + LayoutRequest = 76, // widget should be relayouted + UpdateRequest = 77, // widget should be repainted + UpdateLater = 78, // request update() later + + EmbeddingControl = 79, // ActiveX embedding + ActivateControl = 80, // ActiveX activation + DeactivateControl = 81, // ActiveX deactivation + ContextMenu = 82, // context popup menu + InputMethod = 83, // input method + AccessibilityPrepare = 86, // accessibility information is requested + TabletMove = 87, // Wacom tablet event + LocaleChange = 88, // the system locale changed + LanguageChange = 89, // the application language changed + LayoutDirectionChange = 90, // the layout direction changed + Style = 91, // internal style event + TabletPress = 92, // tablet press + TabletRelease = 93, // tablet release + OkRequest = 94, // CE (Ok) button pressed + HelpRequest = 95, // CE (?) button pressed + + IconDrag = 96, // proxy icon dragged + + FontChange = 97, // font has changed + EnabledChange = 98, // enabled state has changed + ActivationChange = 99, // window activation has changed + StyleChange = 100, // style has changed + IconTextChange = 101, // icon text has changed + ModifiedChange = 102, // modified state has changed + MouseTrackingChange = 109, // mouse tracking state has changed + + WindowBlocked = 103, // window is about to be blocked modally + WindowUnblocked = 104, // windows modal blocking has ended + WindowStateChange = 105, + + ToolTip = 110, + WhatsThis = 111, + StatusTip = 112, + + ActionChanged = 113, + ActionAdded = 114, + ActionRemoved = 115, + + FileOpen = 116, // file open request + + Shortcut = 117, // shortcut triggered + ShortcutOverride = 51, // shortcut override request + +#ifdef QT3_SUPPORT + Accel = 30, // accelerator event + AccelAvailable = 32, // accelerator available event + AccelOverride = ShortcutOverride, // accelerator override event +#endif + + WhatsThisClicked = 118, + +#ifdef QT3_SUPPORT + CaptionChange = WindowTitleChange, + IconChange = WindowIconChange, +#endif + ToolBarChange = 120, // toolbar visibility toggled + + ApplicationActivate = 121, // application has been changed to active + ApplicationActivated = ApplicationActivate, // deprecated + ApplicationDeactivate = 122, // application has been changed to inactive + ApplicationDeactivated = ApplicationDeactivate, // deprecated + + QueryWhatsThis = 123, // query what's this widget help + EnterWhatsThisMode = 124, + LeaveWhatsThisMode = 125, + + ZOrderChange = 126, // child widget has had its z-order changed + + HoverEnter = 127, // mouse cursor enters a hover widget + 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 + EnterEditFocus = 150, // enter edit mode in keypad navigation + LeaveEditFocus = 151, // enter edit mode in keypad navigation +#endif + AcceptDropsChange = 152, + + MenubarUpdated = 153, // Support event for Q3MainWindow, which needs to + // knwow when QMenubar is updated. + + ZeroTimerEvent = 154, // Used for Windows Zero timer events + + GraphicsSceneMouseMove = 155, // GraphicsView + GraphicsSceneMousePress = 156, + GraphicsSceneMouseRelease = 157, + GraphicsSceneMouseDoubleClick = 158, + GraphicsSceneContextMenu = 159, + GraphicsSceneHoverEnter = 160, + GraphicsSceneHoverMove = 161, + GraphicsSceneHoverLeave = 162, + GraphicsSceneHelp = 163, + GraphicsSceneDragEnter = 164, + GraphicsSceneDragMove = 165, + GraphicsSceneDragLeave = 166, + GraphicsSceneDrop = 167, + GraphicsSceneWheel = 168, + + KeyboardLayoutChange = 169, // keyboard layout changed + + DynamicPropertyChange = 170, // A dynamic property was changed through setProperty/property + + TabletEnterProximity = 171, + TabletLeaveProximity = 172, + + NonClientAreaMouseMove = 173, + NonClientAreaMouseButtonPress = 174, + NonClientAreaMouseButtonRelease = 175, + NonClientAreaMouseButtonDblClick = 176, + + MacSizeChange = 177, // when the Qt::WA_Mac{Normal,Small,Mini}Size changes + + ContentsRectChange = 178, // sent by QWidget::setContentsMargins (internal) + + MacGLWindowChange = 179, // Internal! the window of the GLWidget has changed + + FutureCallOut = 180, + + GraphicsSceneResize = 181, + GraphicsSceneMove = 182, + + CursorChange = 183, + ToolTipChange = 184, + + NetworkReplyUpdated = 185, // Internal for QNetworkReply + + GrabMouse = 186, + UngrabMouse = 187, + GrabKeyboard = 188, + UngrabKeyboard = 189, + CocoaRequestModal = 190, // Internal for requesting an application modal Cocoa Window + MacGLClearDrawable = 191, // Internal Cocoa, the window has changed, so we must clear + + StateMachineSignal = 192, + StateMachineWrapped = 193, + + TouchBegin = 194, + TouchUpdate = 195, + TouchEnd = 196, + + NativeGesture = 197, // Internal for platform gesture support + + RequestSoftwareInputPanel = 199, + CloseSoftwareInputPanel = 200, + + UpdateSoftKeys = 201, // Internal for compressing soft key updates + + WinIdChange = 203, + Gesture = 198, + GestureOverride = 202, + + // 512 reserved for Qt Jambi's MetaCall event + // 513 reserved for Qt Jambi's DeleteOnMainThread event + + User = 1000, // first user event id + MaxUser = 65535 // last user event id + }; + + QEvent(Type type); + virtual ~QEvent(); + inline Type type() const { return static_cast<Type>(t); } + inline bool spontaneous() const { return spont; } + + inline void setAccepted(bool accepted) { m_accept = accepted; } + inline bool isAccepted() const { return m_accept; } + + inline void accept() { m_accept = true; } + inline void ignore() { m_accept = false; } + + static int registerEventType(int hint = -1); + +protected: + QEventPrivate *d; + ushort t; + +private: + ushort posted : 1; + ushort spont : 1; + ushort m_accept : 1; + ushort reserved : 13; + + friend class QCoreApplication; + friend class QCoreApplicationPrivate; + friend class QThreadData; + friend class QApplication; + friend class QApplicationPrivate; + friend class Q3AccelManager; + friend class QShortcutMap; + friend class QETWidget; + friend class QGraphicsView; + friend class QGraphicsViewPrivate; + friend class QGraphicsScenePrivate; + friend class QGestureManager; +}; + +class Q_CORE_EXPORT QTimerEvent : public QEvent +{ +public: + QTimerEvent( int timerId ); + ~QTimerEvent(); + int timerId() const { return id; } +protected: + int id; +}; + +class QObject; + +class Q_CORE_EXPORT QChildEvent : public QEvent +{ +public: + QChildEvent( Type type, QObject *child ); + ~QChildEvent(); + QObject *child() const { return c; } + bool added() const { return type() == ChildAdded; } +#ifdef QT3_SUPPORT + QT3_SUPPORT bool inserted() const { return type() == ChildInserted; } +#endif + bool polished() const { return type() == ChildPolished; } + bool removed() const { return type() == ChildRemoved; } +protected: + QObject *c; +}; + +#ifdef QT3_SUPPORT +class Q_CORE_EXPORT QCustomEvent : public QEvent +{ +public: + QT3_SUPPORT_CONSTRUCTOR QCustomEvent(int type, void *data = 0); + ~QCustomEvent(); + QT3_SUPPORT void *data() const { return d; } + QT3_SUPPORT void setData(void* aData) { d = reinterpret_cast<QEventPrivate *>(aData); } +}; +#endif + +class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent +{ +public: + QDynamicPropertyChangeEvent(const QByteArray &name); + ~QDynamicPropertyChangeEvent(); + + inline QByteArray propertyName() const { return n; } + +private: + QByteArray n; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOREEVENT_H diff --git a/qtinterface/qt4/Qt/qcryptographichash.h b/qtinterface/qt4/Qt/qcryptographichash.h new file mode 100644 index 0000000..6fe4191 --- /dev/null +++ b/qtinterface/qt4/Qt/qcryptographichash.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCRYPTOGRAPHICSHASH_H +#define QCRYPTOGRAPHICSHASH_H + +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QCryptographicHashPrivate; + +class Q_CORE_EXPORT QCryptographicHash +{ +public: + enum Algorithm { + Md4, + Md5, + Sha1 + }; + + QCryptographicHash(Algorithm method); + ~QCryptographicHash(); + + void reset(); + + void addData(const char *data, int length); + void addData(const QByteArray &data); + + QByteArray result() const; + + static QByteArray hash(const QByteArray &data, Algorithm method); +private: + Q_DISABLE_COPY(QCryptographicHash) + QCryptographicHashPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qcursor.h b/qtinterface/qt4/Qt/qcursor.h new file mode 100644 index 0000000..ac13893 --- /dev/null +++ b/qtinterface/qt4/Qt/qcursor.h @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCURSOR_H +#define QCURSOR_H + +#include <QtCore/qpoint.h> +#include <QtGui/qwindowdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QVariant; + +/* + ### The fake cursor has to go first with old qdoc. +*/ +#ifdef QT_NO_CURSOR + +class Q_GUI_EXPORT QCursor +{ +public: + static QPoint pos(); + static void setPos(int x, int y); + inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); } +private: + QCursor(); +}; + +#endif // QT_NO_CURSOR + +#ifndef QT_NO_CURSOR + +class QCursorData; +class QBitmap; +class QPixmap; + +#if defined(Q_WS_MAC) +void qt_mac_set_cursor(const QCursor *c, const QPoint &p); +#endif +#if defined(Q_OS_SYMBIAN) +extern void qt_symbian_show_pointer_sprite(); +extern void qt_symbian_hide_pointer_sprite(); +extern void qt_symbian_set_pointer_sprite(const QCursor& cursor); +extern void qt_symbian_move_cursor_sprite(); +#endif + +class Q_GUI_EXPORT QCursor +{ +public: + QCursor(); + QCursor(Qt::CursorShape shape); + QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX=-1, int hotY=-1); + QCursor(const QPixmap &pixmap, int hotX=-1, int hotY=-1); + QCursor(const QCursor &cursor); + ~QCursor(); + QCursor &operator=(const QCursor &cursor); + operator QVariant() const; + + Qt::CursorShape shape() const; + void setShape(Qt::CursorShape newShape); + + const QBitmap *bitmap() const; + const QBitmap *mask() const; + QPixmap pixmap() const; + QPoint hotSpot() const; + + static QPoint pos(); + static void setPos(int x, int y); + inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); } + +#ifdef qdoc + HCURSOR_or_HANDLE handle() const; + QCursor(HCURSOR cursor); + QCursor(Qt::HANDLE cursor); +#endif + +#ifndef qdoc +#if defined(Q_WS_WIN) + HCURSOR handle() const; + QCursor(HCURSOR cursor); +#elif defined(Q_WS_X11) + Qt::HANDLE handle() const; + QCursor(Qt::HANDLE cursor); + static int x11Screen(); +#elif defined(Q_WS_MAC) + Qt::HANDLE handle() const; +#elif defined(Q_WS_QWS) + int handle() const; +#elif defined(Q_OS_SYMBIAN) + Qt::HANDLE handle() const; +#endif +#endif + +private: + QCursorData *d; +#if defined(Q_WS_MAC) + friend void *qt_mac_nsCursorForQCursor(const QCursor &c); + friend void qt_mac_set_cursor(const QCursor *c, const QPoint &p); +#endif +#if defined(Q_OS_SYMBIAN) + friend void qt_symbian_show_pointer_sprite(); + friend void qt_symbian_hide_pointer_sprite(); + friend void qt_symbian_set_pointer_sprite(const QCursor& cursor); + friend void qt_symbian_move_cursor_sprite(); +#endif +}; + +#ifdef QT3_SUPPORT +// CursorShape is defined in X11/X.h +#ifdef CursorShape +#define X_CursorShape CursorShape +#undef CursorShape +#endif +typedef Qt::CursorShape QCursorShape; +#ifdef X_CursorShape +#define CursorShape X_CursorShape +#endif +#endif + +/***************************************************************************** + QCursor stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor); +#endif +#endif // QT_NO_CURSOR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCURSOR_H diff --git a/qtinterface/qt4/Qt/qdatastream.h b/qtinterface/qt4/Qt/qdatastream.h new file mode 100644 index 0000000..a815bc5 --- /dev/null +++ b/qtinterface/qt4/Qt/qdatastream.h @@ -0,0 +1,436 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDATASTREAM_H +#define QDATASTREAM_H + +#include <QtCore/qscopedpointer.h> +#include <QtCore/qiodevice.h> +#include <QtCore/qglobal.h> + +#ifdef Status +#error qdatastream.h must be included before any header file that defines Status +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QByteArray; +class QIODevice; + +template <typename T> class QList; +template <typename T> class QLinkedList; +template <typename T> class QVector; +template <typename T> class QSet; +template <class Key, class T> class QHash; +template <class Key, class T> class QMap; + +#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) +class QDataStreamPrivate; +class Q_CORE_EXPORT QDataStream +{ +public: + enum Version { + Qt_1_0 = 1, + Qt_2_0 = 2, + Qt_2_1 = 3, + Qt_3_0 = 4, + Qt_3_1 = 5, + Qt_3_3 = 6, + Qt_4_0 = 7, + Qt_4_1 = Qt_4_0, + Qt_4_2 = 8, + Qt_4_3 = 9, + Qt_4_4 = 10, + Qt_4_5 = 11, + Qt_4_6 = 12 +#if QT_VERSION >= 0x040700 +#error Add the datastream version for this Qt version + Qt_4_7 = Qt_4_6 +#endif + }; + + enum ByteOrder { + BigEndian = QSysInfo::BigEndian, + LittleEndian = QSysInfo::LittleEndian + }; + + enum Status { + Ok, + ReadPastEnd, + ReadCorruptData + }; + + enum FloatingPointPrecision { + SinglePrecision, + DoublePrecision + }; + + QDataStream(); + explicit QDataStream(QIODevice *); +#ifdef QT3_SUPPORT + QDataStream(QByteArray *, int mode); +#endif + QDataStream(QByteArray *, QIODevice::OpenMode flags); + QDataStream(const QByteArray &); + virtual ~QDataStream(); + + QIODevice *device() const; + void setDevice(QIODevice *); + void unsetDevice(); + + bool atEnd() const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool eof() const { return atEnd(); } +#endif + + Status status() const; + void setStatus(Status status); + void resetStatus(); + + FloatingPointPrecision floatingPointPrecision() const; + void setFloatingPointPrecision(FloatingPointPrecision precision); + + ByteOrder byteOrder() const; + void setByteOrder(ByteOrder); + + int version() const; + void setVersion(int); + + QDataStream &operator>>(qint8 &i); + QDataStream &operator>>(quint8 &i); + QDataStream &operator>>(qint16 &i); + QDataStream &operator>>(quint16 &i); + QDataStream &operator>>(qint32 &i); + QDataStream &operator>>(quint32 &i); + QDataStream &operator>>(qint64 &i); + QDataStream &operator>>(quint64 &i); + + QDataStream &operator>>(bool &i); + QDataStream &operator>>(float &f); + QDataStream &operator>>(double &f); + QDataStream &operator>>(char *&str); + + QDataStream &operator<<(qint8 i); + QDataStream &operator<<(quint8 i); + QDataStream &operator<<(qint16 i); + QDataStream &operator<<(quint16 i); + QDataStream &operator<<(qint32 i); + QDataStream &operator<<(quint32 i); + QDataStream &operator<<(qint64 i); + QDataStream &operator<<(quint64 i); + QDataStream &operator<<(bool i); + QDataStream &operator<<(float f); + QDataStream &operator<<(double f); + QDataStream &operator<<(const char *str); + + QDataStream &readBytes(char *&, uint &len); + int readRawData(char *, int len); + + QDataStream &writeBytes(const char *, uint len); + int writeRawData(const char *, int len); + + int skipRawData(int len); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QDataStream &readRawBytes(char *str, uint len) + { readRawData(str, static_cast<int>(len)); return *this; } + inline QT3_SUPPORT QDataStream &writeRawBytes(const char *str, uint len) + { writeRawData(str, static_cast<int>(len)); return *this; } + inline QT3_SUPPORT bool isPrintableData() const { return false; } + inline QT3_SUPPORT void setPrintableData(bool) {} +#endif + +private: + Q_DISABLE_COPY(QDataStream) + + QScopedPointer<QDataStreamPrivate> d; + + QIODevice *dev; + bool owndev; + bool noswap; + ByteOrder byteorder; + int ver; + Status q_status; +}; + + +/***************************************************************************** + QDataStream inline functions + *****************************************************************************/ + +inline QIODevice *QDataStream::device() const +{ return dev; } + +inline QDataStream::ByteOrder QDataStream::byteOrder() const +{ return byteorder; } + +inline int QDataStream::version() const +{ return ver; } + +inline void QDataStream::setVersion(int v) +{ ver = v; } + +inline QDataStream &QDataStream::operator>>(quint8 &i) +{ return *this >> reinterpret_cast<qint8&>(i); } + +inline QDataStream &QDataStream::operator>>(quint16 &i) +{ return *this >> reinterpret_cast<qint16&>(i); } + +inline QDataStream &QDataStream::operator>>(quint32 &i) +{ return *this >> reinterpret_cast<qint32&>(i); } + +inline QDataStream &QDataStream::operator>>(quint64 &i) +{ return *this >> reinterpret_cast<qint64&>(i); } + +inline QDataStream &QDataStream::operator<<(quint8 i) +{ return *this << qint8(i); } + +inline QDataStream &QDataStream::operator<<(quint16 i) +{ return *this << qint16(i); } + +inline QDataStream &QDataStream::operator<<(quint32 i) +{ return *this << qint32(i); } + +inline QDataStream &QDataStream::operator<<(quint64 i) +{ return *this << qint64(i); } + +template <typename T> +QDataStream& operator>>(QDataStream& s, QList<T>& l) +{ + l.clear(); + quint32 c; + s >> c; + for(quint32 i = 0; i < c; ++i) + { + T t; + s >> t; + l.append(t); + if (s.atEnd()) + break; + } + return s; +} + +template <typename T> +QDataStream& operator<<(QDataStream& s, const QList<T>& l) +{ + s << quint32(l.size()); + for (int i = 0; i < l.size(); ++i) + s << l.at(i); + return s; +} + +template <typename T> +QDataStream& operator>>(QDataStream& s, QLinkedList<T>& l) +{ + l.clear(); + quint32 c; + s >> c; + for(quint32 i = 0; i < c; ++i) + { + T t; + s >> t; + l.append(t); + if (s.atEnd()) + break; + } + return s; +} + +template <typename T> +QDataStream& operator<<(QDataStream& s, const QLinkedList<T>& l) +{ + s << quint32(l.size()); + typename QLinkedList<T>::ConstIterator it = l.constBegin(); + for(; it != l.constEnd(); ++it) + s << *it; + return s; +} + +template<typename T> +QDataStream& operator>>(QDataStream& s, QVector<T>& v) +{ + v.clear(); + quint32 c; + s >> c; + v.resize(c); + for(quint32 i = 0; i < c; ++i) { + T t; + s >> t; + v[i] = t; + } + return s; +} + +template<typename T> +QDataStream& operator<<(QDataStream& s, const QVector<T>& v) +{ + s << quint32(v.size()); + for (typename QVector<T>::const_iterator it = v.begin(); it != v.end(); ++it) + s << *it; + return s; +} + +template <typename T> +QDataStream &operator>>(QDataStream &in, QSet<T> &set) +{ + set.clear(); + quint32 c; + in >> c; + for (quint32 i = 0; i < c; ++i) { + T t; + in >> t; + set << t; + if (in.atEnd()) + break; + } + return in; +} + +template <typename T> +QDataStream& operator<<(QDataStream &out, const QSet<T> &set) +{ + out << quint32(set.size()); + typename QSet<T>::const_iterator i = set.constBegin(); + while (i != set.constEnd()) { + out << *i; + ++i; + } + return out; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QHash<Key, T> &hash) +{ + QDataStream::Status oldStatus = in.status(); + in.resetStatus(); + hash.clear(); + + quint32 n; + in >> n; + + for (quint32 i = 0; i < n; ++i) { + if (in.status() != QDataStream::Ok) + break; + + Key k; + T t; + in >> k >> t; + hash.insertMulti(k, t); + } + + if (in.status() != QDataStream::Ok) + hash.clear(); + if (oldStatus != QDataStream::Ok) + in.setStatus(oldStatus); + return in; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash) +{ + out << quint32(hash.size()); + typename QHash<Key, T>::ConstIterator it = hash.end(); + typename QHash<Key, T>::ConstIterator begin = hash.begin(); + while (it != begin) { + --it; + out << it.key() << it.value(); + } + return out; +} +#ifdef qdoc +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map) +#else +template <class aKey, class aT> +Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &map) +#endif +{ + QDataStream::Status oldStatus = in.status(); + in.resetStatus(); + map.clear(); + + quint32 n; + in >> n; + + map.detach(); + map.setInsertInOrder(true); + for (quint32 i = 0; i < n; ++i) { + if (in.status() != QDataStream::Ok) + break; + + aKey key; + aT value; + in >> key >> value; + map.insertMulti(key, value); + } + map.setInsertInOrder(false); + if (in.status() != QDataStream::Ok) + map.clear(); + if (oldStatus != QDataStream::Ok) + in.setStatus(oldStatus); + return in; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map) +{ + out << quint32(map.size()); + typename QMap<Key, T>::ConstIterator it = map.end(); + typename QMap<Key, T>::ConstIterator begin = map.begin(); + while (it != begin) { + --it; + out << it.key() << it.value(); + } + return out; +} + +#endif // QT_NO_DATASTREAM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDATASTREAM_H diff --git a/qtinterface/qt4/Qt/qdatawidgetmapper.h b/qtinterface/qt4/Qt/qdatawidgetmapper.h new file mode 100644 index 0000000..c8245a6 --- /dev/null +++ b/qtinterface/qt4/Qt/qdatawidgetmapper.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDATAWIDGETMAPPER_H +#define QDATAWIDGETMAPPER_H + +#include "QtCore/qobject.h" + +#ifndef QT_NO_DATAWIDGETMAPPER + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAbstractItemDelegate; +class QAbstractItemModel; +class QModelIndex; +class QDataWidgetMapperPrivate; + +class Q_GUI_EXPORT QDataWidgetMapper: public QObject +{ + Q_OBJECT + + Q_ENUMS(SubmitPolicy) + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(SubmitPolicy submitPolicy READ submitPolicy WRITE setSubmitPolicy) + +public: + QDataWidgetMapper(QObject *parent = 0); + ~QDataWidgetMapper(); + + void setModel(QAbstractItemModel *model); + QAbstractItemModel *model() const; + + void setItemDelegate(QAbstractItemDelegate *delegate); + QAbstractItemDelegate *itemDelegate() const; + + void setRootIndex(const QModelIndex &index); + QModelIndex rootIndex() const; + + void setOrientation(Qt::Orientation aOrientation); + Qt::Orientation orientation() const; + + enum SubmitPolicy { AutoSubmit, ManualSubmit }; + void setSubmitPolicy(SubmitPolicy policy); + SubmitPolicy submitPolicy() const; + + void addMapping(QWidget *widget, int section); + void addMapping(QWidget *widget, int section, const QByteArray &propertyName); + void removeMapping(QWidget *widget); + int mappedSection(QWidget *widget) const; + QByteArray mappedPropertyName(QWidget *widget) const; + QWidget *mappedWidgetAt(int section) const; + void clearMapping(); + + int currentIndex() const; + +public Q_SLOTS: + void revert(); + bool submit(); + + void toFirst(); + void toLast(); + void toNext(); + void toPrevious(); + virtual void setCurrentIndex(int index); + void setCurrentModelIndex(const QModelIndex &index); + +Q_SIGNALS: + void currentIndexChanged(int index); + +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_commitData(QWidget *)) + Q_PRIVATE_SLOT(d_func(), void _q_closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)) + Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_DATAWIDGETMAPPER +#endif + diff --git a/qtinterface/qt4/Qt/qdatetime.h b/qtinterface/qt4/Qt/qdatetime.h new file mode 100644 index 0000000..8488811 --- /dev/null +++ b/qtinterface/qt4/Qt/qdatetime.h @@ -0,0 +1,334 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDATETIME_H +#define QDATETIME_H + +#include <QtCore/qstring.h> +#include <QtCore/qnamespace.h> +#include <QtCore/qsharedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QDate +{ +public: + enum MonthNameType { + DateFormat = 0, + StandaloneFormat + }; +public: + QDate() { jd = 0; } + QDate(int y, int m, int d); + + bool isNull() const { return jd == 0; } + bool isValid() const; + + int year() const; + int month() const; + int day() const; + int dayOfWeek() const; + int dayOfYear() const; + int daysInMonth() const; + int daysInYear() const; + int weekNumber(int *yearNum = 0) const; + +#ifndef QT_NO_TEXTDATE +#ifdef QT3_SUPPORT + static QT3_SUPPORT QString monthName(int month) { return shortMonthName(month); } + static QT3_SUPPORT QString dayName(int weekday) { return shortDayName(weekday); } +#endif + // ### 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); +#endif // QT_NO_TEXTDATE +#ifndef QT_NO_DATESTRING + QString toString(Qt::DateFormat f = Qt::TextDate) const; + QString toString(const QString &format) const; +#endif + bool setYMD(int y, int m, int d); + bool setDate(int year, int month, int day); + + void getDate(int *year, int *month, int *day); + + QDate addDays(int days) const; + QDate addMonths(int months) const; + QDate addYears(int years) const; + int daysTo(const QDate &) const; + + bool operator==(const QDate &other) const { return jd == other.jd; } + bool operator!=(const QDate &other) const { return jd != other.jd; } + bool operator<(const QDate &other) const { return jd < other.jd; } + bool operator<=(const QDate &other) const { return jd <= other.jd; } + bool operator>(const QDate &other) const { return jd > other.jd; } + bool operator>=(const QDate &other) const { return jd >= other.jd; } + + static QDate currentDate(); +#ifndef QT_NO_DATESTRING + static QDate fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); + static QDate fromString(const QString &s, const QString &format); +#endif + static bool isValid(int y, int m, int d); + static bool isLeapYear(int year); +#ifdef QT3_SUPPORT + inline static QT3_SUPPORT bool leapYear(int year) { return isLeapYear(year); } +#endif + + // ### 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); + +#ifdef QT3_SUPPORT + static QT3_SUPPORT QDate currentDate(Qt::TimeSpec spec); +#endif + + static inline QDate fromJulianDay(int jd) { QDate d; d.jd = jd; return d; } + inline int toJulianDay() const { return jd; } + +private: + uint jd; + + friend class QDateTime; + friend class QDateTimePrivate; +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDate &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &); +#endif +}; +Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE); + +class Q_CORE_EXPORT QTime +{ +public: + QTime(): mds(NullTime) +#if defined(Q_OS_WINCE) + , startTick(NullTime) +#endif + {} + QTime(int h, int m, int s = 0, int ms = 0); + + bool isNull() const { return mds == NullTime; } + bool isValid() const; + + int hour() const; + int minute() const; + int second() const; + int msec() const; +#ifndef QT_NO_DATESTRING + QString toString(Qt::DateFormat f = Qt::TextDate) const; + QString toString(const QString &format) const; +#endif + bool setHMS(int h, int m, int s, int ms = 0); + + QTime addSecs(int secs) const; + int secsTo(const QTime &) const; + QTime addMSecs(int ms) const; + int msecsTo(const QTime &) const; + + bool operator==(const QTime &other) const { return mds == other.mds; } + bool operator!=(const QTime &other) const { return mds != other.mds; } + bool operator<(const QTime &other) const { return mds < other.mds; } + bool operator<=(const QTime &other) const { return mds <= other.mds; } + bool operator>(const QTime &other) const { return mds > other.mds; } + bool operator>=(const QTime &other) const { return mds >= other.mds; } + + static QTime currentTime(); +#ifndef QT_NO_DATESTRING + static QTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); + static QTime fromString(const QString &s, const QString &format); +#endif + static bool isValid(int h, int m, int s, int ms = 0); + +#ifdef QT3_SUPPORT + static QT3_SUPPORT QTime currentTime(Qt::TimeSpec spec); +#endif + + void start(); + int restart(); + int elapsed() const; +private: + enum TimeFlag { NullTime = -1 }; + inline int ds() const { return mds == -1 ? 0 : mds; } + int mds; +#if defined(Q_OS_WINCE) + int startTick; +#endif + + friend class QDateTime; + friend class QDateTimePrivate; +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); +#endif +}; +Q_DECLARE_TYPEINFO(QTime, Q_MOVABLE_TYPE); + +class QDateTimePrivate; + +class Q_CORE_EXPORT QDateTime +{ +public: + QDateTime(); + explicit QDateTime(const QDate &); + QDateTime(const QDate &, const QTime &, Qt::TimeSpec spec = Qt::LocalTime); + QDateTime(const QDateTime &other); + ~QDateTime(); + + QDateTime &operator=(const QDateTime &other); + + bool isNull() const; + bool isValid() const; + + QDate date() const; + QTime time() const; + Qt::TimeSpec timeSpec() const; + uint toTime_t() const; + void setDate(const QDate &date); + void setTime(const QTime &time); + void setTimeSpec(Qt::TimeSpec spec); + void setTime_t(uint secsSince1Jan1970UTC); +#ifndef QT_NO_DATESTRING + QString toString(Qt::DateFormat f = Qt::TextDate) const; + QString toString(const QString &format) const; +#endif + QDateTime addDays(int days) const; + QDateTime addMonths(int months) const; + QDateTime addYears(int years) const; + QDateTime addSecs(int secs) const; + QDateTime addMSecs(qint64 msecs) const; + QDateTime toTimeSpec(Qt::TimeSpec spec) const; + inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); } + inline QDateTime toUTC() const { return toTimeSpec(Qt::UTC); } + int daysTo(const QDateTime &) const; + int secsTo(const QDateTime &) const; + + bool operator==(const QDateTime &other) const; + inline bool operator!=(const QDateTime &other) const { return !(*this == other); } + bool operator<(const QDateTime &other) const; + inline bool operator<=(const QDateTime &other) const { return !(other < *this); } + inline bool operator>(const QDateTime &other) const { return other < *this; } + inline bool operator>=(const QDateTime &other) const { return !(*this < other); } + + void setUtcOffset(int seconds); + int utcOffset() const; + + static QDateTime currentDateTime(); +#ifndef QT_NO_DATESTRING + static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); + static QDateTime fromString(const QString &s, const QString &format); +#endif + static QDateTime fromTime_t(uint secsSince1Jan1970UTC); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void setTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec) { + setTime_t(secsSince1Jan1970UTC); + if (spec == Qt::UTC) + *this = toUTC(); + } + static inline QT3_SUPPORT QDateTime currentDateTime(Qt::TimeSpec spec) { + if (spec == Qt::LocalTime) + return currentDateTime(); + else + return currentDateTime().toUTC(); + } + +#endif + +private: + friend class QDateTimePrivate; + void detach(); + QExplicitlySharedDataPointer<QDateTimePrivate> d; + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); +#endif +}; +Q_DECLARE_TYPEINFO(QDateTime, Q_MOVABLE_TYPE); + +#ifdef QT3_SUPPORT +inline QDate QDate::currentDate(Qt::TimeSpec spec) +{ + if (spec == Qt::LocalTime) + return currentDate(); + else + return QDateTime::currentDateTime().toUTC().date(); +} + +inline QTime QTime::currentTime(Qt::TimeSpec spec) +{ + if (spec == Qt::LocalTime) + return currentTime(); + else + return QDateTime::currentDateTime().toUTC().time(); +} +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDate &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &); +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); +#endif // QT_NO_DATASTREAM + +#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QDate &); +Q_CORE_EXPORT QDebug operator<<(QDebug, const QTime &); +Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDATETIME_H diff --git a/qtinterface/qt4/Qt/qdatetimeedit.h b/qtinterface/qt4/Qt/qdatetimeedit.h new file mode 100644 index 0000000..f87a4c3 --- /dev/null +++ b/qtinterface/qt4/Qt/qdatetimeedit.h @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDATETIMEEDIT_H +#define QDATETIMEEDIT_H + +#include <QtCore/qdatetime.h> +#include <QtCore/qvariant.h> +#include <QtGui/qabstractspinbox.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DATETIMEEDIT + +class QDateTimeEditPrivate; +class QStyleOptionSpinBox; +class QCalendarWidget; + +class Q_GUI_EXPORT QDateTimeEdit : public QAbstractSpinBox +{ + Q_OBJECT + + Q_ENUMS(Section) + Q_FLAGS(Sections) + Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true) + Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged) + Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged) + Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime WRITE setMaximumDateTime RESET clearMaximumDateTime) + Q_PROPERTY(QDateTime minimumDateTime READ minimumDateTime WRITE setMinimumDateTime RESET clearMinimumDateTime) + Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET clearMaximumDate) + Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET clearMinimumDate) + Q_PROPERTY(QTime maximumTime READ maximumTime WRITE setMaximumTime RESET clearMaximumTime) + Q_PROPERTY(QTime minimumTime READ minimumTime WRITE setMinimumTime RESET clearMinimumTime) + Q_PROPERTY(Section currentSection READ currentSection WRITE setCurrentSection) + Q_PROPERTY(Sections displayedSections READ displayedSections) + Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat) + Q_PROPERTY(bool calendarPopup READ calendarPopup WRITE setCalendarPopup) + Q_PROPERTY(int currentSectionIndex READ currentSectionIndex WRITE setCurrentSectionIndex) + Q_PROPERTY(int sectionCount READ sectionCount) + Q_PROPERTY(Qt::TimeSpec timeSpec READ timeSpec WRITE setTimeSpec) +public: + enum Section { + NoSection = 0x0000, + AmPmSection = 0x0001, + MSecSection = 0x0002, + SecondSection = 0x0004, + MinuteSection = 0x0008, + HourSection = 0x0010, + DaySection = 0x0100, + MonthSection = 0x0200, + YearSection = 0x0400, + TimeSections_Mask = AmPmSection|MSecSection|SecondSection|MinuteSection|HourSection, + DateSections_Mask = DaySection|MonthSection|YearSection + }; + + Q_DECLARE_FLAGS(Sections, Section) + + explicit QDateTimeEdit(QWidget *parent = 0); + explicit QDateTimeEdit(const QDateTime &dt, QWidget *parent = 0); + explicit QDateTimeEdit(const QDate &d, QWidget *parent = 0); + explicit QDateTimeEdit(const QTime &t, QWidget *parent = 0); + + QDateTime dateTime() const; + QDate date() const; + QTime time() const; + + QDateTime minimumDateTime() const; + void clearMinimumDateTime(); + void setMinimumDateTime(const QDateTime &dt); + + QDateTime maximumDateTime() const; + void clearMaximumDateTime(); + void setMaximumDateTime(const QDateTime &dt); + + void setDateTimeRange(const QDateTime &min, const QDateTime &max); + + QDate minimumDate() const; + void setMinimumDate(const QDate &min); + void clearMinimumDate(); + + QDate maximumDate() const; + void setMaximumDate(const QDate &max); + void clearMaximumDate(); + + void setDateRange(const QDate &min, const QDate &max); + + QTime minimumTime() const; + void setMinimumTime(const QTime &min); + void clearMinimumTime(); + + QTime maximumTime() const; + void setMaximumTime(const QTime &max); + void clearMaximumTime(); + + void setTimeRange(const QTime &min, const QTime &max); + + Sections displayedSections() const; + Section currentSection() const; + Section sectionAt(int index) const; + void setCurrentSection(Section section); + + int currentSectionIndex() const; + void setCurrentSectionIndex(int index); + + QCalendarWidget *calendarWidget() const; + void setCalendarWidget(QCalendarWidget *calendarWidget); + + int sectionCount() const; + + void setSelectedSection(Section section); + + QString sectionText(Section section) const; + + QString displayFormat() const; + void setDisplayFormat(const QString &format); + + bool calendarPopup() const; + void setCalendarPopup(bool enable); + + Qt::TimeSpec timeSpec() const; + void setTimeSpec(Qt::TimeSpec spec); + + QSize sizeHint() const; + + virtual void clear(); + virtual void stepBy(int steps); + + bool event(QEvent *event); +Q_SIGNALS: + void dateTimeChanged(const QDateTime &date); + void timeChanged(const QTime &date); + void dateChanged(const QDate &date); + +public Q_SLOTS: + void setDateTime(const QDateTime &dateTime); + void setDate(const QDate &date); + void setTime(const QTime &time); + +protected: + virtual void keyPressEvent(QKeyEvent *event); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *event); +#endif + virtual void focusInEvent(QFocusEvent *event); + virtual bool focusNextPrevChild(bool next); + virtual QValidator::State validate(QString &input, int &pos) const; + virtual void fixup(QString &input) const; + + virtual QDateTime dateTimeFromText(const QString &text) const; + virtual QString textFromDateTime(const QDateTime &dt) const; + virtual StepEnabled stepEnabled() const; + virtual void mousePressEvent(QMouseEvent *event); + virtual void paintEvent(QPaintEvent *event); + void initStyleOption(QStyleOptionSpinBox *option) const; + + QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = 0); +private: + Q_DECLARE_PRIVATE(QDateTimeEdit) + Q_DISABLE_COPY(QDateTimeEdit) + + Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) +}; + +class Q_GUI_EXPORT QTimeEdit : public QDateTimeEdit +{ + Q_OBJECT + Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true) +public: + QTimeEdit(QWidget *parent = 0); + QTimeEdit(const QTime &time, QWidget *parent = 0); +}; + +class Q_GUI_EXPORT QDateEdit : public QDateTimeEdit +{ + Q_OBJECT + Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true) +public: + QDateEdit(QWidget *parent = 0); + QDateEdit(const QDate &date, QWidget *parent = 0); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections) + +#endif // QT_NO_DATETIMEEDIT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDATETIMEEDIT_H diff --git a/qtinterface/qt4/Qt/qdbusabstractadaptor.h b/qtinterface/qt4/Qt/qdbusabstractadaptor.h new file mode 100644 index 0000000..5edb91c --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusabstractadaptor.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSABSTRACTADAPTOR_H +#define QDBUSABSTRACTADAPTOR_H + +#include <QtCore/qobject.h> +#include <QtDBus/qdbusmacros.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusAbstractAdaptorPrivate; +class QDBUS_EXPORT QDBusAbstractAdaptor: public QObject +{ + Q_OBJECT +protected: + QDBusAbstractAdaptor(QObject *parent); + +public: + ~QDBusAbstractAdaptor(); + +protected: + void setAutoRelaySignals(bool enable); + bool autoRelaySignals() const; + +private: + Q_DECLARE_PRIVATE(QDBusAbstractAdaptor) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusabstractinterface.h b/qtinterface/qt4/Qt/qdbusabstractinterface.h new file mode 100644 index 0000000..c3be090 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusabstractinterface.h @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSABSTRACTINTERFACE_H +#define QDBUSABSTRACTINTERFACE_H + +#include <QtCore/qstring.h> +#include <QtCore/qvariant.h> +#include <QtCore/qlist.h> +#include <QtCore/qobject.h> + +#include <QtDBus/qdbusmessage.h> +#include <QtDBus/qdbusextratypes.h> +#include <QtDBus/qdbusconnection.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusError; +class QDBusPendingCall; + +class QDBusAbstractInterfacePrivate; + +class QDBUS_EXPORT QDBusAbstractInterfaceBase: public QObject +{ +public: + int qt_metacall(QMetaObject::Call, int, void**); +protected: + QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent); +private: + Q_DECLARE_PRIVATE(QDBusAbstractInterface) +}; + +class QDBUS_EXPORT QDBusAbstractInterface: +#ifdef Q_QDOC + public QObject +#else + public QDBusAbstractInterfaceBase +#endif +{ + Q_OBJECT + +public: + virtual ~QDBusAbstractInterface(); + bool isValid() const; + + QDBusConnection connection() const; + + QString service() const; + QString path() const; + QString interface() const; + + QDBusError lastError() const; + + QDBusMessage 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()); + + QDBusMessage call(QDBus::CallMode mode, + 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()); + + QDBusMessage callWithArgumentList(QDBus::CallMode mode, + const QString &method, + const QList<QVariant> &args); + + bool callWithCallback(const QString &method, + const QList<QVariant> &args, + QObject *receiver, const char *member, const char *errorSlot); + bool callWithCallback(const QString &method, + const QList<QVariant> &args, + QObject *receiver, const char *member); + + QDBusPendingCall asyncCall(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()); + QDBusPendingCall asyncCallWithArgumentList(const QString &method, + const QList<QVariant> &args); + +protected: + QDBusAbstractInterface(const QString &service, const QString &path, const char *interface, + const QDBusConnection &connection, QObject *parent); + QDBusAbstractInterface(QDBusAbstractInterfacePrivate &, QObject *parent); + + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant internalPropGet(const char *propname) const; + void internalPropSet(const char *propname, const QVariant &value); + QDBusMessage internalConstCall(QDBus::CallMode mode, + const QString &method, + const QList<QVariant> &args = QList<QVariant>()) const; + +private: + Q_DECLARE_PRIVATE(QDBusAbstractInterface) + Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString)) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusargument.h b/qtinterface/qt4/Qt/qdbusargument.h new file mode 100644 index 0000000..c9cb4a8 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusargument.h @@ -0,0 +1,383 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSARGUMENT_H +#define QDBUSARGUMENT_H + +#include <QtCore/qbytearray.h> +#include <QtCore/qhash.h> +#include <QtCore/qglobal.h> +#include <QtCore/qlist.h> +#include <QtCore/qmap.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qvariant.h> +#include <QtDBus/qdbusextratypes.h> +#include <QtDBus/qdbusmacros.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusArgumentPrivate; +class QDBusDemarshaller; +class QDBusMarshaller; +class QDBUS_EXPORT QDBusArgument +{ +public: + enum ElementType { + BasicType, + VariantType, + ArrayType, + StructureType, + MapType, + MapEntryType, + UnknownType = -1 + }; + + QDBusArgument(); + QDBusArgument(const QDBusArgument &other); + QDBusArgument &operator=(const QDBusArgument &other); + ~QDBusArgument(); + + // used for marshalling (Qt -> D-BUS) + QDBusArgument &operator<<(uchar arg); + QDBusArgument &operator<<(bool arg); + QDBusArgument &operator<<(short arg); + QDBusArgument &operator<<(ushort arg); + QDBusArgument &operator<<(int arg); + QDBusArgument &operator<<(uint arg); + QDBusArgument &operator<<(qlonglong arg); + QDBusArgument &operator<<(qulonglong arg); + QDBusArgument &operator<<(double arg); + QDBusArgument &operator<<(const QString &arg); + QDBusArgument &operator<<(const QDBusVariant &arg); + QDBusArgument &operator<<(const QDBusObjectPath &arg); + QDBusArgument &operator<<(const QDBusSignature &arg); + QDBusArgument &operator<<(const QStringList &arg); + QDBusArgument &operator<<(const QByteArray &arg); + + void beginStructure(); + void endStructure(); + void beginArray(int elementMetaTypeId); + void endArray(); + void beginMap(int keyMetaTypeId, int valueMetaTypeId); + void endMap(); + void beginMapEntry(); + void endMapEntry(); + + void appendVariant(const QVariant &v); + + // used for de-marshalling (D-BUS -> Qt) + QString currentSignature() const; + ElementType currentType() const; + + const QDBusArgument &operator>>(uchar &arg) const; + const QDBusArgument &operator>>(bool &arg) const; + const QDBusArgument &operator>>(short &arg) const; + const QDBusArgument &operator>>(ushort &arg) const; + const QDBusArgument &operator>>(int &arg) const; + const QDBusArgument &operator>>(uint &arg) const; + const QDBusArgument &operator>>(qlonglong &arg) const; + const QDBusArgument &operator>>(qulonglong &arg) const; + const QDBusArgument &operator>>(double &arg) const; + const QDBusArgument &operator>>(QString &arg) const; + const QDBusArgument &operator>>(QDBusVariant &arg) const; + const QDBusArgument &operator>>(QDBusObjectPath &arg) const; + const QDBusArgument &operator>>(QDBusSignature &arg) const; + const QDBusArgument &operator>>(QStringList &arg) const; + const QDBusArgument &operator>>(QByteArray &arg) const; + + void beginStructure() const; + void endStructure() const; + void beginArray() const; + void endArray() const; + void beginMap() const; + void endMap() const; + void beginMapEntry() const; + void endMapEntry() const; + bool atEnd() const; + + QVariant asVariant() const; + +protected: + QDBusArgument(QDBusArgumentPrivate *d); + friend class QDBusArgumentPrivate; + mutable QDBusArgumentPrivate *d; +}; + +template<typename T> inline T qdbus_cast(const QDBusArgument &arg +#ifndef Q_QDOC +, T * = 0 +#endif + ) +{ + T item; + arg >> item; + return item; +} + +template<typename T> inline T qdbus_cast(const QVariant &v +#ifndef Q_QDOC +, T * = 0 +#endif + ) +{ + int id = v.userType(); + if (id == qMetaTypeId<QDBusArgument>()) + return qdbus_cast<T>(qvariant_cast<QDBusArgument>(v)); + else + return qvariant_cast<T>(v); +} + +// specialise for QVariant, allowing it to be used in place of QDBusVariant +template<> inline QVariant qdbus_cast<QVariant>(const QDBusArgument &arg, QVariant *) +{ + QDBusVariant item; + arg >> item; + return item.variant(); +} +template<> inline QVariant qdbus_cast<QVariant>(const QVariant &v, QVariant *) +{ + return qdbus_cast<QDBusVariant>(v).variant(); +} + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QVariant &v); + +// QVariant types +#ifndef QDBUS_NO_SPECIALTYPES + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QDate &date); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QDate &date); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QTime &time); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QTime &time); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QDateTime &dt); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QDateTime &dt); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QRect &rect); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QRect &rect); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QRectF &rect); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QRectF &rect); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QSize &size); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QSize &size); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QSizeF &size); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QSizeF &size); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QPoint &pt); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QPoint &pt); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QPointF &pt); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QPointF &pt); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QLine &line); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QLine &line); + +QDBUS_EXPORT const QDBusArgument &operator>>(const QDBusArgument &a, QLineF &line); +QDBUS_EXPORT QDBusArgument &operator<<(QDBusArgument &a, const QLineF &line); +#endif + +template<template <typename> class Container, typename T> +inline QDBusArgument &operator<<(QDBusArgument &arg, const Container<T> &list) +{ + int id = qMetaTypeId<T>(); + arg.beginArray(id); + typename Container<T>::const_iterator it = list.begin(); + typename Container<T>::const_iterator end = list.end(); + for ( ; it != end; ++it) + arg << *it; + arg.endArray(); + return arg; +} + +template<template <typename> class Container, typename T> +inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list) +{ + arg.beginArray(); + list.clear(); + while (!arg.atEnd()) { + T item; + arg >> item; + list.push_back(item); + } + + arg.endArray(); + return arg; +} + +// QList specializations +template<typename T> +inline QDBusArgument &operator<<(QDBusArgument &arg, const QList<T> &list) +{ + int id = qMetaTypeId<T>(); + arg.beginArray(id); + typename QList<T>::ConstIterator it = list.constBegin(); + typename QList<T>::ConstIterator end = list.constEnd(); + for ( ; it != end; ++it) + arg << *it; + arg.endArray(); + return arg; +} + +template<typename T> +inline const QDBusArgument &operator>>(const QDBusArgument &arg, QList<T> &list) +{ + arg.beginArray(); + list.clear(); + while (!arg.atEnd()) { + T item; + arg >> item; + list.push_back(item); + } + arg.endArray(); + + return arg; +} + +inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list) +{ + int id = qMetaTypeId<QDBusVariant>(); + arg.beginArray(id); + QVariantList::ConstIterator it = list.constBegin(); + QVariantList::ConstIterator end = list.constEnd(); + for ( ; it != end; ++it) + arg << QDBusVariant(*it); + arg.endArray(); + return arg; +} + +// QMap specializations +template<typename Key, typename T> +inline QDBusArgument &operator<<(QDBusArgument &arg, const QMap<Key, T> &map) +{ + int kid = qMetaTypeId<Key>(); + int vid = qMetaTypeId<T>(); + arg.beginMap(kid, vid); + typename QMap<Key, T>::ConstIterator it = map.constBegin(); + typename QMap<Key, T>::ConstIterator end = map.constEnd(); + for ( ; it != end; ++it) { + arg.beginMapEntry(); + arg << it.key() << it.value(); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + +template<typename Key, typename T> +inline const QDBusArgument &operator>>(const QDBusArgument &arg, QMap<Key, T> &map) +{ + arg.beginMap(); + map.clear(); + while (!arg.atEnd()) { + Key key; + T value; + arg.beginMapEntry(); + arg >> key >> value; + map.insertMulti(key, value); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + +inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map) +{ + arg.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>()); + QVariantMap::ConstIterator it = map.constBegin(); + QVariantMap::ConstIterator end = map.constEnd(); + for ( ; it != end; ++it) { + arg.beginMapEntry(); + arg << it.key() << QDBusVariant(it.value()); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + +// QHash specializations +template<typename Key, typename T> +inline QDBusArgument &operator<<(QDBusArgument &arg, const QHash<Key, T> &map) +{ + int kid = qMetaTypeId<Key>(); + int vid = qMetaTypeId<T>(); + arg.beginMap(kid, vid); + typename QHash<Key, T>::ConstIterator it = map.constBegin(); + typename QHash<Key, T>::ConstIterator end = map.constEnd(); + for ( ; it != end; ++it) { + arg.beginMapEntry(); + arg << it.key() << it.value(); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + +template<typename Key, typename T> +inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash<Key, T> &map) +{ + arg.beginMap(); + map.clear(); + while (!arg.atEnd()) { + Key key; + T value; + arg.beginMapEntry(); + arg >> key >> value; + map.insertMulti(key, value); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QDBusArgument) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusconnection.h b/qtinterface/qt4/Qt/qdbusconnection.h new file mode 100644 index 0000000..72551d1 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusconnection.h @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSCONNECTION_H +#define QDBUSCONNECTION_H + +#include <QtDBus/qdbusmacros.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +namespace QDBus +{ + enum CallMode { + NoBlock, + Block, + BlockWithGui, + AutoDetect + }; +} + +class QDBusAbstractInterfacePrivate; +class QDBusInterface; +class QDBusError; +class QDBusMessage; +class QDBusPendingCall; +class QDBusConnectionInterface; +class QObject; + +class QDBusConnectionPrivate; +class QDBUS_EXPORT QDBusConnection +{ + Q_GADGET + Q_ENUMS(BusType UnregisterMode) + Q_FLAGS(RegisterOptions) +public: + enum BusType { SessionBus, SystemBus, ActivationBus }; + enum RegisterOption { + ExportAdaptors = 0x01, + + ExportScriptableSlots = 0x10, + ExportScriptableSignals = 0x20, + ExportScriptableProperties = 0x40, + ExportScriptableContents = 0xf0, + + ExportNonScriptableSlots = 0x100, + ExportNonScriptableSignals = 0x200, + ExportNonScriptableProperties = 0x400, + ExportNonScriptableContents = 0xf00, + + ExportAllSlots = ExportScriptableSlots|ExportNonScriptableSlots, + ExportAllSignals = ExportScriptableSignals|ExportNonScriptableSignals, + ExportAllProperties = ExportScriptableProperties|ExportNonScriptableProperties, + ExportAllContents = ExportScriptableContents|ExportNonScriptableContents, + +#ifndef Q_QDOC + // Qt 4.2 had a misspelling here + ExportAllSignal = ExportAllSignals, +#endif + + ExportChildObjects = 0x1000 + }; + enum UnregisterMode { + UnregisterNode, + UnregisterTree + }; + + Q_DECLARE_FLAGS(RegisterOptions, RegisterOption) + + QDBusConnection(const QString &name); + QDBusConnection(const QDBusConnection &other); + ~QDBusConnection(); + + QDBusConnection &operator=(const QDBusConnection &other); + + bool isConnected() const; + QString baseService() const; + QDBusError lastError() const; + QString name() const; + + bool send(const QDBusMessage &message) const; + bool callWithCallback(const QDBusMessage &message, QObject *receiver, + const char *returnMethod, const char *errorMethod, + int timeout = -1) const; + bool callWithCallback(const QDBusMessage &message, QObject *receiver, + const char *slot, int timeout = -1) const; + QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode = QDBus::Block, + int timeout = -1) const; + QDBusPendingCall asyncCall(const QDBusMessage &message, int timeout = -1) const; + + bool connect(const QString &service, const QString &path, const QString &interface, + const QString &name, QObject *receiver, const char *slot); + bool connect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QString& signature, + QObject *receiver, const char *slot); + bool connect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QStringList &argumentMatch, const QString& signature, + QObject *receiver, const char *slot); + + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, QObject *receiver, const char *slot); + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QString& signature, + QObject *receiver, const char *slot); + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QStringList &argumentMatch, const QString& signature, + QObject *receiver, const char *slot); + + bool registerObject(const QString &path, QObject *object, + RegisterOptions options = ExportAdaptors); + void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode); + QObject *objectRegisteredAt(const QString &path) const; + + bool registerService(const QString &serviceName); + bool unregisterService(const QString &serviceName); + + QDBusConnectionInterface *interface() const; + + static QDBusConnection connectToBus(BusType type, const QString &name); + static QDBusConnection connectToBus(const QString &address, const QString &name); + static void disconnectFromBus(const QString &name); + + static QDBusConnection sessionBus(); + static QDBusConnection systemBus(); + + static QDBusConnection sender(); + +protected: + explicit QDBusConnection(QDBusConnectionPrivate *dd); + +private: + friend class QDBusConnectionPrivate; + QDBusConnectionPrivate *d; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusconnectioninterface.h b/qtinterface/qt4/Qt/qdbusconnectioninterface.h new file mode 100644 index 0000000..453046e --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusconnectioninterface.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSBUS_H +#define QDBUSBUS_H + +#include <QtCore/qstringlist.h> + +#include <QtDBus/qdbusabstractinterface.h> +#include <QtDBus/qdbusreply.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnection; +class QString; +class QByteArray; + +/* + * Proxy class for interface org.freedesktop.DBus + */ +class QDBUS_EXPORT QDBusConnectionInterface: public QDBusAbstractInterface +{ + Q_OBJECT + Q_ENUMS(ServiceQueueOptions ServiceReplacementOptions RegisterServiceReply) + friend class QDBusConnectionPrivate; + static inline const char *staticInterfaceName(); + + explicit QDBusConnectionInterface(const QDBusConnection &connection, QObject *parent); + ~QDBusConnectionInterface(); + + Q_PROPERTY(QDBusReply<QStringList> registeredServiceNames READ registeredServiceNames) + +public: + enum ServiceQueueOptions { + DontQueueService, + QueueService, + ReplaceExistingService + }; + enum ServiceReplacementOptions { + DontAllowReplacement, + AllowReplacement + }; + enum RegisterServiceReply { + ServiceNotRegistered = 0, + ServiceRegistered, + ServiceQueued + }; + +public Q_SLOTS: + QDBusReply<QStringList> registeredServiceNames() const; + QDBusReply<bool> isServiceRegistered(const QString &serviceName) const; + QDBusReply<QString> serviceOwner(const QString &name) const; + QDBusReply<bool> unregisterService(const QString &serviceName); + QDBusReply<QDBusConnectionInterface::RegisterServiceReply> registerService(const QString &serviceName, + ServiceQueueOptions qoption = DontQueueService, + ServiceReplacementOptions roption = DontAllowReplacement); + + QDBusReply<uint> servicePid(const QString &serviceName) const; + QDBusReply<uint> serviceUid(const QString &serviceName) const; + + QDBusReply<void> startService(const QString &name); + +Q_SIGNALS: + void serviceRegistered(const QString &service); + void serviceUnregistered(const QString &service); + void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); + void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &call); + +#ifndef Q_QDOC + // internal signals + // do not use + void NameAcquired(const QString &); + void NameLost(const QString &); + void NameOwnerChanged(const QString &, const QString &, const QString &); +protected: + void connectNotify(const char *); + void disconnectNotify(const char *); +#endif +}; + +QT_END_NAMESPACE + +Q_DECLARE_BUILTIN_METATYPE(QDBusConnectionInterface::RegisterServiceReply, UInt) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbuscontext.h b/qtinterface/qt4/Qt/qdbuscontext.h new file mode 100644 index 0000000..3f88ce2 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbuscontext.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSCONTEXT_H +#define QDBUSCONTEXT_H + +#include <QtCore/qstring.h> +#include <QtDBus/qdbuserror.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnection; +class QDBusMessage; + +class QDBusContextPrivate; +class QDBUS_EXPORT QDBusContext +{ +public: + QDBusContext(); + ~QDBusContext(); + + bool calledFromDBus() const; + QDBusConnection connection() const; + const QDBusMessage &message() const; + + // convenience methods + bool isDelayedReply() const; + // yes, they are const, so that you can use them even from const methods + void setDelayedReply(bool enable) const; + void sendErrorReply(const QString &name, const QString &msg = QString()) const; + void sendErrorReply(QDBusError::ErrorType type, const QString &msg = QString()) const; + +private: + QDBusContextPrivate *d_ptr; + friend class QDBusContextPrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbuserror.h b/qtinterface/qt4/Qt/qdbuserror.h new file mode 100644 index 0000000..03d2992 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbuserror.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSERROR_H +#define QDBUSERROR_H + +#include <QtDBus/qdbusmacros.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +struct DBusError; + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusMessage; + +class QDBUS_EXPORT QDBusError +{ +public: + enum ErrorType { + NoError = 0, + Other = 1, + Failed, + NoMemory, + ServiceUnknown, + NoReply, + BadAddress, + NotSupported, + LimitsExceeded, + AccessDenied, + NoServer, + Timeout, + NoNetwork, + AddressInUse, + Disconnected, + InvalidArgs, + UnknownMethod, + TimedOut, + InvalidSignature, + UnknownInterface, + InternalError, + UnknownObject, + InvalidService, + InvalidObjectPath, + InvalidInterface, + InvalidMember, + +#ifndef Q_QDOC + // don't use this one! + LastErrorType = InvalidMember +#endif + }; + + QDBusError(const DBusError *error = 0); + QDBusError(const QDBusMessage& msg); + QDBusError(ErrorType error, const QString &message); + QDBusError(const QDBusError &other); + QDBusError &operator=(const QDBusError &other); + + ErrorType type() const; + QString name() const; + QString message() const; + bool isValid() const; + + static QString errorString(ErrorType error); + +private: + ErrorType code; + QString msg; + QString nm; + void *unused; +}; + +#ifndef QT_NO_DEBUG_STREAM +QDBUS_EXPORT QDebug operator<<(QDebug, const QDBusError &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusextratypes.h b/qtinterface/qt4/Qt/qdbusextratypes.h new file mode 100644 index 0000000..c7ab2dc --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusextratypes.h @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSEXTRATYPES_H +#define QDBUSEXTRATYPES_H + +// define some useful types for D-BUS + +#include <QtCore/qvariant.h> +#include <QtCore/qstring.h> +#include <QtDBus/qdbusmacros.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +// defined in qhash.cpp +Q_CORE_EXPORT uint qHash(const QString &key); + +class QDBUS_EXPORT QDBusObjectPath : private QString +{ +public: + inline QDBusObjectPath() { } + + inline explicit QDBusObjectPath(const char *path); + inline explicit QDBusObjectPath(const QLatin1String &path); + inline explicit QDBusObjectPath(const QString &path); + inline QDBusObjectPath &operator=(const QDBusObjectPath &path); + + inline void setPath(const QString &path); + + inline QString path() const + { return *this; } + +private: + void check(); +}; + +inline QDBusObjectPath::QDBusObjectPath(const char *objectPath) + : QString(QString::fromLatin1(objectPath)) +{ check(); } + +inline QDBusObjectPath::QDBusObjectPath(const QLatin1String &objectPath) + : QString(objectPath) +{ check(); } + +inline QDBusObjectPath::QDBusObjectPath(const QString &objectPath) + : QString(objectPath) +{ check(); } + +inline QDBusObjectPath &QDBusObjectPath::operator=(const QDBusObjectPath &_path) +{ QString::operator=(_path); check(); return *this; } + +inline void QDBusObjectPath::setPath(const QString &objectPath) +{ QString::operator=(objectPath); check(); } + +inline bool operator==(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs) +{ return lhs.path() == rhs.path(); } + +inline bool operator!=(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs) +{ return lhs.path() != rhs.path(); } + +inline bool operator<(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs) +{ return lhs.path() < rhs.path(); } + +inline uint qHash(const QDBusObjectPath &objectPath) +{ return qHash(objectPath.path()); } + + +class QDBUS_EXPORT QDBusSignature : private QString +{ +public: + inline QDBusSignature() { } + + inline explicit QDBusSignature(const char *signature); + inline explicit QDBusSignature(const QLatin1String &signature); + inline explicit QDBusSignature(const QString &signature); + inline QDBusSignature &operator=(const QDBusSignature &signature); + + inline void setSignature(const QString &signature); + + inline QString signature() const + { return *this; } + +private: + void check(); +}; + +inline QDBusSignature::QDBusSignature(const char *dBusSignature) + : QString(QString::fromAscii(dBusSignature)) +{ check(); } + +inline QDBusSignature::QDBusSignature(const QLatin1String &dBusSignature) + : QString(dBusSignature) +{ check(); } + +inline QDBusSignature::QDBusSignature(const QString &dBusSignature) + : QString(dBusSignature) +{ check(); } + +inline QDBusSignature &QDBusSignature::operator=(const QDBusSignature &dbusSignature) +{ QString::operator=(dbusSignature); check(); return *this; } + +inline void QDBusSignature::setSignature(const QString &dBusSignature) +{ QString::operator=(dBusSignature); check(); } + +inline bool operator==(const QDBusSignature &lhs, const QDBusSignature &rhs) +{ return lhs.signature() == rhs.signature(); } + +inline bool operator!=(const QDBusSignature &lhs, const QDBusSignature &rhs) +{ return lhs.signature() != rhs.signature(); } + +inline bool operator<(const QDBusSignature &lhs, const QDBusSignature &rhs) +{ return lhs.signature() < rhs.signature(); } + +inline uint qHash(const QDBusSignature &signature) +{ return qHash(signature.signature()); } + +class QDBusVariant : private QVariant +{ +public: + inline QDBusVariant() { } + inline explicit QDBusVariant(const QVariant &variant); + + inline void setVariant(const QVariant &variant); + + inline QVariant variant() const + { return *this; } +}; + +inline QDBusVariant::QDBusVariant(const QVariant &dBusVariant) + : QVariant(dBusVariant) { } + +inline void QDBusVariant::setVariant(const QVariant &dBusVariant) +{ QVariant::operator=(dBusVariant); } + +inline bool operator==(const QDBusVariant &v1, const QDBusVariant &v2) +{ return v1.variant() == v2.variant(); } + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QDBusVariant) +Q_DECLARE_METATYPE(QDBusObjectPath) +Q_DECLARE_METATYPE(QList<QDBusObjectPath>) +Q_DECLARE_METATYPE(QDBusSignature) +Q_DECLARE_METATYPE(QList<QDBusSignature>) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusinterface.h b/qtinterface/qt4/Qt/qdbusinterface.h new file mode 100644 index 0000000..af68bdc --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusinterface.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSINTERFACE_H +#define QDBUSINTERFACE_H + +#include <QtDBus/qdbusabstractinterface.h> +#include <QtDBus/qdbusconnection.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusInterfacePrivate; +class QDBUS_EXPORT QDBusInterface: public QDBusAbstractInterface +{ + friend class QDBusConnection; +private: + QDBusInterface(QDBusInterfacePrivate *p); + +public: + QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(), + const QDBusConnection &connection = QDBusConnection::sessionBus(), + QObject *parent = 0); + ~QDBusInterface(); + + virtual const QMetaObject *metaObject() const; + virtual void *qt_metacast(const char *); + virtual int qt_metacall(QMetaObject::Call, int, void **); + +private: + Q_DECLARE_PRIVATE(QDBusInterface) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusmacros.h b/qtinterface/qt4/Qt/qdbusmacros.h new file mode 100644 index 0000000..6a5366d --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusmacros.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSMACROS_H +#define QDBUSMACROS_H + +#include <QtCore/qglobal.h> +#include <QtCore/qmetatype.h> +#include <QtCore/qvariant.h> + +#if defined(QDBUS_MAKEDLL) +# define QDBUS_EXPORT Q_DECL_EXPORT +#else +# define QDBUS_EXPORT Q_DECL_IMPORT +#endif + +#ifndef Q_MOC_RUN +# define Q_NOREPLY +#endif + +#ifdef Q_CC_MSVC +#include <QtCore/qlist.h> +#include <QtCore/qset.h> +#include <QtCore/qhash.h> +#include <QtCore/qvector.h> +#endif + +// prevent syncqt complaints +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE +QT_MODULE(DBus) +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusmessage.h b/qtinterface/qt4/Qt/qdbusmessage.h new file mode 100644 index 0000000..f215c30 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusmessage.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSMESSAGE_H +#define QDBUSMESSAGE_H + +#include <QtDBus/qdbusmacros.h> +#include <QtDBus/qdbuserror.h> +#include <QtCore/qlist.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusMessagePrivate; +class QDBUS_EXPORT QDBusMessage +{ +public: + enum MessageType { + InvalidMessage, + MethodCallMessage, + ReplyMessage, + ErrorMessage, + SignalMessage + }; + + QDBusMessage(); + QDBusMessage(const QDBusMessage &other); + QDBusMessage &operator=(const QDBusMessage &other); + ~QDBusMessage(); + + static QDBusMessage createSignal(const QString &path, const QString &interface, + const QString &name); + static QDBusMessage createMethodCall(const QString &destination, const QString &path, + const QString &interface, const QString &method); + static QDBusMessage createError(const QString &name, const QString &msg); + static inline QDBusMessage createError(const QDBusError &err) + { return createError(err.name(), err.message()); } + static inline QDBusMessage createError(QDBusError::ErrorType type, const QString &msg) + { return createError(QDBusError::errorString(type), msg); } + + QDBusMessage createReply(const QList<QVariant> &arguments = QList<QVariant>()) const; + inline QDBusMessage createReply(const QVariant &argument) const + { return createReply(QList<QVariant>() << argument); } + + QDBusMessage createErrorReply(const QString name, const QString &msg) const; + inline QDBusMessage createErrorReply(const QDBusError &err) const + { return createErrorReply(err.name(), err.message()); } + QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const; + + // there are no setters; if this changes, see qdbusmessage_p.h + QString service() const; + QString path() const; + QString interface() const; + QString member() const; + QString errorName() const; + QString errorMessage() const; + MessageType type() const; + QString signature() const; + + bool isReplyRequired() const; + + void setDelayedReply(bool enable) const; + bool isDelayedReply() const; + + void setArguments(const QList<QVariant> &arguments); + QList<QVariant> arguments() const; + + QDBusMessage &operator<<(const QVariant &arg); + +private: + friend class QDBusMessagePrivate; + QDBusMessagePrivate *d_ptr; +}; + +#ifndef QT_NO_DEBUG_STREAM +QDBUS_EXPORT QDebug operator<<(QDebug, const QDBusMessage &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qdbusmetatype.h b/qtinterface/qt4/Qt/qdbusmetatype.h new file mode 100644 index 0000000..978618f --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusmetatype.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSMETATYPE_H +#define QDBUSMETATYPE_H + +#include "QtCore/qmetatype.h" +#include <QtDBus/qdbusargument.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBUS_EXPORT QDBusMetaType +{ +public: + typedef void (*MarshallFunction)(QDBusArgument &, const void *); + typedef void (*DemarshallFunction)(const QDBusArgument &, void *); + + static void registerMarshallOperators(int typeId, MarshallFunction, DemarshallFunction); + static bool marshall(QDBusArgument &, int id, const void *data); + static bool demarshall(const QDBusArgument &, int id, void *data); + + static int signatureToType(const char *signature); + static const char *typeToSignature(int type); +}; + +template<typename T> +void qDBusMarshallHelper(QDBusArgument &arg, const T *t) +{ arg << *t; } + +template<typename T> +void qDBusDemarshallHelper(const QDBusArgument &arg, T *t) +{ arg >> *t; } + +template<typename T> +int qDBusRegisterMetaType( +#ifndef qdoc + T * /* dummy */ = 0 +#endif +) +{ + void (*mf)(QDBusArgument &, const T *) = qDBusMarshallHelper<T>; + void (*df)(const QDBusArgument &, T *) = qDBusDemarshallHelper<T>; + + int id = qRegisterMetaType<T>(); // make sure it's registered + QDBusMetaType::registerMarshallOperators(id, + reinterpret_cast<QDBusMetaType::MarshallFunction>(mf), + reinterpret_cast<QDBusMetaType::DemarshallFunction>(df)); + return id; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbuspendingcall.h b/qtinterface/qt4/Qt/qdbuspendingcall.h new file mode 100644 index 0000000..bf6350a --- /dev/null +++ b/qtinterface/qt4/Qt/qdbuspendingcall.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSPENDINGCALL_H +#define QDBUSPENDINGCALL_H + +#include <QtCore/qglobal.h> +#include <QtCore/qobject.h> +#include <QtCore/qshareddata.h> + +#include <QtDBus/qdbusmacros.h> +#include <QtDBus/qdbusmessage.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnection; +class QDBusError; +class QDBusPendingCallWatcher; + +class QDBusPendingCallPrivate; +class QDBUS_EXPORT QDBusPendingCall +{ +public: + QDBusPendingCall(const QDBusPendingCall &other); + ~QDBusPendingCall(); + QDBusPendingCall &operator=(const QDBusPendingCall &other); + +#ifndef Q_QDOC + // pretend that they aren't here + bool isFinished() const; + void waitForFinished(); + + bool isError() const; + bool isValid() const; + QDBusError error() const; + QDBusMessage reply() const; +#endif + + static QDBusPendingCall fromError(const QDBusError &error); + static QDBusPendingCall fromCompletedCall(const QDBusMessage &message); + +protected: + QExplicitlySharedDataPointer<QDBusPendingCallPrivate> d; + friend class QDBusPendingCallPrivate; + friend class QDBusPendingCallWatcher; + friend class QDBusConnection; + + QDBusPendingCall(QDBusPendingCallPrivate *dd); + +private: + QDBusPendingCall(); // not defined +}; + +class QDBusPendingCallWatcherPrivate; +class QDBUS_EXPORT QDBusPendingCallWatcher: public QObject, public QDBusPendingCall +{ + Q_OBJECT +public: + QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent = 0); + ~QDBusPendingCallWatcher(); + +#ifdef Q_QDOC + // trick qdoc into thinking this method is here + bool isFinished() const; +#endif + void waitForFinished(); // non-virtual override + +Q_SIGNALS: + void finished(QDBusPendingCallWatcher *self); + +private: + Q_DECLARE_PRIVATE(QDBusPendingCallWatcher) + Q_PRIVATE_SLOT(d_func(), void _q_finished()) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbuspendingreply.h b/qtinterface/qt4/Qt/qdbuspendingreply.h new file mode 100644 index 0000000..1c4e6ee --- /dev/null +++ b/qtinterface/qt4/Qt/qdbuspendingreply.h @@ -0,0 +1,214 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSPENDINGREPLY_H +#define QDBUSPENDINGREPLY_H + +#include <QtCore/qglobal.h> +#include <QtDBus/qdbusmacros.h> +#include <QtDBus/qdbusargument.h> +#include <QtDBus/qdbuspendingcall.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBUS_EXPORT QDBusPendingReplyData: public QDBusPendingCall +{ +protected: + QDBusPendingReplyData(); + ~QDBusPendingReplyData(); + void assign(const QDBusPendingCall &call); + void assign(const QDBusMessage &message); + + QVariant argumentAt(int index) const; + void setMetaTypes(int count, const int *metaTypes); +}; + +namespace QDBusPendingReplyTypes { + template<int Index, + typename T1, typename T2, typename T3, typename T4, + typename T5, typename T6, typename T7, typename T8> + struct Select + { + typedef Select<Index - 1, T2, T3, T4, T5, T6, T7, T8, void> Next; + typedef typename Next::Type Type; + }; + template<typename T1, typename T2, typename T3, typename T4, + typename T5, typename T6, typename T7, typename T8> + struct Select<0, T1, T2, T3, T4, T5, T6, T7, T8> + { + typedef T1 Type; + }; + + template<typename T1> inline int metaTypeFor(T1 * = 0) + { return qMetaTypeId<T1>(); } + // specialise for QVariant, allowing it to be used in place of QDBusVariant + template<> inline int metaTypeFor<QVariant>(QVariant *) + { return qMetaTypeId<QDBusVariant>(); } + + template<typename T1, typename T2, typename T3, typename T4, + typename T5, typename T6, typename T7, typename T8> + struct ForEach + { + typedef ForEach<T2, T3, T4, T5, T6, T7, T8, void> Next; + enum { Total = Next::Total + 1 }; + static inline void fillMetaTypes(int *p) + { + *p = metaTypeFor<T1>(0); + Next::fillMetaTypes(++p); + } + }; + template<> + struct ForEach<void, void, void, void, void, void, void, void> + { + enum { Total = 0 }; + static inline void fillMetaTypes(int *) + { } + }; +} // namespace QDBusPendingReplyTypes + +template<typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void, + typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void> +class QDBusPendingReply: +#ifdef Q_QDOC + public QDBusPendingCall +#else + public QDBusPendingReplyData +#endif +{ + typedef QDBusPendingReplyTypes::ForEach<T1, T2, T3, T4, T5, T6, T7, T8> ForEach; + template<int Index> struct Select : + QDBusPendingReplyTypes::Select<Index, T1, T2, T3, T4, T5, T6, T7, T8> + { + }; + +public: + enum { Count = ForEach::Total }; + + inline QDBusPendingReply() + { } + inline QDBusPendingReply(const QDBusPendingReply &other) + : QDBusPendingReplyData(other) + { } + inline QDBusPendingReply(const QDBusPendingCall &call) + { *this = call; } + inline QDBusPendingReply(const QDBusMessage &message) + { *this = message; } + inline QDBusPendingReply &operator=(const QDBusPendingReply &other) + { assign(other); return *this; } + inline QDBusPendingReply &operator=(const QDBusPendingCall &call) + { assign(call); return *this; } + inline QDBusPendingReply &operator=(const QDBusMessage &message) + { assign(message); return *this; } + + inline int count() const { return Count; } + +#if defined(Q_QDOC) || defined(Q_NO_USING_KEYWORD) + inline QVariant argumentAt(int index) const + { return QDBusPendingReplyData::argumentAt(index); } +#else + using QDBusPendingReplyData::argumentAt; +#endif + +#if defined(Q_QDOC) + bool isFinished() const; + void waitForFinished(); + + bool isValid() const; + bool isError() const; + QDBusError error() const; + QDBusMessage reply() const; + + template<int Index> inline Type argumentAt() const; + inline T1 value() const; + inline operator T1() const; +#else + template<int Index> inline + const typename Select<Index>::Type argumentAt() const + { + // static assert? + Q_ASSERT_X(Index < count() && Index >= 0, "QDBusPendingReply::argumentAt", + "Index out of bounds"); + typedef typename Select<Index>::Type ResultType; + return qdbus_cast<ResultType>(argumentAt(Index), 0); + } + + inline typename Select<0>::Type value() const + { + return argumentAt<0>(); + } + + inline operator typename Select<0>::Type() const + { + return argumentAt<0>(); + } +#endif + +private: + inline void calculateMetaTypes() + { + if (!d) return; + int typeIds[Count > 0 ? Count : 1]; // use at least one since zero-sized arrays aren't valid + ForEach::fillMetaTypes(typeIds); + setMetaTypes(Count, typeIds); + } + + inline void assign(const QDBusPendingCall &call) + { + QDBusPendingReplyData::assign(call); + calculateMetaTypes(); + } + + inline void assign(const QDBusMessage &message) + { + QDBusPendingReplyData::assign(message); + calculateMetaTypes(); + } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusreply.h b/qtinterface/qt4/Qt/qdbusreply.h new file mode 100644 index 0000000..7d26a7c --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusreply.h @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSREPLY_H +#define QDBUSREPLY_H + +#include <QtCore/qglobal.h> +#include <QtCore/qvariant.h> + +#include <QtDBus/qdbusmacros.h> +#include <QtDBus/qdbusmessage.h> +#include <QtDBus/qdbuserror.h> +#include <QtDBus/qdbusextratypes.h> +#include <QtDBus/qdbuspendingreply.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +QDBUS_EXPORT void qDBusReplyFill(const QDBusMessage &reply, QDBusError &error, QVariant &data); + +template<typename T> +class QDBusReply +{ + typedef T Type; +public: + inline QDBusReply(const QDBusMessage &reply) + { + *this = reply; + } + inline QDBusReply& operator=(const QDBusMessage &reply) + { + QVariant data(qMetaTypeId(&m_data), reinterpret_cast<void*>(0)); + qDBusReplyFill(reply, m_error, data); + m_data = qvariant_cast<Type>(data); + return *this; + } + + inline QDBusReply(const QDBusPendingCall &pcall) + { + *this = pcall; + } + inline QDBusReply &operator=(const QDBusPendingCall &pcall) + { + QDBusPendingCall other(pcall); + other.waitForFinished(); + return *this = other.reply(); + } + inline QDBusReply(const QDBusPendingReply<T> &reply) + { + *this = static_cast<QDBusPendingCall>(reply); + } + + inline QDBusReply(const QDBusError &dbusError = QDBusError()) + : m_error(dbusError), m_data(Type()) + { + } + inline QDBusReply& operator=(const QDBusError& dbusError) + { + m_error = dbusError; + m_data = Type(); + return *this; + } + + inline QDBusReply& operator=(const QDBusReply& other) + { + m_error = other.m_error; + m_data = other.m_data; + return *this; + } + + inline bool isValid() const { return !m_error.isValid(); } + + inline const QDBusError& error() { return m_error; } + + inline Type value() const + { + return m_data; + } + + inline operator Type () const + { + return m_data; + } + +private: + QDBusError m_error; + Type m_data; +}; + +# ifndef Q_QDOC +// specialize for QVariant: +template<> inline QDBusReply<QVariant>& +QDBusReply<QVariant>::operator=(const QDBusMessage &reply) +{ + void *null = 0; + QVariant data(qMetaTypeId<QDBusVariant>(), null); + qDBusReplyFill(reply, m_error, data); + m_data = qvariant_cast<QDBusVariant>(data).variant(); + return *this; +} + +// specialize for void: +template<> +class QDBusReply<void> +{ +public: + inline QDBusReply(const QDBusMessage &reply) + : m_error(reply) + { + } + inline QDBusReply& operator=(const QDBusMessage &reply) + { + m_error = reply; + return *this; + } + inline QDBusReply(const QDBusError &dbusError = QDBusError()) + : m_error(dbusError) + { + } + inline QDBusReply(const QDBusPendingCall &pcall) + { + *this = pcall; + } + inline QDBusReply &operator=(const QDBusPendingCall &pcall) + { + QDBusPendingCall other(pcall); + other.waitForFinished(); + return *this = other.reply(); + } + inline QDBusReply& operator=(const QDBusError& dbusError) + { + m_error = dbusError; + return *this; + } + + inline QDBusReply& operator=(const QDBusReply& other) + { + m_error = other.m_error; + return *this; + } + + inline bool isValid() const { return !m_error.isValid(); } + + inline const QDBusError& error() { return m_error; } + +private: + QDBusError m_error; +}; +# endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusserver.h b/qtinterface/qt4/Qt/qdbusserver.h new file mode 100644 index 0000000..e89d024 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusserver.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QDBUSSERVER_H +#define QDBUSSERVER_H + +#include <QtCore/qobject.h> +#include <QtCore/qstring.h> +#include <QtDBus/qdbusmacros.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnectionPrivate; +class QDBusError; +class QDBusConnection; + +class QDBUS_EXPORT QDBusServer: public QObject +{ + Q_OBJECT +public: + QDBusServer(const QString &address, QObject *parent = 0); + + bool isConnected() const; + QDBusError lastError() const; + QString address() const; + +Q_SIGNALS: + void newConnection(const QDBusConnection &connection); + +private: + Q_DISABLE_COPY(QDBusServer) + QDBusConnectionPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdbusservicewatcher.h b/qtinterface/qt4/Qt/qdbusservicewatcher.h new file mode 100644 index 0000000..34bb254 --- /dev/null +++ b/qtinterface/qt4/Qt/qdbusservicewatcher.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSSERVICEWATCHER_H +#define QDBUSSERVICEWATCHER_H + +#include <QtCore/qobject.h> +#include <QtDBus/qdbusmacros.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnection; + +class QDBusServiceWatcherPrivate; +class QDBUS_EXPORT QDBusServiceWatcher: public QObject +{ + Q_OBJECT + Q_PROPERTY(QStringList watchedServices READ watchedServices WRITE setWatchedServices) + Q_PROPERTY(WatchMode watchMode READ watchMode WRITE setWatchMode) +public: + enum WatchModeFlag { + WatchForRegistration = 0x01, + WatchForUnregistration = 0x02, + WatchForOwnerChange = 0x03 + }; + Q_DECLARE_FLAGS(WatchMode, WatchModeFlag) + + explicit QDBusServiceWatcher(QObject *parent = 0); + QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, + WatchMode watchMode = WatchForOwnerChange, QObject *parent = 0); + ~QDBusServiceWatcher(); + + QStringList watchedServices() const; + void setWatchedServices(const QStringList &services); + void addWatchedService(const QString &newService); + bool removeWatchedService(const QString &service); + + WatchMode watchMode() const; + void setWatchMode(WatchMode mode); + + QDBusConnection connection() const; + void setConnection(const QDBusConnection &connection); + +Q_SIGNALS: + void serviceRegistered(const QString &service); + void serviceUnregistered(const QString &service); + void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString)) + Q_DISABLE_COPY(QDBusServiceWatcher) + Q_DECLARE_PRIVATE(QDBusServiceWatcher) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusServiceWatcher::WatchMode) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDBUSSERVICEWATCHER_H diff --git a/qtinterface/qt4/Qt/qdebug.h b/qtinterface/qt4/Qt/qdebug.h new file mode 100644 index 0000000..d788589 --- /dev/null +++ b/qtinterface/qt4/Qt/qdebug.h @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDEBUG_H +#define QDEBUG_H + +#include <QtCore/qalgorithms.h> +#include <QtCore/qhash.h> +#include <QtCore/qlist.h> +#include <QtCore/qmap.h> +#include <QtCore/qpair.h> +#include <QtCore/qtextstream.h> +#include <QtCore/qstring.h> +#include <QtCore/qvector.h> +#include <QtCore/qset.h> +#include <QtCore/qcontiguouscache.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QDebug +{ + struct Stream { + Stream(QIODevice *device) : ts(device), ref(1), type(QtDebugMsg), space(true), message_output(false) {} + Stream(QString *string) : ts(string, QIODevice::WriteOnly), ref(1), type(QtDebugMsg), space(true), message_output(false) {} + Stream(QtMsgType t) : ts(&buffer, QIODevice::WriteOnly), ref(1), type(t), space(true), message_output(true) {} + QTextStream ts; + QString buffer; + int ref; + QtMsgType type; + bool space; + bool message_output; + } *stream; +public: + inline QDebug(QIODevice *device) : stream(new Stream(device)) {} + inline QDebug(QString *string) : stream(new Stream(string)) {} + inline QDebug(QtMsgType t) : stream(new Stream(t)) {} + inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; } + inline QDebug &operator=(const QDebug &other); + inline ~QDebug() { + if (!--stream->ref) { + if(stream->message_output) { + QT_TRY { + qt_message_output(stream->type, stream->buffer.toLocal8Bit().data()); + } QT_CATCH(std::bad_alloc&) { /* We're out of memory - give up. */ } + } + delete stream; + } + } + inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; } + inline QDebug &nospace() { stream->space = false; return *this; } + inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; } + + inline QDebug &operator<<(QChar t) { stream->ts << '\'' << t << '\''; return maybeSpace(); } + inline QDebug &operator<<(QBool t) { stream->ts << (bool(t != 0) ? "true" : "false"); return maybeSpace(); } + inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); } + inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(unsigned short t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(signed int t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(qint64 t) + { stream->ts << QString::number(t); return maybeSpace(); } + inline QDebug &operator<<(quint64 t) + { stream->ts << QString::number(t); return maybeSpace(); } + inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(const char* t) { stream->ts << QString::fromAscii(t); return maybeSpace(); } + inline QDebug &operator<<(const QString & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); } + inline QDebug &operator<<(const QStringRef & t) { return operator<<(t.toString()); } + inline QDebug &operator<<(const QLatin1String &t) { stream->ts << '\"' << t.latin1() << '\"'; return maybeSpace(); } + inline QDebug &operator<<(const QByteArray & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); } + inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(QTextStreamFunction f) { + stream->ts << f; + return *this; + } + + inline QDebug &operator<<(QTextStreamManipulator m) + { stream->ts << m; return *this; } +}; + +class QNoDebug +{ +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; } + +#ifndef QT_NO_MEMBER_TEMPLATES + template<typename T> + inline QNoDebug &operator<<(const T &) { return *this; } +#endif +}; + +Q_CORE_EXPORT_INLINE QDebug qCritical() { return QDebug(QtCriticalMsg); } + +inline QDebug &QDebug::operator=(const QDebug &other) +{ + if (this != &other) { + QDebug copy(other); + qSwap(stream, copy.stream); + } + return *this; +} + +#if defined(FORCE_UREF) +template <class T> +inline QDebug &operator<<(QDebug debug, const QList<T> &list) +#else +template <class T> +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) { + if (i) + debug << ", "; + debug << list.at(i); + } + debug << ')'; + return debug.space(); +} + +#if defined(FORCE_UREF) +template <typename T> +inline QDebug &operator<<(QDebug debug, const QVector<T> &vec) +#else +template <typename T> +inline QDebug operator<<(QDebug debug, const QVector<T> &vec) +#endif +{ + debug.nospace() << "QVector"; + return operator<<(debug, vec.toList()); +} + +#if defined(FORCE_UREF) +template <class aKey, class aT> +inline QDebug &operator<<(QDebug debug, const QMap<aKey, aT> &map) +#else +template <class aKey, class aT> +inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map) +#endif +{ + debug.nospace() << "QMap("; + for (typename QMap<aKey, aT>::const_iterator it = map.constBegin(); + it != map.constEnd(); ++it) { + debug << '(' << it.key() << ", " << it.value() << ')'; + } + debug << ')'; + return debug.space(); +} + +#if defined(FORCE_UREF) +template <class aKey, class aT> +inline QDebug &operator<<(QDebug debug, const QHash<aKey, aT> &hash) +#else +template <class aKey, class aT> +inline QDebug operator<<(QDebug debug, const QHash<aKey, aT> &hash) +#endif +{ + debug.nospace() << "QHash("; + for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin(); + it != hash.constEnd(); ++it) + debug << '(' << it.key() << ", " << it.value() << ')'; + debug << ')'; + return debug.space(); +} + +#if defined(FORCE_UREF) +template <class T1, class T2> +inline QDebug &operator<<(QDebug debug, const QPair<T1, T2> &pair) +#else +template <class T1, class T2> +inline QDebug operator<<(QDebug debug, const QPair<T1, T2> &pair) +#endif +{ + debug.nospace() << "QPair(" << pair.first << ',' << pair.second << ')'; + return debug.space(); +} + +template <typename T> +inline QDebug operator<<(QDebug debug, const QSet<T> &set) +{ + debug.nospace() << "QSet"; + return operator<<(debug, set.toList()); +} + +#if defined(FORCE_UREF) +template <class T> +inline QDebug &operator<<(QDebug debug, const QContiguousCache<T> &cache) +#else +template <class T> +inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache) +#endif +{ + debug.nospace() << "QContiguousCache("; + for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) { + debug << cache[i]; + if (i != cache.lastIndex()) + debug << ", "; + } + debug << ')'; + return debug.space(); +} + +#if !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); } + +#else // QT_NO_DEBUG_STREAM +#undef qDebug +inline QNoDebug qDebug() { return QNoDebug(); } +#define qDebug QT_NO_QDEBUG_MACRO + +#ifdef QT_NO_MEMBER_TEMPLATES +template<typename T> +inline QNoDebug operator<<(QNoDebug debug, const T &) { return debug; } +#endif + +#endif + +#if !defined(QT_NO_WARNING_OUTPUT) +Q_CORE_EXPORT_INLINE QDebug qWarning() { return QDebug(QtWarningMsg); } +#else +#undef qWarning +inline QNoDebug qWarning() { return QNoDebug(); } +#define qWarning QT_NO_QWARNING_MACRO +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDEBUG_H diff --git a/qtinterface/qt4/Qt/qdecoration_qws.h b/qtinterface/qt4/Qt/qdecoration_qws.h new file mode 100644 index 0000000..75911ec --- /dev/null +++ b/qtinterface/qt4/Qt/qdecoration_qws.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECORATION_QWS_H +#define QDECORATION_QWS_H + +#include <QtGui/qregion.h> +#include <QtGui/qwidget.h> +#include <QtGui/qaction.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPopupMenu; +class QMenu; + +#ifndef QT_NO_ACTION +class QDecorationAction : public QAction +{ +public: + QDecorationAction(const QString &text, QObject* parent, int region) + : QAction(text, parent), reg(region) {} + int reg; +}; +#endif // QT_NO_ACTION + +/* + Implements decoration styles +*/ +class Q_GUI_EXPORT QDecoration +{ +public: + QDecoration() {} + virtual ~QDecoration() {} + + /* AABBBBBBBBBBCC Items in DecorationRegion: + AijjjjjjjklmnC + A C A = TopLeft B = Top C = TopRight + D E D = Left E = Right + D E F = BottomLeft H = Bottom G = BottomRight + F G i = Menu j = Title k = Help + FFHHHHHHHHHHGG l = Minimize m = Maximize n = Close + + */ + + enum DecorationRegion { + None = 0x0000000000, All = 0x7fffffff, + TopLeft = 0x0000000001, Top = 0x0000000002, TopRight = 0x0000000004, + Left = 0x0000000008, Right = 0x0000000010, + BottomLeft = 0x0000000020, Bottom = 0x0000000040, BottomRight = 0x0000000080, + Borders = 0x00000000ff, + Menu = 0x0000000100, Title = 0x0000000200, Help = 0x0000000400, + Minimize = 0x0000000800, Maximize = 0x0000001000, Normalize = 0x0000002000, + Close = 0x0000004000, Move = 0x0000008000, Resize = 0x0000010000 + }; + + enum DecorationState { Normal = 0x04, Disabled = 0x08, Hover = 0x01, Pressed = 0x02 }; + + virtual QRegion region(const QWidget *w, const QRect &rect, int decorationRegion = All ) = 0; + QRegion region(const QWidget *w, int decorationRegion = All ) + { return region(w, w->rect(), decorationRegion); } + virtual int regionAt(const QWidget *w, const QPoint &point); + + virtual void regionClicked(QWidget *widget, int region); + virtual void regionDoubleClicked(QWidget *widget, int region); +#ifndef QT_NO_MENU + virtual void buildSysMenu(QWidget *widget, QMenu *menu); + void menuTriggered(QWidget *widget, QAction *action); +#endif + + static void startMove(QWidget *widget); + static void startResize(QWidget *widget); + + virtual bool paint(QPainter *p, const QWidget *w, int decorationRegion = All, + DecorationState state = Normal) = 0; + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECORATION_QWS_H diff --git a/qtinterface/qt4/Qt/qdecorationdefault_qws.h b/qtinterface/qt4/Qt/qdecorationdefault_qws.h new file mode 100644 index 0000000..17a4fae --- /dev/null +++ b/qtinterface/qt4/Qt/qdecorationdefault_qws.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECORATIONDEFAULT_QWS_H +#define QDECORATIONDEFAULT_QWS_H + +#include <QtGui/qdecoration_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_QWS_DECORATION_DEFAULT) || defined(QT_PLUGIN) + +#define CORNER_GRAB 16 +#define BORDER_WIDTH 4 +#define BOTTOM_BORDER_WIDTH BORDER_WIDTH + +class Q_GUI_EXPORT QDecorationDefault : public QDecoration +{ +public: + QDecorationDefault(); + virtual ~QDecorationDefault(); + + virtual QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All); + virtual bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All, + DecorationState state = Normal); + +protected: + virtual int titleBarHeight(const QWidget *widget); + + virtual void paintButton(QPainter *painter, const QWidget *widget, int buttonRegion, + DecorationState state, const QPalette &pal); + virtual QPixmap pixmapFor(const QWidget *widget, int decorationRegion, int &xoff, int &yoff); + virtual const char **xpmForRegion(int region); + + QString windowTitleFor(const QWidget *widget) const; + + int menu_width; + int help_width; + int close_width; + int minimize_width; + int maximize_width; + int normalize_width; + +private: + static QPixmap *staticHelpPixmap; + static QPixmap *staticMenuPixmap; + static QPixmap *staticClosePixmap; + static QPixmap *staticMinimizePixmap; + static QPixmap *staticMaximizePixmap; + static QPixmap *staticNormalizePixmap; + +}; + + +QT_END_NAMESPACE +#endif // QT_NO_QWS_DECORATION_DEFAULT +QT_END_HEADER + +#endif // QDECORATIONDEFAULT_QWS_H diff --git a/qtinterface/qt4/Qt/qdecorationfactory_qws.h b/qtinterface/qt4/Qt/qdecorationfactory_qws.h new file mode 100644 index 0000000..e372cf4 --- /dev/null +++ b/qtinterface/qt4/Qt/qdecorationfactory_qws.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECORATIONFACTORY_QWS_H +#define QDECORATIONFACTORY_QWS_H + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QDecoration; + +class Q_GUI_EXPORT QDecorationFactory +{ +public: + static QStringList keys(); + static QDecoration *create(const QString&); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECORATIONFACTORY_QWS_H diff --git a/qtinterface/qt4/Qt/qdecorationplugin_qws.h b/qtinterface/qt4/Qt/qdecorationplugin_qws.h new file mode 100644 index 0000000..fafd94c --- /dev/null +++ b/qtinterface/qt4/Qt/qdecorationplugin_qws.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECORATIONPLUGIN_QWS_H +#define QDECORATIONPLUGIN_QWS_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QDecoration; + +struct Q_GUI_EXPORT QDecorationFactoryInterface : public QFactoryInterface +{ + virtual QDecoration *create(const QString &key) = 0; +}; + +#define QDecorationFactoryInterface_iid "com.trolltech.Qt.QDecorationFactoryInterface" +Q_DECLARE_INTERFACE(QDecorationFactoryInterface, QDecorationFactoryInterface_iid) + +class Q_GUI_EXPORT QDecorationPlugin : public QObject, public QDecorationFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QDecorationFactoryInterface:QFactoryInterface) + public: + explicit QDecorationPlugin(QObject *parent = 0); + ~QDecorationPlugin(); + + virtual QStringList keys() const = 0; + virtual QDecoration *create(const QString &key) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECORATIONPLUGIN_QWS_H diff --git a/qtinterface/qt4/Qt/qdecorationstyled_qws.h b/qtinterface/qt4/Qt/qdecorationstyled_qws.h new file mode 100644 index 0000000..fdcf61f --- /dev/null +++ b/qtinterface/qt4/Qt/qdecorationstyled_qws.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECORATIONSTYLED_QWS_H +#define QDECORATIONSTYLED_QWS_H + +#include <QtGui/qdecorationdefault_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_QWS_DECORATION_STYLED) || defined(QT_PLUGIN) + +class Q_GUI_EXPORT QDecorationStyled : public QDecorationDefault +{ +public: + QDecorationStyled(); + virtual ~QDecorationStyled(); + + QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All); + bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All, + DecorationState state = Normal); + int titleBarHeight(const QWidget *widget); +}; + +#endif // QT_NO_QWS_DECORATION_STYLED + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECORATIONSTYLED_QWS_H diff --git a/qtinterface/qt4/Qt/qdecorationwindows_qws.h b/qtinterface/qt4/Qt/qdecorationwindows_qws.h new file mode 100644 index 0000000..a8fbea7 --- /dev/null +++ b/qtinterface/qt4/Qt/qdecorationwindows_qws.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECORATIONWINDOWS_QWS_H +#define QDECORATIONWINDOWS_QWS_H + +#include <QtGui/qdecorationdefault_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_QWS_DECORATION_WINDOWS) || defined(QT_PLUGIN) + +class Q_GUI_EXPORT QDecorationWindows : public QDecorationDefault +{ +public: + QDecorationWindows(); + virtual ~QDecorationWindows(); + + QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All); + bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All, + DecorationState state = Normal); + +protected: + void paintButton(QPainter *painter, const QWidget *widget, int buttonRegion, + DecorationState state, const QPalette &pal); + const char **xpmForRegion(int reg); +}; + +#endif // QT_NO_QWS_DECORATION_WINDOWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECORATIONWINDOWS_QWS_H diff --git a/qtinterface/qt4/Qt/qdesktopservices.h b/qtinterface/qt4/Qt/qdesktopservices.h new file mode 100644 index 0000000..74d6a8d --- /dev/null +++ b/qtinterface/qt4/Qt/qdesktopservices.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDESKTOPSERVICES_H +#define QDESKTOPSERVICES_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DESKTOPSERVICES + +class QStringList; +class QUrl; +class QObject; + +class Q_GUI_EXPORT QDesktopServices +{ +public: + static bool openUrl(const QUrl &url); + static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method); + static void unsetUrlHandler(const QString &scheme); + + enum StandardLocation { + DesktopLocation, + DocumentsLocation, + FontsLocation, + ApplicationsLocation, + MusicLocation, + MoviesLocation, + PicturesLocation, + TempLocation, + HomeLocation, + DataLocation, + CacheLocation + }; + + static QString storageLocation(StandardLocation type); + static QString displayName(StandardLocation type); +}; + +#endif // QT_NO_DESKTOPSERVICES + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDESKTOPSERVICES_H + diff --git a/qtinterface/qt4/Qt/qdesktopwidget.h b/qtinterface/qt4/Qt/qdesktopwidget.h new file mode 100644 index 0000000..e8673ab --- /dev/null +++ b/qtinterface/qt4/Qt/qdesktopwidget.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDESKTOPWIDGET_H +#define QDESKTOPWIDGET_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QApplication; +class QDesktopWidgetPrivate; + +class Q_GUI_EXPORT QDesktopWidget : public QWidget +{ + Q_OBJECT + Q_PROPERTY(bool virtualDesktop READ isVirtualDesktop) + Q_PROPERTY(int screenCount READ screenCount NOTIFY screenCountChanged) + Q_PROPERTY(int primaryScreen READ primaryScreen) +public: + QDesktopWidget(); + ~QDesktopWidget(); + + bool isVirtualDesktop() const; + + int numScreens() const; + int screenCount() const; + int primaryScreen() const; + + int screenNumber(const QWidget *widget = 0) const; + int screenNumber(const QPoint &) const; + + QWidget *screen(int screen = -1); + + const QRect screenGeometry(int screen = -1) const; + const QRect screenGeometry(const QWidget *widget) const; + const QRect screenGeometry(const QPoint &point) const + { return screenGeometry(screenNumber(point)); } + + const QRect availableGeometry(int screen = -1) const; + const QRect availableGeometry(const QWidget *widget) const; + const QRect availableGeometry(const QPoint &point) const + { return availableGeometry(screenNumber(point)); } + +Q_SIGNALS: + void resized(int); + void workAreaResized(int); + void screenCountChanged(int); + +protected: + void resizeEvent(QResizeEvent *e); + +private: + Q_DISABLE_COPY(QDesktopWidget) + Q_DECLARE_PRIVATE(QDesktopWidget) + + friend class QApplication; + friend class QApplicationPrivate; +}; + +inline int QDesktopWidget::screenCount() const +{ return numScreens(); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDESKTOPWIDGET_H diff --git a/qtinterface/qt4/Qt/qdial.h b/qtinterface/qt4/Qt/qdial.h new file mode 100644 index 0000000..5434f0b --- /dev/null +++ b/qtinterface/qt4/Qt/qdial.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QDIAL_H +#define QDIAL_H + +#include <QtGui/qabstractslider.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DIAL + +class QDialPrivate; +class QStyleOptionSlider; + +class Q_GUI_EXPORT QDial: public QAbstractSlider +{ + Q_OBJECT + + Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping) + Q_PROPERTY(int notchSize READ notchSize) + Q_PROPERTY(qreal notchTarget READ notchTarget WRITE setNotchTarget) + Q_PROPERTY(bool notchesVisible READ notchesVisible WRITE setNotchesVisible) +public: + explicit QDial(QWidget *parent = 0); + + ~QDial(); + + bool wrapping() const; + + int notchSize() const; + + void setNotchTarget(double target); + qreal notchTarget() const; + bool notchesVisible() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +public Q_SLOTS: + void setNotchesVisible(bool visible); + void setWrapping(bool on); + +protected: + bool event(QEvent *e); + void resizeEvent(QResizeEvent *re); + void paintEvent(QPaintEvent *pe); + + void mousePressEvent(QMouseEvent *me); + void mouseReleaseEvent(QMouseEvent *me); + void mouseMoveEvent(QMouseEvent *me); + + void sliderChange(SliderChange change); + void initStyleOption(QStyleOptionSlider *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QDial(int minValue, int maxValue, int pageStep, int value, + QWidget* parent = 0, const char* name = 0); + QT3_SUPPORT_CONSTRUCTOR QDial(QWidget *parent, const char *name); + +Q_SIGNALS: + QT_MOC_COMPAT void dialPressed(); + QT_MOC_COMPAT void dialMoved(int value); + QT_MOC_COMPAT void dialReleased(); +#endif + +private: + Q_DECLARE_PRIVATE(QDial) + Q_DISABLE_COPY(QDial) +}; + +#endif // QT_NO_DIAL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDIAL_H diff --git a/qtinterface/qt4/Qt/qdialog.h b/qtinterface/qt4/Qt/qdialog.h new file mode 100644 index 0000000..ce4d330 --- /dev/null +++ b/qtinterface/qt4/Qt/qdialog.h @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIALOG_H +#define QDIALOG_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPushButton; +class QDialogPrivate; + +class Q_GUI_EXPORT QDialog : public QWidget +{ + Q_OBJECT + friend class QPushButton; + + Q_PROPERTY(bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled) + Q_PROPERTY(bool modal READ isModal WRITE setModal) + +public: + explicit QDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QDialog(QWidget *parent, const char *name, bool modal = false, + Qt::WindowFlags f = 0); +#endif + ~QDialog(); + + enum DialogCode { Rejected, Accepted }; + + int result() const; + + void setVisible(bool visible); + + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + + void setExtension(QWidget* extension); + QWidget* extension() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setSizeGripEnabled(bool); + bool isSizeGripEnabled() const; + + void setModal(bool modal); + void setResult(int r); + +Q_SIGNALS: + void finished(int result); + void accepted(); + void rejected(); + +public Q_SLOTS: + void open(); + int exec(); + virtual void done(int); + virtual void accept(); + virtual void reject(); + + void showExtension(bool); + +protected: + QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0); + +#if defined(Q_WS_WINCE) || defined(Q_WS_S60) + bool event(QEvent *e); +#endif + void keyPressEvent(QKeyEvent *); + void closeEvent(QCloseEvent *); + void showEvent(QShowEvent *); + void resizeEvent(QResizeEvent *); +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *); +#endif + bool eventFilter(QObject *, QEvent *); + void adjustPosition(QWidget*); +private: + Q_DECLARE_PRIVATE(QDialog) + Q_DISABLE_COPY(QDialog) + +#if defined(Q_WS_S60) + bool s60AdjustedPosition(); +#endif + + +#ifdef Q_WS_WINCE_WM + Q_PRIVATE_SLOT(d_func(), void _q_doneAction()) +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDIALOG_H diff --git a/qtinterface/qt4/Qt/qdialogbuttonbox.h b/qtinterface/qt4/Qt/qdialogbuttonbox.h new file mode 100644 index 0000000..8ebe1bc --- /dev/null +++ b/qtinterface/qt4/Qt/qdialogbuttonbox.h @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIALOGBUTTONBOX_H +#define QDIALOGBUTTONBOX_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAbstractButton; +class QPushButton; +class QDialogButtonBoxPrivate; + +class Q_GUI_EXPORT QDialogButtonBox : public QWidget +{ + Q_OBJECT + Q_FLAGS(StandardButtons) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons) + Q_PROPERTY(bool centerButtons READ centerButtons WRITE setCenterButtons) + +public: + enum ButtonRole { + // keep this in sync with QMessageBox::ButtonRole + InvalidRole = -1, + AcceptRole, + RejectRole, + DestructiveRole, + ActionRole, + HelpRole, + YesRole, + NoRole, + ResetRole, + ApplyRole, + + NRoles + }; + + enum StandardButton { + // keep this in sync with QMessageBox::StandardButton + NoButton = 0x00000000, + Ok = 0x00000400, + Save = 0x00000800, + SaveAll = 0x00001000, + Open = 0x00002000, + Yes = 0x00004000, + YesToAll = 0x00008000, + No = 0x00010000, + NoToAll = 0x00020000, + Abort = 0x00040000, + Retry = 0x00080000, + Ignore = 0x00100000, + Close = 0x00200000, + Cancel = 0x00400000, + Discard = 0x00800000, + Help = 0x01000000, + Apply = 0x02000000, + Reset = 0x04000000, + RestoreDefaults = 0x08000000, + +#ifndef Q_MOC_RUN + FirstButton = Ok, + LastButton = RestoreDefaults +#endif + }; + + Q_DECLARE_FLAGS(StandardButtons, StandardButton) + + enum ButtonLayout { + WinLayout, + MacLayout, + KdeLayout, + GnomeLayout + }; + + QDialogButtonBox(QWidget *parent = 0); + QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = 0); + QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation = Qt::Horizontal, + QWidget *parent = 0); + ~QDialogButtonBox(); + + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + + void addButton(QAbstractButton *button, ButtonRole role); + QPushButton *addButton(const QString &text, ButtonRole role); + QPushButton *addButton(StandardButton button); + void removeButton(QAbstractButton *button); + void clear(); + + QList<QAbstractButton *> buttons() const; + ButtonRole buttonRole(QAbstractButton *button) const; + + void setStandardButtons(StandardButtons buttons); + StandardButtons standardButtons() const; + StandardButton standardButton(QAbstractButton *button) const; + QPushButton *button(StandardButton which) const; + + void setCenterButtons(bool center); + bool centerButtons() const; + +Q_SIGNALS: + void clicked(QAbstractButton *button); + void accepted(); + void helpRequested(); + void rejected(); + +protected: + void changeEvent(QEvent *event); + bool event(QEvent *event); + +private: + Q_DISABLE_COPY(QDialogButtonBox) + Q_DECLARE_PRIVATE(QDialogButtonBox) + Q_PRIVATE_SLOT(d_func(), void _q_handleButtonClicked()) + Q_PRIVATE_SLOT(d_func(), void _q_handleButtonDestroyed()) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDialogButtonBox::StandardButtons) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDIALOGBUTTONBOX_H diff --git a/qtinterface/qt4/Qt/qdir.h b/qtinterface/qt4/Qt/qdir.h new file mode 100644 index 0000000..3f58e88 --- /dev/null +++ b/qtinterface/qt4/Qt/qdir.h @@ -0,0 +1,265 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIR_H +#define QDIR_H + +#include <QtCore/qstring.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QDirPrivate; + +class Q_CORE_EXPORT QDir +{ +protected: + QScopedPointer<QDirPrivate> d_ptr; +private: + Q_DECLARE_PRIVATE(QDir) +public: + enum Filter { Dirs = 0x001, + Files = 0x002, + Drives = 0x004, + NoSymLinks = 0x008, + AllEntries = Dirs | Files | Drives, + TypeMask = 0x00f, +#ifdef QT3_SUPPORT + All = AllEntries, +#endif + + Readable = 0x010, + Writable = 0x020, + Executable = 0x040, + PermissionMask = 0x070, +#ifdef QT3_SUPPORT + RWEMask = 0x070, +#endif + + Modified = 0x080, + Hidden = 0x100, + System = 0x200, + + AccessMask = 0x3F0, + + AllDirs = 0x400, + CaseSensitive = 0x800, + NoDotAndDotDot = 0x1000, + + NoFilter = -1 +#ifdef QT3_SUPPORT + ,DefaultFilter = NoFilter +#endif + }; + Q_DECLARE_FLAGS(Filters, Filter) +#ifdef QT3_SUPPORT + typedef Filters FilterSpec; +#endif + + enum SortFlag { Name = 0x00, + Time = 0x01, + Size = 0x02, + Unsorted = 0x03, + SortByMask = 0x03, + + DirsFirst = 0x04, + Reversed = 0x08, + IgnoreCase = 0x10, + DirsLast = 0x20, + LocaleAware = 0x40, + Type = 0x80, + NoSort = -1 +#ifdef QT3_SUPPORT + ,DefaultSort = NoSort +#endif + }; + Q_DECLARE_FLAGS(SortFlags, SortFlag) + + QDir(const QDir &); + QDir(const QString &path = QString()); + QDir(const QString &path, const QString &nameFilter, + SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries); + ~QDir(); + + QDir &operator=(const QDir &); + QDir &operator=(const QString &path); + + void setPath(const QString &path); + QString path() const; + QString absolutePath() const; + QString canonicalPath() const; + + static void addResourceSearchPath(const QString &path); + + static void setSearchPaths(const QString &prefix, const QStringList &searchPaths); + static void addSearchPath(const QString &prefix, const QString &path); + static QStringList searchPaths(const QString &prefix); + + QString dirName() const; + QString filePath(const QString &fileName) const; + QString absoluteFilePath(const QString &fileName) const; + QString relativeFilePath(const QString &fileName) const; + +#ifdef QT_DEPRECATED + QT_DEPRECATED static QString convertSeparators(const QString &pathName); +#endif + static QString toNativeSeparators(const QString &pathName); + static QString fromNativeSeparators(const QString &pathName); + + bool cd(const QString &dirName); + bool cdUp(); + + QStringList nameFilters() const; + void setNameFilters(const QStringList &nameFilters); + + Filters filter() const; + void setFilter(Filters filter); + SortFlags sorting() const; + void setSorting(SortFlags sort); + + uint count() const; + QString operator[](int) const; + + static QStringList nameFiltersFromString(const QString &nameFilter); + + QStringList entryList(Filters filters = NoFilter, SortFlags sort = NoSort) const; + QStringList entryList(const QStringList &nameFilters, Filters filters = NoFilter, + SortFlags sort = NoSort) const; + + QFileInfoList entryInfoList(Filters filters = NoFilter, SortFlags sort = NoSort) const; + QFileInfoList entryInfoList(const QStringList &nameFilters, Filters filters = NoFilter, + SortFlags sort = NoSort) const; + + bool mkdir(const QString &dirName) const; + bool rmdir(const QString &dirName) const; + bool mkpath(const QString &dirPath) const; + bool rmpath(const QString &dirPath) const; + + bool isReadable() const; + bool exists() const; + bool isRoot() const; + + static bool isRelativePath(const QString &path); + inline static bool isAbsolutePath(const QString &path) { return !isRelativePath(path); } + bool isRelative() const; + inline bool isAbsolute() const { return !isRelative(); } + bool makeAbsolute(); + + bool operator==(const QDir &dir) const; + inline bool operator!=(const QDir &dir) const { return !operator==(dir); } + + bool remove(const QString &fileName); + bool rename(const QString &oldName, const QString &newName); + bool exists(const QString &name) const; + + static QFileInfoList drives(); + + static QChar separator(); + + static bool setCurrent(const QString &path); + static inline QDir current() { return QDir(currentPath()); } + static QString currentPath(); + + static inline QDir home() { return QDir(homePath()); } + static QString homePath(); + static inline QDir root() { return QDir(rootPath()); } + static QString rootPath(); + static inline QDir temp() { return QDir(tempPath()); } + static QString tempPath(); + +#ifndef QT_NO_REGEXP + static bool match(const QStringList &filters, const QString &fileName); + static bool match(const QString &filter, const QString &fileName); +#endif + static QString cleanPath(const QString &path); + void refresh() const; + +#ifdef QT3_SUPPORT + typedef SortFlags SortSpec; + inline QT3_SUPPORT QString absPath() const { return absolutePath(); } + inline QT3_SUPPORT QString absFilePath(const QString &fileName, bool acceptAbsPath = true) const + { Q_UNUSED(acceptAbsPath); return absoluteFilePath(fileName); } + QT3_SUPPORT bool matchAllDirs() const; + QT3_SUPPORT void setMatchAllDirs(bool on); + inline QT3_SUPPORT QStringList entryList(const QString &nameFilter, Filters filters = NoFilter, + SortFlags sort = NoSort) const + { return entryList(nameFiltersFromString(nameFilter), filters, sort); } + inline QT3_SUPPORT QFileInfoList entryInfoList(const QString &nameFilter, + Filters filters = NoFilter, + SortFlags sort = NoSort) const + { return entryInfoList(nameFiltersFromString(nameFilter), filters, sort); } + + QT3_SUPPORT QString nameFilter() const; + QT3_SUPPORT void setNameFilter(const QString &nameFilter); + + inline QT3_SUPPORT bool mkdir(const QString &dirName, bool acceptAbsPath) const + { Q_UNUSED(acceptAbsPath); return mkdir(dirName); } + inline QT3_SUPPORT bool rmdir(const QString &dirName, bool acceptAbsPath) const + { Q_UNUSED(acceptAbsPath); return rmdir(dirName); } + + inline QT3_SUPPORT void convertToAbs() { makeAbsolute(); } + inline QT3_SUPPORT static QString currentDirPath() { return currentPath(); } + inline QT3_SUPPORT static QString homeDirPath() { return homePath(); } + inline QT3_SUPPORT static QString rootDirPath() { return rootPath(); } + inline QT3_SUPPORT static QString cleanDirPath(const QString &name) { return cleanPath(name); } +#endif +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDir::Filters) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDir::SortFlags) + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters); +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QDir &dir); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDIR_H diff --git a/qtinterface/qt4/Qt/qdirectpainter_qws.h b/qtinterface/qt4/Qt/qdirectpainter_qws.h new file mode 100644 index 0000000..040e581 --- /dev/null +++ b/qtinterface/qt4/Qt/qdirectpainter_qws.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIRECTPAINTER_QWS_H +#define QDIRECTPAINTER_QWS_H + +#include <QtCore/qobject.h> +#include <QtGui/qregion.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DIRECTPAINTER +class QDirectPainterPrivate; +class QWSEmbedEvent; + +class Q_GUI_EXPORT QDirectPainter : public QObject { + Q_OBJECT + Q_DECLARE_PRIVATE(QDirectPainter) +public: + + enum SurfaceFlag { NonReserved = 0, + Reserved = 1, + ReservedSynchronous = 3 }; + + explicit QDirectPainter(QObject *parentObject = 0, SurfaceFlag flag = NonReserved); + ~QDirectPainter(); + + void setRegion(const QRegion&); + QRegion requestedRegion() const; + QRegion allocatedRegion() const; + + void setGeometry(const QRect&); + QRect geometry() const; + + WId winId() const; + virtual void regionChanged(const QRegion &exposedRegion); + + void startPainting(bool lockDisplay = true); + void endPainting(); + void endPainting(const QRegion ®ion); + void flush(const QRegion ®ion); + + void raise(); + void lower(); + + + static QRegion reserveRegion(const QRegion&); + static QRegion reservedRegion(); + static QRegion region() { return reservedRegion(); } + + static uchar* frameBuffer(); + static int screenDepth(); + static int screenWidth(); + static int screenHeight(); + static int linestep(); + + static void lock(); + static void unlock(); +private: + friend void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type); + friend void qt_directpainter_embedevent(QDirectPainter*, const QWSEmbedEvent*); +}; + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDIRECTPAINTER_QWS_H diff --git a/qtinterface/qt4/Qt/qdiriterator.h b/qtinterface/qt4/Qt/qdiriterator.h new file mode 100644 index 0000000..011b125 --- /dev/null +++ b/qtinterface/qt4/Qt/qdiriterator.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIRITERATOR_H +#define QDIRITERATOR_H + +#include <QtCore/qdir.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QDirIteratorPrivate; +class Q_CORE_EXPORT QDirIterator { +public: + enum IteratorFlag { + NoIteratorFlags = 0x0, + FollowSymlinks = 0x1, + Subdirectories = 0x2 + }; + Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) + + QDirIterator(const QDir &dir, IteratorFlags flags = NoIteratorFlags); + QDirIterator(const QString &path, + IteratorFlags flags = NoIteratorFlags); + QDirIterator(const QString &path, + QDir::Filters filter, + IteratorFlags flags = NoIteratorFlags); + QDirIterator(const QString &path, + const QStringList &nameFilters, + QDir::Filters filters = QDir::NoFilter, + IteratorFlags flags = NoIteratorFlags); + + virtual ~QDirIterator(); + + QString next(); + bool hasNext() const; + + QString fileName() const; + QString filePath() const; + QFileInfo fileInfo() const; + QString path() const; + +private: + Q_DISABLE_COPY(QDirIterator) + + QScopedPointer<QDirIteratorPrivate> d; + friend class QDir; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDirIterator::IteratorFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qdirmodel.h b/qtinterface/qt4/Qt/qdirmodel.h new file mode 100644 index 0000000..fdd79e0 --- /dev/null +++ b/qtinterface/qt4/Qt/qdirmodel.h @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIRMODEL_H +#define QDIRMODEL_H + +#include <QtCore/qabstractitemmodel.h> +#include <QtCore/qdir.h> +#include <QtGui/qfileiconprovider.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DIRMODEL + +class QDirModelPrivate; + +class Q_GUI_EXPORT QDirModel : public QAbstractItemModel +{ + Q_OBJECT + Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool lazyChildCount READ lazyChildCount WRITE setLazyChildCount) + +public: + enum Roles { + FileIconRole = Qt::DecorationRole, + FilePathRole = Qt::UserRole + 1, + FileNameRole + }; + + QDirModel(const QStringList &nameFilters, QDir::Filters filters, + QDir::SortFlags sort, QObject *parent = 0); + explicit QDirModel(QObject *parent = 0); + ~QDirModel(); + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &child) const; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + + bool hasChildren(const QModelIndex &index = QModelIndex()) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + + QStringList mimeTypes() const; + QMimeData *mimeData(const QModelIndexList &indexes) const; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); + Qt::DropActions supportedDropActions() const; + + // QDirModel specific API + + void setIconProvider(QFileIconProvider *provider); + QFileIconProvider *iconProvider() const; + + void setNameFilters(const QStringList &filters); + QStringList nameFilters() const; + + void setFilter(QDir::Filters filters); + QDir::Filters filter() const; + + void setSorting(QDir::SortFlags sort); + QDir::SortFlags sorting() const; + + void setResolveSymlinks(bool enable); + bool resolveSymlinks() const; + + void setReadOnly(bool enable); + bool isReadOnly() const; + + void setLazyChildCount(bool enable); + bool lazyChildCount() const; + + QModelIndex index(const QString &path, int column = 0) const; + + bool isDir(const QModelIndex &index) const; + QModelIndex mkdir(const QModelIndex &parent, const QString &name); + bool rmdir(const QModelIndex &index); + bool remove(const QModelIndex &index); + + QString filePath(const QModelIndex &index) const; + QString fileName(const QModelIndex &index) const; + QIcon fileIcon(const QModelIndex &index) const; + QFileInfo fileInfo(const QModelIndex &index) const; + +#ifdef Q_NO_USING_KEYWORD + inline QObject *parent() const { return QObject::parent(); } +#else + using QObject::parent; +#endif + +public Q_SLOTS: + void refresh(const QModelIndex &parent = QModelIndex()); + +protected: + QDirModel(QDirModelPrivate &, QObject *parent = 0); + friend class QFileDialogPrivate; + +private: + Q_DECLARE_PRIVATE(QDirModel) + Q_DISABLE_COPY(QDirModel) + Q_PRIVATE_SLOT(d_func(), void _q_refresh()) +}; + +#endif // QT_NO_DIRMODEL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDIRMODEL_H diff --git a/qtinterface/qt4/Qt/qdockwidget.h b/qtinterface/qt4/Qt/qdockwidget.h new file mode 100644 index 0000000..9299e26 --- /dev/null +++ b/qtinterface/qt4/Qt/qdockwidget.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDYNAMICDOCKWIDGET_H +#define QDYNAMICDOCKWIDGET_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DOCKWIDGET + +class QDockAreaLayout; +class QDockWidgetPrivate; +class QMainWindow; +class QStyleOptionDockWidget; + +class Q_GUI_EXPORT QDockWidget : public QWidget +{ + Q_OBJECT + + Q_FLAGS(DockWidgetFeatures) + Q_PROPERTY(bool floating READ isFloating WRITE setFloating) + Q_PROPERTY(DockWidgetFeatures features READ features WRITE setFeatures NOTIFY featuresChanged) + Q_PROPERTY(Qt::DockWidgetAreas allowedAreas READ allowedAreas + WRITE setAllowedAreas NOTIFY allowedAreasChanged) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true) + +public: + explicit QDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDockWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QDockWidget(); + + QWidget *widget() const; + void setWidget(QWidget *widget); + + enum DockWidgetFeature { + DockWidgetClosable = 0x01, + DockWidgetMovable = 0x02, + DockWidgetFloatable = 0x04, + DockWidgetVerticalTitleBar = 0x08, + + DockWidgetFeatureMask = 0x0f, + AllDockWidgetFeatures = DockWidgetClosable|DockWidgetMovable|DockWidgetFloatable, // ### remove in 5.0 + NoDockWidgetFeatures = 0x00, + + Reserved = 0xff + }; + Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature) + + void setFeatures(DockWidgetFeatures features); + DockWidgetFeatures features() const; + + void setFloating(bool floating); + inline bool isFloating() const { return isWindow(); } + + void setAllowedAreas(Qt::DockWidgetAreas areas); + Qt::DockWidgetAreas allowedAreas() const; + + void setTitleBarWidget(QWidget *widget); + QWidget *titleBarWidget() const; + + inline bool isAreaAllowed(Qt::DockWidgetArea area) const + { return (allowedAreas() & area) == area; } + +#ifndef QT_NO_ACTION + QAction *toggleViewAction() const; +#endif + +Q_SIGNALS: + void featuresChanged(QDockWidget::DockWidgetFeatures features); + void topLevelChanged(bool topLevel); + void allowedAreasChanged(Qt::DockWidgetAreas allowedAreas); + void visibilityChanged(bool visible); + void dockLocationChanged(Qt::DockWidgetArea area); + +protected: + void changeEvent(QEvent *event); + void closeEvent(QCloseEvent *event); + void paintEvent(QPaintEvent *event); + bool event(QEvent *event); + void initStyleOption(QStyleOptionDockWidget *option) const; + +private: + Q_DECLARE_PRIVATE(QDockWidget) + Q_DISABLE_COPY(QDockWidget) + Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) + Q_PRIVATE_SLOT(d_func(), void _q_toggleTopLevel()) + friend class QDockAreaLayout; + friend class QDockWidgetItem; + friend class QMainWindowLayout; + friend class QDockWidgetLayout; + friend class QDockAreaLayoutInfo; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDockWidget::DockWidgetFeatures) + +#endif // QT_NO_DOCKWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDYNAMICDOCKWIDGET_H diff --git a/qtinterface/qt4/Qt/qdom.h b/qtinterface/qt4/Qt/qdom.h new file mode 100644 index 0000000..32567f0 --- /dev/null +++ b/qtinterface/qt4/Qt/qdom.h @@ -0,0 +1,681 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDOM_H +#define QDOM_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Xml) + +#ifndef QT_NO_DOM + +class QIODevice; +class QTextStream; + +class QXmlInputSource; +class QXmlReader; + +class QDomDocumentPrivate; +class QDomDocumentTypePrivate; +class QDomDocumentFragmentPrivate; +class QDomNodePrivate; +class QDomNodeListPrivate; +class QDomImplementationPrivate; +class QDomElementPrivate; +class QDomNotationPrivate; +class QDomEntityPrivate; +class QDomEntityReferencePrivate; +class QDomProcessingInstructionPrivate; +class QDomAttrPrivate; +class QDomCharacterDataPrivate; +class QDomTextPrivate; +class QDomCommentPrivate; +class QDomCDATASectionPrivate; +class QDomNamedNodeMapPrivate; +class QDomImplementationPrivate; + +class QDomNodeList; +class QDomElement; +class QDomText; +class QDomComment; +class QDomCDATASection; +class QDomProcessingInstruction; +class QDomAttr; +class QDomEntityReference; +class QDomDocument; +class QDomNamedNodeMap; +class QDomDocument; +class QDomDocumentFragment; +class QDomDocumentType; +class QDomImplementation; +class QDomNode; +class QDomEntity; +class QDomNotation; +class QDomCharacterData; + +class Q_XML_EXPORT QDomImplementation +{ +public: + QDomImplementation(); + QDomImplementation(const QDomImplementation&); + ~QDomImplementation(); + QDomImplementation& operator= (const QDomImplementation&); + bool operator== (const QDomImplementation&) const; + bool operator!= (const QDomImplementation&) const; + + // functions + bool hasFeature(const QString& feature, const QString& version) const; + QDomDocumentType createDocumentType(const QString& qName, const QString& publicId, const QString& systemId); + QDomDocument createDocument(const QString& nsURI, const QString& qName, const QDomDocumentType& doctype); + + enum InvalidDataPolicy { AcceptInvalidChars = 0, DropInvalidChars, ReturnNullNode }; + static InvalidDataPolicy invalidDataPolicy(); + static void setInvalidDataPolicy(InvalidDataPolicy policy); + + // Qt extension + bool isNull(); + +private: + QDomImplementationPrivate* impl; + QDomImplementation(QDomImplementationPrivate*); + + friend class QDomDocument; +}; + +class Q_XML_EXPORT QDomNode +{ +public: + enum NodeType { + ElementNode = 1, + AttributeNode = 2, + TextNode = 3, + CDATASectionNode = 4, + EntityReferenceNode = 5, + EntityNode = 6, + ProcessingInstructionNode = 7, + CommentNode = 8, + DocumentNode = 9, + DocumentTypeNode = 10, + DocumentFragmentNode = 11, + NotationNode = 12, + BaseNode = 21,// this is not in the standard + CharacterDataNode = 22 // this is not in the standard + }; + + enum EncodingPolicy + { + EncodingFromDocument = 1, + EncodingFromTextStream = 2 + }; + + QDomNode(); + QDomNode(const QDomNode&); + QDomNode& operator= (const QDomNode&); + bool operator== (const QDomNode&) const; + bool operator!= (const QDomNode&) const; + ~QDomNode(); + + // DOM functions + QDomNode insertBefore(const QDomNode& newChild, const QDomNode& refChild); + QDomNode insertAfter(const QDomNode& newChild, const QDomNode& refChild); + QDomNode replaceChild(const QDomNode& newChild, const QDomNode& oldChild); + QDomNode removeChild(const QDomNode& oldChild); + QDomNode appendChild(const QDomNode& newChild); + bool hasChildNodes() const; + QDomNode cloneNode(bool deep = true) const; + void normalize(); + bool isSupported(const QString& feature, const QString& version) const; + + // DOM read-only attributes + QString nodeName() const; + NodeType nodeType() const; + QDomNode parentNode() const; + QDomNodeList childNodes() const; + QDomNode firstChild() const; + QDomNode lastChild() const; + QDomNode previousSibling() const; + QDomNode nextSibling() const; + QDomNamedNodeMap attributes() const; + QDomDocument ownerDocument() const; + QString namespaceURI() const; + QString localName() const; + bool hasAttributes() const; + + // DOM attributes + QString nodeValue() const; + void setNodeValue(const QString&); + QString prefix() const; + void setPrefix(const QString& pre); + + // Qt extensions + bool isAttr() const; + bool isCDATASection() const; + bool isDocumentFragment() const; + bool isDocument() const; + bool isDocumentType() const; + bool isElement() const; + bool isEntityReference() const; + bool isText() const; + bool isEntity() const; + bool isNotation() const; + bool isProcessingInstruction() const; + bool isCharacterData() const; + bool isComment() const; + + /** + * Shortcut to avoid dealing with QDomNodeList + * all the time. + */ + QDomNode namedItem(const QString& name) const; + + bool isNull() const; + void clear(); + + QDomAttr toAttr() const; + QDomCDATASection toCDATASection() const; + QDomDocumentFragment toDocumentFragment() const; + QDomDocument toDocument() const; + QDomDocumentType toDocumentType() const; + QDomElement toElement() const; + QDomEntityReference toEntityReference() const; + QDomText toText() const; + QDomEntity toEntity() const; + QDomNotation toNotation() const; + QDomProcessingInstruction toProcessingInstruction() const; + QDomCharacterData toCharacterData() const; + QDomComment toComment() const; + + void save(QTextStream&, int) const; + void save(QTextStream&, int, EncodingPolicy) const; // ### Qt 5: Merge overload(if we at all keep this) + + QDomElement firstChildElement(const QString &tagName = QString()) const; + QDomElement lastChildElement(const QString &tagName = QString()) const; + QDomElement previousSiblingElement(const QString &tagName = QString()) const; + QDomElement nextSiblingElement(const QString &taName = QString()) const; + + int lineNumber() const; + int columnNumber() const; + +protected: + QDomNodePrivate* impl; + QDomNode(QDomNodePrivate*); + +private: + friend class QDomDocument; + friend class QDomDocumentType; + friend class QDomNodeList; + friend class QDomNamedNodeMap; +}; + +class Q_XML_EXPORT QDomNodeList +{ +public: + QDomNodeList(); + QDomNodeList(const QDomNodeList&); + QDomNodeList& operator= (const QDomNodeList&); + bool operator== (const QDomNodeList&) const; + bool operator!= (const QDomNodeList&) const; + ~QDomNodeList(); + + // DOM functions + QDomNode item(int index) const; + inline QDomNode at(int index) const { return item(index); } // Qt API consistency + + // DOM read only attributes + uint length() const; + inline int count() const { return length(); } // Qt API consitancy + inline int size() const { return length(); } // Qt API consistency + inline bool isEmpty() const { return length() == 0; } // Qt API consistency + +private: + QDomNodeListPrivate* impl; + QDomNodeList(QDomNodeListPrivate*); + + friend class QDomNode; + friend class QDomElement; + friend class QDomDocument; +}; + +class Q_XML_EXPORT QDomDocumentType : public QDomNode +{ +public: + QDomDocumentType(); + QDomDocumentType(const QDomDocumentType& x); + QDomDocumentType& operator= (const QDomDocumentType&); + + // DOM read only attributes + QString name() const; + QDomNamedNodeMap entities() const; + QDomNamedNodeMap notations() const; + QString publicId() const; + QString systemId() const; + QString internalSubset() const; + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return DocumentTypeNode; } + +private: + QDomDocumentType(QDomDocumentTypePrivate*); + + friend class QDomImplementation; + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomDocument : public QDomNode +{ +public: + QDomDocument(); + explicit QDomDocument(const QString& name); + explicit QDomDocument(const QDomDocumentType& doctype); + QDomDocument(const QDomDocument& x); + QDomDocument& operator= (const QDomDocument&); + ~QDomDocument(); + + // DOM functions + QDomElement createElement(const QString& tagName); + QDomDocumentFragment createDocumentFragment(); + QDomText createTextNode(const QString& data); + QDomComment createComment(const QString& data); + QDomCDATASection createCDATASection(const QString& data); + QDomProcessingInstruction createProcessingInstruction(const QString& target, const QString& data); + QDomAttr createAttribute(const QString& name); + QDomEntityReference createEntityReference(const QString& name); + QDomNodeList elementsByTagName(const QString& tagname) const; + QDomNode importNode(const QDomNode& importedNode, bool deep); + QDomElement createElementNS(const QString& nsURI, const QString& qName); + QDomAttr createAttributeNS(const QString& nsURI, const QString& qName); + QDomNodeList elementsByTagNameNS(const QString& nsURI, const QString& localName); + QDomElement elementById(const QString& elementId); + + // DOM read only attributes + QDomDocumentType doctype() const; + QDomImplementation implementation() const; + QDomElement documentElement() const; + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return DocumentNode; } + + // Qt extensions + bool setContent(const QByteArray& text, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(const QString& text, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(const QByteArray& text, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(const QString& text, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(QIODevice* dev, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 ); + + // Qt extensions + QString toString(int = 1) const; + QByteArray toByteArray(int = 1) const; + +private: + QDomDocument(QDomDocumentPrivate*); + + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomNamedNodeMap +{ +public: + QDomNamedNodeMap(); + QDomNamedNodeMap(const QDomNamedNodeMap&); + QDomNamedNodeMap& operator= (const QDomNamedNodeMap&); + bool operator== (const QDomNamedNodeMap&) const; + bool operator!= (const QDomNamedNodeMap&) const; + ~QDomNamedNodeMap(); + + // DOM functions + QDomNode namedItem(const QString& name) const; + QDomNode setNamedItem(const QDomNode& newNode); + QDomNode removeNamedItem(const QString& name); + QDomNode item(int index) const; + QDomNode namedItemNS(const QString& nsURI, const QString& localName) const; + QDomNode setNamedItemNS(const QDomNode& newNode); + QDomNode removeNamedItemNS(const QString& nsURI, const QString& localName); + + // DOM read only attributes + uint length() const; + int count() const { return length(); } // Qt API consitancy + inline int size() const { return length(); } // Qt API consistency + inline bool isEmpty() const { return length() == 0; } // Qt API consistency + + // Qt extension + bool contains(const QString& name) const; + +private: + QDomNamedNodeMapPrivate* impl; + QDomNamedNodeMap(QDomNamedNodeMapPrivate*); + + friend class QDomNode; + friend class QDomDocumentType; + friend class QDomElement; +}; + +class Q_XML_EXPORT QDomDocumentFragment : public QDomNode +{ +public: + QDomDocumentFragment(); + QDomDocumentFragment(const QDomDocumentFragment& x); + QDomDocumentFragment& operator= (const QDomDocumentFragment&); + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return DocumentFragmentNode; } + +private: + QDomDocumentFragment(QDomDocumentFragmentPrivate*); + + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomCharacterData : public QDomNode +{ +public: + QDomCharacterData(); + QDomCharacterData(const QDomCharacterData& x); + QDomCharacterData& operator= (const QDomCharacterData&); + + // DOM functions + QString substringData(unsigned long offset, unsigned long count); + void appendData(const QString& arg); + void insertData(unsigned long offset, const QString& arg); + void deleteData(unsigned long offset, unsigned long count); + void replaceData(unsigned long offset, unsigned long count, const QString& arg); + + // DOM read only attributes + uint length() const; + + // DOM attributes + QString data() const; + void setData(const QString&); + + // Overridden from QDomNode + QDomNode::NodeType nodeType() const; + +private: + QDomCharacterData(QDomCharacterDataPrivate*); + + friend class QDomDocument; + friend class QDomText; + friend class QDomComment; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomAttr : public QDomNode +{ +public: + QDomAttr(); + QDomAttr(const QDomAttr& x); + QDomAttr& operator= (const QDomAttr&); + + // DOM read only attributes + QString name() const; + bool specified() const; + QDomElement ownerElement() const; + + // DOM attributes + QString value() const; + void setValue(const QString&); + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return AttributeNode; } + +private: + QDomAttr(QDomAttrPrivate*); + + friend class QDomDocument; + friend class QDomElement; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomElement : public QDomNode +{ +public: + QDomElement(); + QDomElement(const QDomElement& x); + QDomElement& operator= (const QDomElement&); + + // DOM functions + QString attribute(const QString& name, const QString& defValue = QString() ) const; + void setAttribute(const QString& name, const QString& value); + void setAttribute(const QString& name, qlonglong value); + void setAttribute(const QString& name, qulonglong value); + inline void setAttribute(const QString& name, int value) + { setAttribute(name, qlonglong(value)); } + inline void setAttribute(const QString& name, uint value) + { setAttribute(name, qulonglong(value)); } + void setAttribute(const QString& name, float value); + void setAttribute(const QString& name, double value); + void removeAttribute(const QString& name); + QDomAttr attributeNode(const QString& name); + QDomAttr setAttributeNode(const QDomAttr& newAttr); + QDomAttr removeAttributeNode(const QDomAttr& oldAttr); + QDomNodeList elementsByTagName(const QString& tagname) const; + bool hasAttribute(const QString& name) const; + + QString attributeNS(const QString nsURI, const QString& localName, const QString& defValue = QString()) const; + void setAttributeNS(const QString nsURI, const QString& qName, const QString& value); + inline void setAttributeNS(const QString nsURI, const QString& qName, int value) + { setAttributeNS(nsURI, qName, qlonglong(value)); } + inline void setAttributeNS(const QString nsURI, const QString& qName, uint value) + { setAttributeNS(nsURI, qName, qulonglong(value)); } + void setAttributeNS(const QString nsURI, const QString& qName, qlonglong value); + void setAttributeNS(const QString nsURI, const QString& qName, qulonglong value); + void setAttributeNS(const QString nsURI, const QString& qName, double value); + void removeAttributeNS(const QString& nsURI, const QString& localName); + QDomAttr attributeNodeNS(const QString& nsURI, const QString& localName); + QDomAttr setAttributeNodeNS(const QDomAttr& newAttr); + QDomNodeList elementsByTagNameNS(const QString& nsURI, const QString& localName) const; + bool hasAttributeNS(const QString& nsURI, const QString& localName) const; + + // DOM read only attributes + QString tagName() const; + void setTagName(const QString& name); // Qt extension + + // Overridden from QDomNode + QDomNamedNodeMap attributes() const; + inline QDomNode::NodeType nodeType() const { return ElementNode; } + + QString text() const; + +private: + QDomElement(QDomElementPrivate*); + + friend class QDomDocument; + friend class QDomNode; + friend class QDomAttr; +}; + +class Q_XML_EXPORT QDomText : public QDomCharacterData +{ +public: + QDomText(); + QDomText(const QDomText& x); + QDomText& operator= (const QDomText&); + + // DOM functions + QDomText splitText(int offset); + + // Overridden from QDomCharacterData + inline QDomNode::NodeType nodeType() const { return TextNode; } + +private: + QDomText(QDomTextPrivate*); + + friend class QDomCDATASection; + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomComment : public QDomCharacterData +{ +public: + QDomComment(); + QDomComment(const QDomComment& x); + QDomComment& operator= (const QDomComment&); + + // Overridden from QDomCharacterData + inline QDomNode::NodeType nodeType() const { return CommentNode; } + +private: + QDomComment(QDomCommentPrivate*); + + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomCDATASection : public QDomText +{ +public: + QDomCDATASection(); + QDomCDATASection(const QDomCDATASection& x); + QDomCDATASection& operator= (const QDomCDATASection&); + + // Overridden from QDomText + inline QDomNode::NodeType nodeType() const { return CDATASectionNode; } + +private: + QDomCDATASection(QDomCDATASectionPrivate*); + + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomNotation : public QDomNode +{ +public: + QDomNotation(); + QDomNotation(const QDomNotation& x); + QDomNotation& operator= (const QDomNotation&); + + // DOM read only attributes + QString publicId() const; + QString systemId() const; + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return NotationNode; } + +private: + QDomNotation(QDomNotationPrivate*); + + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomEntity : public QDomNode +{ +public: + QDomEntity(); + QDomEntity(const QDomEntity& x); + QDomEntity& operator= (const QDomEntity&); + + // DOM read only attributes + QString publicId() const; + QString systemId() const; + QString notationName() const; + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return EntityNode; } + +private: + QDomEntity(QDomEntityPrivate*); + + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomEntityReference : public QDomNode +{ +public: + QDomEntityReference(); + QDomEntityReference(const QDomEntityReference& x); + QDomEntityReference& operator= (const QDomEntityReference&); + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return EntityReferenceNode; } + +private: + QDomEntityReference(QDomEntityReferencePrivate*); + + friend class QDomDocument; + friend class QDomNode; +}; + +class Q_XML_EXPORT QDomProcessingInstruction : public QDomNode +{ +public: + QDomProcessingInstruction(); + QDomProcessingInstruction(const QDomProcessingInstruction& x); + QDomProcessingInstruction& operator= (const QDomProcessingInstruction&); + + // DOM read only attributes + QString target() const; + + // DOM attributes + QString data() const; + void setData(const QString& d); + + // Overridden from QDomNode + inline QDomNode::NodeType nodeType() const { return ProcessingInstructionNode; } + +private: + QDomProcessingInstruction(QDomProcessingInstructionPrivate*); + + friend class QDomDocument; + friend class QDomNode; +}; + + +Q_XML_EXPORT QTextStream& operator<<(QTextStream&, const QDomNode&); + +#endif // QT_NO_DOM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDOM_H diff --git a/qtinterface/qt4/Qt/qdrag.h b/qtinterface/qt4/Qt/qdrag.h new file mode 100644 index 0000000..333b259 --- /dev/null +++ b/qtinterface/qt4/Qt/qdrag.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDRAG_H +#define QDRAG_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_DRAGANDDROP +class QMimeData; +class QDragPrivate; +class QWidget; +class QPixmap; +class QPoint; +class QDragManager; + +class Q_GUI_EXPORT QDrag : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDrag) +public: + explicit QDrag(QWidget *dragSource); + ~QDrag(); + + void setMimeData(QMimeData *data); + QMimeData *mimeData() const; + + void setPixmap(const QPixmap &); + QPixmap pixmap() const; + + void setHotSpot(const QPoint &hotspot); + QPoint hotSpot() const; + + QWidget *source() const; + QWidget *target() const; + + Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction); + Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction); + Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction); + + void setDragCursor(const QPixmap &cursor, Qt::DropAction action); + +Q_SIGNALS: + void actionChanged(Qt::DropAction action); + void targetChanged(QWidget *newTarget); + +private: +#ifdef Q_WS_MAC + friend class QWidgetPrivate; +#endif + friend class QDragManager; + Q_DISABLE_COPY(QDrag) +}; + +#endif // QT_NO_DRAGANDDROP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDRAG_H diff --git a/qtinterface/qt4/Qt/qdrawutil.h b/qtinterface/qt4/Qt/qdrawutil.h new file mode 100644 index 0000000..83416e9 --- /dev/null +++ b/qtinterface/qt4/Qt/qdrawutil.h @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDRAWUTIL_H +#define QDRAWUTIL_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qstring.h> // char*->QString conversion +#include <QtCore/qmargins.h> +#include <QtGui/qpixmap.h> +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPainter; +#ifndef QT3_SUPPORT +class QColorGroup; +#endif +class QPalette; +class QPoint; +class QColor; +class QBrush; +class QRect; + +// +// Standard shade drawing +// + +Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, + const QPalette &pal, bool sunken = true, + int lineWidth = 1, int midLineWidth = 0); + +Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, + const QPalette &pal, bool sunken = true, + int lineWidth = 1, int midLineWidth = 0); + +Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, + const QPalette &pal, bool sunken = false, + int lineWidth = 1, int midLineWidth = 0, + const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r, + const QPalette &pal, bool sunken = false, + int lineWidth = 1, int midLineWidth = 0, + const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, + const QPalette &pal, bool sunken = false, + int lineWidth = 1, const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r, + const QPalette &pal, bool sunken = false, + int lineWidth = 1, const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, + const QPalette &pal, bool sunken = false, + const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawWinButton(QPainter *p, const QRect &r, + const QPalette &pal, bool sunken = false, + const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, + const QPalette &pal, bool sunken = false, + const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r, + const QPalette &pal, bool sunken = false, + const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, + int lineWidth = 1, const QBrush *fill = 0); + +Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, + int lineWidth = 1, const QBrush *fill = 0); + + +#ifdef QT3_SUPPORT +// +// Use QStyle::itemRect(), QStyle::drawItem() and QStyle::drawArrow() instead. +// +Q_GUI_EXPORT QT3_SUPPORT QRect qItemRect(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h, + int flags, bool enabled, + const QPixmap *pixmap, const QString& text, int len=-1); + +Q_GUI_EXPORT QT3_SUPPORT void qDrawItem(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h, + int flags, const QPalette &pal, bool enabled, + const QPixmap *pixmap, const QString& text, + int len=-1, const QColor* penColor = 0); + +Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down, + int x, int y, int w, int h, + const QPalette &pal, bool enabled); +#endif + +struct QTileRules +{ + inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) + : horizontal(horizontalRule), vertical(verticalRule) {} + inline QTileRules(Qt::TileRule rule = Qt::StretchTile) + : horizontal(rule), vertical(rule) {} + Qt::TileRule horizontal; + Qt::TileRule vertical; +}; + +#ifndef Q_QDOC +// For internal use only. +namespace QDrawBorderPixmap +{ + enum DrawingHint + { + OpaqueTopLeft = 0x0001, + OpaqueTop = 0x0002, + OpaqueTopRight = 0x0004, + OpaqueLeft = 0x0008, + OpaqueCenter = 0x0010, + OpaqueRight = 0x0020, + OpaqueBottomLeft = 0x0040, + OpaqueBottom = 0x0080, + OpaqueBottomRight = 0x0100, + OpaqueCorners = OpaqueTopLeft | OpaqueTopRight | OpaqueBottomLeft | OpaqueBottomRight, + OpaqueEdges = OpaqueTop | OpaqueLeft | OpaqueRight | OpaqueBottom, + OpaqueFrame = OpaqueCorners | OpaqueEdges, + OpaqueAll = OpaqueCenter | OpaqueFrame + }; + + Q_DECLARE_FLAGS(DrawingHints, DrawingHint) +} +#endif + +Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter, + const QRect &targetRect, + const QMargins &targetMargins, + const QPixmap &pixmap, + const QRect &sourceRect, + const QMargins &sourceMargins, + const QTileRules &rules = QTileRules() +#ifndef Q_QDOC + , QDrawBorderPixmap::DrawingHints hints = 0 +#endif + ); + +inline void qDrawBorderPixmap(QPainter *painter, + const QRect &target, + const QMargins &margins, + const QPixmap &pixmap) +{ + qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins); +} + +// For internal use only. +namespace QDrawPixmaps +{ + struct Data + { + QPointF point; + QRectF source; + qreal scaleX; + qreal scaleY; + qreal rotation; + qreal opacity; + }; + + enum DrawingHint + { + OpaqueHint = 0x01 + }; + + Q_DECLARE_FLAGS(DrawingHints, DrawingHint) +} + +// This function is private and may change without notice. Do not use outside Qt!!! +Q_GUI_EXPORT void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, + int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints = 0); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDRAWUTIL_H diff --git a/qtinterface/qt4/Qt/qeasingcurve.h b/qtinterface/qt4/Qt/qeasingcurve.h new file mode 100644 index 0000000..674fa3c --- /dev/null +++ b/qtinterface/qt4/Qt/qeasingcurve.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEASINGCURVE_H +#define QEASINGCURVE_H + +#include <QtCore/qglobal.h> +#include <QtCore/qobjectdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QEasingCurvePrivate; +class Q_CORE_EXPORT QEasingCurve +{ + Q_GADGET + Q_ENUMS(Type) +public: + enum Type { + Linear, + InQuad, OutQuad, InOutQuad, OutInQuad, + InCubic, OutCubic, InOutCubic, OutInCubic, + InQuart, OutQuart, InOutQuart, OutInQuart, + InQuint, OutQuint, InOutQuint, OutInQuint, + InSine, OutSine, InOutSine, OutInSine, + InExpo, OutExpo, InOutExpo, OutInExpo, + InCirc, OutCirc, InOutCirc, OutInCirc, + InElastic, OutElastic, InOutElastic, OutInElastic, + InBack, OutBack, InOutBack, OutInBack, + InBounce, OutBounce, InOutBounce, OutInBounce, + InCurve, OutCurve, SineCurve, CosineCurve, + Custom, NCurveTypes + }; + + QEasingCurve(Type type = Linear); + QEasingCurve(const QEasingCurve &other); + ~QEasingCurve(); + + QEasingCurve &operator=(const QEasingCurve &other); + bool operator==(const QEasingCurve &other) const; + inline bool operator!=(const QEasingCurve &other) const + { return !(this->operator==(other)); } + + qreal amplitude() const; + void setAmplitude(qreal amplitude); + + qreal period() const; + void setPeriod(qreal period); + + qreal overshoot() const; + void setOvershoot(qreal overshoot); + + Type type() const; + void setType(Type type); + typedef qreal (*EasingFunction)(qreal progress); + void setCustomType(EasingFunction func); + EasingFunction customType() const; + + qreal valueForProgress(qreal progress) const; +private: + QEasingCurvePrivate *d_ptr; + friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qendian.h b/qtinterface/qt4/Qt/qendian.h new file mode 100644 index 0000000..f28290e --- /dev/null +++ b/qtinterface/qt4/Qt/qendian.h @@ -0,0 +1,347 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QENDIAN_H +#define QENDIAN_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +/* + * ENDIAN FUNCTIONS +*/ +inline void qbswap_helper(const uchar *src, uchar *dest, int size) +{ + for (int i = 0; i < size ; ++i) dest[i] = src[size - 1 - i]; +} + +/* + * qbswap(const T src, const uchar *dest); + * Changes the byte order of \a src from big endian to little endian or vice versa + * and stores the result in \a dest. + * There is no alignment requirements for \a dest. +*/ +template <typename T> inline void qbswap(const T src, uchar *dest) +{ + qbswap_helper(reinterpret_cast<const uchar *>(&src), dest, sizeof(T)); +} + +// Used to implement a type-safe and alignment-safe copy operation +// If you want to avoid the memcopy, you must write specializations for this function +template <typename T> inline void qToUnaligned(const T src, uchar *dest) +{ + qMemCopy(dest, &src, sizeof(T)); +} + +/* T qFromLittleEndian(const uchar *src) + * This function will read a little-endian encoded value from \a src + * and return the value in host-endian encoding. + * There is no requirement that \a src must be aligned. +*/ +#if defined Q_CC_MSVC && _MSC_VER < 1300 || defined Q_CC_SUN +inline quint64 qFromLittleEndian_helper(const uchar *src, quint64 *dest) +{ + return 0 + | src[0] + | src[1] * Q_UINT64_C(0x0000000000000100) + | src[2] * Q_UINT64_C(0x0000000000010000) + | src[3] * Q_UINT64_C(0x0000000001000000) + | src[4] * Q_UINT64_C(0x0000000100000000) + | src[5] * Q_UINT64_C(0x0000010000000000) + | src[6] * Q_UINT64_C(0x0001000000000000) + | src[7] * Q_UINT64_C(0x0100000000000000); +} + +inline quint32 qFromLittleEndian_helper(const uchar *src, quint32 *dest) +{ + return 0 + | src[0] + | src[1] * quint32(0x00000100) + | src[2] * quint32(0x00010000) + | src[3] * quint32(0x01000000); +} + +inline quint16 qFromLittleEndian_helper(const uchar *src, quint16 *dest) +{ + return 0 + | src[0] + | src[1] * 0x0100; +} + +inline qint64 qFromLittleEndian_helper(const uchar *src, qint64 * dest) +{ return static_cast<qint64>(qFromLittleEndian_helper(src, reinterpret_cast<quint64*>(0))); } +inline qint32 qFromLittleEndian_helper(const uchar *src, qint32 * dest) +{ return static_cast<qint32>(qFromLittleEndian_helper(src, reinterpret_cast<quint32*>(0))); } +inline qint16 qFromLittleEndian_helper(const uchar *src, qint16 * dest) +{ return static_cast<qint16>(qFromLittleEndian_helper(src, reinterpret_cast<quint16*>(0))); } + +template <class T> inline T qFromLittleEndian(const uchar *src) +{ + return qFromLittleEndian_helper(src, reinterpret_cast<T*>(0)); +} + +#else +template <typename T> inline T qFromLittleEndian(const uchar *src); +template <> inline quint64 qFromLittleEndian<quint64>(const uchar *src) +{ + return 0 + | src[0] + | src[1] * Q_UINT64_C(0x0000000000000100) + | src[2] * Q_UINT64_C(0x0000000000010000) + | src[3] * Q_UINT64_C(0x0000000001000000) + | src[4] * Q_UINT64_C(0x0000000100000000) + | src[5] * Q_UINT64_C(0x0000010000000000) + | src[6] * Q_UINT64_C(0x0001000000000000) + | src[7] * Q_UINT64_C(0x0100000000000000); +} + +template <> inline quint32 qFromLittleEndian<quint32>(const uchar *src) +{ + return 0 + | src[0] + | src[1] * quint32(0x00000100) + | src[2] * quint32(0x00010000) + | src[3] * quint32(0x01000000); +} + +template <> inline quint16 qFromLittleEndian<quint16>(const uchar *src) +{ + return quint16(0 + | src[0] + | src[1] * 0x0100); +} + +// signed specializations +template <> inline qint64 qFromLittleEndian<qint64>(const uchar *src) +{ return static_cast<qint64>(qFromLittleEndian<quint64>(src)); } + +template <> inline qint32 qFromLittleEndian<qint32>(const uchar *src) +{ return static_cast<qint32>(qFromLittleEndian<quint32>(src)); } + +template <> inline qint16 qFromLittleEndian<qint16>(const uchar *src) +{ return static_cast<qint16>(qFromLittleEndian<quint16>(src)); } +#endif + +/* This function will read a big-endian (also known as network order) encoded value from \a src + * and return the value in host-endian encoding. + * There is no requirement that \a src must be aligned. +*/ +#if defined Q_CC_MSVC && _MSC_VER < 1300 || defined Q_CC_SUN +inline quint64 qFromBigEndian_helper(const uchar *src, quint64 *dest) +{ + return 0 + | src[7] + | src[6] * Q_UINT64_C(0x0000000000000100) + | src[5] * Q_UINT64_C(0x0000000000010000) + | src[4] * Q_UINT64_C(0x0000000001000000) + | src[3] * Q_UINT64_C(0x0000000100000000) + | src[2] * Q_UINT64_C(0x0000010000000000) + | src[1] * Q_UINT64_C(0x0001000000000000) + | src[0] * Q_UINT64_C(0x0100000000000000); +} + +inline quint32 qFromBigEndian_helper(const uchar *src, quint32 * dest) +{ + return 0 + | src[3] + | src[2] * quint32(0x00000100) + | src[1] * quint32(0x00010000) + | src[0] * quint32(0x01000000); +} + +inline quint16 qFromBigEndian_helper(const uchar *src, quint16 * des) +{ + return 0 + | src[1] + | src[0] * 0x0100; +} + + +inline qint64 qFromBigEndian_helper(const uchar *src, qint64 * dest) +{ return static_cast<qint64>(qFromBigEndian_helper(src, reinterpret_cast<quint64*>(0))); } +inline qint32 qFromBigEndian_helper(const uchar *src, qint32 * dest) +{ return static_cast<qint32>(qFromBigEndian_helper(src, reinterpret_cast<quint32*>(0))); } +inline qint16 qFromBigEndian_helper(const uchar *src, qint16 * dest) +{ return static_cast<qint16>(qFromBigEndian_helper(src, reinterpret_cast<quint16*>(0))); } + +template <class T> inline T qFromBigEndian(const uchar *src) +{ + return qFromBigEndian_helper(src, reinterpret_cast<T*>(0)); +} + +#else +template <class T> inline T qFromBigEndian(const uchar *src); +template<> +inline quint64 qFromBigEndian<quint64>(const uchar *src) +{ + return 0 + | src[7] + | src[6] * Q_UINT64_C(0x0000000000000100) + | src[5] * Q_UINT64_C(0x0000000000010000) + | src[4] * Q_UINT64_C(0x0000000001000000) + | src[3] * Q_UINT64_C(0x0000000100000000) + | src[2] * Q_UINT64_C(0x0000010000000000) + | src[1] * Q_UINT64_C(0x0001000000000000) + | src[0] * Q_UINT64_C(0x0100000000000000); +} + +template<> +inline quint32 qFromBigEndian<quint32>(const uchar *src) +{ + return 0 + | src[3] + | src[2] * quint32(0x00000100) + | src[1] * quint32(0x00010000) + | src[0] * quint32(0x01000000); +} + +template<> +inline quint16 qFromBigEndian<quint16>(const uchar *src) +{ + return quint16( 0 + | src[1] + | src[0] * quint16(0x0100)); +} + + +// signed specializations +template <> inline qint64 qFromBigEndian<qint64>(const uchar *src) +{ return static_cast<qint64>(qFromBigEndian<quint64>(src)); } + +template <> inline qint32 qFromBigEndian<qint32>(const uchar *src) +{ return static_cast<qint32>(qFromBigEndian<quint32>(src)); } + +template <> inline qint16 qFromBigEndian<qint16>(const uchar *src) +{ return static_cast<qint16>(qFromBigEndian<quint16>(src)); } +#endif +/* + * T qbswap(T source). + * Changes the byte order of a value from big endian to little endian or vice versa. + * This function can be used if you are not concerned about alignment issues, + * and it is therefore a bit more convenient and in most cases more efficient. +*/ +template <typename T> T qbswap(T source); +template <> inline quint64 qbswap<quint64>(quint64 source) +{ + return 0 + | ((source & Q_UINT64_C(0x00000000000000ff)) << 56) + | ((source & Q_UINT64_C(0x000000000000ff00)) << 40) + | ((source & Q_UINT64_C(0x0000000000ff0000)) << 24) + | ((source & Q_UINT64_C(0x00000000ff000000)) << 8) + | ((source & Q_UINT64_C(0x000000ff00000000)) >> 8) + | ((source & Q_UINT64_C(0x0000ff0000000000)) >> 24) + | ((source & Q_UINT64_C(0x00ff000000000000)) >> 40) + | ((source & Q_UINT64_C(0xff00000000000000)) >> 56); +} + +template <> inline quint32 qbswap<quint32>(quint32 source) +{ + return 0 + | ((source & 0x000000ff) << 24) + | ((source & 0x0000ff00) << 8) + | ((source & 0x00ff0000) >> 8) + | ((source & 0xff000000) >> 24); +} + +template <> inline quint16 qbswap<quint16>(quint16 source) +{ + return quint16( 0 + | ((source & 0x00ff) << 8) + | ((source & 0xff00) >> 8) ); +} + +// signed specializations +template <> inline qint64 qbswap<qint64>(qint64 source) +{ + return qbswap<quint64>(quint64(source)); +} + +template <> inline qint32 qbswap<qint32>(qint32 source) +{ + return qbswap<quint32>(quint32(source)); +} + +template <> inline qint16 qbswap<qint16>(qint16 source) +{ + return qbswap<quint16>(quint16(source)); +} + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + +template <typename T> inline T qToBigEndian(T source) +{ return source; } +template <typename T> inline T qFromBigEndian(T source) +{ return source; } +template <typename T> inline T qToLittleEndian(T source) +{ return qbswap<T>(source); } +template <typename T> inline T qFromLittleEndian(T source) +{ return qbswap<T>(source); } +template <typename T> inline void qToBigEndian(T src, uchar *dest) +{ qToUnaligned<T>(src, dest); } +template <typename T> inline void qToLittleEndian(T src, uchar *dest) +{ qbswap<T>(src, dest); } +#else // Q_LITTLE_ENDIAN + +template <typename T> inline T qToBigEndian(T source) +{ return qbswap<T>(source); } +template <typename T> inline T qFromBigEndian(T source) +{ return qbswap<T>(source); } +template <typename T> inline T qToLittleEndian(T source) +{ return source; } +template <typename T> inline T qFromLittleEndian(T source) +{ return source; } +template <typename T> inline void qToBigEndian(T src, uchar *dest) +{ qbswap<T>(src, dest); } +template <typename T> inline void qToLittleEndian(T src, uchar *dest) +{ qToUnaligned<T>(src, dest); } + +#endif // Q_BYTE_ORDER == Q_BIG_ENDIAN + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QENDIAN_H diff --git a/qtinterface/qt4/Qt/qerrormessage.h b/qtinterface/qt4/Qt/qerrormessage.h new file mode 100644 index 0000000..47a71c3 --- /dev/null +++ b/qtinterface/qt4/Qt/qerrormessage.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QERRORMESSAGE_H +#define QERRORMESSAGE_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ERRORMESSAGE + +class QErrorMessagePrivate; + +class Q_GUI_EXPORT QErrorMessage: public QDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QErrorMessage) +public: + explicit QErrorMessage(QWidget* parent = 0); + ~QErrorMessage(); + + static QErrorMessage * qtHandler(); + +public Q_SLOTS: + void showMessage(const QString &message); + void showMessage(const QString &message, const QString &type); +#ifdef QT3_SUPPORT + inline QT_MOC_COMPAT void message(const QString &text) { showMessage(text); } +#endif + +protected: + void done(int); + void changeEvent(QEvent *e); + +private: + Q_DISABLE_COPY(QErrorMessage) +}; + +#endif // QT_NO_ERRORMESSAGE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QERRORMESSAGE_H diff --git a/qtinterface/qt4/Qt/qevent.h b/qtinterface/qt4/Qt/qevent.h new file mode 100644 index 0000000..349d818 --- /dev/null +++ b/qtinterface/qt4/Qt/qevent.h @@ -0,0 +1,883 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVENT_H +#define QEVENT_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qobject.h> +#include <QtGui/qregion.h> +#include <QtCore/qnamespace.h> +#include <QtCore/qstring.h> +#include <QtGui/qkeysequence.h> +#include <QtCore/qcoreevent.h> +#include <QtGui/qmime.h> +#include <QtGui/qdrag.h> +#include <QtCore/qvariant.h> +#include <QtCore/qmap.h> +#include <QtCore/qset.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAction; +class QGesture; + +class Q_GUI_EXPORT QInputEvent : public QEvent +{ +public: + QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier); + ~QInputEvent(); + inline Qt::KeyboardModifiers modifiers() const { return modState; } + inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; } +protected: + Qt::KeyboardModifiers modState; +}; + +class Q_GUI_EXPORT QMouseEvent : public QInputEvent +{ +public: + QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); + QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, + Qt::MouseButton button, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers); + ~QMouseEvent(); + + inline const QPoint &pos() const { return p; } + inline const QPoint &globalPos() const { return g; } + inline int x() const { return p.x(); } + inline int y() const { return p.y(); } + inline int globalX() const { return g.x(); } + inline int globalY() const { return g.y(); } + inline Qt::MouseButton button() const { return b; } + inline Qt::MouseButtons buttons() const { return mouseState; } + + static QMouseEvent *createExtendedMouseEvent(Type type, const QPointF &pos, + const QPoint &globalPos, Qt::MouseButton button, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); + inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; } + QPointF posF() const; + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state); + QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, + Qt::ButtonState button, int state); + inline QT3_SUPPORT Qt::ButtonState state() const + { return Qt::ButtonState((mouseState^b)|int(modifiers())); } + inline QT3_SUPPORT Qt::ButtonState stateAfter() const + { return Qt::ButtonState(int(mouseState)|int(modifiers())); } +#endif +protected: + QPoint p, g; + Qt::MouseButton b; + Qt::MouseButtons mouseState; +}; + +class Q_GUI_EXPORT QHoverEvent : public QEvent +{ +public: + QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos); + ~QHoverEvent(); + + inline const QPoint &pos() const { return p; } + inline const QPoint &oldPos() const { return op; } + +protected: + QPoint p, op; +}; + +#ifndef QT_NO_WHEELEVENT +class Q_GUI_EXPORT QWheelEvent : public QInputEvent +{ +public: + QWheelEvent(const QPoint &pos, int delta, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, + Qt::Orientation orient = Qt::Vertical); + QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, + Qt::Orientation orient = Qt::Vertical); + ~QWheelEvent(); + + inline int delta() const { return d; } + inline const QPoint &pos() const { return p; } + inline const QPoint &globalPos() const { return g; } + inline int x() const { return p.x(); } + inline int y() const { return p.y(); } + inline int globalX() const { return g.x(); } + inline int globalY() const { return g.y(); } + + inline Qt::MouseButtons buttons() const { return mouseState; } + Qt::Orientation orientation() const { return o; } + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state, + Qt::Orientation orient = Qt::Vertical); + QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state, + Qt::Orientation orient = Qt::Vertical); + inline QT3_SUPPORT Qt::ButtonState state() const + { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); } +#endif +protected: + QPoint p; + QPoint g; + int d; + Qt::MouseButtons mouseState; + Qt::Orientation o; +}; +#endif + +#ifndef QT_NO_TABLETEVENT +class Q_GUI_EXPORT QTabletEvent : public QInputEvent +{ +public: + enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, + XFreeEraser /*internal*/, RotationStylus }; + enum PointerType { UnknownPointer, Pen, Cursor, Eraser }; + QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, + Qt::KeyboardModifiers keyState, qint64 uniqueID); + ~QTabletEvent(); + + inline const QPoint &pos() const { return mPos; } + inline const QPoint &globalPos() const { return mGPos; } + inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; } + inline int x() const { return mPos.x(); } + inline int y() const { return mPos.y(); } + inline int globalX() const { return mGPos.x(); } + inline int globalY() const { return mGPos.y(); } + inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); } + inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); } + inline TabletDevice device() const { return TabletDevice(mDev); } + inline PointerType pointerType() const { return PointerType(mPointerType); } + inline qint64 uniqueId() const { return mUnique; } + inline qreal pressure() const { return mPress; } + inline int z() const { return mZ; } + inline qreal tangentialPressure() const { return mTangential; } + inline qreal rotation() const { return mRot; } + inline int xTilt() const { return mXT; } + inline int yTilt() const { return mYT; } + +protected: + QPoint mPos, mGPos; + QPointF mHiResGlobalPos; + int mDev, mPointerType, mXT, mYT, mZ; + qreal mPress, mTangential, mRot; + qint64 mUnique; + + // I don't know what the future holds for tablets but there could be some + // new devices coming along, and there seem to be "holes" in the + // OS-specific events for this. + void *mExtra; +}; +#endif // QT_NO_TABLETEVENT + +class Q_GUI_EXPORT QKeyEvent : public QInputEvent +{ +public: + QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), + bool autorep = false, ushort count = 1); + ~QKeyEvent(); + + int key() const { return k; } +#ifndef QT_NO_SHORTCUT + bool matches(QKeySequence::StandardKey key) const; +#endif + Qt::KeyboardModifiers modifiers() const; + inline QString text() const { return txt; } + inline bool isAutoRepeat() const { return autor; } + inline int count() const { return int(c); } + + // Functions for the extended key event information + static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; } + quint32 nativeScanCode() const; + quint32 nativeVirtualKey() const; + quint32 nativeModifiers() const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/, + int modifiers, const QString& text = QString(), + bool autorep = false, ushort count = 1) + : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key), + c(count), autor(autorep) + { + if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast) + ignore(); + } + inline QT3_SUPPORT int ascii() const + { return (txt.length() ? txt.unicode()->toLatin1() : 0); } + inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); } + inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); } +#endif + +protected: + QString txt; + int k; + ushort c; + uint autor:1; +}; + + +class Q_GUI_EXPORT QFocusEvent : public QEvent +{ +public: + QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason); + ~QFocusEvent(); + + inline bool gotFocus() const { return type() == FocusIn; } + inline bool lostFocus() const { return type() == FocusOut; } + +#ifdef QT3_SUPPORT + enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason, + Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason, + ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason, + Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason }; +#endif + Qt::FocusReason reason(); + Qt::FocusReason reason() const; + +private: + Qt::FocusReason m_reason; +}; + + +class Q_GUI_EXPORT QPaintEvent : public QEvent +{ +public: + QPaintEvent(const QRegion& paintRegion); + QPaintEvent(const QRect &paintRect); + ~QPaintEvent(); + + inline const QRect &rect() const { return m_rect; } + inline const QRegion ®ion() const { return m_region; } + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect); + inline QT3_SUPPORT bool erased() const { return m_erased; } + inline QT3_SUPPORT void setErased(bool b) { m_erased = b; } +#endif + +protected: + friend class QApplication; + friend class QCoreApplication; + QRect m_rect; + QRegion m_region; + bool m_erased; +}; + +class QUpdateLaterEvent : public QEvent +{ +public: + QUpdateLaterEvent(const QRegion& paintRegion); + ~QUpdateLaterEvent(); + + inline const QRegion ®ion() const { return m_region; } + +protected: + QRegion m_region; +}; + +class Q_GUI_EXPORT QMoveEvent : public QEvent +{ +public: + QMoveEvent(const QPoint &pos, const QPoint &oldPos); + ~QMoveEvent(); + + inline const QPoint &pos() const { return p; } + inline const QPoint &oldPos() const { return oldp;} +protected: + QPoint p, oldp; + friend class QApplication; + friend class QCoreApplication; +}; + + +class Q_GUI_EXPORT QResizeEvent : public QEvent +{ +public: + QResizeEvent(const QSize &size, const QSize &oldSize); + ~QResizeEvent(); + + inline const QSize &size() const { return s; } + inline const QSize &oldSize()const { return olds;} +protected: + QSize s, olds; + friend class QApplication; + friend class QCoreApplication; +}; + + +class Q_GUI_EXPORT QCloseEvent : public QEvent +{ +public: + QCloseEvent(); + ~QCloseEvent(); +}; + + +class Q_GUI_EXPORT QIconDragEvent : public QEvent +{ +public: + QIconDragEvent(); + ~QIconDragEvent(); +}; + + +class Q_GUI_EXPORT QShowEvent : public QEvent +{ +public: + QShowEvent(); + ~QShowEvent(); +}; + + +class Q_GUI_EXPORT QHideEvent : public QEvent +{ +public: + QHideEvent(); + ~QHideEvent(); +}; + +#ifndef QT_NO_CONTEXTMENU +class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent +{ +public: + enum Reason { Mouse, Keyboard, Other }; + + QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, + Qt::KeyboardModifiers modifiers); + QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos); + QContextMenuEvent(Reason reason, const QPoint &pos); + ~QContextMenuEvent(); + + inline int x() const { return p.x(); } + inline int y() const { return p.y(); } + inline int globalX() const { return gp.x(); } + inline int globalY() const { return gp.y(); } + + inline const QPoint& pos() const { return p; } + inline const QPoint& globalPos() const { return gp; } + + inline Reason reason() const { return Reason(reas); } + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int); + QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int); + + QT3_SUPPORT Qt::ButtonState state() const; +#endif +protected: + QPoint p; + QPoint gp; + uint reas : 8; +}; +#endif // QT_NO_CONTEXTMENU + +#ifndef QT_NO_INPUTMETHOD +class Q_GUI_EXPORT QInputMethodEvent : public QEvent +{ +public: + enum AttributeType { + TextFormat, + Cursor, + Language, + Ruby, + Selection + }; + class Attribute { + public: + Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {} + AttributeType type; + + int start; + int length; + QVariant value; + }; + QInputMethodEvent(); + QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes); + void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); + + inline const QList<Attribute> &attributes() const { return attrs; } + inline const QString &preeditString() const { return preedit; } + + inline const QString &commitString() const { return commit; } + inline int replacementStart() const { return replace_from; } + inline int replacementLength() const { return replace_length; } + + QInputMethodEvent(const QInputMethodEvent &other); + +private: + QString preedit; + QList<Attribute> attrs; + QString commit; + int replace_from; + int replace_length; +}; +#endif // QT_NO_INPUTMETHOD + +#ifndef QT_NO_DRAGANDDROP + +class QMimeData; + +class Q_GUI_EXPORT QDropEvent : public QEvent +// QT3_SUPPORT + , public QMimeSource +// END QT3_SUPPORT +{ +public: + QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop); + ~QDropEvent(); + + inline const QPoint &pos() const { return p; } + inline Qt::MouseButtons mouseButtons() const { return mouseState; } + inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; } + + inline Qt::DropActions possibleActions() const { return act; } + inline Qt::DropAction proposedAction() const { return default_action; } + inline void acceptProposedAction() { drop_action = default_action; accept(); } + + inline Qt::DropAction dropAction() const { return drop_action; } + void setDropAction(Qt::DropAction action); + + QWidget* source() const; + inline const QMimeData *mimeData() const { return mdata; } + +// QT3_SUPPORT + const char* format(int n = 0) const; + QByteArray encodedData(const char*) const; + bool provides(const char*) const; +// END QT3_SUPPORT +#ifdef QT3_SUPPORT + inline void accept() { QEvent::accept(); } + inline QT3_SUPPORT void accept(bool y) { setAccepted(y); } + inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); } + + enum Action { Copy, Link, Move, Private, UserAction = Private }; + QT3_SUPPORT Action action() const; + inline QT3_SUPPORT void acceptAction(bool y = true) { if (y) { drop_action = default_action; accept(); } } + inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; } +#endif + + +protected: + friend class QApplication; + QPoint p; + Qt::MouseButtons mouseState; + Qt::KeyboardModifiers modState; + Qt::DropActions act; + Qt::DropAction drop_action; + Qt::DropAction default_action; + const QMimeData *mdata; + mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT +}; + + +class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent +{ +public: + QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove); + ~QDragMoveEvent(); + + inline QRect answerRect() const { return rect; } + + inline void accept() { QDropEvent::accept(); } + inline void ignore() { QDropEvent::ignore(); } + + inline void accept(const QRect & r) { accept(); rect = r; } + inline void ignore(const QRect & r) { ignore(); rect = r; } + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void accept(bool y) { setAccepted(y); } +#endif + +protected: + friend class QApplication; + QRect rect; +}; + + +class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent +{ +public: + QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); + ~QDragEnterEvent(); +}; + + +/* An internal class */ +class Q_GUI_EXPORT QDragResponseEvent : public QEvent +{ +public: + QDragResponseEvent(bool accepted); + ~QDragResponseEvent(); + + inline bool dragAccepted() const { return a; } +protected: + bool a; +}; + + +class Q_GUI_EXPORT QDragLeaveEvent : public QEvent +{ +public: + QDragLeaveEvent(); + ~QDragLeaveEvent(); +}; +#endif // QT_NO_DRAGANDDROP + + +class Q_GUI_EXPORT QHelpEvent : public QEvent +{ +public: + QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos); + ~QHelpEvent(); + + inline int x() const { return p.x(); } + inline int y() const { return p.y(); } + inline int globalX() const { return gp.x(); } + inline int globalY() const { return gp.y(); } + + inline const QPoint& pos() const { return p; } + inline const QPoint& globalPos() const { return gp; } + +private: + QPoint p; + QPoint gp; +}; + +#ifndef QT_NO_STATUSTIP +class Q_GUI_EXPORT QStatusTipEvent : public QEvent +{ +public: + QStatusTipEvent(const QString &tip); + ~QStatusTipEvent(); + + inline QString tip() const { return s; } +private: + QString s; +}; +#endif + +#ifndef QT_NO_WHATSTHIS +class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent +{ +public: + QWhatsThisClickedEvent(const QString &href); + ~QWhatsThisClickedEvent(); + + inline QString href() const { return s; } +private: + QString s; +}; +#endif + +#ifndef QT_NO_ACTION +class Q_GUI_EXPORT QActionEvent : public QEvent +{ + QAction *act, *bef; +public: + QActionEvent(int type, QAction *action, QAction *before = 0); + ~QActionEvent(); + + inline QAction *action() const { return act; } + inline QAction *before() const { return bef; } +}; +#endif + +class Q_GUI_EXPORT QFileOpenEvent : public QEvent +{ +public: + QFileOpenEvent(const QString &file); + QFileOpenEvent(const QUrl &url); + ~QFileOpenEvent(); + + inline QString file() const { return f; } + QUrl url() const; +private: + QString f; +}; + +#ifndef QT_NO_TOOLBAR +class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent +{ +public: + QToolBarChangeEvent(bool t); + ~QToolBarChangeEvent(); + + inline bool toggle() const { return tog; } +private: + uint tog : 1; +}; +#endif + +#ifndef QT_NO_SHORTCUT +class Q_GUI_EXPORT QShortcutEvent : public QEvent +{ +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; + bool ambig; + int sid; +}; +#endif + +#ifndef QT_NO_CLIPBOARD +class Q_GUI_EXPORT QClipboardEvent : public QEvent +{ +public: + QClipboardEvent(QEventPrivate *data); + ~QClipboardEvent(); + + QEventPrivate *data() { return d; } +}; +#endif + +class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent +{ +public: + QWindowStateChangeEvent(Qt::WindowStates aOldState); + QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride); + ~QWindowStateChangeEvent(); + + inline Qt::WindowStates oldState() const { return ostate; } + bool isOverride() const; + +private: + Qt::WindowStates ostate; +}; + +#ifdef QT3_SUPPORT +class QMenuBar; +class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent +{ +public: + QMenubarUpdatedEvent(QMenuBar * const menBar); + inline QMenuBar *menuBar() { return m_menuBar; } +private: + QMenuBar *m_menuBar; +}; +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *); +#endif + +#ifndef QT_NO_SHORTCUT +inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);} +inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);} +#endif // QT_NO_SHORTCUT + +class QTouchEventTouchPointPrivate; +class Q_GUI_EXPORT QTouchEvent : public QInputEvent +{ +public: + class Q_GUI_EXPORT TouchPoint + { + public: + TouchPoint(int id = -1); + TouchPoint(const QTouchEvent::TouchPoint &other); + ~TouchPoint(); + + int id() const; + + Qt::TouchPointState state() const; + bool isPrimary() const; + + QPointF pos() const; + QPointF startPos() const; + QPointF lastPos() const; + + QPointF scenePos() const; + QPointF startScenePos() const; + QPointF lastScenePos() const; + + QPointF screenPos() const; + QPointF startScreenPos() const; + QPointF lastScreenPos() const; + + QPointF normalizedPos() const; + QPointF startNormalizedPos() const; + QPointF lastNormalizedPos() const; + + QRectF rect() const; + QRectF sceneRect() const; + QRectF screenRect() const; + + qreal pressure() const; + + // internal + void setId(int id); + void setState(Qt::TouchPointStates state); + void setPos(const QPointF &pos); + void setScenePos(const QPointF &scenePos); + void setScreenPos(const QPointF &screenPos); + void setNormalizedPos(const QPointF &normalizedPos); + void setStartPos(const QPointF &startPos); + void setStartScenePos(const QPointF &startScenePos); + void setStartScreenPos(const QPointF &startScreenPos); + void setStartNormalizedPos(const QPointF &startNormalizedPos); + void setLastPos(const QPointF &lastPos); + void setLastScenePos(const QPointF &lastScenePos); + void setLastScreenPos(const QPointF &lastScreenPos); + void setLastNormalizedPos(const QPointF &lastNormalizedPos); + void setRect(const QRectF &rect); + void setSceneRect(const QRectF &sceneRect); + void setScreenRect(const QRectF &screenRect); + void setPressure(qreal pressure); + QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other); + + private: + QTouchEventTouchPointPrivate *d; + friend class QApplication; + friend class QApplicationPrivate; + }; + + enum DeviceType { + TouchScreen, + TouchPad + }; + + QTouchEvent(QEvent::Type eventType, + QTouchEvent::DeviceType deviceType = TouchScreen, + Qt::KeyboardModifiers modifiers = Qt::NoModifier, + Qt::TouchPointStates touchPointStates = 0, + const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>()); + ~QTouchEvent(); + + inline QWidget *widget() const { return _widget; } + inline QTouchEvent::DeviceType deviceType() const { return _deviceType; } + inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; } + inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; } + + // internal + inline void setWidget(QWidget *awidget) { _widget = awidget; } + inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; } + inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; } + inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; } + +protected: + QWidget *_widget; + QTouchEvent::DeviceType _deviceType; + Qt::TouchPointStates _touchPointStates; + QList<QTouchEvent::TouchPoint> _touchPoints; + + friend class QApplication; + friend class QApplicationPrivate; +}; + +class QGesture; +class QGestureEventPrivate; +class Q_GUI_EXPORT QGestureEvent : public QEvent +{ +public: + QGestureEvent(const QList<QGesture *> &gestures); + ~QGestureEvent(); + + QList<QGesture *> gestures() const; + QGesture *gesture(Qt::GestureType type) const; + + QList<QGesture *> activeGestures() const; + QList<QGesture *> canceledGestures() const; + +#ifdef Q_NO_USING_KEYWORD + inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); } + inline bool isAccepted() const { return QEvent::isAccepted(); } + + inline void accept() { QEvent::accept(); } + inline void ignore() { QEvent::ignore(); } +#else + using QEvent::setAccepted; + using QEvent::isAccepted; + using QEvent::accept; + using QEvent::ignore; +#endif + + void setAccepted(QGesture *, bool); + void accept(QGesture *); + void ignore(QGesture *); + bool isAccepted(QGesture *) const; + + void setAccepted(Qt::GestureType, bool); + void accept(Qt::GestureType); + void ignore(Qt::GestureType); + bool isAccepted(Qt::GestureType) const; + + void setWidget(QWidget *widget); + QWidget *widget() const; + +#ifndef QT_NO_GRAPHICSVIEW + QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; +#endif + +private: + QGestureEventPrivate *d_func(); + const QGestureEventPrivate *d_func() const; + + friend class QApplication; + friend class QGestureManager; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QEVENT_H diff --git a/qtinterface/qt4/Qt/qeventloop.h b/qtinterface/qt4/Qt/qeventloop.h new file mode 100644 index 0000000..f8e83be --- /dev/null +++ b/qtinterface/qt4/Qt/qeventloop.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVENTLOOP_H +#define QEVENTLOOP_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QEventLoopPrivate; + +class Q_CORE_EXPORT QEventLoop : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QEventLoop) + +public: + explicit QEventLoop(QObject *parent = 0); + ~QEventLoop(); + + enum ProcessEventsFlag { + AllEvents = 0x00, + ExcludeUserInputEvents = 0x01, + ExcludeSocketNotifiers = 0x02, + WaitForMoreEvents = 0x04, +#ifdef QT3_SUPPORT + ExcludeUserInput = ExcludeUserInputEvents, + WaitForMore = WaitForMoreEvents, +#endif + X11ExcludeTimers = 0x08 +#ifdef QT_DEPRECATED + , DeferredDeletion = 0x10 +#endif + , EventLoopExec = 0x20 + , DialogExec = 0x40 + }; + Q_DECLARE_FLAGS(ProcessEventsFlags, ProcessEventsFlag) + + bool processEvents(ProcessEventsFlags flags = AllEvents); + void processEvents(ProcessEventsFlags flags, int maximumTime); + + int exec(ProcessEventsFlags flags = AllEvents); + void exit(int returnCode = 0); + bool isRunning() const; + + void wakeUp(); + +public Q_SLOTS: + void quit(); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QEventLoop::ProcessEventsFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QEVENTLOOP_H diff --git a/qtinterface/qt4/Qt/qeventtransition.h b/qtinterface/qt4/Qt/qeventtransition.h new file mode 100644 index 0000000..badad2a --- /dev/null +++ b/qtinterface/qt4/Qt/qeventtransition.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVENTTRANSITION_H +#define QEVENTTRANSITION_H + +#include <QtCore/qabstracttransition.h> +#include <QtCore/qcoreevent.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QEventTransitionPrivate; +class Q_CORE_EXPORT QEventTransition : public QAbstractTransition +{ + Q_OBJECT + Q_PROPERTY(QObject* eventSource READ eventSource WRITE setEventSource) + Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType) +public: + QEventTransition(QState *sourceState = 0); + QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = 0); + ~QEventTransition(); + + QObject *eventSource() const; + void setEventSource(QObject *object); + + QEvent::Type eventType() const; + void setEventType(QEvent::Type type); + +protected: + bool eventTest(QEvent *event); + void onTransition(QEvent *event); + + bool event(QEvent *e); + +protected: + QEventTransition(QEventTransitionPrivate &dd, QState *parent); + QEventTransition(QEventTransitionPrivate &dd, QObject *object, + QEvent::Type type, QState *parent); + +private: + Q_DISABLE_COPY(QEventTransition) + Q_DECLARE_PRIVATE(QEventTransition) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qfactoryinterface.h b/qtinterface/qt4/Qt/qfactoryinterface.h new file mode 100644 index 0000000..b788e8e --- /dev/null +++ b/qtinterface/qt4/Qt/qfactoryinterface.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFACTORYINTERFACE_H +#define QFACTORYINTERFACE_H + +#include <QtCore/qobject.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +struct Q_CORE_EXPORT QFactoryInterface +{ + virtual ~QFactoryInterface() {} + virtual QStringList keys() const = 0; +}; + + +Q_DECLARE_INTERFACE(QFactoryInterface, "com.trolltech.Qt.QFactoryInterface") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFACTORYINTERFACE_H diff --git a/qtinterface/qt4/Qt/qfeatures.h b/qtinterface/qt4/Qt/qfeatures.h new file mode 100644 index 0000000..a66a10c --- /dev/null +++ b/qtinterface/qt4/Qt/qfeatures.h @@ -0,0 +1,877 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + * All features and their dependencies. + * + * This list is generated from $QTDIR/src/corelib/global/qfeatures.txt + * by $QTSRCDIR/util/scripts/make_qfeatures_dot_h + */ + +// QAction +//#define QT_NO_ACTION + +// Big Codecs +//#define QT_NO_BIG_CODECS + +// Color Names +//#define QT_NO_COLORNAMES + +// QtConcurrent +//#define QT_NO_CONCURRENT + +// QCopChannel +//#define QT_NO_COP + +// CssParser +//#define QT_NO_CSSPARSER + +// QCursor +//#define QT_NO_CURSOR + +// QDesktopServices +//#define QT_NO_DESKTOPSERVICES + +// QDirectPainter +//#define QT_NO_DIRECTPAINTER + +// Document Object Model +//#define QT_NO_DOM + +// Effects +//#define QT_NO_EFFECTS + +// QFileSystemWatcher +//#define QT_NO_FILESYSTEMWATCHER + +// Freetype Font Engine +//#define QT_NO_FREETYPE + +// QGroupBox +//#define QT_NO_GROUPBOX + +// QImageIOPlugin +//#define QT_NO_IMAGEFORMATPLUGIN + +// BMP Image Format +//#define QT_NO_IMAGEFORMAT_BMP + +// JPEG Image Format +//#define QT_NO_IMAGEFORMAT_JPEG + +// PNG Image Format +//#define QT_NO_IMAGEFORMAT_PNG + +// PPM Image Format +//#define QT_NO_IMAGEFORMAT_PPM + +// XBM Image Format +//#define QT_NO_IMAGEFORMAT_XBM + +// QImage::createHeuristicMask() +//#define QT_NO_IMAGE_HEURISTIC_MASK + +// Image Text +//#define QT_NO_IMAGE_TEXT + +// QLCDNumber +//#define QT_NO_LCDNUMBER + +// QLineEdit +//#define QT_NO_LINEEDIT + +// QMessageBox +//#define QT_NO_MESSAGEBOX + +// QMovie +//#define QT_NO_MOVIE + +// QNetworkInterface +//#define QT_NO_NETWORKINTERFACE + +// QNetworkProxy +//#define QT_NO_NETWORKPROXY + +// Qt::WA_PaintOnScreen +//#define QT_NO_PAINTONSCREEN + +// Painting Debug Utilities +//#define QT_NO_PAINT_DEBUG + +// Phonon::AbstractMediaStream +//#define QT_NO_PHONON_ABSTRACTMEDIASTREAM + +// Support for Audio Capture +//#define QT_NO_PHONON_AUDIOCAPTURE + +// Phonon::Effect +//#define QT_NO_PHONON_EFFECT + +// Phonon::MediaController +//#define QT_NO_PHONON_MEDIACONTROLLER + +// Phonon::ObjectDescriptionModel +//#define QT_NO_PHONON_OBJECTDESCRIPTIONMODEL + +// Phonon::VideoWidget +//#define QT_NO_PHONON_VIDEO + +// QPicture +//#define QT_NO_PICTURE + +// QProcess +//#define QT_NO_PROCESS + +// QProgressBar +//#define QT_NO_PROGRESSBAR + +// Properties +//#define QT_NO_PROPERTIES + +// Universally Unique Identifier Convertion +//#define QT_NO_QUUID_STRING + +// QWSEmbedWidget +//#define QT_NO_QWSEMBEDWIDGET + +// Alpha Cursor +//#define QT_NO_QWS_ALPHA_CURSOR + +// Decoration +//#define QT_NO_QWS_DECORATION_DEFAULT + +// Keyboard +//#define QT_NO_QWS_KEYBOARD + +// Mouse +//#define QT_NO_QWS_MOUSE + +// Mouse (Auto) +//#define QT_NO_QWS_MOUSE_AUTO + +// Mouse (Non-Auto) +//#define QT_NO_QWS_MOUSE_MANUAL + +// Multi-Process +//#define QT_NO_QWS_MULTIPROCESS + +// Properties +//#define QT_NO_QWS_PROPERTIES + +// QProxyScreen +//#define QT_NO_QWS_PROXYSCREEN + +// Qt Prerendered Font Format +//#define QT_NO_QWS_QPF + +// Qt Prerendered Font Format 2 +//#define QT_NO_QWS_QPF2 + +// Raster Paint Engine callback functions +//#define QT_NO_RASTERCALLBACKS + +// Resize Handler +//#define QT_NO_RESIZEHANDLER + +// QRubberBand +//#define QT_NO_RUBBERBAND + +// Session Manager +//#define QT_NO_SESSIONMANAGER + +// QSettings +//#define QT_NO_SETTINGS + +// QSharedMemory +//#define QT_NO_SHAREDMEMORY + +// QShortcut +//#define QT_NO_SHORTCUT + +// QSignalMapper +//#define QT_NO_SIGNALMAPPER + +// QSizeGrip +//#define QT_NO_SIZEGRIP + +// QSlider +//#define QT_NO_SLIDER + +// Sounds +//#define QT_NO_SOUND + +// Spin Widget +//#define QT_NO_SPINWIDGET + +// Splash screen widget +//#define QT_NO_SPLASHSCREEN + +// QStackedWidget +//#define QT_NO_STACKEDWIDGET + +// QStatusBar +//#define QT_NO_STATUSBAR + +// Status Tip +//#define QT_NO_STATUSTIP + +// Standard Template Library +//#define QT_NO_STL + +// QMotifStyle +//#define QT_NO_STYLE_MOTIF + +// QWindowsStyle +//#define QT_NO_STYLE_WINDOWS + +// QSystemSemaphore +//#define QT_NO_SYSTEMSEMAPHORE + +// QSystemTrayIcon +//#define QT_NO_SYSTEMTRAYICON + +// QTabletEvent +//#define QT_NO_TABLETEVENT + +// QTemporaryFile +//#define QT_NO_TEMPORARYFILE + +// QTextCodec +//#define QT_NO_TEXTCODEC + +// Text Date +//#define QT_NO_TEXTDATE + +// HtmlParser +//#define QT_NO_TEXTHTMLPARSER + +// QTextStream +//#define QT_NO_TEXTSTREAM + +// QToolTip +//#define QT_NO_TOOLTIP + +// Translation +//#define QT_NO_TRANSLATION + +// QUdpSocket +//#define QT_NO_UDPSOCKET + +// QUndoCommand +//#define QT_NO_UNDOCOMMAND + +// QUrlInfo +//#define QT_NO_URLINFO + +// QValidator +//#define QT_NO_VALIDATOR + +// QWheelEvent +//#define QT_NO_WHEELEVENT + +// +//#define QT_NO_XMLSTREAM + +// Animation +#if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES)) +#define QT_NO_ANIMATION +#endif + +// QButtonGroup +#if !defined(QT_NO_BUTTONGROUP) && (defined(QT_NO_GROUPBOX)) +#define QT_NO_BUTTONGROUP +#endif + +// QClipboard +#if !defined(QT_NO_CLIPBOARD) && (defined(QT_NO_QWS_PROPERTIES)) +#define QT_NO_CLIPBOARD +#endif + +// Codecs +#if !defined(QT_NO_CODECS) && (defined(QT_NO_TEXTCODEC)) +#define QT_NO_CODECS +#endif + +// QDate/QTime/QDateTime +#if !defined(QT_NO_DATESTRING) && (defined(QT_NO_TEXTDATE)) +#define QT_NO_DATESTRING +#endif + +// QDial +#if !defined(QT_NO_DIAL) && (defined(QT_NO_SLIDER)) +#define QT_NO_DIAL +#endif + +// QFileSystemModel +#if !defined(QT_NO_FILESYSTEMMODEL) && (defined(QT_NO_FILESYSTEMWATCHER)) +#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 +#endif + +// QMenu +#if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION)) +#define QT_NO_MENU +#endif + +// QNetworkDiskCache +#if !defined(QT_NO_NETWORKDISKCACHE) && (defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_NETWORKDISKCACHE +#endif + +// Phonon::SeekSlider +#if !defined(QT_NO_PHONON_SEEKSLIDER) && (defined(QT_NO_SLIDER)) +#define QT_NO_PHONON_SEEKSLIDER +#endif + +// Phonon::AbstractMediaStream +#if !defined(QT_NO_PHONON_SETTINGSGROUP) && (defined(QT_NO_SETTINGS)) +#define QT_NO_PHONON_SETTINGSGROUP +#endif + +// Phonon::VideoPlayer +#if !defined(QT_NO_PHONON_VIDEOPLAYER) && (defined(QT_NO_PHONON_VIDEO)) +#define QT_NO_PHONON_VIDEOPLAYER +#endif + +// Phonon::VolumeFaderEffect +#if !defined(QT_NO_PHONON_VOLUMEFADEREFFECT) && (defined(QT_NO_PHONON_EFFECT)) +#define QT_NO_PHONON_VOLUMEFADEREFFECT +#endif + +// QProgressDialog +#if !defined(QT_NO_PROGRESSDIALOG) && (defined(QT_NO_PROGRESSBAR)) +#define QT_NO_PROGRESSDIALOG +#endif + +// Cursor +#if !defined(QT_NO_QWS_CURSOR) && (defined(QT_NO_CURSOR)) +#define QT_NO_QWS_CURSOR +#endif + +// Decoration (Styled) +#if !defined(QT_NO_QWS_DECORATION_STYLED) && (defined(QT_NO_QWS_DECORATION_DEFAULT)) +#define QT_NO_QWS_DECORATION_STYLED +#endif + +// Decoration (Windows Style) +#if !defined(QT_NO_QWS_DECORATION_WINDOWS) && (defined(QT_NO_QWS_DECORATION_DEFAULT)) +#define QT_NO_QWS_DECORATION_WINDOWS +#endif + +// Dynamic screen transformation. +#if !defined(QT_NO_QWS_DYNAMICSCREENTRANSFORMATION) && (defined(QT_NO_QWS_PROXYSCREEN)) +#define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +#endif + +// Manager +#if !defined(QT_NO_QWS_MANAGER) && (defined(QT_NO_QWS_DECORATION_DEFAULT)) +#define QT_NO_QWS_MANAGER +#endif + +// QVncTransformed +#if !defined(QT_NO_QWS_TRANSFORMED) && (defined(QT_NO_QWS_PROXYSCREEN)) +#define QT_NO_QWS_TRANSFORMED +#endif + +// QVncScreen +#if !defined(QT_NO_QWS_VNC) && (defined(QT_NO_QWS_PROXYSCREEN)) +#define QT_NO_QWS_VNC +#endif + +// QScrollBar +#if !defined(QT_NO_SCROLLBAR) && (defined(QT_NO_SLIDER)) +#define QT_NO_SCROLLBAR +#endif + +// SOCKS5 +#if !defined(QT_NO_SOCKS5) && (defined(QT_NO_NETWORKPROXY)) +#define QT_NO_SOCKS5 +#endif + +// QSoftKeyManager +#if !defined(QT_NO_SOFTKEYMANAGER) && (defined(QT_NO_ACTION)) +#define QT_NO_SOFTKEYMANAGER +#endif + +// QSplitter +#if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND)) +#define QT_NO_SPLITTER +#endif + +// State machine +#if !defined(QT_NO_STATEMACHINE) && (defined(QT_NO_PROPERTIES)) +#define QT_NO_STATEMACHINE +#endif + +// QCDEStyle +#if !defined(QT_NO_STYLE_CDE) && (defined(QT_NO_STYLE_MOTIF)) +#define QT_NO_STYLE_CDE +#endif + +// QWindowsXPStyle +#if !defined(QT_NO_STYLE_WINDOWSXP) && (defined(QT_NO_STYLE_WINDOWS)) +#define QT_NO_STYLE_WINDOWSXP +#endif + +// SXE +#if !defined(QT_NO_SXE) && (defined(QT_NO_QWS_MULTIPROCESS)) +#define QT_NO_SXE +#endif + +// QToolButton +#if !defined(QT_NO_TOOLBUTTON) && (defined(QT_NO_ACTION)) +#define QT_NO_TOOLBUTTON +#endif + +// QUndoStack +#if !defined(QT_NO_UNDOSTACK) && (defined(QT_NO_UNDOCOMMAND)) +#define QT_NO_UNDOSTACK +#endif + +// ActiveQt +#if !defined(QT_NO_WIN_ACTIVEQT) && (defined(QT_NO_PROPERTIES)) +#define QT_NO_WIN_ACTIVEQT +#endif + +// QWizard +#if !defined(QT_NO_WIZARD) && (defined(QT_NO_PROPERTIES)) +#define QT_NO_WIZARD +#endif + +// QXmlStreamReader +#if !defined(QT_NO_XMLSTREAMREADER) && (defined(QT_NO_XMLSTREAM)) +#define QT_NO_XMLSTREAMREADER +#endif + +// QXmlStreamWriter +#if !defined(QT_NO_XMLSTREAMWRITER) && (defined(QT_NO_XMLSTREAM)) +#define QT_NO_XMLSTREAMWRITER +#endif + +// Context menu +#if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU)) +#define QT_NO_CONTEXTMENU +#endif + +// File Transfer Protocol +#if !defined(QT_NO_FTP) && (defined(QT_NO_URLINFO) || defined(QT_NO_TEXTDATE)) +#define QT_NO_FTP +#endif + +// Hyper Text Transfer Protocol +#if !defined(QT_NO_HTTP) && (defined(QT_NO_HOSTINFO)) +#define QT_NO_HTTP +#endif + +// QInputContext +#if !defined(QT_NO_IM) && (defined(QT_NO_LIBRARY)) +#define QT_NO_IM +#endif + +// Phonon::PlatformPlugin +#if !defined(QT_NO_PHONON_PLATFORMPLUGIN) && (defined(QT_NO_LIBRARY)) +#define QT_NO_PHONON_PLATFORMPLUGIN +#endif + +// QScrollArea +#if !defined(QT_NO_SCROLLAREA) && (defined(QT_NO_SCROLLBAR)) +#define QT_NO_SCROLLAREA +#endif + +// QWindowsVistaStyle +#if !defined(QT_NO_STYLE_WINDOWSVISTA) && (defined(QT_NO_STYLE_WINDOWSXP)) +#define QT_NO_STYLE_WINDOWSVISTA +#endif + +// QTabBar +#if !defined(QT_NO_TABBAR) && (defined(QT_NO_TOOLBUTTON)) +#define QT_NO_TABBAR +#endif + +// OdfWriter +#if !defined(QT_NO_TEXTODFWRITER) && (defined(QT_NO_XMLSTREAMWRITER)) +#define QT_NO_TEXTODFWRITER +#endif + +// Translation (UTF-8 representation) +#if !defined(QT_NO_TRANSLATION_UTF8) && (defined(QT_NO_TRANSLATION) || defined(QT_NO_TEXTCODEC)) +#define QT_NO_TRANSLATION_UTF8 +#endif + +// QUndoGroup +#if !defined(QT_NO_UNDOGROUP) && (defined(QT_NO_UNDOSTACK)) +#define QT_NO_UNDOGROUP +#endif + +// QWhatsThis +#if !defined(QT_NO_WHATSTHIS) && (defined(QT_NO_TOOLBUTTON)) +#define QT_NO_WHATSTHIS +#endif + +// Drag and drop +#if !defined(QT_NO_DRAGANDDROP) && (defined(QT_NO_QWS_PROPERTIES) || defined(QT_NO_IMAGEFORMAT_XPM)) +#define QT_NO_DRAGANDDROP +#endif + +// QGraphicsView +#if !defined(QT_NO_GRAPHICSVIEW) && (defined(QT_NO_SCROLLAREA)) +#define QT_NO_GRAPHICSVIEW +#endif + +// QMdiArea +#if !defined(QT_NO_MDIAREA) && (defined(QT_NO_SCROLLAREA)) +#define QT_NO_MDIAREA +#endif + +// Phonon::VolumeSlider +#if !defined(QT_NO_PHONON_VOLUMESLIDER) && (defined(QT_NO_SLIDER) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_PHONON_VOLUMESLIDER +#endif + +// QPrinter +#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_PRINTER +#endif + +// QWSInputMethod +#if !defined(QT_NO_QWS_INPUTMETHODS) && (defined(QT_NO_IM)) +#define QT_NO_QWS_INPUTMETHODS +#endif + +// QSpinBox +#if !defined(QT_NO_SPINBOX) && (defined(QT_NO_SPINWIDGET) || defined(QT_NO_LINEEDIT) || defined(QT_NO_VALIDATOR)) +#define QT_NO_SPINBOX +#endif + +// QCleanLooksStyle +#if !defined(QT_NO_STYLE_CLEANLOOKS) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM)) +#define QT_NO_STYLE_CLEANLOOKS +#endif + +// QPlastiqueStyle +#if !defined(QT_NO_STYLE_PLASTIQUE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM)) +#define QT_NO_STYLE_PLASTIQUE +#endif + +// QStyleSheetStyle +#if !defined(QT_NO_STYLE_STYLESHEET) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_PROPERTIES) || defined(QT_NO_CSSPARSER)) +#define QT_NO_STYLE_STYLESHEET +#endif + +// QWindowsCEStyle +#if !defined(QT_NO_STYLE_WINDOWSCE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM)) +#define QT_NO_STYLE_WINDOWSCE +#endif + +// QWindowsMobileStyle +#if !defined(QT_NO_STYLE_WINDOWSMOBILE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM)) +#define QT_NO_STYLE_WINDOWSMOBILE +#endif + +// QtSvg module +#if !defined(QT_NO_SVG) && (defined(QT_NO_XMLSTREAMREADER) || defined(QT_NO_CSSPARSER)) +#define QT_NO_SVG +#endif + +// Q3TabDialog +#if !defined(QT_NO_TABDIALOG) && (defined(QT_NO_TABBAR)) +#define QT_NO_TABDIALOG +#endif + +// QTextCodecPlugin +#if !defined(QT_NO_TEXTCODECPLUGIN) && (defined(QT_NO_TEXTCODEC) || defined(QT_NO_LIBRARY)) +#define QT_NO_TEXTCODECPLUGIN +#endif + +// QColorDialog +#if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_SPINBOX)) +#define QT_NO_COLORDIALOG +#endif + +// QGraphicsEffect +#if !defined(QT_NO_GRAPHICSEFFECT) && (defined(QT_NO_GRAPHICSVIEW)) +#define QT_NO_GRAPHICSEFFECT +#endif + +// The Model/View Framework +#if !defined(QT_NO_ITEMVIEWS) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_SCROLLAREA)) +#define QT_NO_ITEMVIEWS +#endif + +// QMenuBar +#if !defined(QT_NO_MENUBAR) && (defined(QT_NO_MENU) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_MENUBAR +#endif + +// Sound Server +#if !defined(QT_NO_QWS_SOUNDSERVER) && (defined(QT_NO_SOUND) || defined(QT_NO_HOSTINFO) || defined(QT_NO_QWS_MULTIPROCESS)) +#define QT_NO_QWS_SOUNDSERVER +#endif + +// QSvgGenerator +#if !defined(QT_NO_SVGGENERATOR) && (defined(QT_NO_SVG)) +#define QT_NO_SVGGENERATOR +#endif + +// QSvgRenderer +#if !defined(QT_NO_SVGRENDERER) && (defined(QT_NO_SVG)) +#define QT_NO_SVGRENDERER +#endif + +// QTabWidget +#if !defined(QT_NO_TABWIDGET) && (defined(QT_NO_TABBAR) || defined(QT_NO_STACKEDWIDGET)) +#define QT_NO_TABWIDGET +#endif + +// QTextEdit +#if !defined(QT_NO_TEXTEDIT) && (defined(QT_NO_SCROLLAREA) || defined(QT_NO_PROPERTIES)) +#define QT_NO_TEXTEDIT +#endif + +// QErrorMessage +#if !defined(QT_NO_ERRORMESSAGE) && (defined(QT_NO_TEXTEDIT)) +#define QT_NO_ERRORMESSAGE +#endif + +// QListView +#if !defined(QT_NO_LISTVIEW) && (defined(QT_NO_ITEMVIEWS)) +#define QT_NO_LISTVIEW +#endif + +// QMainWindow +#if !defined(QT_NO_MAINWINDOW) && (defined(QT_NO_MENU) || defined(QT_NO_RESIZEHANDLER) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_MAINWINDOW +#endif + +// QAbstractProxyModel +#if !defined(QT_NO_PROXYMODEL) && (defined(QT_NO_ITEMVIEWS)) +#define QT_NO_PROXYMODEL +#endif + +// QStandardItemModel +#if !defined(QT_NO_STANDARDITEMMODEL) && (defined(QT_NO_ITEMVIEWS)) +#define QT_NO_STANDARDITEMMODEL +#endif + +// QStringListModel +#if !defined(QT_NO_STRINGLISTMODEL) && (defined(QT_NO_ITEMVIEWS)) +#define QT_NO_STRINGLISTMODEL +#endif + +// QSvgWidget +#if !defined(QT_NO_SVGWIDGET) && (defined(QT_NO_SVGRENDERER)) +#define QT_NO_SVGWIDGET +#endif + +// QSyntaxHighlighter +#if !defined(QT_NO_SYNTAXHIGHLIGHTER) && (defined(QT_NO_TEXTEDIT)) +#define QT_NO_SYNTAXHIGHLIGHTER +#endif + +// QTableView +#if !defined(QT_NO_TABLEVIEW) && (defined(QT_NO_ITEMVIEWS)) +#define QT_NO_TABLEVIEW +#endif + +// QTextBrowser +#if !defined(QT_NO_TEXTBROWSER) && (defined(QT_NO_TEXTEDIT)) +#define QT_NO_TEXTBROWSER +#endif + +// QToolBox +#if !defined(QT_NO_TOOLBOX) && (defined(QT_NO_TOOLBUTTON) || defined(QT_NO_SCROLLAREA)) +#define QT_NO_TOOLBOX +#endif + +// QTreeView +#if !defined(QT_NO_TREEVIEW) && (defined(QT_NO_ITEMVIEWS)) +#define QT_NO_TREEVIEW +#endif + +// Accessibility +#if !defined(QT_NO_ACCESSIBILITY) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_MENUBAR)) +#define QT_NO_ACCESSIBILITY +#endif + +// QColumnView +#if !defined(QT_NO_COLUMNVIEW) && (defined(QT_NO_LISTVIEW)) +#define QT_NO_COLUMNVIEW +#endif + +// QCompleter +#if !defined(QT_NO_COMPLETER) && (defined(QT_NO_PROXYMODEL)) +#define QT_NO_COMPLETER +#endif + +// Common UNIX Printing System +#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) +#define QT_NO_CUPS +#endif + +// QDataWidgetMapper +#if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES)) +#define QT_NO_DATAWIDGETMAPPER +#endif + +// QListWidget +#if !defined(QT_NO_LISTWIDGET) && (defined(QT_NO_LISTVIEW)) +#define QT_NO_LISTWIDGET +#endif + +// QSortFilterProxyModel +#if !defined(QT_NO_SORTFILTERPROXYMODEL) && (defined(QT_NO_PROXYMODEL)) +#define QT_NO_SORTFILTERPROXYMODEL +#endif + +// QTableWidget +#if !defined(QT_NO_TABLEWIDGET) && (defined(QT_NO_TABLEVIEW)) +#define QT_NO_TABLEWIDGET +#endif + +// QToolBar +#if !defined(QT_NO_TOOLBAR) && (defined(QT_NO_MAINWINDOW)) +#define QT_NO_TOOLBAR +#endif + +// QTreeWidget +#if !defined(QT_NO_TREEWIDGET) && (defined(QT_NO_TREEVIEW)) +#define QT_NO_TREEWIDGET +#endif + +// QDirModel +#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_FILESYSTEMMODEL)) +#define QT_NO_DIRMODEL +#endif + +// QDockwidget +#if !defined(QT_NO_DOCKWIDGET) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_MAINWINDOW)) +#define QT_NO_DOCKWIDGET +#endif + +// QUndoView +#if !defined(QT_NO_UNDOVIEW) && (defined(QT_NO_UNDOSTACK) || defined(QT_NO_LISTVIEW)) +#define QT_NO_UNDOVIEW +#endif + +// QCompleter +#if !defined(QT_NO_FSCOMPLETER) && (defined(QT_NO_FILESYSTEMMODEL) || defined(QT_NO_COMPLETER)) +#define QT_NO_FSCOMPLETER +#endif + +// QGraphicsSvgItem +#if !defined(QT_NO_GRAPHICSSVGITEM) && (defined(QT_NO_SVGRENDERER) || defined(QT_NO_GRAPHICSVIEW)) +#define QT_NO_GRAPHICSSVGITEM +#endif + +// QComboBox +#if !defined(QT_NO_COMBOBOX) && (defined(QT_NO_LINEEDIT) || defined(QT_NO_STANDARDITEMMODEL) || defined(QT_NO_LISTVIEW)) +#define QT_NO_COMBOBOX +#endif + +// QWorkSpace +#if !defined(QT_NO_WORKSPACE) && (defined(QT_NO_SCROLLBAR) || defined(QT_NO_MAINWINDOW) || defined(QT_NO_MENUBAR)) +#define QT_NO_WORKSPACE +#endif + +// QPrintPreviewWidget +#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER) || defined(QT_NO_MAINWINDOW)) +#define QT_NO_PRINTPREVIEWWIDGET +#endif + +// QCalendarWidget +#if !defined(QT_NO_CALENDARWIDGET) && (defined(QT_NO_TABLEVIEW) || defined(QT_NO_MENU) || defined(QT_NO_TEXTDATE) || defined(QT_NO_SPINBOX) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_CALENDARWIDGET +#endif + +// QDateTimeEdit +#if !defined(QT_NO_DATETIMEEDIT) && (defined(QT_NO_CALENDARWIDGET) || defined(QT_NO_DATESTRING)) +#define QT_NO_DATETIMEEDIT +#endif + +// QInputDialog +#if !defined(QT_NO_INPUTDIALOG) && (defined(QT_NO_COMBOBOX) || defined(QT_NO_SPINBOX) || defined(QT_NO_STACKEDWIDGET)) +#define QT_NO_INPUTDIALOG +#endif + +// Phonon::EffectWidget +#if !defined(QT_NO_PHONON_EFFECTWIDGET) && (defined(QT_NO_PHONON_EFFECT) || defined(QT_NO_COMBOBOX) || defined(QT_NO_SPINBOX)) +#define QT_NO_PHONON_EFFECTWIDGET +#endif + +// QFontComboBox +#if !defined(QT_NO_FONTCOMBOBOX) && (defined(QT_NO_COMBOBOX) || defined(QT_NO_STRINGLISTMODEL)) +#define QT_NO_FONTCOMBOBOX +#endif + +// QFontDialog +#if !defined(QT_NO_FONTDIALOG) && (defined(QT_NO_STRINGLISTMODEL) || defined(QT_NO_COMBOBOX) || defined(QT_NO_VALIDATOR) || defined(QT_NO_GROUPBOX)) +#define QT_NO_FONTDIALOG +#endif + +// QPrintDialog +#if !defined(QT_NO_PRINTDIALOG) && (defined(QT_NO_PRINTER) || defined(QT_NO_COMBOBOX) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_SPINBOX) || defined(QT_NO_TREEVIEW) || defined(QT_NO_TABWIDGET)) +#define QT_NO_PRINTDIALOG +#endif + +// QFileDialog +#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_PROXYMODEL)) +#define QT_NO_FILEDIALOG +#endif + +// QPrintPreviewDialog +#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_TOOLBAR)) +#define QT_NO_PRINTPREVIEWDIALOG +#endif + diff --git a/qtinterface/qt4/Qt/qfile.h b/qtinterface/qt4/Qt/qfile.h new file mode 100644 index 0000000..c8a67d1 --- /dev/null +++ b/qtinterface/qt4/Qt/qfile.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILE_H +#define QFILE_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qstring.h> +#include <stdio.h> + +#ifdef open +#error qfile.h must be included before any header file that defines open +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QAbstractFileEngine; +class QFilePrivate; + +class Q_CORE_EXPORT QFile : public QIODevice +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + Q_DECLARE_PRIVATE(QFile) + +public: + + enum FileError { + NoError = 0, + ReadError = 1, + WriteError = 2, + FatalError = 3, + ResourceError = 4, + OpenError = 5, + AbortError = 6, + TimeOutError = 7, + UnspecifiedError = 8, + RemoveError = 9, + RenameError = 10, + PositionError = 11, + ResizeError = 12, + PermissionsError = 13, + CopyError = 14 +#ifdef QT3_SUPPORT + , ConnectError = 30 +#endif + }; + + enum Permission { + ReadOwner = 0x4000, WriteOwner = 0x2000, ExeOwner = 0x1000, + ReadUser = 0x0400, WriteUser = 0x0200, ExeUser = 0x0100, + ReadGroup = 0x0040, WriteGroup = 0x0020, ExeGroup = 0x0010, + ReadOther = 0x0004, WriteOther = 0x0002, ExeOther = 0x0001 + }; + Q_DECLARE_FLAGS(Permissions, Permission) + + QFile(); + QFile(const QString &name); +#ifndef QT_NO_QOBJECT + explicit QFile(QObject *parent); + QFile(const QString &name, QObject *parent); +#endif + ~QFile(); + + FileError error() const; + void unsetError(); + + QString fileName() const; + void setFileName(const QString &name); + + typedef QByteArray (*EncoderFn)(const QString &fileName); + typedef QString (*DecoderFn)(const QByteArray &localfileName); + static QByteArray encodeName(const QString &fileName); + static QString decodeName(const QByteArray &localFileName); + inline static QString decodeName(const char *localFileName) + { return decodeName(QByteArray(localFileName)); } + static void setEncodingFunction(EncoderFn); + static void setDecodingFunction(DecoderFn); + + bool exists() const; + static bool exists(const QString &fileName); + + QString readLink() const; + static QString readLink(const QString &fileName); + inline QString symLinkTarget() const { return readLink(); } + inline static QString symLinkTarget(const QString &fileName) { return readLink(fileName); } + + bool remove(); + static bool remove(const QString &fileName); + + bool rename(const QString &newName); + static bool rename(const QString &oldName, const QString &newName); + + bool link(const QString &newName); + static bool link(const QString &oldname, const QString &newName); + + bool copy(const QString &newName); + static bool copy(const QString &fileName, const QString &newName); + + bool isSequential() const; + + bool open(OpenMode flags); + bool open(FILE *f, OpenMode flags); + bool open(int fd, OpenMode flags); + virtual void close(); + + qint64 size() const; + qint64 pos() const; + bool seek(qint64 offset); + bool atEnd() const; + bool flush(); + + bool resize(qint64 sz); + static bool resize(const QString &filename, qint64 sz); + + Permissions permissions() const; + static Permissions permissions(const QString &filename); + bool setPermissions(Permissions permissionSpec); + static bool setPermissions(const QString &filename, Permissions permissionSpec); + + int handle() const; + + enum MemoryMapFlags { + NoOptions = 0 + }; + + uchar *map(qint64 offset, qint64 size, MemoryMapFlags flags = NoOptions); + bool unmap(uchar *address); + + virtual QAbstractFileEngine *fileEngine() const; + +#ifdef QT3_SUPPORT + typedef Permission PermissionSpec; + inline QT3_SUPPORT QString name() const { return fileName(); } + inline QT3_SUPPORT void setName(const QString &aName) { setFileName(aName); } + inline QT3_SUPPORT bool open(OpenMode aFlags, FILE *f) { return open(f, aFlags); } + inline QT3_SUPPORT bool open(OpenMode aFlags, int fd) { return open(fd, aFlags); } +#endif + +protected: +#ifdef QT_NO_QOBJECT + QFile(QFilePrivate &dd); +#else + QFile(QFilePrivate &dd, QObject *parent = 0); +#endif + + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + qint64 readLineData(char *data, qint64 maxlen); + +private: + Q_DISABLE_COPY(QFile) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QFile::Permissions) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFILE_H diff --git a/qtinterface/qt4/Qt/qfiledialog.h b/qtinterface/qt4/Qt/qfiledialog.h new file mode 100644 index 0000000..992dae0 --- /dev/null +++ b/qtinterface/qt4/Qt/qfiledialog.h @@ -0,0 +1,330 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILEDIALOG_H +#define QFILEDIALOG_H + +#include <QtCore/qdir.h> +#include <QtCore/qstring.h> +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_FILEDIALOG + +class QModelIndex; +class QItemSelection; +struct QFileDialogArgs; +class QFileIconProvider; +class QFileDialogPrivate; +class QAbstractItemDelegate; +class QAbstractProxyModel; +class QUrl; + +class Q_GUI_EXPORT QFileDialog : public QDialog +{ + Q_OBJECT + Q_ENUMS(ViewMode FileMode AcceptMode Option) + Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) + Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode) + Q_PROPERTY(AcceptMode acceptMode READ acceptMode WRITE setAcceptMode) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false) + Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks DESIGNABLE false) + Q_PROPERTY(bool confirmOverwrite READ confirmOverwrite WRITE setConfirmOverwrite DESIGNABLE false) + Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix) + Q_PROPERTY(bool nameFilterDetailsVisible READ isNameFilterDetailsVisible + WRITE setNameFilterDetailsVisible DESIGNABLE false) + Q_PROPERTY(Options options READ options WRITE setOptions) + +public: + enum ViewMode { Detail, List }; + enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }; + enum AcceptMode { AcceptOpen, AcceptSave }; + enum DialogLabel { LookIn, FileName, FileType, Accept, Reject }; + + // ### Rename to FileDialogOption and FileDialogOptions for Qt 5.0 + enum Option + { + ShowDirsOnly = 0x00000001, + DontResolveSymlinks = 0x00000002, + DontConfirmOverwrite = 0x00000004, + DontUseSheet = 0x00000008, + DontUseNativeDialog = 0x00000010, + ReadOnly = 0x00000020, + HideNameFilterDetails = 0x00000040 + }; + Q_DECLARE_FLAGS(Options, Option) + + QFileDialog(QWidget *parent, Qt::WindowFlags f); + explicit QFileDialog(QWidget *parent = 0, + const QString &caption = QString(), + const QString &directory = QString(), + const QString &filter = QString()); + ~QFileDialog(); + + void setDirectory(const QString &directory); + inline void setDirectory(const QDir &directory); + QDir directory() const; + + void selectFile(const QString &filename); + QStringList selectedFiles() const; + +#ifdef QT_DEPRECATED + QT_DEPRECATED void setFilter(const QString &filter); + QT_DEPRECATED void setFilters(const QStringList &filters); + QT_DEPRECATED QStringList filters() const; + QT_DEPRECATED void selectFilter(const QString &filter); + QT_DEPRECATED QString selectedFilter() const; +#endif + void setNameFilterDetailsVisible(bool enabled); + bool isNameFilterDetailsVisible() const; + + void setNameFilter(const QString &filter); + void setNameFilters(const QStringList &filters); + QStringList nameFilters() const; + void selectNameFilter(const QString &filter); + QString selectedNameFilter() 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 setReadOnly(bool enabled); + bool isReadOnly() const; + + void setResolveSymlinks(bool enabled); + bool resolveSymlinks() const; + + void setSidebarUrls(const QList<QUrl> &urls); + QList<QUrl> sidebarUrls() const; + + QByteArray saveState() const; + bool restoreState(const QByteArray &state); + + void setConfirmOverwrite(bool enabled); + bool confirmOverwrite() const; + + void setDefaultSuffix(const QString &suffix); + QString defaultSuffix() const; + + void setHistory(const QStringList &paths); + QStringList history() const; + + void setItemDelegate(QAbstractItemDelegate *delegate); + QAbstractItemDelegate *itemDelegate() const; + + void setIconProvider(QFileIconProvider *provider); + QFileIconProvider *iconProvider() const; + + void setLabelText(DialogLabel label, const QString &text); + QString labelText(DialogLabel label) const; + +#ifndef QT_NO_PROXYMODEL + void setProxyModel(QAbstractProxyModel *model); + QAbstractProxyModel *proxyModel() const; +#endif + + void setOption(Option option, bool on = true); + bool testOption(Option option) const; + void setOptions(Options options); + Options options() const; + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + void setVisible(bool visible); + +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); + +public: +#ifdef QT3_SUPPORT + typedef FileMode Mode; + inline QT3_SUPPORT void setMode(FileMode m) { setFileMode(m); } + inline QT3_SUPPORT FileMode mode() const { return fileMode(); } + inline QT3_SUPPORT void setDir(const QString &directory) { setDirectory(directory); } + inline QT3_SUPPORT void setDir( const QDir &directory ) { setDirectory(directory); } + QT3_SUPPORT QString selectedFile() const; +#endif + + static QString getOpenFileName(QWidget *parent = 0, + const QString &caption = QString(), + const QString &dir = QString(), + const QString &filter = QString(), + QString *selectedFilter = 0, + Options options = 0); + + static QString getSaveFileName(QWidget *parent = 0, + const QString &caption = QString(), + const QString &dir = QString(), + const QString &filter = QString(), + QString *selectedFilter = 0, + Options options = 0); + + static QString getExistingDirectory(QWidget *parent = 0, + const QString &caption = QString(), + const QString &dir = QString(), + Options options = ShowDirsOnly); + + static QStringList getOpenFileNames(QWidget *parent = 0, + const QString &caption = QString(), + const QString &dir = QString(), + const QString &filter = QString(), + QString *selectedFilter = 0, + Options options = 0); + +#ifdef QT3_SUPPORT + inline static QString QT3_SUPPORT getOpenFileName(const QString &dir, + const QString &filter = QString(), + QWidget *parent = 0, const char* name = 0, + const QString &caption = QString(), + QString *selectedFilter = 0, + bool resolveSymlinks = true) + { Q_UNUSED(name); + return getOpenFileName(parent, caption, dir, filter, selectedFilter, + resolveSymlinks ? Option(0) : DontResolveSymlinks); } + + inline static QString QT3_SUPPORT getSaveFileName(const QString &dir, + const QString &filter = QString(), + QWidget *parent = 0, const char* name = 0, + const QString &caption = QString(), + QString *selectedFilter = 0, + bool resolveSymlinks = true) + { Q_UNUSED(name); + return getSaveFileName(parent, caption, dir, filter, selectedFilter, + resolveSymlinks ? Option(0) : DontResolveSymlinks); } + + inline static QString QT3_SUPPORT getExistingDirectory(const QString &dir, + QWidget *parent = 0, + const char* name = 0, + const QString &caption = QString(), + bool dirOnly = true, + bool resolveSymlinks = true) + { Q_UNUSED(name); + return getExistingDirectory(parent, caption, dir, + Options((resolveSymlinks ? Option(0) : DontResolveSymlinks) + | (dirOnly ? ShowDirsOnly : Option(0)))); } + + inline static QStringList QT3_SUPPORT getOpenFileNames(const QString &filter, + const QString &dir = QString(), + QWidget *parent = 0, + const char* name = 0, + const QString &caption = QString(), + QString *selectedFilter = 0, + bool resolveSymlinks = true) + { Q_UNUSED(name); + return getOpenFileNames(parent, caption, dir, filter, selectedFilter, + resolveSymlinks ? Option(0) : DontResolveSymlinks); } +#endif // QT3_SUPPORT + +protected: + QFileDialog(const QFileDialogArgs &args); + void done(int result); + void accept(); + void changeEvent(QEvent *e); + +private: + Q_DECLARE_PRIVATE(QFileDialog) + Q_DISABLE_COPY(QFileDialog) + + Q_PRIVATE_SLOT(d_func(), void _q_pathChanged(const QString &)) + + Q_PRIVATE_SLOT(d_func(), void _q_navigateBackward()) + Q_PRIVATE_SLOT(d_func(), void _q_navigateForward()) + Q_PRIVATE_SLOT(d_func(), void _q_navigateToParent()) + Q_PRIVATE_SLOT(d_func(), void _q_createDirectory()) + Q_PRIVATE_SLOT(d_func(), void _q_showListView()) + Q_PRIVATE_SLOT(d_func(), void _q_showDetailsView()) + Q_PRIVATE_SLOT(d_func(), void _q_showContextMenu(const QPoint &)) + Q_PRIVATE_SLOT(d_func(), void _q_renameCurrent()) + Q_PRIVATE_SLOT(d_func(), void _q_deleteCurrent()) + Q_PRIVATE_SLOT(d_func(), void _q_showHidden()) + Q_PRIVATE_SLOT(d_func(), void _q_updateOkButton()) + Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_enterDirectory(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_goToDirectory(const QString &path)) + Q_PRIVATE_SLOT(d_func(), void _q_useNameFilter(int index)) + Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_goToUrl(const QUrl &url)) + Q_PRIVATE_SLOT(d_func(), void _q_goHome()) + Q_PRIVATE_SLOT(d_func(), void _q_showHeader(QAction *)) + Q_PRIVATE_SLOT(d_func(), void _q_autoCompleteFileName(const QString &text)) + Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex & parent)) + Q_PRIVATE_SLOT(d_func(), void _q_fileRenamed(const QString &path, + const QString oldName, const QString newName)) +#if defined(Q_WS_MAC) + Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel()) +#endif +}; + +inline void QFileDialog::setDirectory(const QDir &adirectory) +{ setDirectory(adirectory.absolutePath()); } + +Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options) + +#endif // QT_NO_FILEDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFILEDIALOG_H diff --git a/qtinterface/qt4/Qt/qfileiconprovider.h b/qtinterface/qt4/Qt/qfileiconprovider.h new file mode 100644 index 0000000..302914b --- /dev/null +++ b/qtinterface/qt4/Qt/qfileiconprovider.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILEICONPROVIDER_H +#define QFILEICONPROVIDER_H + +#include <QtCore/qfileinfo.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_FILEICONPROVIDER + +class QFileIconProviderPrivate; + +class Q_GUI_EXPORT QFileIconProvider +{ +public: + QFileIconProvider(); + virtual ~QFileIconProvider(); + enum IconType { Computer, Desktop, Trashcan, Network, Drive, Folder, File }; + virtual QIcon icon(IconType type) const; + virtual QIcon icon(const QFileInfo &info) const; + virtual QString type(const QFileInfo &info) const; + +private: + Q_DECLARE_PRIVATE(QFileIconProvider) + QScopedPointer<QFileIconProviderPrivate> d_ptr; + Q_DISABLE_COPY(QFileIconProvider) +}; + +#endif // QT_NO_FILEICONPROVIDER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFILEICONPROVIDER_H + diff --git a/qtinterface/qt4/Qt/qfileinfo.h b/qtinterface/qt4/Qt/qfileinfo.h new file mode 100644 index 0000000..91e42cd --- /dev/null +++ b/qtinterface/qt4/Qt/qfileinfo.h @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILEINFO_H +#define QFILEINFO_H + +#include <QtCore/qfile.h> +#include <QtCore/qlist.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QDir; +class QDateTime; +class QFileInfoPrivate; + +class Q_CORE_EXPORT QFileInfo +{ +public: + QFileInfo(); + QFileInfo(const QString &file); + QFileInfo(const QFile &file); + QFileInfo(const QDir &dir, const QString &file); + QFileInfo(const QFileInfo &fileinfo); + ~QFileInfo(); + + QFileInfo &operator=(const QFileInfo &fileinfo); + bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me + bool operator==(const QFileInfo &fileinfo) const; + inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); } // 5.0 - remove me + inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); } + + void setFile(const QString &file); + void setFile(const QFile &file); + void setFile(const QDir &dir, const QString &file); + bool exists() const; + void refresh(); + + QString filePath() const; + QString absoluteFilePath() const; + QString canonicalFilePath() const; + QString fileName() const; + QString baseName() const; + QString completeBaseName() const; + QString suffix() const; + QString bundleName() const; + QString completeSuffix() const; + + QString path() const; + QString absolutePath() const; + QString canonicalPath() const; + QDir dir() const; + QDir absoluteDir() const; + + bool isReadable() const; + bool isWritable() const; + bool isExecutable() const; + bool isHidden() const; + + bool isRelative() const; + inline bool isAbsolute() const { return !isRelative(); } + bool makeAbsolute(); + + bool isFile() const; + bool isDir() const; + bool isSymLink() const; + bool isRoot() const; + bool isBundle() const; + + QString readLink() const; + inline QString symLinkTarget() const { return readLink(); } + + QString owner() const; + uint ownerId() const; + QString group() const; + uint groupId() const; + + bool permission(QFile::Permissions permissions) const; + QFile::Permissions permissions() const; + + qint64 size() const; + + QDateTime created() const; + QDateTime lastModified() const; + QDateTime lastRead() const; + + void detach(); + + bool caching() const; + void setCaching(bool on); + +#ifdef QT3_SUPPORT + enum Permission { + ReadOwner = QFile::ReadOwner, WriteOwner = QFile::WriteOwner, ExeOwner = QFile::ExeOwner, + ReadUser = QFile::ReadUser, WriteUser = QFile::WriteUser, ExeUser = QFile::ExeUser, + ReadGroup = QFile::ReadGroup, WriteGroup = QFile::WriteGroup, ExeGroup = QFile::ExeGroup, + ReadOther = QFile::ReadOther, WriteOther = QFile::WriteOther, ExeOther = QFile::ExeOther + }; + Q_DECLARE_FLAGS(PermissionSpec, Permission) + + inline QT3_SUPPORT QString baseName(bool complete) { + if(complete) + return completeBaseName(); + return baseName(); + } + inline QT3_SUPPORT QString extension(bool complete = true) const { + if(complete) + return completeSuffix(); + return suffix(); + } + inline QT3_SUPPORT QString absFilePath() const { return absoluteFilePath(); } + + inline QT3_SUPPORT QString dirPath(bool absPath = false) const { + if(absPath) + return absolutePath(); + return path(); + } + QT3_SUPPORT QDir dir(bool absPath) const; + inline QT3_SUPPORT bool convertToAbs() { return makeAbsolute(); } +#if !defined(Q_NO_TYPESAFE_FLAGS) + inline QT3_SUPPORT bool permission(PermissionSpec permissions) const + { return permission(QFile::Permissions(static_cast<int>(permissions))); } +#endif +#endif + +protected: + QScopedPointer<QFileInfoPrivate> d_ptr; +private: + Q_DECLARE_PRIVATE(QFileInfo) +}; +Q_DECLARE_TYPEINFO(QFileInfo, Q_MOVABLE_TYPE); + +#ifdef QT3_SUPPORT +Q_DECLARE_OPERATORS_FOR_FLAGS(QFileInfo::PermissionSpec) +#endif + +typedef QList<QFileInfo> QFileInfoList; +#ifdef QT3_SUPPORT +typedef QList<QFileInfo>::Iterator QFileInfoListIterator; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFILEINFO_H diff --git a/qtinterface/qt4/Qt/qfilesystemmodel.h b/qtinterface/qt4/Qt/qfilesystemmodel.h new file mode 100644 index 0000000..cd98ea7 --- /dev/null +++ b/qtinterface/qt4/Qt/qfilesystemmodel.h @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILESYSTEMMODEL_H +#define QFILESYSTEMMODEL_H + +#include <QtCore/qabstractitemmodel.h> +#include <QtCore/qpair.h> +#include <QtCore/qdir.h> +#include <QtGui/qicon.h> +#include <QtCore/qdiriterator.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_FILESYSTEMMODEL + +class ExtendedInformation; +class QFileSystemModelPrivate; +class QFileIconProvider; + +class Q_GUI_EXPORT QFileSystemModel : public QAbstractItemModel +{ + Q_OBJECT + Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool nameFilterDisables READ nameFilterDisables WRITE setNameFilterDisables) + +Q_SIGNALS: + void rootPathChanged(const QString &newPath); + void fileRenamed(const QString &path, const QString &oldName, const QString &newName); + +public: + enum Roles { + FileIconRole = Qt::DecorationRole, + FilePathRole = Qt::UserRole + 1, + FileNameRole = Qt::UserRole + 2, + FilePermissions = Qt::UserRole + 3 + }; + + explicit QFileSystemModel(QObject *parent = 0); + ~QFileSystemModel(); + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex index(const QString &path, int column = 0) const; + QModelIndex parent(const QModelIndex &child) const; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + bool canFetchMore(const QModelIndex &parent) const; + void fetchMore(const QModelIndex &parent); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant myComputer(int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + + Qt::ItemFlags flags(const QModelIndex &index) const; + + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + + QStringList mimeTypes() const; + QMimeData *mimeData(const QModelIndexList &indexes) const; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); + Qt::DropActions supportedDropActions() const; + + // QFileSystemModel specific API + QModelIndex setRootPath(const QString &path); + QString rootPath() const; + QDir rootDirectory() const; + + void setIconProvider(QFileIconProvider *provider); + QFileIconProvider *iconProvider() const; + + void setFilter(QDir::Filters filters); + QDir::Filters filter() const; + + void setResolveSymlinks(bool enable); + bool resolveSymlinks() const; + + void setReadOnly(bool enable); + bool isReadOnly() const; + + void setNameFilterDisables(bool enable); + bool nameFilterDisables() const; + + void setNameFilters(const QStringList &filters); + QStringList nameFilters() const; + + QString filePath(const QModelIndex &index) const; + bool isDir(const QModelIndex &index) const; + qint64 size(const QModelIndex &index) const; + QString type(const QModelIndex &index) const; + QDateTime lastModified(const QModelIndex &index) const; + + QModelIndex mkdir(const QModelIndex &parent, const QString &name); + inline bool rmdir(const QModelIndex &index) const; + inline QString fileName(const QModelIndex &index) const; + inline QIcon fileIcon(const QModelIndex &index) const; + QFile::Permissions permissions(const QModelIndex &index) const; + inline QFileInfo fileInfo(const QModelIndex &index) const; + bool remove(const QModelIndex &index) const; + +protected: + QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = 0); + void timerEvent(QTimerEvent *event); + bool event(QEvent *event); + +private: + Q_DECLARE_PRIVATE(QFileSystemModel) + Q_DISABLE_COPY(QFileSystemModel) + + Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QStringList &list)) + Q_PRIVATE_SLOT(d_func(), void _q_performDelayedSort()) + Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &)) + Q_PRIVATE_SLOT(d_func(), void _q_resolvedName(const QString &fileName, const QString &resolvedName)) + + friend class QFileDialogPrivate; +}; + +inline bool QFileSystemModel::rmdir(const QModelIndex &aindex) const +{ QDir dir; return dir.rmdir(filePath(aindex)); } +inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const +{ return aindex.data(Qt::DisplayRole).toString(); } +inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const +{ return qvariant_cast<QIcon>(aindex.data(Qt::DecorationRole)); } +inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const +{ return QFileInfo(filePath(aindex)); } + +#endif // QT_NO_FILESYSTEMMODEL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFILESYSTEMMODEL_H + diff --git a/qtinterface/qt4/Qt/qfilesystemwatcher.h b/qtinterface/qt4/Qt/qfilesystemwatcher.h new file mode 100644 index 0000000..b7ef1cd --- /dev/null +++ b/qtinterface/qt4/Qt/qfilesystemwatcher.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILESYSTEMWATCHER_H +#define QFILESYSTEMWATCHER_H + +#include <QtCore/qobject.h> + +#ifndef QT_NO_FILESYSTEMWATCHER + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QFileSystemWatcherPrivate; + +class Q_CORE_EXPORT QFileSystemWatcher : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QFileSystemWatcher) + +public: + QFileSystemWatcher(QObject *parent = 0); + 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); + + QStringList files() const; + QStringList directories() const; + +Q_SIGNALS: + void fileChanged(const QString &path); + void directoryChanged(const QString &path); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_fileChanged(const QString &path, bool removed)) + Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &path, bool removed)) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_FILESYSTEMWATCHER +#endif // QFILESYSTEMWATCHER_H diff --git a/qtinterface/qt4/Qt/qfinalstate.h b/qtinterface/qt4/Qt/qfinalstate.h new file mode 100644 index 0000000..d8447b2 --- /dev/null +++ b/qtinterface/qt4/Qt/qfinalstate.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFINALSTATE_H +#define QFINALSTATE_H + +#include <QtCore/qabstractstate.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QFinalStatePrivate; +class Q_CORE_EXPORT QFinalState : public QAbstractState +{ + Q_OBJECT +public: + QFinalState(QState *parent = 0); + ~QFinalState(); + +protected: + void onEntry(QEvent *event); + void onExit(QEvent *event); + + bool event(QEvent *e); + +private: + Q_DISABLE_COPY(QFinalState) + Q_DECLARE_PRIVATE(QFinalState) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qfocusframe.h b/qtinterface/qt4/Qt/qfocusframe.h new file mode 100644 index 0000000..3b3f349 --- /dev/null +++ b/qtinterface/qt4/Qt/qfocusframe.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFOCUSFRAME_H +#define QFOCUSFRAME_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFocusFramePrivate; +class QStyleOption; + +class Q_GUI_EXPORT QFocusFrame : public QWidget +{ + Q_OBJECT +public: + QFocusFrame(QWidget *parent=0); + ~QFocusFrame(); + + void setWidget(QWidget *widget); + QWidget *widget() const; + +protected: + bool event(QEvent *e); + + bool eventFilter(QObject *, QEvent *); + void paintEvent(QPaintEvent *); + void initStyleOption(QStyleOption *option) const; + +private: + Q_DECLARE_PRIVATE(QFocusFrame) + Q_DISABLE_COPY(QFocusFrame) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFOCUSFRAME_H diff --git a/qtinterface/qt4/Qt/qfont.h b/qtinterface/qt4/Qt/qfont.h new file mode 100644 index 0000000..11ea5be --- /dev/null +++ b/qtinterface/qt4/Qt/qfont.h @@ -0,0 +1,358 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONT_H +#define QFONT_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qstring.h> +#include <QtCore/qsharedpointer.h> + +#if defined(Q_WS_X11) || defined(Q_WS_QWS) +typedef struct FT_FaceRec_* FT_Face; +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFontPrivate; /* don't touch */ +class QStringList; +class QVariant; +class Q3TextFormatCollection; + +class Q_GUI_EXPORT QFont +{ + Q_GADGET + Q_ENUMS(StyleStrategy) +public: + enum StyleHint { + Helvetica, SansSerif = Helvetica, + Times, Serif = Times, + Courier, TypeWriter = Courier, + OldEnglish, Decorative = OldEnglish, + System, + AnyStyle + }; + + enum StyleStrategy { + PreferDefault = 0x0001, + PreferBitmap = 0x0002, + PreferDevice = 0x0004, + PreferOutline = 0x0008, + ForceOutline = 0x0010, + PreferMatch = 0x0020, + PreferQuality = 0x0040, + PreferAntialias = 0x0080, + NoAntialias = 0x0100, + OpenGLCompatible = 0x0200, + NoFontMerging = 0x8000 + }; + + enum Weight { + Light = 25, + Normal = 50, + DemiBold = 63, + Bold = 75, + Black = 87 + }; + + enum Style { + StyleNormal, + StyleItalic, + StyleOblique + }; + + enum Stretch { + UltraCondensed = 50, + ExtraCondensed = 62, + Condensed = 75, + SemiCondensed = 87, + Unstretched = 100, + SemiExpanded = 112, + Expanded = 125, + ExtraExpanded = 150, + UltraExpanded = 200 + }; + + enum Capitalization { + MixedCase, + AllUppercase, + AllLowercase, + SmallCaps, + Capitalize + }; + + enum SpacingType { + PercentageSpacing, + AbsoluteSpacing + }; + + enum ResolveProperties { + FamilyResolved = 0x0001, + SizeResolved = 0x0002, + StyleHintResolved = 0x0004, + StyleStrategyResolved = 0x0008, + WeightResolved = 0x0010, + StyleResolved = 0x0020, + UnderlineResolved = 0x0040, + OverlineResolved = 0x0080, + StrikeOutResolved = 0x0100, + FixedPitchResolved = 0x0200, + StretchResolved = 0x0400, + KerningResolved = 0x0800, + CapitalizationResolved = 0x1000, + LetterSpacingResolved = 0x2000, + WordSpacingResolved = 0x4000, + AllPropertiesResolved = 0x7fff + }; + + QFont(); + QFont(const QString &family, int pointSize = -1, int weight = -1, bool italic = false); + QFont(const QFont &, QPaintDevice *pd); + QFont(const QFont &); + ~QFont(); + + QString family() const; + void setFamily(const QString &); + + int pointSize() const; + void setPointSize(int); + qreal pointSizeF() const; + void setPointSizeF(qreal); + + int pixelSize() const; + void setPixelSize(int); + + int weight() const; + void setWeight(int); + + inline bool bold() const; + inline void setBold(bool); + + void setStyle(Style style); + Style style() const; + + inline bool italic() const; + inline void setItalic(bool b); + + bool underline() const; + void setUnderline(bool); + + bool overline() const; + void setOverline(bool); + + bool strikeOut() const; + void setStrikeOut(bool); + + bool fixedPitch() const; + void setFixedPitch(bool); + + bool kerning() const; + void setKerning(bool); + + StyleHint styleHint() const; + StyleStrategy styleStrategy() const; + void setStyleHint(StyleHint, StyleStrategy = PreferDefault); + void setStyleStrategy(StyleStrategy s); + + int stretch() const; + void setStretch(int); + + qreal letterSpacing() const; + SpacingType letterSpacingType() const; + void setLetterSpacing(SpacingType type, qreal spacing); + + qreal wordSpacing() const; + void setWordSpacing(qreal spacing); + + void setCapitalization(Capitalization); + Capitalization capitalization() const; + + // is raw mode still needed? + bool rawMode() const; + void setRawMode(bool); + + // dupicated from QFontInfo + bool exactMatch() const; + + QFont &operator=(const QFont &); + bool operator==(const QFont &) const; + bool operator!=(const QFont &) const; + bool operator<(const QFont &) const; + operator QVariant() const; + bool isCopyOf(const QFont &) const; + + +#ifdef Q_WS_WIN + HFONT handle() const; +#else // !Q_WS_WIN + Qt::HANDLE handle() const; +#endif // Q_WS_WIN +#ifdef Q_WS_MAC + quint32 macFontID() const; +#endif +#if defined(Q_WS_X11) || defined(Q_WS_QWS) + FT_Face freetypeFace() const; +#endif + + // needed for X11 + void setRawName(const QString &); + QString rawName() const; + + QString key() const; + + QString toString() const; + bool fromString(const QString &); + + static QString substitute(const QString &); + static QStringList substitutes(const QString &); + static QStringList substitutions(); + static void insertSubstitution(const QString&, const QString &); + static void insertSubstitutions(const QString&, const QStringList &); + static void removeSubstitution(const QString &); + static void initialize(); + static void cleanup(); +#ifndef Q_WS_QWS + static void cacheStatistics(); +#endif + + QString defaultFamily() const; + QString lastResortFamily() const; + QString lastResortFont() const; + + QFont resolve(const QFont &) const; + inline uint resolve() const { return resolve_mask; } + inline void resolve(uint mask) { resolve_mask = mask; } + +#ifdef QT3_SUPPORT + static QT3_SUPPORT QFont defaultFont(); + static QT3_SUPPORT void setDefaultFont(const QFont &); + QT3_SUPPORT void setPixelSizeFloat(qreal); + QT3_SUPPORT qreal pointSizeFloat() const { return pointSizeF(); } + QT3_SUPPORT void setPointSizeFloat(qreal size) { setPointSizeF(size); } +#endif + +private: + QFont(QFontPrivate *); + + void detach(); + +#if defined(Q_WS_MAC) + void macSetFont(QPaintDevice *); +#elif defined(Q_WS_X11) + void x11SetScreen(int screen = -1); + int x11Screen() const; +#endif + + friend class QFontPrivate; + friend class QFontDialogPrivate; + friend class QFontMetrics; + friend class QFontMetricsF; + friend class QFontInfo; + friend class QPainter; + friend class QPSPrintEngineFont; + friend class QApplication; + friend class QWidget; + friend class QWidgetPrivate; + friend class Q3TextFormatCollection; + friend class QTextLayout; + friend class QTextEngine; + friend class QStackTextEngine; + friend class QTextLine; + friend struct QScriptLine; + friend class QGLContext; + friend class QWin32PaintEngine; + friend class QAlphaPaintEngine; + friend class QPainterPath; + friend class QTextItemInt; + friend class QPicturePaintEngine; + friend class QPainterReplayer; + friend class QPaintBufferEngine; + friend class QCommandLinkButtonPrivate; + +#ifndef QT_NO_DATASTREAM + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QFont &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QFont &); +#endif + + QExplicitlySharedDataPointer<QFontPrivate> d; + uint resolve_mask; +}; + + +inline bool QFont::bold() const +{ return weight() > Normal; } + + +inline void QFont::setBold(bool enable) +{ setWeight(enable ? Bold : Normal); } + +inline bool QFont::italic() const +{ + return (style() != StyleNormal); +} + +inline void QFont::setItalic(bool b) { + setStyle(b ? StyleItalic : StyleNormal); +} + + +/***************************************************************************** + QFont stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QFont &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QFont &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QFont &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFONT_H diff --git a/qtinterface/qt4/Qt/qfontcombobox.h b/qtinterface/qt4/Qt/qfontcombobox.h new file mode 100644 index 0000000..123ddeb --- /dev/null +++ b/qtinterface/qt4/Qt/qfontcombobox.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTCOMBOBOX_H +#define QFONTCOMBOBOX_H + +#include <QtGui/qcombobox.h> +#include <QtGui/qfontdatabase.h> + +#ifndef QT_NO_FONTCOMBOBOX + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFontComboBoxPrivate; + +class Q_GUI_EXPORT QFontComboBox : public QComboBox +{ + Q_OBJECT + Q_FLAGS(FontFilters) + Q_PROPERTY(QFontDatabase::WritingSystem writingSystem READ writingSystem WRITE setWritingSystem) + Q_PROPERTY(FontFilters fontFilters READ fontFilters WRITE setFontFilters) + Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged) + Q_ENUMS(FontSelection) + +public: + explicit QFontComboBox(QWidget *parent = 0); + ~QFontComboBox(); + + void setWritingSystem(QFontDatabase::WritingSystem); + QFontDatabase::WritingSystem writingSystem() const; + + enum FontFilter { + AllFonts = 0, + ScalableFonts = 0x1, + NonScalableFonts = 0x2, + MonospacedFonts = 0x4, + ProportionalFonts = 0x8 + }; + Q_DECLARE_FLAGS(FontFilters, FontFilter) + + void setFontFilters(FontFilters filters); + FontFilters fontFilters() const; + + QFont currentFont() const; + QSize sizeHint() const; + +public Q_SLOTS: + void setCurrentFont(const QFont &f); + +Q_SIGNALS: + void currentFontChanged(const QFont &f); + +protected: + bool event(QEvent *e); + +private: + Q_DISABLE_COPY(QFontComboBox) + Q_DECLARE_PRIVATE(QFontComboBox) + Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QString &)) + Q_PRIVATE_SLOT(d_func(), void _q_updateModel()) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QFontComboBox::FontFilters) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_FONTCOMBOBOX +#endif diff --git a/qtinterface/qt4/Qt/qfontdatabase.h b/qtinterface/qt4/Qt/qfontdatabase.h new file mode 100644 index 0000000..3bbbced --- /dev/null +++ b/qtinterface/qt4/Qt/qfontdatabase.h @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTDATABASE_H +#define QFONTDATABASE_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qstring.h> +#include <QtGui/qfont.h> +#ifdef QT3_SUPPORT +#include <QtCore/qstringlist.h> +#include <QtCore/qlist.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStringList; +template <class T> class QList; +struct QFontDef; +class QFontEngine; + +class QFontDatabasePrivate; + +class Q_GUI_EXPORT QFontDatabase +{ + Q_GADGET + Q_ENUMS(WritingSystem) +public: + // do not re-order or delete entries from this enum without updating the + // QPF2 format and makeqpf!! + enum WritingSystem { + Any, + + Latin, + Greek, + Cyrillic, + Armenian, + Hebrew, + Arabic, + Syriac, + Thaana, + Devanagari, + Bengali, + Gurmukhi, + Gujarati, + Oriya, + Tamil, + Telugu, + Kannada, + Malayalam, + Sinhala, + Thai, + Lao, + Tibetan, + Myanmar, + Georgian, + Khmer, + SimplifiedChinese, + TraditionalChinese, + Japanese, + Korean, + Vietnamese, + + Symbol, + Other = Symbol, + + Ogham, + Runic, + Nko, + + WritingSystemsCount + }; + + static QList<int> standardSizes(); + + QFontDatabase(); + + QList<WritingSystem> writingSystems() const; + QList<WritingSystem> writingSystems(const QString &family) const; + + QStringList families(WritingSystem writingSystem = Any) const; + QStringList styles(const QString &family) const; + QList<int> pointSizes(const QString &family, const QString &style = QString()); + QList<int> smoothSizes(const QString &family, const QString &style); + QString styleString(const QFont &font); + QString styleString(const QFontInfo &fontInfo); + + QFont font(const QString &family, const QString &style, int pointSize) const; + + bool isBitmapScalable(const QString &family, const QString &style = QString()) const; + bool isSmoothlyScalable(const QString &family, const QString &style = QString()) const; + bool isScalable(const QString &family, const QString &style = QString()) const; + bool isFixedPitch(const QString &family, const QString &style = QString()) const; + + bool italic(const QString &family, const QString &style) const; + bool bold(const QString &family, const QString &style) const; + int weight(const QString &family, const QString &style) const; + + static QString writingSystemName(WritingSystem writingSystem); + static QString writingSystemSample(WritingSystem writingSystem); + + static int addApplicationFont(const QString &fileName); + static int addApplicationFontFromData(const QByteArray &fontData); + static QStringList applicationFontFamilies(int id); + static bool removeApplicationFont(int id); + static bool removeAllApplicationFonts(); + + static bool supportsThreadedFontRendering(); + +private: + static void createDatabase(); + static void parseFontName(const QString &name, QString &foundry, QString &family); +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) + static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request); +#endif + static void load(const QFontPrivate *d, int script); +#ifdef Q_WS_X11 + static QFontEngine *loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id = -1); +#endif + + friend struct QFontDef; + friend class QFontPrivate; + friend class QFontDialog; + friend class QFontDialogPrivate; + friend class QFontEngineMultiXLFD; + friend class QFontEngineMultiQWS; + friend class QFontEngineMultiS60; + + QFontDatabasePrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFONTDATABASE_H diff --git a/qtinterface/qt4/Qt/qfontdialog.h b/qtinterface/qt4/Qt/qfontdialog.h new file mode 100644 index 0000000..f45998b --- /dev/null +++ b/qtinterface/qt4/Qt/qfontdialog.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTDIALOG_H +#define QFONTDIALOG_H + +#include <QtGui/qwindowdefs.h> +#include <QtGui/qdialog.h> +#include <QtGui/qfont.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_FONTDIALOG + +class QFontDialogPrivate; + +class Q_GUI_EXPORT QFontDialog : public QDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QFontDialog) + Q_ENUMS(FontDialogOption) + Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged) + Q_PROPERTY(FontDialogOptions options READ options WRITE setOptions) + +public: + enum FontDialogOption { + NoButtons = 0x00000001, + DontUseNativeDialog = 0x00000002 + }; + + Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) + + explicit QFontDialog(QWidget *parent = 0); + explicit QFontDialog(const QFont &initial, QWidget *parent = 0); + ~QFontDialog(); + + void setCurrentFont(const QFont &font); + QFont currentFont() const; + + QFont selectedFont() const; + + void setOption(FontDialogOption option, bool on = true); + bool testOption(FontDialogOption option) const; + void setOptions(FontDialogOptions options); + FontDialogOptions options() const; + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + + void setVisible(bool visible); + + // ### Qt 5: merge overloads + static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title, + FontDialogOptions options); + static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title); + static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = 0); + static QFont getFont(bool *ok, QWidget *parent = 0); + +#ifdef QT3_SUPPORT + static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const char *name) + { Q_UNUSED(name); return getFont(ok, initial, parent); } + static QFont getFont(bool *ok, QWidget *parent, const char *name) + { Q_UNUSED(name); return getFont(ok, parent); } +#endif + +Q_SIGNALS: + void currentFontChanged(const QFont &font); + void fontSelected(const QFont &font); + +protected: + void changeEvent(QEvent *event); + void done(int result); + +private: + // ### Qt 5: make protected + bool eventFilter(QObject *object, QEvent *event); + + Q_DISABLE_COPY(QFontDialog) + + Q_PRIVATE_SLOT(d_func(), void _q_sizeChanged(const QString &)) + Q_PRIVATE_SLOT(d_func(), void _q_familyHighlighted(int)) + Q_PRIVATE_SLOT(d_func(), void _q_writingSystemHighlighted(int)) + Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int)) + Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSample()) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions) + +#endif // QT_NO_FONTDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFONTDIALOG_H diff --git a/qtinterface/qt4/Qt/qfontinfo.h b/qtinterface/qt4/Qt/qfontinfo.h new file mode 100644 index 0000000..6a45738 --- /dev/null +++ b/qtinterface/qt4/Qt/qfontinfo.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTINFO_H +#define QFONTINFO_H + +#include <QtGui/qfont.h> +#include <QtCore/qsharedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QFontInfo +{ +public: + QFontInfo(const QFont &); + QFontInfo(const QFontInfo &); + ~QFontInfo(); + + QFontInfo &operator=(const QFontInfo &); + + QString family() const; + int pixelSize() const; + int pointSize() const; + qreal pointSizeF() const; + bool italic() const; + QFont::Style style() const; + int weight() const; + inline bool bold() const { return weight() > QFont::Normal; } + bool underline() const; + bool overline() const; + bool strikeOut() const; + bool fixedPitch() const; + QFont::StyleHint styleHint() const; + bool rawMode() const; + + bool exactMatch() const; + +private: + QExplicitlySharedDataPointer<QFontPrivate> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFONTINFO_H diff --git a/qtinterface/qt4/Qt/qfontmetrics.h b/qtinterface/qt4/Qt/qfontmetrics.h new file mode 100644 index 0000000..0492223 --- /dev/null +++ b/qtinterface/qt4/Qt/qfontmetrics.h @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTMETRICS_H +#define QFONTMETRICS_H + +#include <QtGui/qfont.h> +#include <QtCore/qsharedpointer.h> +#ifndef QT_INCLUDE_COMPAT +#include <QtCore/qrect.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifdef Q_WS_QWS +class QFontEngine; +#endif + +class QTextCodec; +class QRect; + + +class Q_GUI_EXPORT QFontMetrics +{ +public: + QFontMetrics(const QFont &); + QFontMetrics(const QFont &, QPaintDevice *pd); + QFontMetrics(const QFontMetrics &); + ~QFontMetrics(); + + QFontMetrics &operator=(const QFontMetrics &); + + int ascent() const; + int descent() const; + int height() const; + int leading() const; + int lineSpacing() const; + int minLeftBearing() const; + int minRightBearing() const; + int maxWidth() const; + + int xHeight() const; + int averageCharWidth() const; + + bool inFont(QChar) const; + + int leftBearing(QChar) const; + int rightBearing(QChar) const; + int width(const QString &, int len = -1) const; + + int width(QChar) const; + int charWidth(const QString &str, int pos) const; + + QRect boundingRect(QChar) const; + + QRect boundingRect(const QString &text) const; + QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops=0, int *tabarray=0) const; + inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, + int tabstops=0, int *tabarray=0) const + { return boundingRect(QRect(x, y, w, h), flags, text, tabstops, tabarray); } + QSize size(int flags, const QString& str, int tabstops=0, int *tabarray=0) const; + + QRect tightBoundingRect(const QString &text) const; + + QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags = 0) const; + + int underlinePos() const; + int overlinePos() const; + int strikeOutPos() const; + int lineWidth() const; + + bool operator==(const QFontMetrics &other); // 5.0 - remove me + bool operator==(const QFontMetrics &other) const; + inline bool operator !=(const QFontMetrics &other) { return !operator==(other); } // 5.0 - remove me + inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); } + +#ifdef QT3_SUPPORT + inline QRect boundingRect(const QString &text, int len) const + { return boundingRect(text.left(len)); } + inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString& str, int len, + int tabstops=0, int *tabarray=0) const + { return boundingRect(QRect(x, y, w, h), flags, str.left(len), tabstops, tabarray); } + inline QSize size(int flags, const QString& str, int len, int tabstops=0, int *tabarray=0) const + { return size(flags, str.left(len), tabstops, tabarray); } +#endif +private: +#if defined(Q_WS_MAC) + friend class QFontPrivate; +#endif + friend class QFontMetricsF; + friend class QStackTextEngine; + + QExplicitlySharedDataPointer<QFontPrivate> d; +}; + + +class Q_GUI_EXPORT QFontMetricsF +{ +public: + QFontMetricsF(const QFont &); + QFontMetricsF(const QFont &, QPaintDevice *pd); + QFontMetricsF(const QFontMetrics &); + QFontMetricsF(const QFontMetricsF &); + ~QFontMetricsF(); + + QFontMetricsF &operator=(const QFontMetricsF &); + QFontMetricsF &operator=(const QFontMetrics &); + + qreal ascent() const; + qreal descent() const; + qreal height() const; + qreal leading() const; + qreal lineSpacing() const; + qreal minLeftBearing() const; + qreal minRightBearing() const; + qreal maxWidth() const; + + qreal xHeight() const; + qreal averageCharWidth() const; + + bool inFont(QChar) const; + + qreal leftBearing(QChar) const; + qreal rightBearing(QChar) const; + qreal width(const QString &string) const; + + qreal width(QChar) const; + + QRectF boundingRect(const QString &string) const; + QRectF boundingRect(QChar) const; + QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops=0, int *tabarray=0) const; + QSizeF size(int flags, const QString& str, int tabstops=0, int *tabarray=0) const; + + QRectF tightBoundingRect(const QString &text) const; + + QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags = 0) const; + + qreal underlinePos() const; + qreal overlinePos() const; + qreal strikeOutPos() const; + qreal lineWidth() const; + + bool operator==(const QFontMetricsF &other); // 5.0 - remove me + bool operator==(const QFontMetricsF &other) const; + inline bool operator !=(const QFontMetricsF &other) { return !operator==(other); } // 5.0 - remove me + inline bool operator !=(const QFontMetricsF &other) const { return !operator==(other); } + +private: + QExplicitlySharedDataPointer<QFontPrivate> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFONTMETRICS_H diff --git a/qtinterface/qt4/Qt/qformlayout.h b/qtinterface/qt4/Qt/qformlayout.h new file mode 100644 index 0000000..9ef1943 --- /dev/null +++ b/qtinterface/qt4/Qt/qformlayout.h @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFORMLAYOUT_H +#define QFORMLAYOUT_H + +#include <QtGui/QLayout> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFormLayoutPrivate; + +class Q_GUI_EXPORT QFormLayout : public QLayout +{ + Q_OBJECT + Q_ENUMS(FormStyle FieldGrowthPolicy RowWrapPolicy ItemRole) + Q_DECLARE_PRIVATE(QFormLayout) + Q_PROPERTY(FieldGrowthPolicy fieldGrowthPolicy READ fieldGrowthPolicy WRITE setFieldGrowthPolicy RESET resetFieldGrowthPolicy) + Q_PROPERTY(RowWrapPolicy rowWrapPolicy READ rowWrapPolicy WRITE setRowWrapPolicy RESET resetRowWrapPolicy) + Q_PROPERTY(Qt::Alignment labelAlignment READ labelAlignment WRITE setLabelAlignment RESET resetLabelAlignment) + Q_PROPERTY(Qt::Alignment formAlignment READ formAlignment WRITE setFormAlignment RESET resetFormAlignment) + Q_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) + Q_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) + +public: + enum FieldGrowthPolicy { + FieldsStayAtSizeHint, + ExpandingFieldsGrow, + AllNonFixedFieldsGrow + }; + + enum RowWrapPolicy { + DontWrapRows, + WrapLongRows, + WrapAllRows + }; + + enum ItemRole { + LabelRole = 0, + FieldRole = 1, + SpanningRole = 2 + }; + + explicit QFormLayout(QWidget *parent = 0); + ~QFormLayout(); + + void setFieldGrowthPolicy(FieldGrowthPolicy policy); + FieldGrowthPolicy fieldGrowthPolicy() const; + void setRowWrapPolicy(RowWrapPolicy policy); + RowWrapPolicy rowWrapPolicy() const; + void setLabelAlignment(Qt::Alignment alignment); + Qt::Alignment labelAlignment() const; + void setFormAlignment(Qt::Alignment alignment); + Qt::Alignment formAlignment() const; + + void setHorizontalSpacing(int spacing); + int horizontalSpacing() const; + void setVerticalSpacing(int spacing); + int verticalSpacing() const; + + int spacing() const; + void setSpacing(int); + + void addRow(QWidget *label, QWidget *field); + void addRow(QWidget *label, QLayout *field); + void addRow(const QString &labelText, QWidget *field); + void addRow(const QString &labelText, QLayout *field); + void addRow(QWidget *widget); + void addRow(QLayout *layout); + + void insertRow(int row, QWidget *label, QWidget *field); + void insertRow(int row, QWidget *label, QLayout *field); + void insertRow(int row, const QString &labelText, QWidget *field); + void insertRow(int row, const QString &labelText, QLayout *field); + void insertRow(int row, QWidget *widget); + void insertRow(int row, QLayout *layout); + + void setItem(int row, ItemRole role, QLayoutItem *item); + void setWidget(int row, ItemRole role, QWidget *widget); + void setLayout(int row, ItemRole role, QLayout *layout); + + QLayoutItem *itemAt(int row, ItemRole role) const; + void getItemPosition(int index, int *rowPtr, ItemRole *rolePtr) const; + void getWidgetPosition(QWidget *widget, int *rowPtr, ItemRole *rolePtr) const; + void getLayoutPosition(QLayout *layout, int *rowPtr, ItemRole *rolePtr) const; + QWidget *labelForField(QWidget *field) const; + QWidget *labelForField(QLayout *field) const; + + // reimplemented from QLayout + void addItem(QLayoutItem *item); + QLayoutItem *itemAt(int index) const; + QLayoutItem *takeAt(int index); + + void setGeometry(const QRect &rect); + QSize minimumSize() const; + QSize sizeHint() const; + void invalidate(); + + bool hasHeightForWidth() const; + int heightForWidth(int width) const; + Qt::Orientations expandingDirections() const; + int count() const; + + int rowCount() const; + +#if 0 + void dump() const; +#endif + +private: + void resetFieldGrowthPolicy(); + void resetRowWrapPolicy(); + void resetLabelAlignment(); + void resetFormAlignment(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qframe.h b/qtinterface/qt4/Qt/qframe.h new file mode 100644 index 0000000..30a709f --- /dev/null +++ b/qtinterface/qt4/Qt/qframe.h @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFRAME_H +#define QFRAME_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFramePrivate; + +class Q_GUI_EXPORT QFrame : public QWidget +{ + Q_OBJECT + + Q_ENUMS(Shape Shadow) + Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape) + Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow) + Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) + Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth) + Q_PROPERTY(int frameWidth READ frameWidth) + Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false) + +public: + explicit QFrame(QWidget* parent = 0, Qt::WindowFlags f = 0); + ~QFrame(); + + int frameStyle() const; + void setFrameStyle(int); + + int frameWidth() const; + + QSize sizeHint() const; + + enum Shape { + NoFrame = 0, // no frame + Box = 0x0001, // rectangular box + Panel = 0x0002, // rectangular panel + WinPanel = 0x0003, // rectangular panel (Windows) + HLine = 0x0004, // horizontal line + VLine = 0x0005, // vertical line + StyledPanel = 0x0006 // rectangular panel depending on the GUI style + +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + ,PopupPanel = StyledPanel, // rectangular panel depending on the GUI style + MenuBarPanel = StyledPanel, + ToolBarPanel = StyledPanel, + LineEditPanel = StyledPanel, + TabWidgetPanel = StyledPanel, + GroupBoxPanel = StyledPanel +#endif + }; + enum Shadow { + Plain = 0x0010, // plain line + Raised = 0x0020, // raised shadow effect + Sunken = 0x0030 // sunken shadow effect + }; + + enum StyleMask { + Shadow_Mask = 0x00f0, // mask for the shadow + Shape_Mask = 0x000f // mask for the shape +#if defined(QT3_SUPPORT) + ,MShadow = Shadow_Mask, + MShape = Shape_Mask +#endif + }; + + Shape frameShape() const; + void setFrameShape(Shape); + Shadow frameShadow() const; + void setFrameShadow(Shadow); + + int lineWidth() const; + void setLineWidth(int); + + int midLineWidth() const; + void setMidLineWidth(int); + + QRect frameRect() const; + void setFrameRect(const QRect &); + +protected: + bool event(QEvent *e); + void paintEvent(QPaintEvent *); + void changeEvent(QEvent *); + void drawFrame(QPainter *); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QFrame(QWidget* parent, const char* name, Qt::WindowFlags f = 0); +#endif + +protected: + QFrame(QFramePrivate &dd, QWidget* parent = 0, Qt::WindowFlags f = 0); + +private: + Q_DISABLE_COPY(QFrame) + Q_DECLARE_PRIVATE(QFrame) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFRAME_H diff --git a/qtinterface/qt4/Qt/qfsfileengine.h b/qtinterface/qt4/Qt/qfsfileengine.h new file mode 100644 index 0000000..a0b1159 --- /dev/null +++ b/qtinterface/qt4/Qt/qfsfileengine.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFSFILEENGINE_H +#define QFSFILEENGINE_H + +#include <QtCore/qabstractfileengine.h> + +#ifndef QT_NO_FSFILEENGINE + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QFSFileEnginePrivate; + +class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine +{ + Q_DECLARE_PRIVATE(QFSFileEngine) +public: + QFSFileEngine(); + explicit QFSFileEngine(const QString &file); + ~QFSFileEngine(); + + bool open(QIODevice::OpenMode openMode); + bool open(QIODevice::OpenMode flags, FILE *fh); + bool close(); + bool flush(); + qint64 size() const; + qint64 pos() const; + bool seek(qint64); + bool isSequential() const; + bool remove(); + bool copy(const QString &newName); + bool rename(const QString &newName); + bool link(const QString &newName); + bool mkdir(const QString &dirName, bool createParentDirectories) const; + bool rmdir(const QString &dirName, bool recurseParentDirectories) const; + bool setSize(qint64 size); + bool caseSensitive() const; + bool isRelativePath() const; + QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; + FileFlags fileFlags(FileFlags type) const; + bool setPermissions(uint perms); + QString fileName(FileName file) const; + uint ownerId(FileOwner) const; + QString owner(FileOwner) const; + QDateTime fileTime(FileTime time) const; + void setFileName(const QString &file); + int handle() const; + + Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames); + Iterator *endEntryList(); + + qint64 read(char *data, qint64 maxlen); + qint64 readLine(char *data, qint64 maxlen); + qint64 write(const char *data, qint64 len); + + bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0); + bool supportsExtension(Extension extension) const; + + //FS only!! + bool open(QIODevice::OpenMode flags, int fd); + static bool setCurrentPath(const QString &path); + static QString currentPath(const QString &path = QString()); + static QString homePath(); + static QString rootPath(); + static QString tempPath(); + static QFileInfoList drives(); + +protected: + QFSFileEngine(QFSFileEnginePrivate &dd); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_FSFILEENGINE + +#endif // QFSFILEENGINE_H diff --git a/qtinterface/qt4/Qt/qftp.h b/qtinterface/qt4/Qt/qftp.h new file mode 100644 index 0000000..976afea --- /dev/null +++ b/qtinterface/qt4/Qt/qftp.h @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFTP_H +#define QFTP_H + +#include <QtCore/qstring.h> +#include <QtNetwork/qurlinfo.h> +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_FTP + +class QFtpPrivate; + +class Q_NETWORK_EXPORT QFtp : public QObject +{ + Q_OBJECT + +public: + explicit QFtp(QObject *parent = 0); + virtual ~QFtp(); + + enum State { + Unconnected, + HostLookup, + Connecting, + Connected, + LoggedIn, + Closing + }; + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + NotConnected + }; + enum Command { + None, + SetTransferMode, + SetProxy, + ConnectToHost, + Login, + Close, + List, + Cd, + Get, + Put, + Remove, + Mkdir, + Rmdir, + Rename, + RawCommand + }; + enum TransferMode { + Active, + Passive + }; + enum TransferType { + Binary, + Ascii + }; + + int setProxy(const QString &host, quint16 port); + int connectToHost(const QString &host, quint16 port=21); + int login(const QString &user = QString(), const QString &password = QString()); + int close(); + int setTransferMode(TransferMode mode); + int list(const QString &dir = QString()); + int cd(const QString &dir); + int get(const QString &file, QIODevice *dev=0, TransferType type = Binary); + int put(const QByteArray &data, const QString &file, TransferType type = Binary); + int put(QIODevice *dev, const QString &file, TransferType type = Binary); + int remove(const QString &file); + int mkdir(const QString &dir); + int rmdir(const QString &dir); + int rename(const QString &oldname, const QString &newname); + + int rawCommand(const QString &command); + + qint64 bytesAvailable() const; + qint64 read(char *data, qint64 maxlen); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT qint64 readBlock(char *data, quint64 maxlen) + { return read(data, qint64(maxlen)); } +#endif + QByteArray readAll(); + + int currentId() const; + QIODevice* currentDevice() const; + Command currentCommand() const; + bool hasPendingCommands() const; + void clearPendingCommands(); + + State state() const; + + Error error() const; + QString errorString() const; + +public Q_SLOTS: + void abort(); + +Q_SIGNALS: + void stateChanged(int); + void listInfo(const QUrlInfo&); + void readyRead(); + void dataTransferProgress(qint64, qint64); + void rawCommandReply(int, const QString&); + + void commandStarted(int); + void commandFinished(int, bool); + void done(bool); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QFtp(QObject *parent, const char *name); +#endif + +private: + Q_DISABLE_COPY(QFtp) + Q_DECLARE_PRIVATE(QFtp) + + Q_PRIVATE_SLOT(d_func(), void _q_startNextCommand()) + Q_PRIVATE_SLOT(d_func(), void _q_piFinished(const QString&)) + Q_PRIVATE_SLOT(d_func(), void _q_piError(int, const QString&)) + Q_PRIVATE_SLOT(d_func(), void _q_piConnectState(int)) + Q_PRIVATE_SLOT(d_func(), void _q_piFtpReply(int, const QString&)) +}; + +#endif // QT_NO_FTP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFTP_H diff --git a/qtinterface/qt4/Qt/qfunctions_vxworks.h b/qtinterface/qt4/Qt/qfunctions_vxworks.h new file mode 100644 index 0000000..9f8ead8 --- /dev/null +++ b/qtinterface/qt4/Qt/qfunctions_vxworks.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUNCTIONS_VXWORKS_H +#define QFUNCTIONS_VXWORKS_H +#ifdef Q_OS_VXWORKS + +#include <unistd.h> +#include <pthread.h> +#include <dirent.h> +#include <signal.h> +#include <string.h> +#include <strings.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/times.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +#ifdef QT_BUILD_CORE_LIB +QT_MODULE(Core) +#endif + +QT_END_NAMESPACE +QT_END_HEADER + + +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif + +#ifndef NSIG +#define NSIG _NSIGS +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// isascii is missing (sometimes!!) +#ifndef isascii +inline int isascii(int c) { return (c & 0x7f); } +#endif + +// no lfind() - used by the TIF image format +void *lfind(const void* key, const void* base, size_t* elements, size_t size, + int (*compare)(const void*, const void*)); + +// no rand_r(), but rand() +// NOTE: this implementation is wrong for multi threaded applications, +// but there is no way to get it right on VxWorks (in kernel mode) +int rand_r(unsigned int * /*seedp*/); + +// no usleep() support +int usleep(unsigned int); + +// gettimeofday() is declared, but is missing from the library. +// It IS however defined in the Curtis-Wright X11 libraries, so +// we have to make the symbol 'weak' +int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak)); + +// neither getpagesize() or sysconf(_SC_PAGESIZE) are available +int getpagesize(); + +// symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) +int symlink(const char *, const char *); +ssize_t readlink(const char *, char *, size_t); + +// there's no truncate(), but ftruncate() support... +int truncate(const char *path, off_t length); + +// VxWorks doesn't know about passwd & friends. +// in order to avoid patching the unix fs path everywhere +// we introduce some dummy functions that simulate a single +// 'root' user on the system. + +uid_t getuid(); +gid_t getgid(); +uid_t geteuid(); + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* user password */ + uid_t pw_uid; /* user ID */ + gid_t pw_gid; /* group ID */ + char *pw_gecos; /* real name */ + char *pw_dir; /* home directory */ + char *pw_shell; /* shell program */ +}; + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group ID */ + char **gr_mem; /* group members */ +}; + +struct passwd *getpwuid(uid_t uid); +struct group *getgrgid(gid_t gid); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // Q_OS_VXWORKS +#endif // QFUNCTIONS_VXWORKS_H diff --git a/qtinterface/qt4/Qt/qfunctions_wince.h b/qtinterface/qt4/Qt/qfunctions_wince.h new file mode 100644 index 0000000..9d703ce --- /dev/null +++ b/qtinterface/qt4/Qt/qfunctions_wince.h @@ -0,0 +1,401 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUNCTIONS_WCE_H +#define QFUNCTIONS_WCE_H +#ifdef Q_OS_WINCE +#include <stdio.h> +#include <stdlib.h> +#include <windows.h> +#include <winuser.h> +#include <winbase.h> +#include <objbase.h> +#include <kfuncs.h> +#include <ctype.h> +#include <time.h> +#include <crtdefs.h> +#include <altcecrt.h> +#include <winsock.h> +#include <ceconfig.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +#ifdef QT_BUILD_CORE_LIB +QT_MODULE(Core) +#endif + +QT_END_NAMESPACE +QT_END_HEADER + + +// The standard SDK misses this define... +#define _control87 _controlfp + +#if !defined __cplusplus +#define bool int +#define true 1 +#define false 0 +#endif + +// Environment ------------------------------------------------------ +errno_t qt_wince_getenv_s(size_t*, char*, size_t, const char*); +errno_t qt_wince__putenv_s(const char*, const char*); + +#ifdef __cplusplus // have this as tiff plugin is written in C +extern "C" { +#endif + +#define SetWindowLongA SetWindowLong +#define GetWindowLongA GetWindowLong +#define SendMessageA SendMessage + +#if !defined(NO_ERRNO_H) +#define NO_ERRNO_H +#endif + +// Environment ------------------------------------------------------ +int qt_wince__getpid(void); + + +// Time ------------------------------------------------------------- +#ifndef _TM_DEFINED +#define _TM_DEFINED +struct tm { + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday - [0,6] */ + int tm_yday; /* days since January 1 - [0,365] */ + int tm_isdst; /* daylight savings time flag */ +}; +#endif // _TM_DEFINED + +FILETIME qt_wince_time_tToFt( time_t tt ); + +// File I/O --------------------------------------------------------- +#define _O_RDONLY 0x0001 +#define _O_RDWR 0x0002 +#define _O_WRONLY 0x0004 +#define _O_CREAT 0x0008 +#define _O_TRUNC 0x0010 +#define _O_APPEND 0x0020 +#define _O_EXCL 0x0040 + +#define O_RDONLY _O_RDONLY +#define O_RDWR _O_RDWR +#define O_WRONLY _O_WRONLY +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_APPEND _O_APPEND +#define O_EXCL _O_EXCL + +#define _S_IFMT 0x0600 +#define _S_IFDIR 0x0200 +#define _S_IFCHR 0x0100 +#define _S_IFREG 0x0400 +#define _S_IREAD 0x0010 +#define _S_IWRITE 0x0008 + +#define S_IFMT _S_IFMT +#define S_IFDIR _S_IFDIR +#define S_IFCHR _S_IFCHR +#define S_IFREG _S_IFREG +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE + +#ifndef _IOFBF +#define _IOFBF 0x0000 +#endif + +#ifndef _IOLBF +#define _IOLBF 0x0040 +#endif + +#ifndef _IONBF +#define _IONBF 0x0004 +#endif + +// Regular Berkeley error constants +#ifndef _STAT_DEFINED +#define _STAT_DEFINED +struct stat +{ + int st_mode; + int st_size; + int st_nlink; + time_t st_mtime; + time_t st_atime; + time_t st_ctime; +}; +#endif + +typedef int mode_t; +extern int errno; + +int qt_wince__getdrive( void ); +int qt_wince__waccess( const wchar_t *path, int pmode ); +int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode ); +long qt_wince__lseek( int handle, long offset, int origin ); +int qt_wince__read( int handle, void *buffer, unsigned int count ); +int qt_wince__write( int handle, const void *buffer, unsigned int count ); +int qt_wince__close( int handle ); +FILE *qt_wince__fdopen(int handle, const char *mode); +FILE *qt_wince_fdopen(int handle, const char *mode); +void qt_wince_rewind( FILE *stream ); +int qt_wince___fileno(FILE *); +FILE *qt_wince_tmpfile( void ); + +int qt_wince__mkdir(const char *dirname); +int qt_wince__rmdir(const char *dirname); +int qt_wince__access( const char *path, int pmode ); +int qt_wince__rename( const char *oldname, const char *newname ); +int qt_wince__remove( const char *name ); +#ifdef __cplusplus +int qt_wince_open( const char *filename, int oflag, int pmode = 0 ); +#else +int qt_wince_open( const char *filename, int oflag, int pmode ); +#endif +int qt_wince_stat( const char *path, struct stat *buffer ); +int qt_wince__fstat( int handle, struct stat *buffer); + +#define SEM_FAILCRITICALERRORS 0x0001 +#define SEM_NOOPENFILEERRORBOX 0x0002 +int qt_wince_SetErrorMode(int); +#ifndef CoInitialize +#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED) +#endif + +bool qt_wince__chmod(const char *file, int mode); +bool qt_wince__wchmod(const wchar_t *file, int mode); + +#pragma warning(disable: 4273) +HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); + +// Printer ---------------------------------------------------------- +#define ETO_GLYPH_INDEX 0x0010 + +// Graphics --------------------------------------------------------- +#ifndef SM_CXCURSOR +# define SM_CXCURSOR 13 +#endif +#ifndef SM_CYCURSOR +# define SM_CYCURSOR 14 +#endif +BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint ); + +// Other stuff ------------------------------------------------------ +#define MWMO_ALERTABLE 0x0002 +// ### not the real values +#define CREATE_NO_WINDOW 2 +#define CF_HDROP 15 + +void *qt_wince_calloc(size_t num, size_t size); +#if !defined(TLS_OUT_OF_INDEXES) +# define TLS_OUT_OF_INDEXES 0xffffffff +#endif +DWORD qt_wince_GetThreadLocale(void); + +HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist); + +unsigned long qt_wince__beginthreadex( void *security, + unsigned stack_size, + unsigned (__stdcall *start_address)(void *), + void *arglist, + unsigned initflag, + unsigned *thrdaddr ); +void qt_wince__endthreadex(unsigned nExitCode); + + +// bsearch is needed for building the tiff plugin +// otherwise it could go into qguifunctions_wce +void *qt_wince_bsearch(const void *key, + const void *base, + size_t num, + size_t size, + int (__cdecl *compare)(const void *, const void *)); + +// Missing typedefs +#ifndef _TIME_T_DEFINED +typedef unsigned long time_t; +#define _TIME_T_DEFINED +#endif +typedef HANDLE HDROP; + +#ifndef WS_THICKFRAME +#define WS_THICKFRAME WS_DLGFRAME +#endif + +typedef UINT UWORD; + +// Missing definitions: not necessary equal to their Win32 values +// (the goal is to just have a clean compilation of MFC) +#define WS_MAXIMIZE 0 +#define WS_MINIMIZE 0 +#ifndef WS_EX_TOOLWINDOW +#define WS_EX_TOOLWINDOW 0 +#endif +#define WS_EX_NOPARENTNOTIFY 0 +#define WM_ENTERIDLE 0x0121 +#define WM_PRINT WM_PAINT +#define WM_NCCREATE (0x0081) +#define WM_PARENTNOTIFY 0 +#define WM_NCDESTROY (WM_APP-1) +#ifndef SW_RESTORE +#define SW_RESTORE (SW_SHOWNORMAL) +#endif +#define SW_NORMAL (SW_SHOWNORMAL) +#define WAIT_OBJECT_0 0x00000000L +#define DEFAULT_GUI_FONT SYSTEM_FONT +#ifndef SWP_NOREDRAW +#define SWP_NOREDRAW 0 +#endif +#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) +#define HWND_TOPMOST ((HWND)-1) +#define HWND_NOTOPMOST ((HWND)-2) +#define PS_DOT 2 +#define PD_ALLPAGES 0 +#define PD_USEDEVMODECOPIES 0 +#define PD_NOSELECTION 0 +#define PD_HIDEPRINTTOFILE 0 +#define PD_NOPAGENUMS 0 +#define CF_METAFILEPICT 3 +#define MM_ANISOTROPIC 8 +#define KF_ALTDOWN 0x2000 +#define SPI_GETWORKAREA 48 + +#ifndef WM_SETCURSOR + #define WM_SETCURSOR 0x0020 + #define IDC_ARROW MAKEINTRESOURCE(32512) + #define IDC_IBEAM MAKEINTRESOURCE(32513) + #define IDC_WAIT MAKEINTRESOURCE(32514) + #define IDC_CROSS MAKEINTRESOURCE(32515) + #define IDC_UPARROW MAKEINTRESOURCE(32516) + #define IDC_SIZE MAKEINTRESOURCE(32646) + #define IDC_ICON MAKEINTRESOURCE(32512) + #define IDC_SIZENWSE MAKEINTRESOURCE(32642) + #define IDC_SIZENESW MAKEINTRESOURCE(32643) + #define IDC_SIZEWE MAKEINTRESOURCE(32644) + #define IDC_SIZENS MAKEINTRESOURCE(32645) + #define IDC_SIZEALL MAKEINTRESOURCE(32646) + #define IDC_NO MAKEINTRESOURCE(32648) + #define IDC_APPSTARTING MAKEINTRESOURCE(32650) + #define IDC_HELP MAKEINTRESOURCE(32651) + #define IDC_HAND MAKEINTRESOURCE(32649) +#endif + +#define GMEM_MOVEABLE LMEM_MOVEABLE +#define GPTR LPTR + +// WinCE: CESYSGEN prunes the following FRP defines, +// and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h +#undef FTP_TRANSFER_TYPE_ASCII +#define FTP_TRANSFER_TYPE_ASCII 0x00000001 +#undef FTP_TRANSFER_TYPE_BINARY +#define FTP_TRANSFER_TYPE_BINARY 0x00000002 + +typedef DWORD OLE_COLOR; + +// Define the Windows Styles which are not defined by MS +#ifndef WS_POPUPWINDOW +#define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION +#endif + +#ifndef WS_OVERLAPPEDWINDOW +#define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX +#endif + +#ifndef WS_TILED +#define WS_TILED WS_OVERLAPPED +#endif + +#ifndef WS_TILEDWINDOW +#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW +#endif + +#ifndef WS_EX_CAPTIONOKBTN +#define WS_EX_CAPTIONOKBTN 0x80000000L +#endif + +#ifndef WS_EX_NODRAG +#define WS_EX_NODRAG 0x40000000L +#endif + +// As Windows CE lacks some standard functions used in Qt, these got +// reimplented. Other projects do this as well and to not fill the +// global namespace with this implementation, prepend qt_wince* and use +// these versions inside of Qt. +// The other declarations available in this file are being used per +// define inside qplatformdefs.h of the corresponding WinCE mkspec. +#define getenv_s(a,b,c,d) qt_wince_getenv_s(a,b,c,d) +#define _putenv_s(a,b) qt_wince__putenv_s(a,b) +#define _getpid() qt_wince__getpid() +#define time_tToFt(a) qt_wince_time_tToFt(a) +#define _getdrive() qt_wince__getdrive() +#define _waccess(a,b) qt_wince__waccess(a,b) +#define _wopen(a,b,c) qt_wince__wopen(a,b,c) +#define _fdopen(a,b) qt_wince__fdopen(a,b) +#define fdopen(a,b) qt_wince_fdopen(a,b) +#define rewind(a) qt_wince_rewind(a) +#define tmpfile() qt_wince_tmpfile() +#define _rename(a,b) qt_wince__rename(a,b) +#define _remove(a) qt_wince__remove(a) +#define SetErrorMode(a) qt_wince_SetErrorMode(a) +#define _chmod(a,b) qt_wince__chmod(a,b) +#define _wchmod(a,b) qt_wince__wchmod(a,b) +#define CreateFileA(a,b,c,d,e,f,g) qt_wince_CreateFileA(a,b,c,d,e,f,g) +#define SetWindowOrgEx(a,b,c,d) qt_wince_SetWindowOrgEx(a,b,c,d) +#define calloc(a,b) qt_wince_calloc(a,b) +#define GetThreadLocale() qt_wince_GetThreadLocale() +#define _beginthread(a,b,c) qt_wince__beginthread(a,b,c) +#define _beginthreadex(a,b,c,d,e,f) qt_wince__beginthreadex(a,b,c,d,e,f) +#define _endthreadex(a) qt_wince__endthreadex(a) +#define bsearch(a,b,c,d,e) qt_wince_bsearch(a,b,c,d,e) + +#ifdef __cplusplus +} // Extern C. +#endif + +#endif // Q_OS_WINCE +#endif // QFUNCTIONS_WCE_H diff --git a/qtinterface/qt4/Qt/qfuture.h b/qtinterface/qt4/Qt/qfuture.h new file mode 100644 index 0000000..1123e1a --- /dev/null +++ b/qtinterface/qt4/Qt/qfuture.h @@ -0,0 +1,278 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUTURE_H +#define QFUTURE_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_QFUTURE + +#include <QtCore/qfutureinterface.h> +#include <QtCore/qstring.h> +#include <QtCore/qtconcurrentcompilertest.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <typename T> +class QFutureWatcher; +template <> +class QFutureWatcher<void>; + +template <typename T> +class QFuture +{ +public: + QFuture() + : d(QFutureInterface<T>::canceledResult()) + { } + explicit QFuture(QFutureInterface<T> *p) // internal + : d(*p) + { } + QFuture(const QFuture &other) + : d(other.d) + { } + ~QFuture() + { } + + inline QFuture &operator=(const QFuture &other); + bool operator==(const QFuture &other) const { return (d == other.d); } + bool operator!=(const QFuture &other) const { return (d != other.d); } + + void cancel() { d.cancel(); } + bool isCanceled() const { return d.isCanceled(); } + + void setPaused(bool paused) { d.setPaused(paused); } + bool isPaused() const { return d.isPaused(); } + void pause() { setPaused(true); } + void resume() { setPaused(false); } + void togglePaused() { d.togglePaused(); } + + bool isStarted() const { return d.isStarted(); } + bool isFinished() const { return d.isFinished(); } + bool isRunning() const { return d.isRunning(); } + + int resultCount() const { return d.resultCount(); } + int progressValue() const { return d.progressValue(); } + int progressMinimum() const { return d.progressMinimum(); } + int progressMaximum() const { return d.progressMaximum(); } + QString progressText() const { return d.progressText(); } + void waitForFinished() { d.waitForFinished(); } + + inline T result() const; + inline T resultAt(int index) const; + bool isResultReadyAt(int resultIndex) const { return d.isResultReadyAt(resultIndex); } + + operator T() const { return result(); } + QList<T> results() const { return d.results(); } + + class const_iterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() {} + inline const_iterator(QFuture const * const _future, int _index) : future(_future), index(_index) {} + inline const_iterator(const const_iterator &o) : future(o.future), index(o.index) {} + inline const_iterator &operator=(const const_iterator &o) + { future = o.future; index = o.index; return *this; } + inline const T &operator*() const { return future->d.resultReference(index); } + inline const T *operator->() const { return future->d.resultPointer(index); } + + inline bool operator!=(const const_iterator &other) const + { + if (index == -1 && other.index == -1) // comparing end != end? + return false; + if (other.index == -1) + return (future->isRunning() || (index < future->resultCount())); + return (index != other.index); + } + + inline bool operator==(const const_iterator &o) const { return !operator!=(o); } + inline const_iterator &operator++() { ++index; return *this; } + inline const_iterator operator++(int) { const_iterator r = *this; ++index; return r; } + inline const_iterator &operator--() { --index; return *this; } + inline const_iterator operator--(int) { const_iterator r = *this; --index; return r; } + inline const_iterator operator+(int j) const { return const_iterator(future, index + j); } + inline const_iterator operator-(int j) const { return const_iterator(future, index - j); } + inline const_iterator &operator+=(int j) { index += j; return *this; } + inline const_iterator &operator-=(int j) { index -= j; return *this; } + private: + QFuture const * future; + int index; + }; + friend class const_iterator; + typedef const_iterator ConstIterator; + + const_iterator begin() const { return const_iterator(this, 0); } + const_iterator constBegin() const { return const_iterator(this, 0); } + const_iterator end() const { return const_iterator(this, -1); } + const_iterator constEnd() const { return const_iterator(this, -1); } + +private: + friend class QFutureWatcher<T>; + +public: // Warning: the d pointer is not documented and is considered private. + mutable QFutureInterface<T> d; +}; + +template <typename T> +inline QFuture<T> &QFuture<T>::operator=(const QFuture<T> &other) +{ + d = other.d; + return *this; +} + +template <typename T> +inline T QFuture<T>::result() const +{ + d.waitForResult(0); + return d.resultReference(0); +} + +template <typename T> +inline T QFuture<T>::resultAt(int index) const +{ + d.waitForResult(index); + return d.resultReference(index); +} + +template <typename T> +inline QFuture<T> QFutureInterface<T>::future() +{ + return QFuture<T>(this); +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(Future) + +template <> +class QFuture<void> +{ +public: + QFuture() + : d(QFutureInterface<void>::canceledResult()) + { } + explicit QFuture(QFutureInterfaceBase *p) // internal + : d(*p) + { } + QFuture(const QFuture &other) + : d(other.d) + { } + ~QFuture() + { } + + QFuture &operator=(const QFuture &other); + bool operator==(const QFuture &other) const { return (d == other.d); } + bool operator!=(const QFuture &other) const { return (d != other.d); } + +#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(Q_CC_XLC) + template <typename T> + QFuture(const QFuture<T> &other) + : d(other.d) + { } + + template <typename T> + QFuture<void> &operator=(const QFuture<T> &other) + { + d = other.d; + return *this; + } +#endif + + void cancel() { d.cancel(); } + bool isCanceled() const { return d.isCanceled(); } + + void setPaused(bool paused) { d.setPaused(paused); } + bool isPaused() const { return d.isPaused(); } + void pause() { setPaused(true); } + void resume() { setPaused(false); } + void togglePaused() { d.togglePaused(); } + + bool isStarted() const { return d.isStarted(); } + bool isFinished() const { return d.isFinished(); } + bool isRunning() const { return d.isRunning(); } + + int resultCount() const { return d.resultCount(); } + int progressValue() const { return d.progressValue(); } + int progressMinimum() const { return d.progressMinimum(); } + int progressMaximum() const { return d.progressMaximum(); } + QString progressText() const { return d.progressText(); } + void waitForFinished() { d.waitForFinished(); } + +private: + friend class QFutureWatcher<void>; + +#ifdef QFUTURE_TEST +public: +#endif + mutable QFutureInterfaceBase d; +}; + +inline QFuture<void> &QFuture<void>::operator=(const QFuture<void> &other) +{ + d = other.d; + return *this; +} + +inline QFuture<void> QFutureInterface<void>::future() +{ + return QFuture<void>(this); +} + +template <typename T> +QFuture<void> qToVoidFuture(const QFuture<T> &future) +{ + return QFuture<void>(future.d); +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif // QFUTURE_H diff --git a/qtinterface/qt4/Qt/qfutureinterface.h b/qtinterface/qt4/Qt/qfutureinterface.h new file mode 100644 index 0000000..35c3cc1 --- /dev/null +++ b/qtinterface/qt4/Qt/qfutureinterface.h @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUTUREINTERFACE_H +#define QFUTUREINTERFACE_H + +#include <QtCore/qglobal.h> +#include <QtCore/qrunnable.h> + +#ifndef QT_NO_QFUTURE + +#include <QtCore/qmutex.h> +#include <QtCore/qtconcurrentexception.h> +#include <QtCore/qtconcurrentresultstore.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <typename T> class QFuture; +class QFutureInterfaceBasePrivate; +class QFutureWatcherBase; +class QFutureWatcherBasePrivate; + +class Q_CORE_EXPORT QFutureInterfaceBase +{ +public: + enum State { + NoState = 0x00, + Running = 0x01, + Started = 0x02, + Finished = 0x04, + Canceled = 0x08, + Paused = 0x10, + Throttled = 0x20 + }; + + QFutureInterfaceBase(State initialState = NoState); + QFutureInterfaceBase(const QFutureInterfaceBase &other); + virtual ~QFutureInterfaceBase(); + + // reporting functions available to the engine author: + void reportStarted(); + void reportFinished(); + void reportCanceled(); +#ifndef QT_NO_EXCEPTIONS + void reportException(const QtConcurrent::Exception &e); +#endif + void reportResultsReady(int beginIndex, int endIndex); + + void setRunnable(QRunnable *runnable); + void setFilterMode(bool enable); + void setProgressRange(int minimum, int maximum); + int progressMinimum() const; + int progressMaximum() const; + bool isProgressUpdateNeeded() const; + void setProgressValue(int progressValue); + int progressValue() const; + void setProgressValueAndText(int progressValue, const QString &progressText); + QString progressText() const; + + void setExpectedResultCount(int resultCount); + int expectedResultCount(); + int resultCount() const; + + bool queryState(State state) const; + bool isRunning() const; + bool isStarted() const; + bool isCanceled() const; + bool isFinished() const; + bool isPaused() const; + bool isThrottled() const; + bool isResultReadyAt(int index) const; + + void cancel(); + void setPaused(bool paused); + void togglePaused(); + void setThrottled(bool enable); + + void waitForFinished(); + bool waitForNextResult(); + void waitForResult(int resultIndex); + void waitForResume(); + + QMutex *mutex() const; + QtConcurrent::internal::ExceptionStore &exceptionStore(); + QtConcurrent::ResultStoreBase &resultStoreBase(); + const QtConcurrent::ResultStoreBase &resultStoreBase() const; + + inline bool operator==(const QFutureInterfaceBase &other) const { return d == other.d; } + inline bool operator!=(const QFutureInterfaceBase &other) const { return d != other.d; } + QFutureInterfaceBase &operator=(const QFutureInterfaceBase &other); + +protected: + bool referenceCountIsOne() const; +public: + +#ifndef QFUTURE_TEST +private: +#endif + QFutureInterfaceBasePrivate *d; + +private: + friend class QFutureWatcherBase; + friend class QFutureWatcherBasePrivate; +}; + +template <typename T> +class QFutureInterface : public QFutureInterfaceBase +{ +public: + QFutureInterface(State initialState = NoState) + : QFutureInterfaceBase(initialState) + { } + QFutureInterface(const QFutureInterface &other) + : QFutureInterfaceBase(other) + { } + ~QFutureInterface() + { + if (referenceCountIsOne()) + resultStore().clear(); + } + + static QFutureInterface canceledResult() + { return QFutureInterface(State(Started | Finished | Canceled)); } + + QFutureInterface &operator=(const QFutureInterface &other) + { + if (referenceCountIsOne()) + resultStore().clear(); + QFutureInterfaceBase::operator=(other); + return *this; + } + + inline QFuture<T> future(); // implemented in qfuture.h + + inline void reportResult(const T *result, int index = -1); + inline void reportResult(const T &result, int index = -1); + inline void reportResults(const QVector<T> &results, int beginIndex = -1, int count = -1); + inline void reportFinished(const T *result = 0); + + inline const T &resultReference(int index) const; + inline const T *resultPointer(int index) const; + inline QList<T> results(); +private: + QtConcurrent::ResultStore<T> &resultStore() + { return static_cast<QtConcurrent::ResultStore<T> &>(resultStoreBase()); } + const QtConcurrent::ResultStore<T> &resultStore() const + { return static_cast<const QtConcurrent::ResultStore<T> &>(resultStoreBase()); } +}; + +template <typename T> +inline void QFutureInterface<T>::reportResult(const T *result, int index) +{ + QMutexLocker locker(mutex()); + if (this->queryState(Canceled) || this->queryState(Finished)) { + return; + } + + QtConcurrent::ResultStore<T> &store = resultStore(); + + + if (store.filterMode()) { + const int resultCountBefore = store.count(); + store.addResult(index, result); + this->reportResultsReady(resultCountBefore, resultCountBefore + store.count()); + } else { + const int insertIndex = store.addResult(index, result); + this->reportResultsReady(insertIndex, insertIndex + 1); + } +} + +template <typename T> +inline void QFutureInterface<T>::reportResult(const T &result, int index) +{ + reportResult(&result, index); +} + +template <typename T> +inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int beginIndex, int count) +{ + QMutexLocker locker(mutex()); + if (this->queryState(Canceled) || this->queryState(Finished)) { + return; + } + + QtConcurrent::ResultStore<T> &store = resultStore(); + + if (store.filterMode()) { + const int resultCountBefore = store.count(); + store.addResults(beginIndex, &_results, count); + this->reportResultsReady(resultCountBefore, store.count()); + } else { + const int insertIndex = store.addResults(beginIndex, &_results, count); + this->reportResultsReady(insertIndex, insertIndex + _results.count()); + } +} + +template <typename T> +inline void QFutureInterface<T>::reportFinished(const T *result) +{ + if (result) + reportResult(result); + QFutureInterfaceBase::reportFinished(); +} + +template <typename T> +inline const T &QFutureInterface<T>::resultReference(int index) const +{ + QMutexLocker lock(mutex()); + return resultStore().resultAt(index).value(); +} + +template <typename T> +inline const T *QFutureInterface<T>::resultPointer(int index) const +{ + QMutexLocker lock(mutex()); + return resultStore().resultAt(index).pointer(); +} + +template <typename T> +inline QList<T> QFutureInterface<T>::results() +{ + if (this->isCanceled()) { + exceptionStore().throwPossibleException(); + return QList<T>(); + } + QFutureInterfaceBase::waitForResult(-1); + + QList<T> res; + QMutexLocker lock(mutex()); + + QtConcurrent::ResultIterator<T> it = resultStore().begin(); + while (it != resultStore().end()) { + res.append(it.value()); + ++it; + } + + return res; +} + +template <> +class QFutureInterface<void> : public QFutureInterfaceBase +{ +public: + QFutureInterface<void>(State initialState = NoState) + : QFutureInterfaceBase(initialState) + { } + QFutureInterface<void>(const QFutureInterface<void> &other) + : QFutureInterfaceBase(other) + { } + + static QFutureInterface<void> canceledResult() + { return QFutureInterface(State(Started | Finished | Canceled)); } + + QFutureInterface<void> &operator=(const QFutureInterface<void> &other) + { + QFutureInterfaceBase::operator=(other); + return *this; + } + + inline QFuture<void> future(); // implemented in qfuture.h + + void reportResult(const void *, int) { } + void reportResults(const QVector<void> &, int) { } + void reportFinished(void * = 0) { QFutureInterfaceBase::reportFinished(); } +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif // QFUTUREINTERFACE_H diff --git a/qtinterface/qt4/Qt/qfuturesynchronizer.h b/qtinterface/qt4/Qt/qfuturesynchronizer.h new file mode 100644 index 0000000..56c29f6 --- /dev/null +++ b/qtinterface/qt4/Qt/qfuturesynchronizer.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUTRUESYNCHRONIZER_H +#define QFUTRUESYNCHRONIZER_H + +#include <QtCore/qfuture.h> + +#ifndef QT_NO_CONCURRENT + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <typename T> +class QFutureSynchronizer +{ + Q_DISABLE_COPY(QFutureSynchronizer) + +public: + QFutureSynchronizer() : m_cancelOnWait(false) { } + explicit QFutureSynchronizer(const QFuture<T> &future) + : m_cancelOnWait(false) + { addFuture(future); } + ~QFutureSynchronizer() { waitForFinished(); } + + void setFuture(const QFuture<T> &future) + { + waitForFinished(); + m_futures.clear(); + addFuture(future); + } + + void addFuture(const QFuture<T> &future) + { + m_futures.append(future); + } + + void waitForFinished() + { + if (m_cancelOnWait) { + for (int i = 0; i < m_futures.count(); ++i) { + m_futures[i].cancel(); + } + } + + for (int i = 0; i < m_futures.count(); ++i) { + m_futures[i].waitForFinished(); + } + } + + void clearFutures() + { + m_futures.clear(); + } + + QList<QFuture<T> > futures() const + { + return m_futures; + } + + void setCancelOnWait(bool enabled) + { + m_cancelOnWait = enabled; + } + + bool cancelOnWait() const + { + return m_cancelOnWait; + } + +protected: + QList<QFuture<T> > m_futures; + bool m_cancelOnWait; +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif // QFUTRUESYNCHRONIZER_H diff --git a/qtinterface/qt4/Qt/qfuturewatcher.h b/qtinterface/qt4/Qt/qfuturewatcher.h new file mode 100644 index 0000000..96b86d6 --- /dev/null +++ b/qtinterface/qt4/Qt/qfuturewatcher.h @@ -0,0 +1,222 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUTUREWATCHER_H +#define QFUTUREWATCHER_H + +#include <QtCore/qfuture.h> + +#ifndef QT_NO_QFUTURE + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QEvent; + +class QFutureWatcherBasePrivate; +class Q_CORE_EXPORT QFutureWatcherBase : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QFutureWatcherBase) + +public: + QFutureWatcherBase(QObject *parent = 0); + + int progressValue() const; + int progressMinimum() const; + int progressMaximum() const; + QString progressText() const; + + bool isStarted() const; + bool isFinished() const; + bool isRunning() const; + bool isCanceled() const; + bool isPaused() const; + + void waitForFinished(); + + void setPendingResultsLimit(int limit); + + bool event(QEvent *event); + +Q_SIGNALS: + void started(); + void finished(); + void canceled(); + void paused(); + void resumed(); + void resultReadyAt(int resultIndex); + void resultsReadyAt(int beginIndex, int endIndex); + void progressRangeChanged(int minimum, int maximum); + void progressValueChanged(int progressValue); + void progressTextChanged(const QString &progressText); + +public Q_SLOTS: + void cancel(); + void setPaused(bool paused); + void pause(); + void resume(); + void togglePaused(); + +protected: + void connectNotify (const char * signal); + void disconnectNotify (const char * signal); + + // called from setFuture() implemented in template sub-classes + void connectOutputInterface(); + void disconnectOutputInterface(bool pendingAssignment = false); + +private: + // implemented in the template sub-classes + virtual const QFutureInterfaceBase &futureInterface() const = 0; + virtual QFutureInterfaceBase &futureInterface() = 0; +}; + +template <typename T> +class QFutureWatcher : public QFutureWatcherBase +{ +public: + QFutureWatcher(QObject *_parent = 0) + : QFutureWatcherBase(_parent) + { } + ~QFutureWatcher() + { disconnectOutputInterface(); } + + void setFuture(const QFuture<T> &future); + QFuture<T> future() const + { return m_future; } + + T result() const { return m_future.result(); } + T resultAt(int index) const { return m_future.resultAt(index); } + +#ifdef qdoc + int progressValue() const; + int progressMinimum() const; + int progressMaximum() const; + QString progressText() const; + + bool isStarted() const; + bool isFinished() const; + bool isRunning() const; + bool isCanceled() const; + bool isPaused() const; + + void waitForFinished(); + + void setPendingResultsLimit(int limit); + +Q_SIGNALS: + void started(); + void finished(); + void canceled(); + void paused(); + void resumed(); + void resultReadyAt(int resultIndex); + void resultsReadyAt(int beginIndex, int endIndex); + void progressRangeChanged(int minimum, int maximum); + void progressValueChanged(int progressValue); + void progressTextChanged(const QString &progressText); + +public Q_SLOTS: + void cancel(); + void setPaused(bool paused); + void pause(); + void resume(); + void togglePaused(); +#endif + +private: + QFuture<T> m_future; + const QFutureInterfaceBase &futureInterface() const { return m_future.d; } + QFutureInterfaceBase &futureInterface() { return m_future.d; } +}; + +template <typename T> +Q_INLINE_TEMPLATE void QFutureWatcher<T>::setFuture(const QFuture<T> &_future) +{ + if (_future == m_future) + return; + + disconnectOutputInterface(true); + m_future = _future; + connectOutputInterface(); +} + +template <> +class QFutureWatcher<void> : public QFutureWatcherBase +{ +public: + QFutureWatcher(QObject *_parent = 0) + : QFutureWatcherBase(_parent) + { } + ~QFutureWatcher() + { disconnectOutputInterface(); } + + void setFuture(const QFuture<void> &future); + QFuture<void> future() const + { return m_future; } + +private: + QFuture<void> m_future; + const QFutureInterfaceBase &futureInterface() const { return m_future.d; } + QFutureInterfaceBase &futureInterface() { return m_future.d; } +}; + +Q_INLINE_TEMPLATE void QFutureWatcher<void>::setFuture(const QFuture<void> &_future) +{ + if (_future == m_future) + return; + + disconnectOutputInterface(true); + m_future = _future; + connectOutputInterface(); +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif // QFUTUREWATCHER_H diff --git a/qtinterface/qt4/Qt/qgenericmatrix.h b/qtinterface/qt4/Qt/qgenericmatrix.h new file mode 100644 index 0000000..00e74db --- /dev/null +++ b/qtinterface/qt4/Qt/qgenericmatrix.h @@ -0,0 +1,395 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGENERICMATRIX_H +#define QGENERICMATRIX_H + +#include <QtCore/qmetatype.h> +#include <QtCore/qdebug.h> +#include <QtCore/qdatastream.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +template <int N, int M, typename T> +class QGenericMatrix +{ +public: + QGenericMatrix(); + QGenericMatrix(const QGenericMatrix<N, M, T>& other); + explicit QGenericMatrix(const T *values); + + const T& operator()(int row, int column) const; + T& operator()(int row, int column); + + bool isIdentity() const; + void setToIdentity(); + + void fill(T value); + + QGenericMatrix<M, N, T> transposed() const; + + QGenericMatrix<N, M, T>& operator+=(const QGenericMatrix<N, M, T>& other); + QGenericMatrix<N, M, T>& operator-=(const QGenericMatrix<N, M, T>& other); + QGenericMatrix<N, M, T>& operator*=(T factor); + QGenericMatrix<N, M, T>& operator/=(T divisor); + bool operator==(const QGenericMatrix<N, M, T>& other) const; + bool operator!=(const QGenericMatrix<N, M, T>& other) const; + + void copyDataTo(T *values) const; + + T *data() { return m[0]; } + const T *data() const { return m[0]; } + const T *constData() const { return m[0]; } + +#if !defined(Q_NO_TEMPLATE_FRIENDS) + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator+(const QGenericMatrix<NN, MM, TT>& m1, const QGenericMatrix<NN, MM, TT>& m2); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator-(const QGenericMatrix<NN, MM, TT>& m1, const QGenericMatrix<NN, MM, TT>& m2); + template<int NN, int M1, int M2, typename TT> + friend QGenericMatrix<M1, M2, TT> operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator-(const QGenericMatrix<NN, MM, TT>& matrix); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator*(TT factor, const QGenericMatrix<NN, MM, TT>& matrix); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator*(const QGenericMatrix<NN, MM, TT>& matrix, TT factor); + template<int NN, int MM, typename TT> + friend QGenericMatrix<NN, MM, TT> operator/(const QGenericMatrix<NN, MM, TT>& matrix, TT divisor); + +private: +#endif + T m[N][M]; // Column-major order to match OpenGL. + + QGenericMatrix(int) {} // Construct without initializing identity matrix. + +#if !defined(Q_NO_TEMPLATE_FRIENDS) + template <int NN, int MM, typename TT> + friend class QGenericMatrix; +#endif +}; + +template <int N, int M, typename T> +Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix() +{ + setToIdentity(); +} + +template <int N, int M, typename T> +Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const QGenericMatrix<N, M, T>& other) +{ + for (int col = 0; col < N; ++col) + for (int row = 0; row < M; ++row) + m[col][row] = other.m[col][row]; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const T *values) +{ + for (int col = 0; col < N; ++col) + for (int row = 0; row < M; ++row) + m[col][row] = values[row * N + col]; +} + +template <int N, int M, typename T> +Q_INLINE_TEMPLATE const T& QGenericMatrix<N, M, T>::operator()(int row, int column) const +{ + Q_ASSERT(row >= 0 && row < M && column >= 0 && column < N); + return m[column][row]; +} + +template <int N, int M, typename T> +Q_INLINE_TEMPLATE T& QGenericMatrix<N, M, T>::operator()(int row, int column) +{ + Q_ASSERT(row >= 0 && row < M && column >= 0 && column < N); + return m[column][row]; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::isIdentity() const +{ + for (int col = 0; col < N; ++col) { + for (int row = 0; row < M; ++row) { + if (row == col) { + if (m[col][row] != 1.0f) + return false; + } else { + if (m[col][row] != 0.0f) + return false; + } + } + } + return true; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::setToIdentity() +{ + for (int col = 0; col < N; ++col) { + for (int row = 0; row < M; ++row) { + if (row == col) + m[col][row] = 1.0f; + else + m[col][row] = 0.0f; + } + } +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::fill(T value) +{ + for (int col = 0; col < N; ++col) + for (int row = 0; row < M; ++row) + m[col][row] = value; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<M, N, T> QGenericMatrix<N, M, T>::transposed() const +{ + QGenericMatrix<M, N, T> result(1); + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + result.m[row][col] = m[col][row]; + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other) +{ + for (int index = 0; index < N * M; ++index) + m[0][index] += other.m[0][index]; + return *this; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other) +{ + for (int index = 0; index < N * M; ++index) + m[0][index] -= other.m[0][index]; + return *this; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor) +{ + for (int index = 0; index < N * M; ++index) + m[0][index] *= factor; + return *this; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const +{ + for (int index = 0; index < N * M; ++index) { + if (m[0][index] != other.m[0][index]) + return false; + } + return true; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const +{ + for (int index = 0; index < N * M; ++index) { + if (m[0][index] != other.m[0][index]) + return true; + } + return false; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor) +{ + for (int index = 0; index < N * M; ++index) + m[0][index] /= divisor; + return *this; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) +{ + QGenericMatrix<N, M, T> result(1); + for (int index = 0; index < N * M; ++index) + result.m[0][index] = m1.m[0][index] + m2.m[0][index]; + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) +{ + QGenericMatrix<N, M, T> result(1); + for (int index = 0; index < N * M; ++index) + result.m[0][index] = m1.m[0][index] - m2.m[0][index]; + return result; +} + +template <int N, int M1, int M2, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2) +{ + QGenericMatrix<M1, M2, T> result(1); + for (int row = 0; row < M2; ++row) { + for (int col = 0; col < M1; ++col) { + T sum(0.0f); + for (int j = 0; j < N; ++j) + sum += m1.m[j][row] * m2.m[col][j]; + result.m[col][row] = sum; + } + } + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix) +{ + QGenericMatrix<N, M, T> result(1); + for (int index = 0; index < N * M; ++index) + result.m[0][index] = -matrix.m[0][index]; + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix) +{ + QGenericMatrix<N, M, T> result(1); + for (int index = 0; index < N * M; ++index) + result.m[0][index] = matrix.m[0][index] * factor; + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor) +{ + QGenericMatrix<N, M, T> result(1); + for (int index = 0; index < N * M; ++index) + result.m[0][index] = matrix.m[0][index] * factor; + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor) +{ + QGenericMatrix<N, M, T> result(1); + for (int index = 0; index < N * M; ++index) + result.m[0][index] = matrix.m[0][index] / divisor; + return result; +} + +template <int N, int M, typename T> +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::copyDataTo(T *values) const +{ + for (int col = 0; col < N; ++col) + for (int row = 0; row < M; ++row) + values[row * N + col] = T(m[col][row]); +} + +// Define aliases for the useful variants of QGenericMatrix. +typedef QGenericMatrix<2, 2, qreal> QMatrix2x2; +typedef QGenericMatrix<2, 3, qreal> QMatrix2x3; +typedef QGenericMatrix<2, 4, qreal> QMatrix2x4; +typedef QGenericMatrix<3, 2, qreal> QMatrix3x2; +typedef QGenericMatrix<3, 3, qreal> QMatrix3x3; +typedef QGenericMatrix<3, 4, qreal> QMatrix3x4; +typedef QGenericMatrix<4, 2, qreal> QMatrix4x2; +typedef QGenericMatrix<4, 3, qreal> QMatrix4x3; + +#ifndef QT_NO_DEBUG_STREAM + +template <int N, int M, typename T> +QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m) +{ + dbg.nospace() << "QGenericMatrix<" << N << ", " << M + << ", " << QTypeInfo<T>::name() + << ">(" << endl << qSetFieldWidth(10); + for (int row = 0; row < M; ++row) { + for (int col = 0; col < N; ++col) + dbg << m(row, col); + dbg << endl; + } + dbg << qSetFieldWidth(0) << ')'; + return dbg.space(); +} + +#endif + +#ifndef QT_NO_DATASTREAM + +template <int N, int M, typename T> +QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix) +{ + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + stream << double(matrix(row, col)); + return stream; +} + +template <int N, int M, typename T> +QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix) +{ + double x; + for (int row = 0; row < M; ++row) { + for (int col = 0; col < N; ++col) { + stream >> x; + matrix(row, col) = T(x); + } + } + return stream; +} + +#endif + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QMatrix2x2) +Q_DECLARE_METATYPE(QMatrix2x3) +Q_DECLARE_METATYPE(QMatrix2x4) +Q_DECLARE_METATYPE(QMatrix3x2) +Q_DECLARE_METATYPE(QMatrix3x3) +Q_DECLARE_METATYPE(QMatrix3x4) +Q_DECLARE_METATYPE(QMatrix4x2) +Q_DECLARE_METATYPE(QMatrix4x3) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qgesture.h b/qtinterface/qt4/Qt/qgesture.h new file mode 100644 index 0000000..6b4e786 --- /dev/null +++ b/qtinterface/qt4/Qt/qgesture.h @@ -0,0 +1,261 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGESTURE_H +#define QGESTURE_H + +#include <QtCore/qobject.h> +#include <QtCore/qlist.h> +#include <QtCore/qdatetime.h> +#include <QtCore/qpoint.h> +#include <QtCore/qrect.h> +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +Q_DECLARE_METATYPE(Qt::GestureState) + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGesturePrivate; +class Q_GUI_EXPORT QGesture : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QGesture) + + Q_PROPERTY(Qt::GestureState state READ state) + Q_PROPERTY(Qt::GestureType gestureType READ gestureType) + Q_PROPERTY(QGesture::GestureCancelPolicy gestureCancelPolicy READ gestureCancelPolicy WRITE setGestureCancelPolicy) + Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot) + Q_PROPERTY(bool hasHotSpot READ hasHotSpot) + +public: + explicit QGesture(QObject *parent = 0); + ~QGesture(); + + Qt::GestureType gestureType() const; + + Qt::GestureState state() const; + + QPointF hotSpot() const; + void setHotSpot(const QPointF &value); + bool hasHotSpot() const; + void unsetHotSpot(); + + enum GestureCancelPolicy { + CancelNone = 0, + CancelAllInContext + }; + + void setGestureCancelPolicy(GestureCancelPolicy policy); + GestureCancelPolicy gestureCancelPolicy() const; + +protected: + QGesture(QGesturePrivate &dd, QObject *parent); + +private: + friend class QGestureEvent; + friend class QGestureRecognizer; + friend class QGestureManager; + friend class QGraphicsScenePrivate; +}; + +class QPanGesturePrivate; +class Q_GUI_EXPORT QPanGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPanGesture) + + Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset) + Q_PROPERTY(QPointF offset READ offset WRITE setOffset) + Q_PROPERTY(QPointF delta READ delta STORED false) + Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration) + +public: + QPanGesture(QObject *parent = 0); + + QPointF lastOffset() const; + QPointF offset() const; + QPointF delta() const; + qreal acceleration() const; + + void setLastOffset(const QPointF &value); + void setOffset(const QPointF &value); + void setAcceleration(qreal value); + + friend class QPanGestureRecognizer; + friend class QWinNativePanGestureRecognizer; +}; + +class QPinchGesturePrivate; +class Q_GUI_EXPORT QPinchGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPinchGesture) + +public: + enum ChangeFlag { + ScaleFactorChanged = 0x1, + RotationAngleChanged = 0x2, + CenterPointChanged = 0x4 + }; + Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) + + Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags) + Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags) + + Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor) + Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor) + Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor) + + Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle) + Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle) + Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle) + + Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint) + Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint) + Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint) + +public: + QPinchGesture(QObject *parent = 0); + + ChangeFlags totalChangeFlags() const; + void setTotalChangeFlags(ChangeFlags value); + + ChangeFlags changeFlags() const; + void setChangeFlags(ChangeFlags value); + + QPointF startCenterPoint() const; + QPointF lastCenterPoint() const; + QPointF centerPoint() const; + void setStartCenterPoint(const QPointF &value); + void setLastCenterPoint(const QPointF &value); + void setCenterPoint(const QPointF &value); + + qreal totalScaleFactor() const; + qreal lastScaleFactor() const; + qreal scaleFactor() const; + void setTotalScaleFactor(qreal value); + void setLastScaleFactor(qreal value); + void setScaleFactor(qreal value); + + qreal totalRotationAngle() const; + qreal lastRotationAngle() const; + qreal rotationAngle() const; + void setTotalRotationAngle(qreal value); + void setLastRotationAngle(qreal value); + void setRotationAngle(qreal value); + + friend class QPinchGestureRecognizer; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags) + +QT_BEGIN_NAMESPACE + +class QSwipeGesturePrivate; +class Q_GUI_EXPORT QSwipeGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSwipeGesture) + Q_ENUMS(SwipeDirection) + + Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false) + Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false) + Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle) + +public: + enum SwipeDirection { NoDirection, Left, Right, Up, Down }; + QSwipeGesture(QObject *parent = 0); + + SwipeDirection horizontalDirection() const; + SwipeDirection verticalDirection() const; + + qreal swipeAngle() const; + void setSwipeAngle(qreal value); + + friend class QSwipeGestureRecognizer; +}; + +class QTapGesturePrivate; +class Q_GUI_EXPORT QTapGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTapGesture) + + Q_PROPERTY(QPointF position READ position WRITE setPosition) + +public: + QTapGesture(QObject *parent = 0); + + QPointF position() const; + void setPosition(const QPointF &pos); + + friend class QTapGestureRecognizer; +}; + +class QTapAndHoldGesturePrivate; +class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTapAndHoldGesture) + + Q_PROPERTY(QPointF position READ position WRITE setPosition) + +public: + QTapAndHoldGesture(QObject *parent = 0); + + QPointF position() const; + void setPosition(const QPointF &pos); + + friend class QTapAndHoldGestureRecognizer; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy) +QT_END_HEADER + +#endif // QGESTURE_H diff --git a/qtinterface/qt4/Qt/qgesturerecognizer.h b/qtinterface/qt4/Qt/qgesturerecognizer.h new file mode 100644 index 0000000..304579b --- /dev/null +++ b/qtinterface/qt4/Qt/qgesturerecognizer.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGESTURERECOGNIZER_H +#define QGESTURERECOGNIZER_H + +#include <QtCore/qglobal.h> +#include <QtCore/qnamespace.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QObject; +class QEvent; +class QGesture; +class Q_GUI_EXPORT QGestureRecognizer +{ +public: + enum ResultFlag + { + Ignore = 0x0001, + + MayBeGesture = 0x0002, + TriggerGesture = 0x0004, + FinishGesture = 0x0008, + CancelGesture = 0x0010, + + ResultState_Mask = 0x00ff, + + ConsumeEventHint = 0x0100, + // StoreEventHint = 0x0200, + // ReplayStoredEventsHint = 0x0400, + // DiscardStoredEventsHint = 0x0800, + + ResultHint_Mask = 0xff00 + }; + Q_DECLARE_FLAGS(Result, ResultFlag) + + QGestureRecognizer(); + virtual ~QGestureRecognizer(); + + virtual QGesture *create(QObject *target); + virtual Result recognize(QGesture *state, QObject *watched, + QEvent *event) = 0; + virtual void reset(QGesture *state); + + static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer); + static void unregisterRecognizer(Qt::GestureType type); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGESTURERECOGNIZER_H diff --git a/qtinterface/qt4/Qt/qgl.h b/qtinterface/qt4/Qt/qgl.h new file mode 100644 index 0000000..e318b77 --- /dev/null +++ b/qtinterface/qt4/Qt/qgl.h @@ -0,0 +1,617 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGL_H +#define QGL_H + +#include <QtGui/qwidget.h> +#include <QtGui/qpaintengine.h> +#include <QtOpenGL/qglcolormap.h> +#include <QtCore/qmap.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +#if defined(Q_WS_WIN) +# include <QtCore/qt_windows.h> +#endif + +#if defined(Q_WS_MAC) +# include <OpenGL/gl.h> +# include <OpenGL/glu.h> +#elif defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) +# include <GLES/gl.h> +#ifndef GL_DOUBLE +# define GL_DOUBLE GL_FLOAT +#endif +#ifndef GLdouble +typedef GLfloat GLdouble; +#endif +#elif defined(QT_OPENGL_ES_2) +# include <GLES2/gl2.h> +#ifndef GL_DOUBLE +# define GL_DOUBLE GL_FLOAT +#endif +#ifndef GLdouble +typedef GLfloat GLdouble; +#endif +#else +# include <GL/gl.h> +# ifndef QT_LINUXBASE +# include <GL/glu.h> +# endif +#endif + +QT_BEGIN_NAMESPACE + +QT_MODULE(OpenGL) + +#if defined(Q_WS_MAC) && defined (QT_BUILD_OPENGL_LIB) && !defined(QT_MAC_USE_COCOA) && !defined(QDOC) +#define Q_MAC_COMPAT_GL_FUNCTIONS + +template <typename T> +struct QMacGLCompatTypes +{ + typedef long CompatGLint; + typedef unsigned long CompatGLuint; + typedef unsigned long CompatGLenum; +}; + +template <> +struct QMacGLCompatTypes<long> +{ + typedef int CompatGLint; + typedef unsigned int CompatGLuint; + typedef unsigned int CompatGLenum; +}; + +typedef QMacGLCompatTypes<GLint>::CompatGLint QMacCompatGLint; +typedef QMacGLCompatTypes<GLint>::CompatGLuint QMacCompatGLuint; +typedef QMacGLCompatTypes<GLint>::CompatGLenum QMacCompatGLenum; + +#endif + +#ifdef QT3_SUPPORT +#define QGL_VERSION 460 +#define QGL_VERSION_STR "4.6" +inline QT3_SUPPORT const char *qGLVersion() { + return QGL_VERSION_STR; +} +#endif + +#if defined(Q_WS_WIN) || defined(Q_WS_MAC) +class QGLCmap; +#endif + +class QPixmap; +#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) +class QGLOverlayWidget; +#endif +class QGLWidgetPrivate; +class QGLContextPrivate; + +// Namespace class: +namespace QGL +{ + Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType); + + enum FormatOption { + DoubleBuffer = 0x0001, + DepthBuffer = 0x0002, + Rgba = 0x0004, + AlphaChannel = 0x0008, + AccumBuffer = 0x0010, + StencilBuffer = 0x0020, + StereoBuffers = 0x0040, + DirectRendering = 0x0080, + HasOverlay = 0x0100, + SampleBuffers = 0x0200, + SingleBuffer = DoubleBuffer << 16, + NoDepthBuffer = DepthBuffer << 16, + ColorIndex = Rgba << 16, + NoAlphaChannel = AlphaChannel << 16, + NoAccumBuffer = AccumBuffer << 16, + NoStencilBuffer = StencilBuffer << 16, + NoStereoBuffers = StereoBuffers << 16, + IndirectRendering = DirectRendering << 16, + NoOverlay = HasOverlay << 16, + NoSampleBuffers = SampleBuffers << 16 + }; + Q_DECLARE_FLAGS(FormatOptions, FormatOption) +} + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions) + +class QGLFormatPrivate; + +class Q_OPENGL_EXPORT QGLFormat +{ +public: + QGLFormat(); + QGLFormat(QGL::FormatOptions options, int plane = 0); + QGLFormat(const QGLFormat &other); + QGLFormat &operator=(const QGLFormat &other); + ~QGLFormat(); + + void setDepthBufferSize(int size); + int depthBufferSize() const; + + void setAccumBufferSize(int size); + int accumBufferSize() const; + + void setRedBufferSize(int size); + int redBufferSize() const; + + void setGreenBufferSize(int size); + int greenBufferSize() const; + + void setBlueBufferSize(int size); + int blueBufferSize() const; + + void setAlphaBufferSize(int size); + int alphaBufferSize() const; + + void setStencilBufferSize(int size); + int stencilBufferSize() const; + + void setSampleBuffers(bool enable); + bool sampleBuffers() const; + + void setSamples(int numSamples); + int samples() const; + + void setSwapInterval(int interval); + int swapInterval() const; + + bool doubleBuffer() const; + void setDoubleBuffer(bool enable); + bool depth() const; + void setDepth(bool enable); + bool rgba() const; + void setRgba(bool enable); + bool alpha() const; + void setAlpha(bool enable); + bool accum() const; + void setAccum(bool enable); + bool stencil() const; + void setStencil(bool enable); + bool stereo() const; + void setStereo(bool enable); + bool directRendering() const; + void setDirectRendering(bool enable); + bool hasOverlay() const; + void setOverlay(bool enable); + + int plane() const; + void setPlane(int plane); + + void setOption(QGL::FormatOptions opt); + bool testOption(QGL::FormatOptions opt) const; + + static QGLFormat defaultFormat(); + static void setDefaultFormat(const QGLFormat& f); + + static QGLFormat defaultOverlayFormat(); + static void setDefaultOverlayFormat(const QGLFormat& f); + + static bool hasOpenGL(); + static bool hasOpenGLOverlays(); + + enum OpenGLVersionFlag { + OpenGL_Version_None = 0x00000000, + OpenGL_Version_1_1 = 0x00000001, + OpenGL_Version_1_2 = 0x00000002, + OpenGL_Version_1_3 = 0x00000004, + OpenGL_Version_1_4 = 0x00000008, + OpenGL_Version_1_5 = 0x00000010, + OpenGL_Version_2_0 = 0x00000020, + OpenGL_Version_2_1 = 0x00000040, + OpenGL_ES_Common_Version_1_0 = 0x00000080, + OpenGL_ES_CommonLite_Version_1_0 = 0x00000100, + OpenGL_ES_Common_Version_1_1 = 0x00000200, + OpenGL_ES_CommonLite_Version_1_1 = 0x00000400, + OpenGL_ES_Version_2_0 = 0x00000800, + OpenGL_Version_3_0 = 0x00001000 + }; + Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag) + + static OpenGLVersionFlags openGLVersionFlags(); + +private: + QGLFormatPrivate *d; + + void detach(); + + friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); + friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags) + +Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); +Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); + +class Q_OPENGL_EXPORT QGLContext +{ + Q_DECLARE_PRIVATE(QGLContext) +public: + QGLContext(const QGLFormat& format, QPaintDevice* device); + QGLContext(const QGLFormat& format); + virtual ~QGLContext(); + + virtual bool create(const QGLContext* shareContext = 0); + bool isValid() const; + bool isSharing() const; + void reset(); + + static bool areSharing(const QGLContext *context1, const QGLContext *context2); + + QGLFormat format() const; + QGLFormat requestedFormat() const; + void setFormat(const QGLFormat& format); + + // ### Qt 5: return bools + maybe remove virtuals + virtual void makeCurrent(); + virtual void doneCurrent(); + + virtual void swapBuffers() const; + + enum BindOption { + NoBindOption = 0x0000, + InvertedYBindOption = 0x0001, + MipmapBindOption = 0x0002, + PremultipliedAlphaBindOption = 0x0004, + LinearFilteringBindOption = 0x0008, + + MemoryManagedBindOption = 0x0010, // internal flag + CanFlipNativePixmapBindOption = 0x0020, // internal flag + + DefaultBindOption = LinearFilteringBindOption + | InvertedYBindOption + | MipmapBindOption, + InternalBindOption = MemoryManagedBindOption + | PremultipliedAlphaBindOption + }; + Q_DECLARE_FLAGS(BindOptions, BindOption) + + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + BindOptions options); + + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, + GLint format = GL_RGBA); + GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, + GLint format = GL_RGBA); + GLuint bindTexture(const QString &fileName); + + void deleteTexture(GLuint tx_id); + + void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D, + QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, + QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); + + void deleteTexture(QMacCompatGLuint tx_id); + + void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); +#endif + + static void setTextureCacheLimit(int size); + static int textureCacheLimit(); + + void *getProcAddress(const QString &proc) const; + QPaintDevice* device() const; + QColor overlayTransparentColor() const; + + static const QGLContext* currentContext(); + +protected: + virtual bool chooseContext(const QGLContext* shareContext = 0); + +#if defined(Q_WS_WIN) + virtual int choosePixelFormat(void* pfd, HDC pdc); +#endif +#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) + virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1); + virtual void* chooseVisual(); +#endif +#if defined(Q_WS_MAC) + virtual void* chooseMacVisual(GDHandle); +#endif + + bool deviceIsPixmap() const; + bool windowCreated() const; + void setWindowCreated(bool on); + bool initialized() const; + void setInitialized(bool on); + void generateFontDisplayLists(const QFont & fnt, int listBase); // ### Qt 5: remove + + uint colorIndex(const QColor& c) const; + void setValid(bool valid); + void setDevice(QPaintDevice *pDev); + +protected: + static QGLContext* currentCtx; + +private: + QScopedPointer<QGLContextPrivate> d_ptr; + + friend class QGLPixelBuffer; + friend class QGLPixelBufferPrivate; + friend class QGLWidget; + friend class QGLWidgetPrivate; + friend class QGLGlyphCache; + friend class QOpenGLPaintEngine; + friend class QOpenGLPaintEnginePrivate; + friend class QGL2PaintEngineEx; + friend class QGL2PaintEngineExPrivate; + friend class QGLEngineShaderManager; + friend class QGLWindowSurface; + friend class QGLPixmapData; + friend class QGLPixmapFilterBase; + friend class QGLTextureGlyphCache; + friend class QGLContextGroup; + friend class QGLSharedResourceGuard; + friend class QGLPixmapBlurFilter; + friend class QGLExtensions; + friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); +#ifdef Q_WS_MAC +public: + void updatePaintDevice(); +private: + friend class QMacGLWindowChangeEvent; + friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *); +#endif + friend class QGLFramebufferObject; + friend class QGLFramebufferObjectPrivate; + friend class QGLFBOGLPaintDevice; + friend class QGLPaintDevice; + friend class QX11GLPixmapData; +private: + Q_DISABLE_COPY(QGLContext) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions) + +class Q_OPENGL_EXPORT QGLWidget : public QWidget +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QGLWidget) +public: + explicit QGLWidget(QWidget* parent=0, + const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); + explicit QGLWidget(QGLContext *context, QWidget* parent=0, + const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); + explicit QGLWidget(const QGLFormat& format, QWidget* parent=0, + const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QGLWidget(QWidget* parent, const char* name, + const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); + QT3_SUPPORT_CONSTRUCTOR QGLWidget(QGLContext *context, QWidget* parent, const char* name, + const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); + QT3_SUPPORT_CONSTRUCTOR QGLWidget(const QGLFormat& format, QWidget* parent, const char* name, + const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); +#endif + ~QGLWidget(); + + void qglColor(const QColor& c) const; + void qglClearColor(const QColor& c) const; + + bool isValid() const; + bool isSharing() const; + + // ### Qt 5: return bools + void makeCurrent(); + void doneCurrent(); + + bool doubleBuffer() const; + void swapBuffers(); + + QGLFormat format() const; + void setFormat(const QGLFormat& format); + + const QGLContext* context() const; + void setContext(QGLContext* context, const QGLContext* shareContext = 0, + bool deleteOldContext = true); + + QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false); + QImage grabFrameBuffer(bool withAlpha = false); + + void makeOverlayCurrent(); + const QGLContext* overlayContext() const; + + static QImage convertToGLFormat(const QImage& img); + + void setMouseTracking(bool enable); + + const QGLColormap & colormap() const; + void setColormap(const QGLColormap & map); + + void renderText(int x, int y, const QString & str, + const QFont & fnt = QFont(), int listBase = 2000); + void renderText(double x, double y, double z, const QString & str, + const QFont & fnt = QFont(), int listBase = 2000); + QPaintEngine *paintEngine() const; + + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options); + + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, + GLint format = GL_RGBA); + GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, + GLint format = GL_RGBA); + + GLuint bindTexture(const QString &fileName); + + void deleteTexture(GLuint tx_id); + + void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D, + QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, + QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); + + void deleteTexture(QMacCompatGLuint tx_id); + + void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); +#endif + +public Q_SLOTS: + virtual void updateGL(); + virtual void updateOverlayGL(); + +protected: + bool event(QEvent *); + virtual void initializeGL(); + virtual void resizeGL(int w, int h); + virtual void paintGL(); + + virtual void initializeOverlayGL(); + virtual void resizeOverlayGL(int w, int h); + virtual void paintOverlayGL(); + + void setAutoBufferSwap(bool on); + bool autoBufferSwap() const; + + void paintEvent(QPaintEvent*); + void resizeEvent(QResizeEvent*); + + virtual void glInit(); + virtual void glDraw(); + int fontDisplayListBase(const QFont & fnt, int listBase = 2000); // ### Qt 5: remove + +private: + Q_DISABLE_COPY(QGLWidget) + +#ifdef Q_WS_MAC + friend class QMacGLWindowChangeEvent; +#endif + friend class QGLDrawable; + friend class QGLPixelBuffer; + friend class QGLPixelBufferPrivate; + friend class QGLContext; + friend class QGLContextPrivate; + friend class QGLOverlayWidget; + friend class QOpenGLPaintEngine; + friend class QGLPaintDevice; + friend class QGLWidgetGLPaintDevice; +}; + + +// +// QGLFormat inline functions +// + +inline bool QGLFormat::doubleBuffer() const +{ + return testOption(QGL::DoubleBuffer); +} + +inline bool QGLFormat::depth() const +{ + return testOption(QGL::DepthBuffer); +} + +inline bool QGLFormat::rgba() const +{ + return testOption(QGL::Rgba); +} + +inline bool QGLFormat::alpha() const +{ + return testOption(QGL::AlphaChannel); +} + +inline bool QGLFormat::accum() const +{ + return testOption(QGL::AccumBuffer); +} + +inline bool QGLFormat::stencil() const +{ + return testOption(QGL::StencilBuffer); +} + +inline bool QGLFormat::stereo() const +{ + return testOption(QGL::StereoBuffers); +} + +inline bool QGLFormat::directRendering() const +{ + return testOption(QGL::DirectRendering); +} + +inline bool QGLFormat::hasOverlay() const +{ + return testOption(QGL::HasOverlay); +} + +inline bool QGLFormat::sampleBuffers() const +{ + return testOption(QGL::SampleBuffers); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGL_H diff --git a/qtinterface/qt4/Qt/qglcolormap.h b/qtinterface/qt4/Qt/qglcolormap.h new file mode 100644 index 0000000..83183ee --- /dev/null +++ b/qtinterface/qt4/Qt/qglcolormap.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLCOLORMAP_H +#define QGLCOLORMAP_H + +#include <QtGui/qcolor.h> +#include <QtCore/qvector.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(OpenGL) + +class Q_OPENGL_EXPORT QGLColormap +{ +public: + QGLColormap(); + QGLColormap(const QGLColormap &); + ~QGLColormap(); + + QGLColormap &operator=(const QGLColormap &); + + bool isEmpty() const; + int size() const; + void detach(); + + void setEntries(int count, const QRgb * colors, int base = 0); + void setEntry(int idx, QRgb color); + void setEntry(int idx, const QColor & color); + QRgb entryRgb(int idx) const; + QColor entryColor(int idx) const; + int find(QRgb color) const; + int findNearest(QRgb color) const; + +protected: + Qt::HANDLE handle() { return d ? d->cmapHandle : 0; } + void setHandle(Qt::HANDLE ahandle) { d->cmapHandle = ahandle; } + +private: + struct QGLColormapData { + QBasicAtomicInt ref; + QVector<QRgb> *cells; + Qt::HANDLE cmapHandle; + }; + + QGLColormapData *d; + static struct QGLColormapData shared_null; + static void cleanup(QGLColormapData *x); + void detach_helper(); + + friend class QGLWidget; + friend class QGLWidgetPrivate; +}; + +inline void QGLColormap::detach() +{ + if (d->ref != 1) + detach_helper(); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGLCOLORMAP_H diff --git a/qtinterface/qt4/Qt/qglframebufferobject.h b/qtinterface/qt4/Qt/qglframebufferobject.h new file mode 100644 index 0000000..3d7b15f --- /dev/null +++ b/qtinterface/qt4/Qt/qglframebufferobject.h @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLFRAMEBUFFEROBJECT_H +#define QGLFRAMEBUFFEROBJECT_H + +#include <QtOpenGL/qgl.h> +#include <QtGui/qpaintdevice.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(OpenGL) + +class QGLFramebufferObjectPrivate; +class QGLFramebufferObjectFormat; + +class Q_OPENGL_EXPORT QGLFramebufferObject : public QPaintDevice +{ + Q_DECLARE_PRIVATE(QGLFramebufferObject) +public: + enum Attachment { + NoAttachment, + CombinedDepthStencil, + Depth + }; + + QGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D); + QGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D); +#if !defined(QT_OPENGL_ES) || defined(Q_QDOC) + QGLFramebufferObject(const QSize &size, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8); + QGLFramebufferObject(int width, int height, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8); +#else + QGLFramebufferObject(const QSize &size, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA); + QGLFramebufferObject(int width, int height, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA); +#endif + + QGLFramebufferObject(const QSize &size, const QGLFramebufferObjectFormat &format); + QGLFramebufferObject(int width, int height, const QGLFramebufferObjectFormat &format); + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + QGLFramebufferObject(const QSize &size, QMacCompatGLenum target = GL_TEXTURE_2D); + QGLFramebufferObject(int width, int height, QMacCompatGLenum target = GL_TEXTURE_2D); + + QGLFramebufferObject(const QSize &size, Attachment attachment, + QMacCompatGLenum target = GL_TEXTURE_2D, QMacCompatGLenum internal_format = GL_RGBA8); + QGLFramebufferObject(int width, int height, Attachment attachment, + QMacCompatGLenum target = GL_TEXTURE_2D, QMacCompatGLenum internal_format = GL_RGBA8); +#endif + + virtual ~QGLFramebufferObject(); + + QGLFramebufferObjectFormat format() const; + + bool isValid() const; + bool isBound() const; + bool bind(); + bool release(); + + GLuint texture() const; + QSize size() const; + QImage toImage() const; + Attachment attachment() const; + + QPaintEngine *paintEngine() const; + GLuint handle() const; + + static bool hasOpenGLFramebufferObjects(); + + void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); +#endif + + static bool hasOpenGLFramebufferBlit(); + static void blitFramebuffer(QGLFramebufferObject *target, const QRect &targetRect, + QGLFramebufferObject *source, const QRect &sourceRect, + GLbitfield buffers = GL_COLOR_BUFFER_BIT, + GLenum filter = GL_NEAREST); + +protected: + int metric(PaintDeviceMetric metric) const; + int devType() const { return QInternal::FramebufferObject; } + +private: + Q_DISABLE_COPY(QGLFramebufferObject) + QScopedPointer<QGLFramebufferObjectPrivate> d_ptr; + friend class QGLPaintDevice; + friend class QGLFBOGLPaintDevice; +}; + +class QGLFramebufferObjectFormatPrivate; +class Q_OPENGL_EXPORT QGLFramebufferObjectFormat +{ +public: + QGLFramebufferObjectFormat(); + QGLFramebufferObjectFormat(const QGLFramebufferObjectFormat &other); + QGLFramebufferObjectFormat &operator=(const QGLFramebufferObjectFormat &other); + ~QGLFramebufferObjectFormat(); + + void setSamples(int samples); + int samples() const; + + void setAttachment(QGLFramebufferObject::Attachment attachment); + QGLFramebufferObject::Attachment attachment() const; + + void setTextureTarget(GLenum target); + GLenum textureTarget() const; + + void setInternalTextureFormat(GLenum internalTextureFormat); + GLenum internalTextureFormat() const; + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + void setTextureTarget(QMacCompatGLenum target); + void setInternalTextureFormat(QMacCompatGLenum internalTextureFormat); +#endif + + bool operator==(const QGLFramebufferObjectFormat& other) const; + bool operator!=(const QGLFramebufferObjectFormat& other) const; + +private: + QGLFramebufferObjectFormatPrivate *d; + + void detach(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif // QGLFRAMEBUFFEROBJECT_H diff --git a/qtinterface/qt4/Qt/qglobal.h b/qtinterface/qt4/Qt/qglobal.h new file mode 100644 index 0000000..9b647a9 --- /dev/null +++ b/qtinterface/qt4/Qt/qglobal.h @@ -0,0 +1,2649 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLOBAL_H +#define QGLOBAL_H + +#include <stddef.h> + +#define QT_VERSION_STR "4.6.2" +/* + QT_VERSION is (major << 16) + (minor << 8) + patch. +*/ +#define QT_VERSION 0x040602 +/* + can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) +*/ +#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) + +#define QT_PACKAGEDATE_STR "2010-02-12" + +#define QT_PACKAGE_TAG "244b440f11a519bbd0f6a2c5cde90edb1732f2ea" + +#if !defined(QT_BUILD_MOC) +#include <QtCore/qconfig.h> +#endif + +#ifdef __cplusplus + +#ifndef QT_NAMESPACE /* user namespace */ + +# define QT_PREPEND_NAMESPACE(name) ::name +# define QT_USE_NAMESPACE +# define QT_BEGIN_NAMESPACE +# define QT_END_NAMESPACE +# define QT_BEGIN_INCLUDE_NAMESPACE +# define QT_END_INCLUDE_NAMESPACE +# define QT_BEGIN_MOC_NAMESPACE +# define QT_END_MOC_NAMESPACE +# define QT_FORWARD_DECLARE_CLASS(name) class name; +# define QT_FORWARD_DECLARE_STRUCT(name) struct name; +# define QT_MANGLE_NAMESPACE(name) name + +#else /* user namespace */ + +# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE; +# define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE { +# define QT_END_NAMESPACE } +# define QT_BEGIN_INCLUDE_NAMESPACE } +# define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE { +# define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE +# define QT_END_MOC_NAMESPACE +# define QT_FORWARD_DECLARE_CLASS(name) \ + QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \ + using QT_PREPEND_NAMESPACE(name); + +# define QT_FORWARD_DECLARE_STRUCT(name) \ + QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \ + using QT_PREPEND_NAMESPACE(name); + +# define QT_MANGLE_NAMESPACE0(x) x +# define QT_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b) +# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \ + QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE)) + +namespace QT_NAMESPACE {} + +# ifndef QT_BOOTSTRAPPED +# ifndef QT_NO_USING_NAMESPACE + /* + This expands to a "using QT_NAMESPACE" also in _header files_. + It is the only way the feature can be used without too much + pain, but if people _really_ do not want it they can add + DEFINES += QT_NO_USING_NAMESPACE to their .pro files. + */ + QT_USE_NAMESPACE +# endif +# endif + +#endif /* user namespace */ + +#else /* __cplusplus */ + +# define QT_BEGIN_NAMESPACE +# define QT_END_NAMESPACE +# define QT_USE_NAMESPACE +# define QT_BEGIN_INCLUDE_NAMESPACE +# define QT_END_INCLUDE_NAMESPACE + +#endif /* __cplusplus */ + +#if defined(Q_OS_MAC) && !defined(Q_CC_INTEL) +#define QT_BEGIN_HEADER extern "C++" { +#define QT_END_HEADER } +#define QT_BEGIN_INCLUDE_HEADER } +#define QT_END_INCLUDE_HEADER extern "C++" { +#else +#define QT_BEGIN_HEADER +#define QT_END_HEADER +#define QT_BEGIN_INCLUDE_HEADER +#define QT_END_INCLUDE_HEADER extern "C++" +#endif + +/* + The operating system, must be one of: (Q_OS_x) + + DARWIN - Darwin OS (synonym for Q_OS_MAC) + SYMBIAN - Symbian + MSDOS - MS-DOS and Windows + OS2 - OS/2 + OS2EMX - XFree86 on OS/2 (not PM) + WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) + WINCE - WinCE (Windows CE 5.0) + CYGWIN - Cygwin + SOLARIS - Sun Solaris + HPUX - HP-UX + ULTRIX - DEC Ultrix + LINUX - Linux + FREEBSD - FreeBSD + NETBSD - NetBSD + OPENBSD - OpenBSD + BSDI - BSD/OS + IRIX - SGI Irix + OSF - HP Tru64 UNIX + SCO - SCO OpenServer 5 + UNIXWARE - UnixWare 7, Open UNIX 8 + AIX - AIX + HURD - GNU Hurd + DGUX - DG/UX + RELIANT - Reliant UNIX + DYNIX - DYNIX/ptx + QNX - QNX + QNX6 - QNX RTP 6.1 + LYNX - LynxOS + BSD4 - Any BSD 4.4 system + UNIX - Any UNIX BSD/SYSV system +*/ + +#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) +# define Q_OS_DARWIN +# define Q_OS_BSD4 +# ifdef __LP64__ +# define Q_OS_DARWIN64 +# else +# define Q_OS_DARWIN32 +# endif +#elif defined(__SYMBIAN32__) || defined(SYMBIAN) +# define Q_OS_SYMBIAN +# define Q_NO_POSIX_SIGNALS +# define QT_NO_GETIFADDRS +#elif defined(__CYGWIN__) +# define Q_OS_CYGWIN +#elif defined(MSDOS) || defined(_MSDOS) +# define Q_OS_MSDOS +#elif defined(__OS2__) +# if defined(__EMX__) +# define Q_OS_OS2EMX +# else +# define Q_OS_OS2 +# endif +#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) +# define Q_OS_WIN32 +# define Q_OS_WIN64 +#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) +# if defined(WINCE) || defined(_WIN32_WCE) +# define Q_OS_WINCE +# else +# define Q_OS_WIN32 +# endif +#elif defined(__MWERKS__) && defined(__INTEL__) +# define Q_OS_WIN32 +#elif defined(__sun) || defined(sun) +# define Q_OS_SOLARIS +#elif defined(hpux) || defined(__hpux) +# define Q_OS_HPUX +#elif defined(__ultrix) || defined(ultrix) +# define Q_OS_ULTRIX +#elif defined(sinix) +# define Q_OS_RELIANT +#elif defined(__linux__) || defined(__linux) +# define Q_OS_LINUX +# define Q_OS_GLIBC +#elif defined(__GNU_HURD__) || defined(__GNU__) +# define Q_OS_HURD +# define Q_OS_GLIBC +#elif defined(__GLIBC__) +# define Q_OS_GLIBC +#elif defined(__FreeBSD__) || defined(__DragonFly__) +# define Q_OS_FREEBSD +# define Q_OS_BSD4 +#elif defined(__NetBSD__) +# define Q_OS_NETBSD +# define Q_OS_BSD4 +#elif defined(__OpenBSD__) +# define Q_OS_OPENBSD +# define Q_OS_BSD4 +#elif defined(__bsdi__) +# define Q_OS_BSDI +# define Q_OS_BSD4 +#elif defined(__sgi) +# define Q_OS_IRIX +#elif defined(__osf__) +# define Q_OS_OSF +#elif defined(_AIX) +# define Q_OS_AIX +#elif defined(__Lynx__) +# define Q_OS_LYNX +#elif defined(__DGUX__) +# define Q_OS_DGUX +#elif defined(__QNXNTO__) +# define Q_OS_QNX +#elif defined(_SEQUENT_) +# define Q_OS_DYNIX +#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ +# define Q_OS_SCO +#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ +# define Q_OS_UNIXWARE +#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ +# define Q_OS_UNIXWARE +#elif defined(__INTEGRITY) +# define Q_OS_INTEGRITY +#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ +# define Q_OS_VXWORKS +#elif defined(__MAKEDEPEND__) +#else +# error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" +#endif + +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) +# define Q_OS_WIN +#endif + +#if defined(Q_OS_DARWIN) +# define Q_OS_MAC /* Q_OS_MAC is mostly for compatibility, but also more clear */ +# define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/ +# if defined(Q_OS_DARWIN64) +# define Q_OS_MAC64 +# elif defined(Q_OS_DARWIN32) +# define Q_OS_MAC32 +# endif +#endif + +#ifdef AUTODETECT_COCOA +# ifdef Q_OS_MAC64 +# define QT_MAC_USE_COCOA 1 +# define QT_BUILD_KEY QT_BUILD_KEY_COCOA +# else +# define QT_BUILD_KEY QT_BUILD_KEY_CARBON +# endif +#endif + +#if defined(Q_OS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) +#error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." +#endif + +#if defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN) +# undef Q_OS_UNIX +#elif !defined(Q_OS_UNIX) +# define Q_OS_UNIX +#endif + +#if defined(Q_OS_DARWIN) && !defined(QT_LARGEFILE_SUPPORT) +# define QT_LARGEFILE_SUPPORT 64 +#endif + +#ifdef Q_OS_DARWIN +# ifdef MAC_OS_X_VERSION_MIN_REQUIRED +# undef MAC_OS_X_VERSION_MIN_REQUIRED +# endif +# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4 +# include <AvailabilityMacros.h> +# if !defined(MAC_OS_X_VERSION_10_3) +# define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_4) +# define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_5) +# define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_6) +# define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1 +# endif +# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6) +# warning "This version of Mac OS X is unsupported" +# endif +#endif + +#ifdef __LSB_VERSION__ +# if __LSB_VERSION__ < 40 +# error "This version of the Linux Standard Base is unsupported" +# endif +#ifndef QT_LINUXBASE +# define QT_LINUXBASE +#endif +#endif + +/* + The compiler, must be one of: (Q_CC_x) + + SYM - Digital Mars C/C++ (used to be Symantec C++) + MWERKS - Metrowerks CodeWarrior + MSVC - Microsoft Visual C/C++, Intel C++ for Windows + BOR - Borland/Turbo C++ + WAT - Watcom C++ + GNU - GNU C++ + COMEAU - Comeau C++ + EDG - Edison Design Group C++ + OC - CenterLine C++ + SUN - Forte Developer, or Sun Studio C++ + MIPS - MIPSpro C++ + DEC - DEC C++ + HPACC - HP aC++ + USLC - SCO OUDK and UDK + CDS - Reliant C++ + KAI - KAI C++ + INTEL - Intel C++ for Linux, Intel C++ for Windows + HIGHC - MetaWare High C/C++ + PGI - Portland Group C++ + GHS - Green Hills Optimizing C++ Compilers + GCCE - GCCE (Symbian GCCE builds) + RVCT - ARM Realview Compiler Suite + NOKIAX86 - Nokia x86 (Symbian WINSCW builds) + + + Should be sorted most to least authoritative. +*/ + +#if defined(__ghs) +# define Q_OUTOFLINE_TEMPLATE inline +#endif + +/* Symantec C++ is now Digital Mars */ +#if defined(__DMC__) || defined(__SC__) +# define Q_CC_SYM +/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ +# if defined(__SC__) && __SC__ < 0x750 +# define Q_NO_EXPLICIT_KEYWORD +# endif +# define Q_NO_USING_KEYWORD + +#elif defined(__MWERKS__) +# define Q_CC_MWERKS +# if defined(__EMU_SYMBIAN_OS__) +# define Q_CC_NOKIAX86 +# endif +/* "explicit" recognized since 4.0d1 */ + +#elif defined(_MSC_VER) +# define Q_CC_MSVC +/* proper support of bool for _MSC_VER >= 1100 */ +# define Q_CANNOT_DELETE_CONSTANT +# define Q_OUTOFLINE_TEMPLATE inline +# define Q_NO_TEMPLATE_FRIENDS +# define QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +# define Q_ALIGNOF(type) __alignof(type) +# define Q_DECL_ALIGN(n) __declspec(align(n)) + +/* Visual C++.Net issues for _MSC_VER >= 1300 */ +# if _MSC_VER >= 1300 +# define Q_CC_MSVC_NET +# if _MSC_VER < 1310 || (defined(Q_OS_WIN64) && defined(_M_IA64)) +# define Q_TYPENAME +# else +# undef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +# endif +# else +# define Q_NO_USING_KEYWORD +# define QT_NO_MEMBER_TEMPLATES +# endif +# if _MSC_VER < 1310 +# define QT_NO_QOBJECT_CHECK +# define Q_TYPENAME +# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS +# endif +/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ +# if defined(__INTEL_COMPILER) +# define Q_CC_INTEL +# endif +/* x64 does not support mmx intrinsics on windows */ +# if (defined(Q_OS_WIN64) && defined(_M_X64)) +# undef QT_HAVE_SSE +# undef QT_HAVE_SSE2 +# undef QT_HAVE_MMX +# undef QT_HAVE_3DNOW +# endif + + +#elif defined(__BORLANDC__) || defined(__TURBOC__) +# define Q_CC_BOR +# define Q_INLINE_TEMPLATE +# if __BORLANDC__ < 0x502 +# define Q_NO_BOOL_TYPE +# define Q_NO_EXPLICIT_KEYWORD +# endif +# define Q_NO_USING_KEYWORD + +#elif defined(__WATCOMC__) +# define Q_CC_WAT + +/* Symbian GCCE */ +#elif defined(__GCCE__) +# define Q_CC_GCCE +# define QT_VISIBILITY_AVAILABLE +# if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) +# define QT_HAVE_ARMV6 +# endif + +/* ARM Realview Compiler Suite + RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given), + so check for it before that */ +#elif defined(__ARMCC__) || defined(__CC_ARM) +# define Q_CC_RVCT +# if __TARGET_ARCH_ARM >= 6 +# define QT_HAVE_ARMV6 +# endif +#elif defined(__GNUC__) +# define Q_CC_GNU +# define Q_C_CALLBACKS +# if defined(__MINGW32__) +# define Q_CC_MINGW +# endif +# if defined(__INTEL_COMPILER) +/* Intel C++ also masquerades as GCC 3.2.0 */ +# define Q_CC_INTEL +# define Q_NO_TEMPLATE_FRIENDS +# endif +# ifdef __APPLE__ +# define Q_NO_DEPRECATED_CONSTRUCTORS +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 +# define Q_FULL_TEMPLATE_INSTANTIATION +# endif +/* 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) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +# endif +/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ +# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 +# define Q_WRONG_SB_CTYPE_MACROS +# endif +/* GCC <= 3.3 cannot handle template friends */ +# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3) +# define Q_NO_TEMPLATE_FRIENDS +# endif +/* Apple's GCC 3.1 chokes on our streaming qDebug() */ +# if defined(Q_OS_DARWIN) && __GNUC__ == 3 && (__GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 3) +# define Q_BROKEN_DEBUG_STREAM +# endif +# if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP) +# define Q_PACKED __attribute__ ((__packed__)) +# define Q_NO_PACKED_REFERENCE +# ifndef __ARM_EABI__ +# define QT_NO_ARM_EABI +# endif +# endif + +/* IBM compiler versions are a bit messy. There are actually two products: + the C product, and the C++ product. The C++ compiler is always packaged + with the latest version of the C compiler. Version numbers do not always + match. This little table (I'm not sure it's accurate) should be helpful: + + C++ product C product + + C Set 3.1 C Compiler 3.0 + ... ... + C++ Compiler 3.6.6 C Compiler 4.3 + ... ... + Visual Age C++ 4.0 ... + ... ... + Visual Age C++ 5.0 C Compiler 5.0 + ... ... + Visual Age C++ 6.0 C Compiler 6.0 + + Now: + __xlC__ is the version of the C compiler in hexadecimal notation + is only an approximation of the C++ compiler version + __IBMCPP__ is the version of the C++ compiler in decimal notation + but it is not defined on older compilers like C Set 3.1 */ +#elif defined(__xlC__) +# define Q_CC_XLC +# define Q_FULL_TEMPLATE_INSTANTIATION +# if __xlC__ < 0x400 +# 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 +# elif __xlC__ >= 0x0600 +# define Q_ALIGNOF(type) __alignof__(type) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +# define Q_PACKED __attribute__((__packed__)) +# endif + +/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed + on DEC C++ V5.5-004. New versions do define __EDG__ - observed on + Compaq C++ V6.3-002. + This compiler is different enough from other EDG compilers to handle + it separately anyway. */ +#elif defined(__DECCXX) || defined(__DECC) +# define Q_CC_DEC +/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older + DEC C++ V5 compilers. */ +# if defined(__EDG__) +# define Q_CC_EDG +# endif +/* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead + - observed on Compaq C++ V6.3-002. + In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ +# if !defined(_BOOL_EXISTS) +# define Q_NO_BOOL_TYPE +# endif +/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ +# define Q_NO_USING_KEYWORD +/* 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 +/* avoid undefined symbol problems with out-of-line template members */ +# define Q_OUTOFLINE_TEMPLATE inline + +/* The Portland Group C++ compiler is based on EDG and does define __EDG__ + but the C compiler does not */ +#elif defined(__PGI) +# define Q_CC_PGI +# if defined(__EDG__) +# define Q_CC_EDG +# endif + +/* Compilers with EDG front end are similar. To detect them we test: + __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b + __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 + and PGI C++ 5.2-4 */ +#elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__)) +# define Q_CC_EDG +/* From the EDG documentation (does not seem to apply to Compaq C++): + _BOOL + Defined in C++ mode when bool is a keyword. The name of this + predefined macro is specified by a configuration flag. _BOOL + is the default. + __BOOL_DEFINED + Defined in Microsoft C++ mode when bool is a keyword. */ +# if !defined(_BOOL) && !defined(__BOOL_DEFINED) +# define Q_NO_BOOL_TYPE +# endif + +/* The Comeau compiler is based on EDG and does define __EDG__ */ +# if defined(__COMO__) +# define Q_CC_COMEAU +# define Q_C_CALLBACKS + +/* The `using' keyword was introduced to avoid KAI C++ warnings + but it's now causing KAI C++ errors instead. The standard is + unclear about the use of this keyword, and in practice every + compiler is using its own set of rules. Forget it. */ +# elif defined(__KCC) +# define Q_CC_KAI +# define Q_NO_USING_KEYWORD + +/* Using the `using' keyword avoids Intel C++ for Linux warnings */ +# elif defined(__INTEL_COMPILER) +# define Q_CC_INTEL + +/* Uses CFront, make sure to read the manual how to tweak templates. */ +# elif defined(__ghs) +# define Q_CC_GHS + +# elif defined(__DCC__) +# define Q_CC_DIAB +# undef Q_NO_BOOL_TYPE +# if !defined(__bool) +# define Q_NO_BOOL_TYPE +# endif + +/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ +# elif defined(__USLC__) && defined(__SCO_VERSION__) +# define Q_CC_USLC +/* The latest UDK 7.1.1b does not need this, but previous versions do */ +# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) +# define Q_OUTOFLINE_TEMPLATE inline +# endif +# define Q_NO_USING_KEYWORD /* ### check "using" status */ + +/* Never tested! */ +# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) +# define Q_CC_OC +# define Q_NO_USING_KEYWORD + +/* CDS++ defines __EDG__ although this is not documented in the Reliant + documentation. It also follows conventions like _BOOL and this documented */ +# elif defined(sinix) +# define Q_CC_CDS +# define Q_NO_USING_KEYWORD + +/* The MIPSpro compiler defines __EDG */ +# elif defined(__sgi) +# define Q_CC_MIPS +# define Q_NO_USING_KEYWORD /* ### check "using" status */ +# define Q_NO_TEMPLATE_FRIENDS +# if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740) +# define Q_OUTOFLINE_TEMPLATE inline +# pragma set woff 3624,3625,3649 /* turn off some harmless warnings */ +# endif +# endif + +/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler + (see __DCC__ above). This one is for C mode files (__EDG is not defined) */ +#elif defined(_DIAB_TOOL) +# define Q_CC_DIAB + +/* Never tested! */ +#elif defined(__HIGHC__) +# define Q_CC_HIGHC + +#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) +# define Q_CC_SUN +/* 5.0 compiler or better + 'bool' is enabled by default but can be disabled using -features=nobool + in which case _BOOL is not defined + this is the default in 4.2 compatibility mode triggered by -compat=4 */ +# if __SUNPRO_CC >= 0x500 +# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS + /* see http://developers.sun.com/sunstudio/support/Ccompare.html */ +# if __SUNPRO_CC >= 0x590 +# define Q_ALIGNOF(type) __alignof__(type) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +// using CC 5.9: Warning: attribute visibility is unsupported and will be skipped.. +//# define Q_DECL_EXPORT __attribute__((__visibility__("default"))) +# endif +# if __SUNPRO_CC < 0x5a0 +# define Q_NO_TEMPLATE_FRIENDS +# endif +# if !defined(_BOOL) +# define Q_NO_BOOL_TYPE +# endif +# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) +# define Q_NO_USING_KEYWORD +# endif +# define Q_C_CALLBACKS +/* 4.2 compiler or older */ +# else +# define Q_NO_BOOL_TYPE +# define Q_NO_EXPLICIT_KEYWORD +# define Q_NO_USING_KEYWORD +# endif + +/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant + documentation but nevertheless uses EDG conventions like _BOOL */ +#elif defined(sinix) +# define Q_CC_EDG +# define Q_CC_CDS +# if !defined(_BOOL) +# define Q_NO_BOOL_TYPE +# endif +# define Q_BROKEN_TEMPLATE_SPECIALIZATION + +#elif defined(Q_OS_HPUX) +/* __HP_aCC was not defined in first aCC releases */ +# if defined(__HP_aCC) || __cplusplus >= 199707L +# define Q_NO_TEMPLATE_FRIENDS +# define Q_CC_HPACC +# if __HP_aCC-0 < 060000 +# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# endif +# if __HP_aCC-0 >= 061200 +# define Q_DECL_ALIGNED(n) __attribute__((aligned(n))) +# endif +# if __HP_aCC-0 >= 062000 +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# define Q_DECL_IMPORT Q_DECL_EXPORT +# endif +# else +# define Q_CC_HP +# define Q_NO_BOOL_TYPE +# define Q_FULL_TEMPLATE_INSTANTIATION +# define Q_BROKEN_TEMPLATE_SPECIALIZATION +# define Q_NO_EXPLICIT_KEYWORD +# endif +# define Q_NO_USING_KEYWORD /* ### check "using" status */ + +#elif defined(__WINSCW__) && !defined(Q_CC_NOKIAX86) +# define Q_CC_NOKIAX86 + + +#else +# error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com" +#endif + +#ifndef Q_PACKED +# define Q_PACKED +# undef Q_NO_PACKED_REFERENCE +#endif + +#ifndef Q_CONSTRUCTOR_FUNCTION +# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \ + static const int AFUNC ## __init_variable__ = AFUNC(); +# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC) +#endif + +#ifndef Q_DESTRUCTOR_FUNCTION +# define Q_DESTRUCTOR_FUNCTION0(AFUNC) \ + class AFUNC ## __dest_class__ { \ + public: \ + inline AFUNC ## __dest_class__() { } \ + inline ~ AFUNC ## __dest_class__() { AFUNC(); } \ + } AFUNC ## __dest_instance__; +# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) +#endif + +#ifndef Q_REQUIRED_RESULT +# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +# define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result)) +# else +# define Q_REQUIRED_RESULT +# endif +#endif + +#ifndef Q_COMPILER_MANGLES_RETURN_TYPE +# if defined(Q_CC_MSVC) +# define Q_COMPILER_MANGLES_RETURN_TYPE +# endif +#endif + +/* + The window system, must be one of: (Q_WS_x) + + MACX - Mac OS X + MAC9 - Mac OS 9 + QWS - Qt for Embedded Linux + WIN32 - Windows + X11 - X Window System + S60 - Symbian S60 + PM - unsupported + WIN16 - unsupported +*/ + +#if defined(Q_OS_MSDOS) +# define Q_WS_WIN16 +# error "Qt requires Win32 and does not work with Windows 3.x" +#elif defined(_WIN32_X11_) +# define Q_WS_X11 +#elif defined(Q_OS_WIN32) +# define Q_WS_WIN32 +# if defined(Q_OS_WIN64) +# define Q_WS_WIN64 +# endif +#elif defined(Q_OS_WINCE) +# define Q_WS_WIN32 +# define Q_WS_WINCE +# if defined(Q_OS_WINCE_WM) +# define Q_WS_WINCE_WM +# endif +#elif defined(Q_OS_OS2) +# define Q_WS_PM +# error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" +#elif defined(Q_OS_UNIX) +# if defined(Q_OS_MAC) && !defined(__USE_WS_X11__) && !defined(Q_WS_QWS) +# define Q_WS_MAC +# define Q_WS_MACX +# if defined(Q_OS_MAC64) +# define Q_WS_MAC64 +# elif defined(Q_OS_MAC32) +# define Q_WS_MAC32 +# endif +# elif defined(Q_OS_SYMBIAN) +# if (defined(__SERIES60_31__) || defined(__S60_32__) || defined(__S60_50__)) && !defined(QT_NO_S60) +# define Q_WS_S60 +# endif +# elif !defined(Q_WS_QWS) +# define Q_WS_X11 +# endif +#endif + +#if defined(Q_WS_WIN16) || defined(Q_WS_WIN32) || defined(Q_WS_WINCE) +# define Q_WS_WIN +#endif + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +/* + Size-dependent types (architechture-dependent byte order) + + Make sure to update QMetaType when changing these typedefs +*/ + +typedef signed char qint8; /* 8 bit signed */ +typedef unsigned char quint8; /* 8 bit unsigned */ +typedef short qint16; /* 16 bit signed */ +typedef unsigned short quint16; /* 16 bit unsigned */ +typedef int qint32; /* 32 bit signed */ +typedef unsigned int quint32; /* 32 bit unsigned */ +#if defined(Q_OS_WIN) && !defined(Q_CC_GNU) && !defined(Q_CC_MWERKS) +# define Q_INT64_C(c) c ## i64 /* signed 64 bit constant */ +# define Q_UINT64_C(c) c ## ui64 /* unsigned 64 bit constant */ +typedef __int64 qint64; /* 64 bit signed */ +typedef unsigned __int64 quint64; /* 64 bit unsigned */ +#else +# define Q_INT64_C(c) static_cast<long long>(c ## LL) /* signed 64 bit constant */ +# define Q_UINT64_C(c) static_cast<unsigned long long>(c ## ULL) /* unsigned 64 bit constant */ +typedef long long qint64; /* 64 bit signed */ +typedef unsigned long long quint64; /* 64 bit unsigned */ +#endif + +typedef qint64 qlonglong; +typedef quint64 qulonglong; + +#ifndef QT_POINTER_SIZE +# if defined(Q_OS_WIN64) +# define QT_POINTER_SIZE 8 +# elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) +# define QT_POINTER_SIZE 4 +# endif +#endif + +#define Q_INIT_RESOURCE(name) \ + do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \ + QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0) +#define Q_CLEANUP_RESOURCE(name) \ + do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \ + QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0) + +#if defined(__cplusplus) + +/* + quintptr and qptrdiff is guaranteed to be the same size as a pointer, i.e. + + sizeof(void *) == sizeof(quintptr) + && sizeof(void *) == sizeof(qptrdiff) +*/ +template <int> struct QIntegerForSize; +template <> struct QIntegerForSize<1> { typedef quint8 Unsigned; typedef qint8 Signed; }; +template <> struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qint16 Signed; }; +template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; }; +template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; }; +template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { }; +typedef QIntegerForSizeof<void*>::Unsigned quintptr; +typedef QIntegerForSizeof<void*>::Signed qptrdiff; + +/* + Useful type definitions for Qt +*/ + +QT_BEGIN_INCLUDE_NAMESPACE +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +QT_END_INCLUDE_NAMESPACE + +#if defined(Q_NO_BOOL_TYPE) +#error "Compiler doesn't support the bool type" +#endif + +/* + Constant bool values +*/ + +#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 +# endif +#endif + +/* + Proper for-scoping in VC++6 and MIPSpro CC +*/ +#ifndef QT_NO_KEYWORDS +# if (defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) && !defined(Q_CC_INTEL)) || defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64)) +# define for if(0){}else for +# endif +#endif + +/* + Workaround for static const members on MSVC++. +*/ + +#if defined(Q_CC_MSVC) +# define QT_STATIC_CONST static +# define QT_STATIC_CONST_IMPL +#else +# define QT_STATIC_CONST static const +# define QT_STATIC_CONST_IMPL const +#endif + +/* + Warnings and errors when using deprecated methods +*/ +#if defined(Q_MOC_RUN) +# define Q_DECL_DEPRECATED Q_DECL_DEPRECATED +#elif (defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2))) || defined(Q_CC_RVCT) +# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) +#elif defined(Q_CC_MSVC) && (_MSC_VER >= 1300) +# define Q_DECL_DEPRECATED __declspec(deprecated) +# if defined (Q_CC_INTEL) +# define Q_DECL_VARIABLE_DEPRECATED +# else +# endif +#else +# define Q_DECL_DEPRECATED +#endif +#ifndef Q_DECL_VARIABLE_DEPRECATED +# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED +#endif +#ifndef Q_DECL_CONSTRUCTOR_DEPRECATED +# if defined(Q_MOC_RUN) +# define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED +# elif defined(Q_NO_DEPRECATED_CONSTRUCTORS) +# define Q_DECL_CONSTRUCTOR_DEPRECATED +# else +# define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_DEPRECATED +# endif +#endif + +#if defined(QT_NO_DEPRECATED) +/* disable Qt3 support as well */ +# undef QT3_SUPPORT_WARNINGS +# undef QT3_SUPPORT +# undef QT_DEPRECATED +# undef QT_DEPRECATED_VARIABLE +# undef QT_DEPRECATED_CONSTRUCTOR +#elif defined(QT_DEPRECATED_WARNINGS) +/* enable Qt3 support warnings as well */ +# undef QT3_SUPPORT_WARNINGS +# define QT3_SUPPORT_WARNINGS +# undef QT_DEPRECATED +# define QT_DEPRECATED Q_DECL_DEPRECATED +# undef QT_DEPRECATED_VARIABLE +# define QT_DEPRECATED_VARIABLE Q_DECL_VARIABLE_DEPRECATED +# undef QT_DEPRECATED_CONSTRUCTOR +# define QT_DEPRECATED_CONSTRUCTOR explicit Q_DECL_CONSTRUCTOR_DEPRECATED +#else +# undef QT_DEPRECATED +# define QT_DEPRECATED +# undef QT_DEPRECATED_VARIABLE +# define QT_DEPRECATED_VARIABLE +# undef QT_DEPRECATED_CONSTRUCTOR +# define QT_DEPRECATED_CONSTRUCTOR +#endif + +#if defined(QT3_SUPPORT_WARNINGS) +# if !defined(QT_COMPAT_WARNINGS) /* also enable compat */ +# define QT_COMPAT_WARNINGS +# endif +# undef QT3_SUPPORT +# define QT3_SUPPORT Q_DECL_DEPRECATED +# undef QT3_SUPPORT_VARIABLE +# define QT3_SUPPORT_VARIABLE Q_DECL_VARIABLE_DEPRECATED +# undef QT3_SUPPORT_CONSTRUCTOR +# define QT3_SUPPORT_CONSTRUCTOR explicit Q_DECL_CONSTRUCTOR_DEPRECATED +#elif defined(QT3_SUPPORT) /* define back to nothing */ +# if !defined(QT_COMPAT) /* also enable qt3 support */ +# define QT_COMPAT +# endif +# undef QT3_SUPPORT +# define QT3_SUPPORT +# undef QT3_SUPPORT_VARIABLE +# define QT3_SUPPORT_VARIABLE +# undef QT3_SUPPORT_CONSTRUCTOR +# define QT3_SUPPORT_CONSTRUCTOR explicit +#endif + +/* moc compats (signals/slots) */ +#ifndef QT_MOC_COMPAT +# if defined(QT3_SUPPORT) +# define QT_MOC_COMPAT QT3_SUPPORT +# else +# define QT_MOC_COMPAT +# endif +#else +# undef QT_MOC_COMPAT +# define QT_MOC_COMPAT +#endif + +#ifdef QT_ASCII_CAST_WARNINGS +# define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED +# if defined(Q_CC_GNU) && __GNUC__ < 4 + /* gcc < 4 doesn't like Q_DECL_DEPRECATED in front of constructors */ +# define QT_ASCII_CAST_WARN_CONSTRUCTOR +# else +# define QT_ASCII_CAST_WARN_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED +# endif +#else +# define QT_ASCII_CAST_WARN +# define QT_ASCII_CAST_WARN_CONSTRUCTOR +#endif + +#if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE) +# if defined(Q_CC_GNU) +#if !defined(Q_CC_INTEL) && ((100*(__GNUC__ - 0) + 10*(__GNUC_MINOR__ - 0) + __GNUC_PATCHLEVEL__) >= 332) +# define QT_FASTCALL __attribute__((regparm(3))) +#else +# define QT_FASTCALL +#endif +# elif defined(Q_CC_MSVC) && (_MSC_VER > 1300 || defined(Q_CC_INTEL)) +# define QT_FASTCALL __fastcall +# else +# define QT_FASTCALL +# endif +#else +# define QT_FASTCALL +#endif + +typedef int QNoImplicitBoolCast; + +#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) +#define QT_NO_FPU +#endif + +// 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) +typedef float qreal; +#else +typedef double qreal; +#endif + +/* + Utility macros and inline functions +*/ + +template <typename T> +inline T qAbs(const T &t) { return t >= 0 ? t : -t; } + +inline int qRound(qreal d) +{ return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); } + +#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) +inline qint64 qRound64(double d) +{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } +#else +inline qint64 qRound64(qreal d) +{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } +#endif + +template <typename T> +inline const T &qMin(const T &a, const T &b) { if (a < b) return a; return b; } +template <typename T> +inline const T &qMax(const T &a, const T &b) { if (a < b) return b; return a; } +template <typename T> +inline const T &qBound(const T &min, const T &val, const T &max) +{ return qMax(min, qMin(max, val)); } + +#ifdef QT3_SUPPORT +typedef qint8 Q_INT8; +typedef quint8 Q_UINT8; +typedef qint16 Q_INT16; +typedef quint16 Q_UINT16; +typedef qint32 Q_INT32; +typedef quint32 Q_UINT32; +typedef qint64 Q_INT64; +typedef quint64 Q_UINT64; + +typedef qint64 Q_LLONG; +typedef quint64 Q_ULLONG; +#if defined(Q_OS_WIN64) +typedef __int64 Q_LONG; /* word up to 64 bit signed */ +typedef unsigned __int64 Q_ULONG; /* word up to 64 bit unsigned */ +#else +typedef long Q_LONG; /* word up to 64 bit signed */ +typedef unsigned long Q_ULONG; /* word up to 64 bit unsigned */ +#endif + +# define QABS(a) qAbs(a) +# define QMAX(a, b) qMax((a), (b)) +# define QMIN(a, b) qMin((a), (b)) +#endif + +/* + Data stream functions are provided by many classes (defined in qdatastream.h) +*/ + +class QDataStream; + +#ifndef QT_BUILD_KEY +#define QT_BUILD_KEY "unspecified" +#endif + +#if defined(Q_WS_MAC) +# ifndef QMAC_QMENUBAR_NO_EVENT +# define QMAC_QMENUBAR_NO_EVENT +# endif +#endif + +#if !defined(Q_WS_QWS) && !defined(QT_NO_COP) +# define QT_NO_COP +#endif + +#if defined(Q_OS_VXWORKS) +# define QT_NO_CRASHHANDLER // no popen +# define QT_NO_PROCESS // no exec*, no fork +# define QT_NO_LPR +# define QT_NO_SHAREDMEMORY // only POSIX, no SysV and in the end... +# define QT_NO_SYSTEMSEMAPHORE // not needed at all in a flat address space +# define QT_NO_QWS_MULTIPROCESS // no processes +#endif + +# include <QtCore/qfeatures.h> + +#define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) + +#ifndef Q_DECL_EXPORT +# if defined(Q_OS_WIN) || defined(Q_CC_NOKIAX86) || defined(Q_CC_RVCT) +# define Q_DECL_EXPORT __declspec(dllexport) +# elif defined(QT_VISIBILITY_AVAILABLE) +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# endif +# ifndef Q_DECL_EXPORT +# define Q_DECL_EXPORT +# endif +#endif +#ifndef Q_DECL_IMPORT +# if defined(Q_OS_WIN) || defined(Q_CC_NOKIAX86) || defined(Q_CC_RVCT) +# define Q_DECL_IMPORT __declspec(dllimport) +# else +# define Q_DECL_IMPORT +# endif +#endif + +/* + Create Qt DLL if QT_DLL is defined (Windows and Symbian only) +*/ + +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) +# if defined(QT_NODLL) +# undef QT_MAKEDLL +# undef QT_DLL +# elif defined(QT_MAKEDLL) /* create a Qt DLL library */ +# if defined(QT_DLL) +# undef QT_DLL +# endif +# if defined(QT_BUILD_CORE_LIB) +# define Q_CORE_EXPORT Q_DECL_EXPORT +# else +# define Q_CORE_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_GUI_LIB) +# define Q_GUI_EXPORT Q_DECL_EXPORT +# else +# define Q_GUI_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_SQL_LIB) +# define Q_SQL_EXPORT Q_DECL_EXPORT +# else +# define Q_SQL_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_NETWORK_LIB) +# define Q_NETWORK_EXPORT Q_DECL_EXPORT +# else +# define Q_NETWORK_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_SVG_LIB) +# define Q_SVG_EXPORT Q_DECL_EXPORT +# else +# define Q_SVG_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_DECLARATIVE_LIB) +# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT +# else +# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_OPENGL_LIB) +# define Q_OPENGL_EXPORT Q_DECL_EXPORT +# else +# define Q_OPENGL_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_MULTIMEDIA_LIB) +# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT +# else +# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_OPENVG_LIB) +# define Q_OPENVG_EXPORT Q_DECL_EXPORT +# else +# define Q_OPENVG_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_XML_LIB) +# define Q_XML_EXPORT Q_DECL_EXPORT +# else +# define Q_XML_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_XMLPATTERNS_LIB) +# define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT +# else +# define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_SCRIPT_LIB) +# define Q_SCRIPT_EXPORT Q_DECL_EXPORT +# else +# define Q_SCRIPT_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_SCRIPTTOOLS_LIB) +# define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT +# else +# define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_CANVAS_LIB) +# define Q_CANVAS_EXPORT Q_DECL_EXPORT +# else +# define Q_CANVAS_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_COMPAT_LIB) +# define Q_COMPAT_EXPORT Q_DECL_EXPORT +# else +# define Q_COMPAT_EXPORT Q_DECL_IMPORT +# endif +# define Q_TEMPLATEDLL +# elif defined(QT_DLL) /* use a Qt DLL library */ +# define Q_CORE_EXPORT Q_DECL_IMPORT +# define Q_GUI_EXPORT Q_DECL_IMPORT +# define Q_SQL_EXPORT Q_DECL_IMPORT +# define Q_NETWORK_EXPORT Q_DECL_IMPORT +# define Q_SVG_EXPORT Q_DECL_IMPORT +# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT +# define Q_CANVAS_EXPORT Q_DECL_IMPORT +# define Q_OPENGL_EXPORT Q_DECL_IMPORT +# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT +# define Q_OPENVG_EXPORT Q_DECL_IMPORT +# define Q_XML_EXPORT Q_DECL_IMPORT +# define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT +# define Q_SCRIPT_EXPORT Q_DECL_IMPORT +# define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT +# define Q_COMPAT_EXPORT Q_DECL_IMPORT +# define Q_TEMPLATEDLL +# endif +# define Q_NO_DECLARED_NOT_DEFINED +#else +# if defined(Q_OS_LINUX) && defined(Q_CC_BOR) +# define Q_TEMPLATEDLL +# define Q_NO_DECLARED_NOT_DEFINED +# endif +# undef QT_MAKEDLL /* ignore these for other platforms */ +# undef QT_DLL +#endif + +#if !defined(Q_CORE_EXPORT) +# if defined(QT_SHARED) +# define Q_CORE_EXPORT Q_DECL_EXPORT +# define Q_GUI_EXPORT Q_DECL_EXPORT +# define Q_SQL_EXPORT Q_DECL_EXPORT +# define Q_NETWORK_EXPORT Q_DECL_EXPORT +# define Q_SVG_EXPORT Q_DECL_EXPORT +# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT +# define Q_OPENGL_EXPORT Q_DECL_EXPORT +# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT +# define Q_OPENVG_EXPORT Q_DECL_EXPORT +# define Q_XML_EXPORT Q_DECL_EXPORT +# define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT +# define Q_SCRIPT_EXPORT Q_DECL_EXPORT +# define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT +# define Q_COMPAT_EXPORT Q_DECL_EXPORT +# else +# define Q_CORE_EXPORT +# define Q_GUI_EXPORT +# define Q_SQL_EXPORT +# define Q_NETWORK_EXPORT +# define Q_SVG_EXPORT +# define Q_DECLARATIVE_EXPORT +# define Q_OPENGL_EXPORT +# define Q_MULTIMEDIA_EXPORT +# define Q_XML_EXPORT +# define Q_XMLPATTERNS_EXPORT +# define Q_SCRIPT_EXPORT +# define Q_SCRIPTTOOLS_EXPORT +# define Q_COMPAT_EXPORT +# endif +#endif + +// Functions marked as Q_GUI_EXPORT_INLINE were exported and inlined by mistake. +// Compilers like MinGW complain that the import attribute is ignored. +#if defined(Q_CC_MINGW) +# if defined(QT_BUILD_CORE_LIB) +# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline +# else +# define Q_CORE_EXPORT_INLINE inline +# endif +# if defined(QT_BUILD_GUI_LIB) +# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline +# else +# define Q_GUI_EXPORT_INLINE inline +# endif +#elif defined(Q_CC_RVCT) +// we force RVCT not to export inlines by passing --visibility_inlines_hidden +// so we need to just inline it, rather than exporting and inlining +// note: this affects the contents of the DEF files (ie. these functions do not appear) +# define Q_CORE_EXPORT_INLINE inline +# define Q_GUI_EXPORT_INLINE inline +#else +# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline +# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline +#endif + +/* + No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols + 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) +# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT +#elif defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && 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) +# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT +#else +# define Q_AUTOTEST_EXPORT +#endif + +inline void qt_noop() {} + +/* These wrap try/catch so we can switch off exceptions later. + + Beware - do not use more than one QT_CATCH per QT_TRY, and do not use + the exception instance in the catch block. + If you can't live with those constraints, don't use these macros. + Use the QT_NO_EXCEPTIONS macro to protect your code instead. +*/ + +#ifdef QT_BOOTSTRAPPED +# define QT_NO_EXCEPTIONS +#endif +#if !defined(QT_NO_EXCEPTIONS) && defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) +# define QT_NO_EXCEPTIONS +#endif + +#ifdef QT_NO_EXCEPTIONS +# define QT_TRY if (true) +# define QT_CATCH(A) else +# define QT_THROW(A) qt_noop() +# define QT_RETHROW qt_noop() +#else +# define QT_TRY try +# define QT_CATCH(A) catch (A) +# define QT_THROW(A) throw A +# define QT_RETHROW throw +#endif + +/* + System information +*/ + +class QString; +class Q_CORE_EXPORT QSysInfo { +public: + enum Sizes { + WordSize = (sizeof(void *)<<3) + }; + +#if defined(QT_BUILD_QMAKE) + enum Endian { + BigEndian, + LittleEndian + }; + /* needed to bootstrap qmake */ + static const int ByteOrder; +#elif defined(Q_BYTE_ORDER) + enum Endian { + BigEndian, + LittleEndian + +# ifdef qdoc + , ByteOrder = <platform-dependent> +# elif Q_BYTE_ORDER == Q_BIG_ENDIAN + , ByteOrder = BigEndian +# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN + , ByteOrder = LittleEndian +# else +# error "Undefined byte order" +# endif + }; +#else +# error "Qt not configured correctly, please run configure" +#endif +#if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN) + enum WinVersion { + WV_32s = 0x0001, + WV_95 = 0x0002, + WV_98 = 0x0003, + WV_Me = 0x0004, + WV_DOS_based= 0x000f, + + /* codenames */ + WV_NT = 0x0010, + WV_2000 = 0x0020, + WV_XP = 0x0030, + WV_2003 = 0x0040, + WV_VISTA = 0x0080, + WV_WINDOWS7 = 0x0090, + WV_NT_based = 0x00f0, + + /* version numbers */ + WV_4_0 = WV_NT, + WV_5_0 = WV_2000, + WV_5_1 = WV_XP, + WV_5_2 = WV_2003, + WV_6_0 = WV_VISTA, + WV_6_1 = WV_WINDOWS7, + + WV_CE = 0x0100, + WV_CENET = 0x0200, + WV_CE_5 = 0x0300, + WV_CE_6 = 0x0400, + WV_CE_based = 0x0f00 + }; + static const WinVersion WindowsVersion; + static WinVersion windowsVersion(); + +#endif +#ifdef Q_OS_MAC + enum MacVersion { + MV_Unknown = 0x0000, + + /* version */ + MV_9 = 0x0001, + MV_10_0 = 0x0002, + MV_10_1 = 0x0003, + MV_10_2 = 0x0004, + MV_10_3 = 0x0005, + MV_10_4 = 0x0006, + MV_10_5 = 0x0007, + MV_10_6 = 0x0008, + + /* codenames */ + MV_CHEETAH = MV_10_0, + MV_PUMA = MV_10_1, + MV_JAGUAR = MV_10_2, + MV_PANTHER = MV_10_3, + MV_TIGER = MV_10_4, + MV_LEOPARD = MV_10_5, + MV_SNOWLEOPARD = MV_10_6 + }; + static const MacVersion MacintoshVersion; +#endif +#ifdef Q_OS_SYMBIAN + enum SymbianVersion { + SV_Unknown = 0x0000, + //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 + }; + static SymbianVersion symbianVersion(); + enum S60Version { + SV_S60_None = 0, + SV_S60_Unknown = 1, + SV_S60_3_1 = SV_9_2, + SV_S60_3_2 = SV_9_3, + SV_S60_5_0 = SV_9_4, + //versions beyond 5.0 are to be confirmed - it is better to use symbian version + SV_S60_5_1 = SV_SF_2, + SV_S60_5_2 = SV_SF_3 + }; + static S60Version s60Version(); +#endif +}; + +Q_CORE_EXPORT const char *qVersion(); +Q_CORE_EXPORT bool qSharedBuild(); + +#if defined(Q_OS_MAC) +inline int qMacVersion() { return QSysInfo::MacintoshVersion; } +#endif + +#ifdef QT3_SUPPORT +inline QT3_SUPPORT bool qSysInfo(int *wordSize, bool *bigEndian) +{ + *wordSize = QSysInfo::WordSize; + *bigEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian); + return true; +} +#endif + +#if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN) +#if defined(QT3_SUPPORT) +inline QT3_SUPPORT bool qt_winUnicode() { return true; } +inline QT3_SUPPORT int qWinVersion() { return QSysInfo::WindowsVersion; } +#endif + +#define QT_WA(unicode, ansi) unicode +#define QT_WA_INLINE(unicode, ansi) (unicode) + +#endif /* Q_WS_WIN */ + +#ifndef Q_OUTOFLINE_TEMPLATE +# define Q_OUTOFLINE_TEMPLATE +#endif +#ifndef Q_INLINE_TEMPLATE +# define Q_INLINE_TEMPLATE inline +#endif + +#ifndef Q_TYPENAME +# define Q_TYPENAME typename +#endif + +/* + Avoid "unused parameter" warnings +*/ + +#if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT) +template <typename T> +inline void qUnused(T &x) { (void)x; } +# define Q_UNUSED(x) qUnused(x); +#else +# define Q_UNUSED(x) (void)x; +#endif + +/* + 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 + +#ifndef qPrintable +# define qPrintable(string) (string).toLocal8Bit().constData() +#endif + +Q_CORE_EXPORT void qDebug(const char *, ...) /* print debug message */ +#if defined(Q_CC_GNU) && !defined(__INSURE__) + __attribute__ ((format (printf, 1, 2))) +#endif +; + +Q_CORE_EXPORT void qWarning(const char *, ...) /* print warning message */ +#if defined(Q_CC_GNU) && !defined(__INSURE__) + __attribute__ ((format (printf, 1, 2))) +#endif +; + +class QString; +Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); +Q_CORE_EXPORT void qCritical(const char *, ...) /* print critical message */ +#if defined(Q_CC_GNU) && !defined(__INSURE__) + __attribute__ ((format (printf, 1, 2))) +#endif +; +Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */ +#if defined(Q_CC_GNU) && !defined(__INSURE__) + __attribute__ ((format (printf, 1, 2))) +#endif +; + +#ifdef QT3_SUPPORT +Q_CORE_EXPORT QT3_SUPPORT void qSystemWarning(const char *msg, int code = -1); +#endif /* QT3_SUPPORT */ +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. + + In order to use the qDebug() stream, you must #include<QDebug> +*/ +class QDebug; +class QNoDebug; +#ifndef 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 + +#define QT_NO_QDEBUG_MACRO while (false) qDebug +#ifdef QT_NO_DEBUG_OUTPUT +# define qDebug QT_NO_QDEBUG_MACRO +#endif +#define QT_NO_QWARNING_MACRO while (false) qWarning +#ifdef QT_NO_WARNING_OUTPUT +# define qWarning QT_NO_QWARNING_MACRO +#endif + + +Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); + +#if !defined(Q_ASSERT) +# ifndef QT_NO_DEBUG +# define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) +# else +# define Q_ASSERT(cond) qt_noop() +# endif +#endif + +#if defined(QT_NO_DEBUG) && !defined(QT_PAINT_DEBUG) +#define QT_NO_PAINT_DEBUG +#endif + +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 +# define Q_ASSERT_X(cond, where, what) qt_noop() +# endif +#endif + +Q_CORE_EXPORT void qt_check_pointer(const char *, int); + +#ifndef QT_NO_EXCEPTIONS +Q_CORE_EXPORT void qBadAlloc(); +#endif + +#ifdef QT_NO_EXCEPTIONS +# if defined(QT_NO_DEBUG) +# define Q_CHECK_PTR(p) qt_noop(); +# else +# define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0) +# endif +#else +# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0) +#endif + +template <typename T> +inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; } + +#if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB) +# define Q_FUNC_INFO __PRETTY_FUNCTION__ +#elif defined(_MSC_VER) + /* MSVC 2002 doesn't have __FUNCSIG__ nor can it handle QT_STRINGIFY. */ +# if _MSC_VER <= 1300 +# define Q_FUNC_INFO __FILE__ "(line number unavailable)" +# else +# define Q_FUNC_INFO __FUNCSIG__ +# endif +#else +# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) || defined(Q_OS_SYMBIAN) +# define Q_FUNC_INFO __FILE__ "(line number unavailable)" +# else + /* These two macros makes it possible to turn the builtin line expander into a + * string literal. */ +# define QT_STRINGIFY2(x) #x +# define QT_STRINGIFY(x) QT_STRINGIFY2(x) +# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__) +# endif + /* The MIPSpro and RVCT compilers postpones macro expansion, + and therefore macros must be in scope when being used. */ +# if !defined(Q_CC_MIPS) && !defined(Q_CC_RVCT) && !defined(Q_CC_NOKIAX86) +# undef QT_STRINGIFY2 +# undef QT_STRINGIFY +# endif +#endif + +enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; + +Q_CORE_EXPORT void qt_message_output(QtMsgType, const char *buf); + +typedef void (*QtMsgHandler)(QtMsgType, const char *); +Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler); + +#ifdef QT3_SUPPORT +inline QT3_SUPPORT void qSuppressObsoleteWarnings(bool = true) {} +inline QT3_SUPPORT void qObsolete(const char *, const char * = 0, const char * = 0) {} +#endif + +#if defined(QT_NO_THREAD) + +template <typename T> +class QGlobalStatic +{ +public: + T *pointer; + inline QGlobalStatic(T *p) : pointer(p) { } + inline ~QGlobalStatic() { pointer = 0; } +}; + +#define Q_GLOBAL_STATIC(TYPE, NAME) \ + static TYPE *NAME() \ + { \ + static TYPE this_##NAME; \ + static QGlobalStatic<TYPE > global_##NAME(&this_##NAME); \ + return global_##NAME.pointer; \ + } + +#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ + static TYPE *NAME() \ + { \ + static TYPE this_##NAME ARGS; \ + static QGlobalStatic<TYPE > global_##NAME(&this_##NAME); \ + return global_##NAME.pointer; \ + } + +#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ + static TYPE *NAME() \ + { \ + static TYPE this_##NAME; \ + static QGlobalStatic<TYPE > global_##NAME(0); \ + if (!global_##NAME.pointer) { \ + TYPE *x = global_##NAME.pointer = &this_##NAME; \ + INITIALIZER; \ + } \ + return global_##NAME.pointer; \ + } + +#else + +// forward declaration, since qatomic.h needs qglobal.h +template <typename T> class QBasicAtomicPointer; + +// POD for Q_GLOBAL_STATIC +template <typename T> +class QGlobalStatic +{ +public: + QBasicAtomicPointer<T> pointer; + bool destroyed; +}; + +// Created as a function-local static to delete a QGlobalStatic<T> +template <typename T> +class QGlobalStaticDeleter +{ +public: + QGlobalStatic<T> &globalStatic; + QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic) + : globalStatic(_globalStatic) + { } + + inline ~QGlobalStaticDeleter() + { + delete globalStatic.pointer; + globalStatic.pointer = 0; + globalStatic.destroyed = true; + } +}; + +#define Q_GLOBAL_STATIC_INIT(TYPE, NAME) \ + static QGlobalStatic<TYPE > this_##NAME = { Q_BASIC_ATOMIC_INITIALIZER(0), false } + +#define Q_GLOBAL_STATIC(TYPE, NAME) \ + Q_GLOBAL_STATIC_INIT(TYPE, NAME); \ + static TYPE *NAME() \ + { \ + if (!this_##NAME.pointer && !this_##NAME.destroyed) { \ + TYPE *x = new TYPE; \ + if (!this_##NAME.pointer.testAndSetOrdered(0, x)) \ + delete x; \ + else \ + static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \ + } \ + return this_##NAME.pointer; \ + } + +#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ + Q_GLOBAL_STATIC_INIT(TYPE, NAME); \ + static TYPE *NAME() \ + { \ + if (!this_##NAME.pointer && !this_##NAME.destroyed) { \ + TYPE *x = new TYPE ARGS; \ + if (!this_##NAME.pointer.testAndSetOrdered(0, x)) \ + delete x; \ + else \ + static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \ + } \ + return this_##NAME.pointer; \ + } + +#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ + Q_GLOBAL_STATIC_INIT(TYPE, NAME); \ + static TYPE *NAME() \ + { \ + if (!this_##NAME.pointer && !this_##NAME.destroyed) { \ + QScopedPointer<TYPE > x(new TYPE); \ + INITIALIZER; \ + if (this_##NAME.pointer.testAndSetOrdered(0, x.data())) { \ + static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \ + x.take(); \ + } \ + } \ + return this_##NAME.pointer; \ + } + +#endif + +class QBool +{ + bool b; + +public: + inline explicit QBool(bool B) : b(B) {} + inline operator const void *() const + { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); } +}; + +inline bool operator==(QBool b1, bool b2) { return !b1 == !b2; } +inline bool operator==(bool b1, QBool b2) { return !b1 == !b2; } +inline bool operator==(QBool b1, QBool b2) { return !b1 == !b2; } +inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; } +inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; } +inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; } + +static inline bool qFuzzyCompare(double p1, double p2) +{ + return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2))); +} + +static inline bool qFuzzyCompare(float p1, float p2) +{ + return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); +} + +/*! + \internal +*/ +static inline bool qFuzzyIsNull(double d) +{ + return qAbs(d) <= 0.000000000001; +} + +/*! + \internal +*/ +static inline bool qFuzzyIsNull(float f) +{ + return qAbs(f) <= 0.00001f; +} + +/* + This function tests a double for a null value. It doesn't + check whether the actual value is 0 or close to 0, but whether + it is binary 0. +*/ +static inline bool qIsNull(double d) +{ + union U { + double d; + quint64 u; + }; + U val; + val.d = d; + return val.u == quint64(0); +} + +/* + This function tests a float for a null value. It doesn't + check whether the actual value is 0 or close to 0, but whether + it is binary 0. +*/ +static inline bool qIsNull(float f) +{ + union U { + float f; + quint32 u; + }; + U val; + val.f = f; + return val.u == 0u; +} + +/* + Compilers which follow outdated template instantiation rules + require a class to have a comparison operator to exist when + a QList of this type is instantiated. It's not actually + used in the list, though. Hence the dummy implementation. + Just in case other code relies on it we better trigger a warning + mandating a real implementation. +*/ + +#ifdef Q_FULL_TEMPLATE_INSTANTIATION +# define Q_DUMMY_COMPARISON_OPERATOR(C) \ + bool operator==(const C&) const { \ + qWarning(#C"::operator==(const "#C"&) was called"); \ + return false; \ + } +#else +# define Q_DUMMY_COMPARISON_OPERATOR(C) +#endif + + +/* + QTypeInfo - type trait functionality + qIsDetached - data sharing functionality +*/ + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + +/* + The catch-all template. +*/ + +template <typename T> inline bool qIsDetached(T &) { return true; } + +template <typename T> +class QTypeInfo +{ +public: + enum { + isPointer = false, + isComplex = true, + isStatic = true, + isLarge = (sizeof(T)>sizeof(void*)), + isDummy = false + }; +}; + +template <typename T> +class QTypeInfo<T*> +{ +public: + enum { + isPointer = true, + isComplex = false, + isStatic = false, + isLarge = false, + isDummy = false + }; +}; + +#else + +template <typename T> char QTypeInfoHelper(T*(*)()); +void* QTypeInfoHelper(...); + +template <typename T> inline bool qIsDetached(T &) { return true; } + +template <typename T> +class QTypeInfo +{ +public: + enum { + isPointer = (1 == sizeof(QTypeInfoHelper((T(*)())0))), + isComplex = !isPointer, + isStatic = !isPointer, + isLarge = (sizeof(T)>sizeof(void*)), + isDummy = false + }; +}; + +#endif /* QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION */ + +/* + Specialize a specific type with: + + Q_DECLARE_TYPEINFO(type, flags); + + where 'type' is the name of the type to specialize and 'flags' is + logically-OR'ed combination of the flags below. +*/ +enum { /* TYPEINFO flags */ + Q_COMPLEX_TYPE = 0, + Q_PRIMITIVE_TYPE = 0x1, + Q_STATIC_TYPE = 0, + Q_MOVABLE_TYPE = 0x2, + Q_DUMMY_TYPE = 0x4 +}; + +#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \ +template <> \ +class QTypeInfo<TYPE > \ +{ \ +public: \ + enum { \ + isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0), \ + isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ + isLarge = (sizeof(TYPE)>sizeof(void*)), \ + isPointer = false, \ + isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0) \ + }; \ + static inline const char *name() { return #TYPE; } \ +} + +template <typename T> +inline void qSwap(T &value1, T &value2) +{ + const T t = value1; + value1 = value2; + value2 = t; +} + +/* + Specialize a shared type with: + + Q_DECLARE_SHARED(type); + + where 'type' is the name of the type to specialize. NOTE: shared + types must declare a 'bool isDetached(void) const;' member for this + to work. +*/ +#define Q_DECLARE_SHARED(TYPE) \ +template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \ +template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \ +{ \ + qSwap(value1.data_ptr(), value2.data_ptr()); \ +} + +/* + QTypeInfo primitive specializations +*/ +Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE); +#ifndef Q_OS_DARWIN +Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); +#endif + +/* + 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 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 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); + + +/* + Avoid some particularly useless warnings from some stupid compilers. + To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out + the line "#define QT_NO_WARNINGS". +*/ +#if !defined(QT_CC_WARNINGS) +# define QT_NO_WARNINGS +#endif +#if defined(QT_NO_WARNINGS) +# if defined(Q_CC_MSVC) +# pragma warning(disable: 4251) /* class 'A' needs to have dll interface for to be used by clients of class 'B'. */ +# pragma warning(disable: 4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */ +# pragma warning(disable: 4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */ +# pragma warning(disable: 4514) /* unreferenced inline/local function has been removed */ +# pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ +# pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */ +# pragma warning(disable: 4706) /* assignment within conditional expression */ +# pragma warning(disable: 4786) /* truncating debug info after 255 characters */ +# pragma warning(disable: 4660) /* template-class specialization 'identifier' is already instantiated */ +# pragma warning(disable: 4355) /* 'this' : used in base member initializer list */ +# pragma warning(disable: 4231) /* nonstandard extension used : 'extern' before template explicit instantiation */ +# pragma warning(disable: 4710) /* function not inlined */ +# pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify -GX */ +# if _MSC_VER < 1300 +# pragma warning(disable: 4284) /* return type for 'type1::operator ->' is 'type2 *' */ + /* (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation) */ +# endif +# elif defined(Q_CC_BOR) +# pragma option -w-inl +# pragma option -w-aus +# pragma warn -inl +# pragma warn -pia +# pragma warn -ccc +# pragma warn -rch +# pragma warn -sig +# endif +#endif + +class Q_CORE_EXPORT QFlag +{ + int i; +public: + inline QFlag(int i); + inline operator int() const { return i; } +}; + +inline QFlag::QFlag(int ai) : i(ai) {} + +class Q_CORE_EXPORT QIncompatibleFlag +{ + int i; +public: + inline explicit QIncompatibleFlag(int i); + inline operator int() const { return i; } +}; + +inline QIncompatibleFlag::QIncompatibleFlag(int ai) : i(ai) {} + + +#ifndef Q_NO_TYPESAFE_FLAGS + +template<typename Enum> +class QFlags +{ + typedef void **Zero; + int i; +public: + typedef Enum enum_type; + inline QFlags(const QFlags &f) : i(f.i) {} + inline QFlags(Enum f) : i(f) {} + inline QFlags(Zero = 0) : i(0) {} + inline QFlags(QFlag f) : i(f) {} + + inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; } + inline QFlags &operator&=(int mask) { i &= mask; return *this; } + inline QFlags &operator&=(uint mask) { i &= mask; return *this; } + inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; } + inline QFlags &operator|=(Enum f) { i |= f; return *this; } + inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; } + inline QFlags &operator^=(Enum f) { i ^= f; return *this; } + + inline operator int() const { return i; } + + inline QFlags operator|(QFlags f) const { QFlags g; g.i = i | f.i; return g; } + inline QFlags operator|(Enum f) const { QFlags g; g.i = i | f; return g; } + inline QFlags operator^(QFlags f) const { QFlags g; g.i = i ^ f.i; return g; } + inline QFlags operator^(Enum f) const { QFlags g; g.i = i ^ f; return g; } + inline QFlags operator&(int mask) const { QFlags g; g.i = i & mask; return g; } + inline QFlags operator&(uint mask) const { QFlags g; g.i = i & mask; return g; } + inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; } + inline QFlags operator~() const { QFlags g; g.i = ~i; return g; } + + inline bool operator!() const { return !i; } + + inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); } +}; + +#define Q_DECLARE_FLAGS(Flags, Enum)\ +typedef QFlags<Enum> Flags; + +#if defined Q_CC_MSVC && _MSC_VER < 1300 +# define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) +#else +# define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \ +inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \ +{ return QIncompatibleFlag(int(f1) | f2); } +#endif + +#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ +inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ +{ return QFlags<Flags::enum_type>(f1) | f2; } \ +inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ +{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) + + +#else /* Q_NO_TYPESAFE_FLAGS */ + +#define Q_DECLARE_FLAGS(Flags, Enum)\ +typedef uint Flags; +#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) + +#endif /* Q_NO_TYPESAFE_FLAGS */ + +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT) +/* make use of typeof-extension */ +template <typename T> +class QForeachContainer { +public: + inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { } + const T c; + int brk; + typename T::const_iterator i, e; +}; + +#define Q_FOREACH(variable, container) \ +for (QForeachContainer<__typeof__(container)> _container_(container); \ + !_container_.brk && _container_.i != _container_.e; \ + __extension__ ({ ++_container_.brk; ++_container_.i; })) \ + for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;})) + +#else + +struct QForeachContainerBase {}; + +template <typename T> +class QForeachContainer : public QForeachContainerBase { +public: + inline QForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){}; + const T c; + mutable int brk; + mutable typename T::const_iterator i, e; + inline bool condition() const { return (!brk++ && i != e); } +}; + +template <typename T> inline T *qForeachPointer(const T &) { return 0; } + +template <typename T> inline QForeachContainer<T> qForeachContainerNew(const T& t) +{ return QForeachContainer<T>(t); } + +template <typename T> +inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase *base, const T *) +{ return static_cast<const QForeachContainer<T> *>(base); } + +#if (defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) && !defined(Q_CC_INTEL)) || defined(Q_CC_MIPS) +/* + Proper for-scoping in VC++6 and MIPSpro CC +*/ +# define Q_FOREACH(variable,container) \ + if(0){}else \ + for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ + qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \ + ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \ + for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \ + qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \ + --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk) + +#elif defined(Q_CC_DIAB) +// VxWorks DIAB generates unresolvable symbols, if container is a function call +# define Q_FOREACH(variable,container) \ + if(0){}else \ + for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ + qForeachContainer(&_container_, (__typeof__(container) *) 0)->condition(); \ + ++qForeachContainer(&_container_, (__typeof__(container) *) 0)->i) \ + for (variable = *qForeachContainer(&_container_, (__typeof__(container) *) 0)->i; \ + qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk; \ + --qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk) + +#else +# define Q_FOREACH(variable, container) \ + for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ + qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \ + ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \ + for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \ + qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \ + --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk) +#endif // MSVC6 || MIPSpro + +#endif + +#define Q_FOREVER for(;;) +#ifndef QT_NO_KEYWORDS +# ifndef foreach +# define foreach Q_FOREACH +# endif +# ifndef forever +# define forever Q_FOREVER +# endif +#endif + +#if 0 +/* tell gcc to use its built-in methods for some common functions */ +#if defined(QT_NO_DEBUG) && defined(Q_CC_GNU) +# define qMemCopy __builtin_memcpy +# define qMemSet __builtin_memset +#endif +#endif + +template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; } +template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); } + +#define Q_DECLARE_PRIVATE(Class) \ + inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \ + inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \ + friend class Class##Private; + +#define Q_DECLARE_PRIVATE_D(Dptr, Class) \ + inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(Dptr); } \ + inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(Dptr); } \ + friend class Class##Private; + +#define Q_DECLARE_PUBLIC(Class) \ + inline Class* q_func() { return static_cast<Class *>(q_ptr); } \ + inline const Class* q_func() const { return static_cast<const Class *>(q_ptr); } \ + friend class Class; + +#define Q_D(Class) Class##Private * const d = d_func() +#define Q_Q(Class) Class * const q = q_func() + +#define QT_TR_NOOP(x) (x) +#define QT_TR_NOOP_UTF8(x) (x) +#define QT_TRANSLATE_NOOP(scope, x) (x) +#define QT_TRANSLATE_NOOP_UTF8(scope, x) (x) +#define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment} +#define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} + +#ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above + +// Defined in qcoreapplication.cpp +// The better name qTrId() is reserved for an upcoming function which would +// return a much more powerful QStringFormatter instead of a QString. +Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); + +#define QT_TRID_NOOP(id) id + +#endif // QT_NO_TRANSLATION + +#define QDOC_PROPERTY(text) + +/* + When RTTI is not available, define this macro to force any uses of + dynamic_cast to cause a compile failure. +*/ + +#ifdef QT_NO_DYNAMIC_CAST +# define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check) + + template<typename T, typename X> + T qt_dynamic_cast_check(X, T* = 0) + { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; } +#endif + +/* + Some classes do not permit copies to be made of an object. These + classes contains a private copy constructor and assignment + operator to disable copying (the compiler gives an error message). +*/ +#define Q_DISABLE_COPY(Class) \ + Class(const Class &); \ + Class &operator=(const Class &); + +class QByteArray; +Q_CORE_EXPORT QByteArray qgetenv(const char *varName); +Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value); + +inline int qIntCast(double f) { return int(f); } +inline int qIntCast(float f) { return int(f); } + +/* + Reentrant versions of basic rand() functions for random number generation +*/ +Q_CORE_EXPORT void qsrand(uint seed); +Q_CORE_EXPORT int qrand(); + +/* + Compat functions that were generated by configure +*/ +#ifdef QT3_SUPPORT +#ifndef QT_PRODUCT_LICENSEE +# define QT_PRODUCT_LICENSEE QLibraryInfo::licensee() +#endif +#ifndef QT_PRODUCT_LICENSE +# define QT_PRODUCT_LICENSE QLibraryInfo::licensedProducts() +#endif +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPath(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathDocs(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathHeaders(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathLibs(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathBins(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathPlugins(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathData(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathTranslations(); +QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); +#endif + +#if defined(Q_OS_SYMBIAN) + +#ifdef SYMBIAN_GRAPHICS_USE_GCE +//RWsPointerCursor is fixed, so don't use low performance sprites +#define Q_SYMBIAN_FIXED_POINTER_CURSORS +#define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE +//enabling new graphics resources +#define QT_SYMBIAN_SUPPORTS_SGIMAGE +#define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER + +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE +#endif +#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. +*/ + +/* Qt modules */ +#define QT_MODULE_CORE 0x00001 +#define QT_MODULE_GUI 0x00002 +#define QT_MODULE_NETWORK 0x00004 +#define QT_MODULE_OPENGL 0x00008 +#define QT_MODULE_SQL 0x00010 +#define QT_MODULE_XML 0x00020 +#define QT_MODULE_QT3SUPPORTLIGHT 0x00040 +#define QT_MODULE_QT3SUPPORT 0x00080 +#define QT_MODULE_SVG 0x00100 +#define QT_MODULE_ACTIVEQT 0x00200 +#define QT_MODULE_GRAPHICSVIEW 0x00400 +#define QT_MODULE_SCRIPT 0x00800 +#define QT_MODULE_XMLPATTERNS 0x01000 +#define QT_MODULE_HELP 0x02000 +#define QT_MODULE_TEST 0x04000 +#define QT_MODULE_DBUS 0x08000 +#define QT_MODULE_SCRIPTTOOLS 0x10000 +#define QT_MODULE_OPENVG 0x20000 +#define QT_MODULE_MULTIMEDIA 0x40000 +#define QT_MODULE_DECLARATIVE 0x80000 + +/* Qt editions */ +#define QT_EDITION_CONSOLE (QT_MODULE_CORE \ + | QT_MODULE_NETWORK \ + | QT_MODULE_SQL \ + | QT_MODULE_SCRIPT \ + | QT_MODULE_MULTIMEDIA \ + | QT_MODULE_XML \ + | QT_MODULE_XMLPATTERNS \ + | QT_MODULE_TEST \ + | QT_MODULE_DBUS) +#define QT_EDITION_DESKTOPLIGHT (QT_MODULE_CORE \ + | QT_MODULE_GUI \ + | QT_MODULE_QT3SUPPORTLIGHT \ + | QT_MODULE_TEST \ + | QT_MODULE_DBUS) +#define QT_EDITION_OPENSOURCE (QT_MODULE_CORE \ + | QT_MODULE_GUI \ + | QT_MODULE_NETWORK \ + | QT_MODULE_OPENGL \ + | QT_MODULE_OPENVG \ + | QT_MODULE_SQL \ + | QT_MODULE_MULTIMEDIA \ + | QT_MODULE_XML \ + | QT_MODULE_XMLPATTERNS \ + | QT_MODULE_SCRIPT \ + | QT_MODULE_SCRIPTTOOLS \ + | QT_MODULE_QT3SUPPORTLIGHT \ + | QT_MODULE_QT3SUPPORT \ + | QT_MODULE_SVG \ + | QT_MODULE_DECLARATIVE \ + | QT_MODULE_GRAPHICSVIEW \ + | QT_MODULE_HELP \ + | QT_MODULE_TEST \ + | QT_MODULE_DBUS \ + | QT_MODULE_ACTIVEQT) +#define QT_EDITION_DESKTOP (QT_EDITION_OPENSOURCE) +#define QT_EDITION_UNIVERSAL QT_EDITION_DESKTOP +#define QT_EDITION_ACADEMIC QT_EDITION_DESKTOP +#define QT_EDITION_EDUCATIONAL QT_EDITION_DESKTOP +#define QT_EDITION_EVALUATION QT_EDITION_DESKTOP + +/* Determine which modules can be used */ +#ifndef QT_EDITION +# ifdef QT_BUILD_QMAKE +# define QT_EDITION QT_EDITION_DESKTOP +# else +# error "Qt not configured correctly, please run configure" +# endif +#endif + +#define QT_LICENSED_MODULE(x) \ + enum QtValidLicenseFor##x##Module { Licensed##x = true }; + +/* qdoc is really unhappy with the following block of preprocessor checks, + making it difficult to document classes properly after this point. */ + +#if (QT_EDITION & QT_MODULE_CORE) +QT_LICENSED_MODULE(Core) +#endif +#if (QT_EDITION & QT_MODULE_GUI) +QT_LICENSED_MODULE(Gui) +#endif +#if (QT_EDITION & QT_MODULE_NETWORK) +QT_LICENSED_MODULE(Network) +#endif +#if (QT_EDITION & QT_MODULE_OPENGL) +QT_LICENSED_MODULE(OpenGL) +#endif +#if (QT_EDITION & QT_MODULE_OPENVG) +QT_LICENSED_MODULE(OpenVG) +#endif +#if (QT_EDITION & QT_MODULE_SQL) +QT_LICENSED_MODULE(Sql) +#endif +#if (QT_EDITION & QT_MODULE_MULTIMEDIA) +QT_LICENSED_MODULE(Multimedia) +#endif +#if (QT_EDITION & QT_MODULE_XML) +QT_LICENSED_MODULE(Xml) +#endif +#if (QT_EDITION & QT_MODULE_XMLPATTERNS) +QT_LICENSED_MODULE(XmlPatterns) +#endif +#if (QT_EDITION & QT_MODULE_HELP) +QT_LICENSED_MODULE(Help) +#endif +#if (QT_EDITION & QT_MODULE_SCRIPT) || defined(QT_BUILD_QMAKE) +QT_LICENSED_MODULE(Script) +#endif +#if (QT_EDITION & QT_MODULE_SCRIPTTOOLS) +QT_LICENSED_MODULE(ScriptTools) +#endif +#if (QT_EDITION & QT_MODULE_QT3SUPPORTLIGHT) +QT_LICENSED_MODULE(Qt3SupportLight) +#endif +#if (QT_EDITION & QT_MODULE_QT3SUPPORT) +QT_LICENSED_MODULE(Qt3Support) +#endif +#if (QT_EDITION & QT_MODULE_SVG) +QT_LICENSED_MODULE(Svg) +#endif +#if (QT_EDITION & QT_MODULE_DECLARATIVE) +QT_LICENSED_MODULE(Declarative) +#endif +#if (QT_EDITION & QT_MODULE_ACTIVEQT) +QT_LICENSED_MODULE(ActiveQt) +#endif +#if (QT_EDITION & QT_MODULE_TEST) +QT_LICENSED_MODULE(Test) +#endif +#if (QT_EDITION & QT_MODULE_DBUS) +QT_LICENSED_MODULE(DBus) +#endif + +#define QT_MODULE(x) \ + typedef QtValidLicenseFor##x##Module Qt##x##Module; + +#ifdef QT_NO_CONCURRENT +# define QT_NO_QFUTURE +#endif + +// MSVC 6.0 and MSVC .NET 2002, can`t handle the map(), etc templates, +// but the QFuture class compiles. +#if (defined(Q_CC_MSVC) && _MSC_VER <= 1300) +# define QT_NO_CONCURRENT +#endif + +// gcc 3 version has problems with some of the +// map/filter overloads. +#if defined(Q_CC_GNU) && (__GNUC__ < 4) +# define QT_NO_CONCURRENT_MAP +# define QT_NO_CONCURRENT_FILTER +#endif + +#ifdef Q_OS_QNX +// QNX doesn't have SYSV style shared memory. Multiprocess QWS apps, +// shared fonts and QSystemSemaphore + QSharedMemory are not available +# define QT_NO_QWS_MULTIPROCESS +# define QT_NO_QWS_SHARE_FONTS +# define QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SHAREDMEMORY +// QNX currently doesn't support forking in a thread, so disable QProcess +# define QT_NO_PROCESS +#endif + +QT_END_NAMESPACE +QT_END_HEADER + +#endif /* __cplusplus */ + +#endif /* QGLOBAL_H */ diff --git a/qtinterface/qt4/Qt/qglpixelbuffer.h b/qtinterface/qt4/Qt/qglpixelbuffer.h new file mode 100644 index 0000000..6f726b6 --- /dev/null +++ b/qtinterface/qt4/Qt/qglpixelbuffer.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLPIXELBUFFER_H +#define QGLPIXELBUFFER_H + +#include <QtOpenGL/qgl.h> +#include <QtGui/qpaintdevice.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(OpenGL) + +class QGLPixelBufferPrivate; + +class Q_OPENGL_EXPORT QGLPixelBuffer : public QPaintDevice +{ + Q_DECLARE_PRIVATE(QGLPixelBuffer) +public: + QGLPixelBuffer(const QSize &size, const QGLFormat &format = QGLFormat::defaultFormat(), + QGLWidget *shareWidget = 0); + QGLPixelBuffer(int width, int height, const QGLFormat &format = QGLFormat::defaultFormat(), + QGLWidget *shareWidget = 0); + virtual ~QGLPixelBuffer(); + + bool isValid() const; + bool makeCurrent(); + bool doneCurrent(); + + GLuint generateDynamicTexture() const; + bool bindToDynamicTexture(GLuint texture); + void releaseFromDynamicTexture(); + void updateDynamicTexture(GLuint texture_id) const; + + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D); + GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D); + GLuint bindTexture(const QString &fileName); + void deleteTexture(GLuint texture_id); + + void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + bool bindToDynamicTexture(QMacCompatGLuint texture); + void updateDynamicTexture(QMacCompatGLuint texture_id) const; + GLuint bindTexture(const QImage &image, QMacCompatGLenum target = GL_TEXTURE_2D); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum target = GL_TEXTURE_2D); + + void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); + void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); + + void deleteTexture(QMacCompatGLuint texture_id); +#endif + + QSize size() const; + Qt::HANDLE handle() const; + QImage toImage() const; + + QPaintEngine *paintEngine() const; + QGLFormat format() const; + + static bool hasOpenGLPbuffers(); + +protected: + int metric(PaintDeviceMetric metric) const; + int devType() const { return QInternal::Pbuffer; } + +private: + Q_DISABLE_COPY(QGLPixelBuffer) + QScopedPointer<QGLPixelBufferPrivate> d_ptr; + friend class QGLDrawable; + friend class QGLWindowSurface; + friend class QGLPaintDevice; + friend class QGLPBufferGLPaintDevice; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGLPIXELBUFFER_H diff --git a/qtinterface/qt4/Qt/qglscreen_qws.h b/qtinterface/qt4/Qt/qglscreen_qws.h new file mode 100644 index 0000000..d902eb1 --- /dev/null +++ b/qtinterface/qt4/Qt/qglscreen_qws.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENEGL_P_H +#define QSCREENEGL_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 QScreenEGL class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include <QtGui/QScreen> +#include <QtOpenGL/qgl.h> +#if defined(QT_OPENGL_ES_2) +#include <EGL/egl.h> +#else +#include <GLES/egl.h> +#endif +#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED) +#undef EGLNativeWindowType +#undef EGLNativePixmapType +#undef EGLNativeDisplayType +typedef NativeWindowType EGLNativeWindowType; +typedef NativePixmapType EGLNativePixmapType; +typedef NativeDisplayType EGLNativeDisplayType; +#define QEGL_NATIVE_TYPES_DEFINED 1 +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(OpenGL) + +class QGLScreenPrivate; + +class Q_OPENGL_EXPORT QGLScreenSurfaceFunctions +{ +public: + virtual bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); + virtual bool createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native); + virtual bool createNativeImage(QImage *image, EGLNativePixmapType *native); +}; + +class Q_OPENGL_EXPORT QGLScreen : public QScreen +{ + Q_DECLARE_PRIVATE(QGLScreen) +public: + QGLScreen(int displayId); + virtual ~QGLScreen(); + + enum Option + { + NoOptions = 0, + NativeWindows = 1, + NativePixmaps = 2, + NativeImages = 4, + Overlays = 8 + }; + Q_DECLARE_FLAGS(Options, Option) + + QGLScreen::Options options() const; + + virtual bool chooseContext(QGLContext *context, const QGLContext *shareContext); + virtual bool hasOpenGL() = 0; + + QGLScreenSurfaceFunctions *surfaceFunctions() const; + +protected: + void setOptions(QGLScreen::Options value); + void setSurfaceFunctions(QGLScreenSurfaceFunctions *functions); + +private: + QGLScreenPrivate *d_ptr; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLScreen::Options) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENEGL_P_H diff --git a/qtinterface/qt4/Qt/qglshaderprogram.h b/qtinterface/qt4/Qt/qglshaderprogram.h new file mode 100644 index 0000000..9771834 --- /dev/null +++ b/qtinterface/qt4/Qt/qglshaderprogram.h @@ -0,0 +1,298 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLSHADERPROGRAM_H +#define QGLSHADERPROGRAM_H + +#include <QtOpenGL/qgl.h> +#include <QtGui/qvector2d.h> +#include <QtGui/qvector3d.h> +#include <QtGui/qvector4d.h> +#include <QtGui/qmatrix4x4.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(OpenGL) + +#if !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) + +class QGLShaderProgram; +class QGLShaderPrivate; + +class Q_OPENGL_EXPORT QGLShader : public QObject +{ + Q_OBJECT +public: + enum ShaderTypeBit + { + Vertex = 0x0001, + Fragment = 0x0002 + }; + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit) + + explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0); + QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0); + virtual ~QGLShader(); + + QGLShader::ShaderType shaderType() const; + + bool compileSourceCode(const char *source); + bool compileSourceCode(const QByteArray& source); + bool compileSourceCode(const QString& source); + bool compileSourceFile(const QString& fileName); + + QByteArray sourceCode() const; + + bool isCompiled() const; + QString log() const; + + GLuint shaderId() const; + +private: + friend class QGLShaderProgram; + + Q_DISABLE_COPY(QGLShader) + Q_DECLARE_PRIVATE(QGLShader) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType) + + +class QGLShaderProgramPrivate; + +class Q_OPENGL_EXPORT QGLShaderProgram : public QObject +{ + Q_OBJECT +public: + explicit QGLShaderProgram(QObject *parent = 0); + explicit QGLShaderProgram(const QGLContext *context, QObject *parent = 0); + virtual ~QGLShaderProgram(); + + bool addShader(QGLShader *shader); + void removeShader(QGLShader *shader); + QList<QGLShader *> shaders() const; + + bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const QByteArray& source); + bool addShaderFromSourceCode(QGLShader::ShaderType type, const QString& source); + bool addShaderFromSourceFile(QGLShader::ShaderType type, const QString& fileName); + + void removeAllShaders(); + + virtual bool link(); + bool isLinked() const; + QString log() const; + + bool bind(); + void release(); + + GLuint programId() const; + + void bindAttributeLocation(const char *name, int location); + void bindAttributeLocation(const QByteArray& name, int location); + void bindAttributeLocation(const QString& name, int location); + + int attributeLocation(const char *name) const; + int attributeLocation(const QByteArray& name) const; + int attributeLocation(const QString& name) const; + + void setAttributeValue(int location, GLfloat value); + void setAttributeValue(int location, GLfloat x, GLfloat y); + void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z); + void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setAttributeValue(int location, const QVector2D& value); + void setAttributeValue(int location, const QVector3D& value); + void setAttributeValue(int location, const QVector4D& value); + void setAttributeValue(int location, const QColor& value); + void setAttributeValue(int location, const GLfloat *values, int columns, int rows); + + void setAttributeValue(const char *name, GLfloat value); + void setAttributeValue(const char *name, GLfloat x, GLfloat y); + void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z); + void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setAttributeValue(const char *name, const QVector2D& value); + void setAttributeValue(const char *name, const QVector3D& value); + void setAttributeValue(const char *name, const QVector4D& value); + void setAttributeValue(const char *name, const QColor& value); + void setAttributeValue(const char *name, const GLfloat *values, int columns, int rows); + + void setAttributeArray + (int location, const GLfloat *values, int tupleSize, int stride = 0); + void setAttributeArray + (int location, const QVector2D *values, int stride = 0); + void setAttributeArray + (int location, const QVector3D *values, int stride = 0); + void setAttributeArray + (int location, const QVector4D *values, int stride = 0); + void setAttributeArray + (const char *name, const GLfloat *values, int tupleSize, int stride = 0); + void setAttributeArray + (const char *name, const QVector2D *values, int stride = 0); + void setAttributeArray + (const char *name, const QVector3D *values, int stride = 0); + void setAttributeArray + (const char *name, const QVector4D *values, int stride = 0); + + void enableAttributeArray(int location); + void enableAttributeArray(const char *name); + void disableAttributeArray(int location); + void disableAttributeArray(const char *name); + + int uniformLocation(const char *name) const; + int uniformLocation(const QByteArray& name) const; + int uniformLocation(const QString& name) const; + +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + void setUniformValue(int location, QMacCompatGLint value); + void setUniformValue(int location, QMacCompatGLuint value); + void setUniformValue(const char *name, QMacCompatGLint value); + void setUniformValue(const char *name, QMacCompatGLuint value); + void setUniformValueArray(int location, const QMacCompatGLint *values, int count); + void setUniformValueArray(int location, const QMacCompatGLuint *values, int count); + void setUniformValueArray(const char *name, const QMacCompatGLint *values, int count); + void setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count); +#endif + + void setUniformValue(int location, GLfloat value); + void setUniformValue(int location, GLint value); + void setUniformValue(int location, GLuint value); + void setUniformValue(int location, GLfloat x, GLfloat y); + void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z); + void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setUniformValue(int location, const QVector2D& value); + void setUniformValue(int location, const QVector3D& value); + void setUniformValue(int location, const QVector4D& value); + void setUniformValue(int location, const QColor& color); + void setUniformValue(int location, const QPoint& point); + void setUniformValue(int location, const QPointF& point); + void setUniformValue(int location, const QSize& size); + void setUniformValue(int location, const QSizeF& size); + void setUniformValue(int location, const QMatrix2x2& value); + void setUniformValue(int location, const QMatrix2x3& value); + void setUniformValue(int location, const QMatrix2x4& value); + void setUniformValue(int location, const QMatrix3x2& value); + void setUniformValue(int location, const QMatrix3x3& value); + void setUniformValue(int location, const QMatrix3x4& value); + void setUniformValue(int location, const QMatrix4x2& value); + void setUniformValue(int location, const QMatrix4x3& value); + void setUniformValue(int location, const QMatrix4x4& value); + void setUniformValue(int location, const GLfloat value[4][4]); + void setUniformValue(int location, const QTransform& value); + + void setUniformValue(const char *name, GLfloat value); + void setUniformValue(const char *name, GLint value); + void setUniformValue(const char *name, GLuint value); + void setUniformValue(const char *name, GLfloat x, GLfloat y); + void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z); + void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setUniformValue(const char *name, const QVector2D& value); + void setUniformValue(const char *name, const QVector3D& value); + void setUniformValue(const char *name, const QVector4D& value); + void setUniformValue(const char *name, const QColor& color); + void setUniformValue(const char *name, const QPoint& point); + void setUniformValue(const char *name, const QPointF& point); + void setUniformValue(const char *name, const QSize& size); + void setUniformValue(const char *name, const QSizeF& size); + void setUniformValue(const char *name, const QMatrix2x2& value); + void setUniformValue(const char *name, const QMatrix2x3& value); + void setUniformValue(const char *name, const QMatrix2x4& value); + void setUniformValue(const char *name, const QMatrix3x2& value); + void setUniformValue(const char *name, const QMatrix3x3& value); + void setUniformValue(const char *name, const QMatrix3x4& value); + void setUniformValue(const char *name, const QMatrix4x2& value); + void setUniformValue(const char *name, const QMatrix4x3& value); + void setUniformValue(const char *name, const QMatrix4x4& value); + void setUniformValue(const char *name, const GLfloat value[4][4]); + void setUniformValue(const char *name, const QTransform& value); + + void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize); + void setUniformValueArray(int location, const GLint *values, int count); + void setUniformValueArray(int location, const GLuint *values, int count); + void setUniformValueArray(int location, const QVector2D *values, int count); + void setUniformValueArray(int location, const QVector3D *values, int count); + void setUniformValueArray(int location, const QVector4D *values, int count); + void setUniformValueArray(int location, const QMatrix2x2 *values, int count); + void setUniformValueArray(int location, const QMatrix2x3 *values, int count); + void setUniformValueArray(int location, const QMatrix2x4 *values, int count); + void setUniformValueArray(int location, const QMatrix3x2 *values, int count); + void setUniformValueArray(int location, const QMatrix3x3 *values, int count); + void setUniformValueArray(int location, const QMatrix3x4 *values, int count); + void setUniformValueArray(int location, const QMatrix4x2 *values, int count); + void setUniformValueArray(int location, const QMatrix4x3 *values, int count); + void setUniformValueArray(int location, const QMatrix4x4 *values, int count); + + void setUniformValueArray(const char *name, const GLfloat *values, int count, int tupleSize); + void setUniformValueArray(const char *name, const GLint *values, int count); + void setUniformValueArray(const char *name, const GLuint *values, int count); + void setUniformValueArray(const char *name, const QVector2D *values, int count); + void setUniformValueArray(const char *name, const QVector3D *values, int count); + void setUniformValueArray(const char *name, const QVector4D *values, int count); + void setUniformValueArray(const char *name, const QMatrix2x2 *values, int count); + void setUniformValueArray(const char *name, const QMatrix2x3 *values, int count); + void setUniformValueArray(const char *name, const QMatrix2x4 *values, int count); + void setUniformValueArray(const char *name, const QMatrix3x2 *values, int count); + void setUniformValueArray(const char *name, const QMatrix3x3 *values, int count); + void setUniformValueArray(const char *name, const QMatrix3x4 *values, int count); + void setUniformValueArray(const char *name, const QMatrix4x2 *values, int count); + void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count); + void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count); + + static bool hasOpenGLShaderPrograms(const QGLContext *context = 0); + +private Q_SLOTS: + void shaderDestroyed(); + +private: + Q_DISABLE_COPY(QGLShaderProgram) + Q_DECLARE_PRIVATE(QGLShaderProgram) + + bool init(); +}; + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qgraphicsanchorlayout.h b/qtinterface/qt4/Qt/qgraphicsanchorlayout.h new file mode 100644 index 0000000..2ababc5 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsanchorlayout.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSANCHORLAYOUT_H +#define QGRAPHICSANCHORLAYOUT_H + +#include <QtGui/qgraphicsitem.h> +#include <QtGui/qgraphicslayout.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsAnchorPrivate; +class QGraphicsAnchorLayout; +class QGraphicsAnchorLayoutPrivate; + +class Q_GUI_EXPORT QGraphicsAnchor : public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET unsetSpacing) + Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy) +public: + void setSpacing(qreal spacing); + void unsetSpacing(); + qreal spacing() const; + void setSizePolicy(QSizePolicy::Policy policy); + QSizePolicy::Policy sizePolicy() const; + ~QGraphicsAnchor(); +private: + QGraphicsAnchor(QGraphicsAnchorLayout *parent); + + Q_DECLARE_PRIVATE(QGraphicsAnchor) + + friend class QGraphicsAnchorLayoutPrivate; + friend struct AnchorData; +}; + +class Q_GUI_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout +{ +public: + QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = 0); + virtual ~QGraphicsAnchorLayout(); + + QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge, + QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge); + QGraphicsAnchor *anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge, + QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge); + + void addCornerAnchors(QGraphicsLayoutItem *firstItem, Qt::Corner firstCorner, + QGraphicsLayoutItem *secondItem, Qt::Corner secondCorner); + + void addAnchors(QGraphicsLayoutItem *firstItem, + QGraphicsLayoutItem *secondItem, + Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical); + + void setHorizontalSpacing(qreal spacing); + void setVerticalSpacing(qreal spacing); + void setSpacing(qreal spacing); + qreal horizontalSpacing() const; + qreal verticalSpacing() const; + + void removeAt(int index); + void setGeometry(const QRectF &rect); + int count() const; + QGraphicsLayoutItem *itemAt(int index) const; + + void invalidate(); +protected: + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + +private: + Q_DISABLE_COPY(QGraphicsAnchorLayout) + Q_DECLARE_PRIVATE(QGraphicsAnchorLayout) + + friend class QGraphicsAnchor; +}; + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qgraphicseffect.h b/qtinterface/qt4/Qt/qgraphicseffect.h new file mode 100644 index 0000000..b52fe97 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicseffect.h @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSEFFECT_H +#define QGRAPHICSEFFECT_H + +#include <QtCore/qobject.h> +#include <QtCore/qpoint.h> +#include <QtCore/qrect.h> +#include <QtGui/qcolor.h> +#include <QtGui/qbrush.h> + +#ifndef QT_NO_GRAPHICSEFFECT +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGraphicsItem; +class QStyleOption; +class QPainter; +class QPixmap; + +class QGraphicsEffectSource; + +class QGraphicsEffectPrivate; +class Q_GUI_EXPORT QGraphicsEffect : public QObject +{ + Q_OBJECT + Q_FLAGS(ChangeFlags) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) +public: + enum ChangeFlag { + SourceAttached = 0x1, + SourceDetached = 0x2, + SourceBoundingRectChanged = 0x4, + SourceInvalidated = 0x8 + }; + Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) + + enum PixmapPadMode { + NoPad, + PadToTransparentBorder, + PadToEffectiveBoundingRect + }; + + QGraphicsEffect(QObject *parent = 0); + virtual ~QGraphicsEffect(); + + virtual QRectF boundingRectFor(const QRectF &sourceRect) const; + QRectF boundingRect() const; + + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool enable); + void update(); + +Q_SIGNALS: + void enabledChanged(bool enabled); + +protected: + QGraphicsEffect(QGraphicsEffectPrivate &d, QObject *parent = 0); + virtual void draw(QPainter *painter) = 0; + virtual void sourceChanged(ChangeFlags flags); + void updateBoundingRect(); + + bool sourceIsPixmap() const; + QRectF sourceBoundingRect(Qt::CoordinateSystem system = Qt::LogicalCoordinates) const; + void drawSource(QPainter *painter); + QPixmap sourcePixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, + QPoint *offset = 0, + PixmapPadMode mode = PadToEffectiveBoundingRect) const; + +private: + Q_DECLARE_PRIVATE(QGraphicsEffect) + Q_DISABLE_COPY(QGraphicsEffect) + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + friend class QGraphicsScenePrivate; + friend class QWidget; + friend class QWidgetPrivate; + +public: + QGraphicsEffectSource *source() const; // internal + +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags) + +class QGraphicsColorizeEffectPrivate; +class Q_GUI_EXPORT QGraphicsColorizeEffect: public QGraphicsEffect +{ + Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged) +public: + QGraphicsColorizeEffect(QObject *parent = 0); + ~QGraphicsColorizeEffect(); + + QColor color() const; + qreal strength() const; + +public Q_SLOTS: + void setColor(const QColor &c); + void setStrength(qreal strength); + +Q_SIGNALS: + void colorChanged(const QColor &color); + void strengthChanged(qreal strength); + +protected: + void draw(QPainter *painter); + +private: + Q_DECLARE_PRIVATE(QGraphicsColorizeEffect) + Q_DISABLE_COPY(QGraphicsColorizeEffect) +}; + +class QGraphicsBlurEffectPrivate; +class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect +{ + Q_OBJECT + Q_FLAGS(BlurHint BlurHints) + Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) + Q_PROPERTY(BlurHints blurHints READ blurHints WRITE setBlurHints NOTIFY blurHintsChanged) +public: + enum BlurHint { + PerformanceHint = 0x00, + QualityHint = 0x01, + AnimationHint = 0x02 + }; + Q_DECLARE_FLAGS(BlurHints, BlurHint) + + QGraphicsBlurEffect(QObject *parent = 0); + ~QGraphicsBlurEffect(); + + QRectF boundingRectFor(const QRectF &rect) const; + qreal blurRadius() const; + BlurHints blurHints() const; + +public Q_SLOTS: + void setBlurRadius(qreal blurRadius); + void setBlurHints(BlurHints hints); + +Q_SIGNALS: + void blurRadiusChanged(qreal blurRadius); + void blurHintsChanged(BlurHints hints); + +protected: + void draw(QPainter *painter); + +private: + Q_DECLARE_PRIVATE(QGraphicsBlurEffect) + Q_DISABLE_COPY(QGraphicsBlurEffect) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsBlurEffect::BlurHints) + +class QGraphicsDropShadowEffectPrivate; +class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect +{ + Q_OBJECT + Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) +public: + QGraphicsDropShadowEffect(QObject *parent = 0); + ~QGraphicsDropShadowEffect(); + + QRectF boundingRectFor(const QRectF &rect) const; + QPointF offset() const; + + inline qreal xOffset() const + { return offset().x(); } + + inline qreal yOffset() const + { return offset().y(); } + + qreal blurRadius() const; + QColor color() const; + +public Q_SLOTS: + void setOffset(const QPointF &ofs); + + inline void setOffset(qreal dx, qreal dy) + { setOffset(QPointF(dx, dy)); } + + inline void setOffset(qreal d) + { setOffset(QPointF(d, d)); } + + inline void setXOffset(qreal dx) + { setOffset(QPointF(dx, yOffset())); } + + inline void setYOffset(qreal dy) + { setOffset(QPointF(xOffset(), dy)); } + + void setBlurRadius(qreal blurRadius); + void setColor(const QColor &color); + +Q_SIGNALS: + void offsetChanged(const QPointF &offset); + void blurRadiusChanged(qreal blurRadius); + void colorChanged(const QColor &color); + +protected: + void draw(QPainter *painter); + +private: + Q_DECLARE_PRIVATE(QGraphicsDropShadowEffect) + Q_DISABLE_COPY(QGraphicsDropShadowEffect) +}; + +class QGraphicsOpacityEffectPrivate; +class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect +{ + Q_OBJECT + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(QBrush opacityMask READ opacityMask WRITE setOpacityMask NOTIFY opacityMaskChanged) +public: + QGraphicsOpacityEffect(QObject *parent = 0); + ~QGraphicsOpacityEffect(); + + qreal opacity() const; + QBrush opacityMask() const; + +public Q_SLOTS: + void setOpacity(qreal opacity); + void setOpacityMask(const QBrush &mask); + +Q_SIGNALS: + void opacityChanged(qreal opacity); + void opacityMaskChanged(const QBrush &mask); + +protected: + void draw(QPainter *painter); + +private: + Q_DECLARE_PRIVATE(QGraphicsOpacityEffect) + Q_DISABLE_COPY(QGraphicsOpacityEffect) +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif //QT_NO_GRAPHICSEFFECT + +#endif // QGRAPHICSEFFECT_H + diff --git a/qtinterface/qt4/Qt/qgraphicsgridlayout.h b/qtinterface/qt4/Qt/qgraphicsgridlayout.h new file mode 100644 index 0000000..2e599be --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsgridlayout.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSGRIDLAYOUT_H +#define QGRAPHICSGRIDLAYOUT_H + +#include <QtGui/qgraphicsitem.h> +#include <QtGui/qgraphicslayout.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsGridLayoutPrivate; + +class Q_GUI_EXPORT QGraphicsGridLayout : public QGraphicsLayout +{ +public: + QGraphicsGridLayout(QGraphicsLayoutItem *parent = 0); + virtual ~QGraphicsGridLayout(); + + void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, + Qt::Alignment alignment = 0); + inline void addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = 0); + + void setHorizontalSpacing(qreal spacing); + qreal horizontalSpacing() const; + void setVerticalSpacing(qreal spacing); + qreal verticalSpacing() const; + void setSpacing(qreal spacing); + + void setRowSpacing(int row, qreal spacing); + qreal rowSpacing(int row) const; + void setColumnSpacing(int column, qreal spacing); + qreal columnSpacing(int column) const; + + void setRowStretchFactor(int row, int stretch); + int rowStretchFactor(int row) const; + void setColumnStretchFactor(int column, int stretch); + int columnStretchFactor(int column) const; + + void setRowMinimumHeight(int row, qreal height); + qreal rowMinimumHeight(int row) const; + void setRowPreferredHeight(int row, qreal height); + qreal rowPreferredHeight(int row) const; + void setRowMaximumHeight(int row, qreal height); + qreal rowMaximumHeight(int row) const; + void setRowFixedHeight(int row, qreal height); + + void setColumnMinimumWidth(int column, qreal width); + qreal columnMinimumWidth(int column) const; + void setColumnPreferredWidth(int column, qreal width); + qreal columnPreferredWidth(int column) const; + void setColumnMaximumWidth(int column, qreal width); + qreal columnMaximumWidth(int column) const; + void setColumnFixedWidth(int column, qreal width); + + void setRowAlignment(int row, Qt::Alignment alignment); + Qt::Alignment rowAlignment(int row) const; + void setColumnAlignment(int column, Qt::Alignment alignment); + Qt::Alignment columnAlignment(int column) const; + + void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment); + Qt::Alignment alignment(QGraphicsLayoutItem *item) const; + + int rowCount() const; + int columnCount() const; + + QGraphicsLayoutItem *itemAt(int row, int column) const; + + // inherited from QGraphicsLayout + int count() const; + QGraphicsLayoutItem *itemAt(int index) const; + void removeAt(int index); + + void invalidate(); + + // inherited from QGraphicsLayoutItem + void setGeometry(const QRectF &rect); + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + + // #### + //QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const; + //QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; + +private: + Q_DISABLE_COPY(QGraphicsGridLayout) + Q_DECLARE_PRIVATE(QGraphicsGridLayout) +}; + +inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment) +{ addItem(aitem, arow, acolumn, 1, 1, aalignment); } + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qgraphicsitem.h b/qtinterface/qt4/Qt/qgraphicsitem.h new file mode 100644 index 0000000..617de4c --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsitem.h @@ -0,0 +1,1146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSITEM_H +#define QGRAPHICSITEM_H + +#include <QtCore/qglobal.h> +#include <QtCore/qobject.h> +#include <QtCore/qvariant.h> +#include <QtCore/qrect.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qpainterpath.h> +#include <QtGui/qpixmap.h> + +class tst_QGraphicsItem; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QBrush; +class QCursor; +class QFocusEvent; +class QGraphicsEffect; +class QGraphicsItemGroup; +class QGraphicsObject; +class QGraphicsSceneContextMenuEvent; +class QGraphicsSceneDragDropEvent; +class QGraphicsSceneEvent; +class QGraphicsSceneHoverEvent; +class QGraphicsSceneMouseEvent; +class QGraphicsSceneWheelEvent; +class QGraphicsScene; +class QGraphicsTransform; +class QGraphicsWidget; +class QInputMethodEvent; +class QKeyEvent; +class QMatrix; +class QMenu; +class QPainter; +class QPen; +class QPointF; +class QRectF; +class QStyleOptionGraphicsItem; + +class QGraphicsItemPrivate; +class Q_GUI_EXPORT QGraphicsItem +{ +public: + enum GraphicsItemFlag { + ItemIsMovable = 0x1, + ItemIsSelectable = 0x2, + ItemIsFocusable = 0x4, + ItemClipsToShape = 0x8, + ItemClipsChildrenToShape = 0x10, + ItemIgnoresTransformations = 0x20, + ItemIgnoresParentOpacity = 0x40, + ItemDoesntPropagateOpacityToChildren = 0x80, + ItemStacksBehindParent = 0x100, + ItemUsesExtendedStyleOption = 0x200, + ItemHasNoContents = 0x400, + ItemSendsGeometryChanges = 0x800, + ItemAcceptsInputMethod = 0x1000, + ItemNegativeZStacksBehindParent = 0x2000, + ItemIsPanel = 0x4000, + ItemIsFocusScope = 0x8000, // internal + ItemSendsScenePositionChanges = 0x10000 + // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. + }; + Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) + + enum GraphicsItemChange { + ItemPositionChange, + ItemMatrixChange, + ItemVisibleChange, + ItemEnabledChange, + ItemSelectedChange, + ItemParentChange, + ItemChildAddedChange, + ItemChildRemovedChange, + ItemTransformChange, + ItemPositionHasChanged, + ItemTransformHasChanged, + ItemSceneChange, + ItemVisibleHasChanged, + ItemEnabledHasChanged, + ItemSelectedHasChanged, + ItemParentHasChanged, + ItemSceneHasChanged, + ItemCursorChange, + ItemCursorHasChanged, + ItemToolTipChange, + ItemToolTipHasChanged, + ItemFlagsChange, + ItemFlagsHaveChanged, + ItemZValueChange, + ItemZValueHasChanged, + ItemOpacityChange, + ItemOpacityHasChanged, + ItemScenePositionHasChanged + }; + + enum CacheMode { + NoCache, + ItemCoordinateCache, + DeviceCoordinateCache + }; + + enum PanelModality + { + NonModal, + PanelModal, + SceneModal + }; + + QGraphicsItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + virtual ~QGraphicsItem(); + + QGraphicsScene *scene() const; + + QGraphicsItem *parentItem() const; + QGraphicsItem *topLevelItem() const; + QGraphicsObject *parentObject() const; + QGraphicsWidget *parentWidget() const; + QGraphicsWidget *topLevelWidget() const; + QGraphicsWidget *window() const; + QGraphicsItem *panel() const; + void setParentItem(QGraphicsItem *parent); + QList<QGraphicsItem *> children() const; // ### obsolete + QList<QGraphicsItem *> childItems() const; + bool isWidget() const; + bool isWindow() const; + bool isPanel() const; + + QGraphicsObject *toGraphicsObject(); + const QGraphicsObject *toGraphicsObject() const; + + QGraphicsItemGroup *group() const; + void setGroup(QGraphicsItemGroup *group); + + GraphicsItemFlags flags() const; + void setFlag(GraphicsItemFlag flag, bool enabled = true); + void setFlags(GraphicsItemFlags flags); + + CacheMode cacheMode() const; + void setCacheMode(CacheMode mode, const QSize &cacheSize = QSize()); + + PanelModality panelModality() const; + void setPanelModality(PanelModality panelModality); + bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = 0) const; + +#ifndef QT_NO_TOOLTIP + QString toolTip() const; + void setToolTip(const QString &toolTip); +#endif + +#ifndef QT_NO_CURSOR + QCursor cursor() const; + void setCursor(const QCursor &cursor); + bool hasCursor() const; + void unsetCursor(); +#endif + + bool isVisible() const; + bool isVisibleTo(const QGraphicsItem *parent) const; + void setVisible(bool visible); + inline void hide() { setVisible(false); } + inline void show() { setVisible(true); } + + bool isEnabled() const; + void setEnabled(bool enabled); + + bool isSelected() const; + void setSelected(bool selected); + + bool acceptDrops() const; + void setAcceptDrops(bool on); + + qreal opacity() const; + qreal effectiveOpacity() const; + void setOpacity(qreal opacity); + +#ifndef QT_NO_GRAPHICSEFFECT + // Effect + QGraphicsEffect *graphicsEffect() const; + void setGraphicsEffect(QGraphicsEffect *effect); +#endif //QT_NO_GRAPHICSEFFECT + + Qt::MouseButtons acceptedMouseButtons() const; + void setAcceptedMouseButtons(Qt::MouseButtons buttons); + + bool acceptsHoverEvents() const; // ### obsolete + void setAcceptsHoverEvents(bool enabled); // ### obsolete + bool acceptHoverEvents() const; + void setAcceptHoverEvents(bool enabled); + bool acceptTouchEvents() const; + void setAcceptTouchEvents(bool enabled); + + bool filtersChildEvents() const; + void setFiltersChildEvents(bool enabled); + + bool handlesChildEvents() const; + void setHandlesChildEvents(bool enabled); + + bool isActive() const; + void setActive(bool active); + + bool hasFocus() const; + void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); + void clearFocus(); + + QGraphicsItem *focusProxy() const; + void setFocusProxy(QGraphicsItem *item); + + QGraphicsItem *focusItem() const; + QGraphicsItem *focusScopeItem() const; + + void grabMouse(); + void ungrabMouse(); + void grabKeyboard(); + void ungrabKeyboard(); + + // Positioning in scene coordinates + QPointF pos() const; + inline qreal x() const { return pos().x(); } + void setX(qreal x); + inline qreal y() const { return pos().y(); } + void setY(qreal y); + QPointF scenePos() const; + void setPos(const QPointF &pos); + inline void setPos(qreal x, qreal y); + inline void moveBy(qreal dx, qreal dy) { setPos(pos().x() + dx, pos().y() + dy); } + + void ensureVisible(const QRectF &rect = QRectF(), int xmargin = 50, int ymargin = 50); + inline void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50); + + // Local transformation + QMatrix matrix() const; + QMatrix sceneMatrix() const; + void setMatrix(const QMatrix &matrix, bool combine = false); + void resetMatrix(); + QTransform transform() const; + QTransform sceneTransform() const; + QTransform deviceTransform(const QTransform &viewportTransform) const; + QTransform itemTransform(const QGraphicsItem *other, bool *ok = 0) const; + void setTransform(const QTransform &matrix, bool combine = false); + void resetTransform(); + + void rotate(qreal angle); // ### obsolete + void scale(qreal sx, qreal sy); // ### obsolete + void shear(qreal sh, qreal sv); // ### obsolete + void translate(qreal dx, qreal dy); // ### obsolete + + void setRotation(qreal angle); + qreal rotation() const; + + void setScale(qreal scale); + qreal scale() const; + + QList<QGraphicsTransform *> transformations() const; + void setTransformations(const QList<QGraphicsTransform *> &transformations); + + QPointF transformOriginPoint() const; + void setTransformOriginPoint(const QPointF &origin); + inline void setTransformOriginPoint(qreal ax, qreal ay) + { setTransformOriginPoint(QPointF(ax,ay)); } + + virtual void advance(int phase); + + // Stacking order + qreal zValue() const; + void setZValue(qreal z); + void stackBefore(const QGraphicsItem *sibling); + + // Hit test + virtual QRectF boundingRect() const = 0; + QRectF childrenBoundingRect() const; + QRectF sceneBoundingRect() const; + virtual QPainterPath shape() const; + bool isClipped() const; + QPainterPath clipPath() const; + virtual bool contains(const QPointF &point) const; + virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + bool isObscured() const; + bool isObscured(const QRectF &rect) const; // ### Qt 5: merge with isObscured(), add QRectF arg to isObscuredBy() + inline bool isObscured(qreal x, qreal y, qreal w, qreal h) const; + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + + QRegion boundingRegion(const QTransform &itemToDeviceTransform) const; + qreal boundingRegionGranularity() const; + void setBoundingRegionGranularity(qreal granularity); + + // Drawing + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0; + void update(const QRectF &rect = QRectF()); + inline void update(qreal x, qreal y, qreal width, qreal height); + void scroll(qreal dx, qreal dy, const QRectF &rect = QRectF()); + + // Coordinate mapping + QPointF mapToItem(const QGraphicsItem *item, const QPointF &point) const; + QPointF mapToParent(const QPointF &point) const; + QPointF mapToScene(const QPointF &point) const; + QPolygonF mapToItem(const QGraphicsItem *item, const QRectF &rect) const; + QPolygonF mapToParent(const QRectF &rect) const; + QPolygonF mapToScene(const QRectF &rect) const; + QRectF mapRectToItem(const QGraphicsItem *item, const QRectF &rect) const; + QRectF mapRectToParent(const QRectF &rect) const; + QRectF mapRectToScene(const QRectF &rect) const; + QPolygonF mapToItem(const QGraphicsItem *item, const QPolygonF &polygon) const; + QPolygonF mapToParent(const QPolygonF &polygon) const; + QPolygonF mapToScene(const QPolygonF &polygon) const; + QPainterPath mapToItem(const QGraphicsItem *item, const QPainterPath &path) const; + QPainterPath mapToParent(const QPainterPath &path) const; + QPainterPath mapToScene(const QPainterPath &path) const; + QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const; + QPointF mapFromParent(const QPointF &point) const; + QPointF mapFromScene(const QPointF &point) const; + QPolygonF mapFromItem(const QGraphicsItem *item, const QRectF &rect) const; + QPolygonF mapFromParent(const QRectF &rect) const; + QPolygonF mapFromScene(const QRectF &rect) const; + QRectF mapRectFromItem(const QGraphicsItem *item, const QRectF &rect) const; + QRectF mapRectFromParent(const QRectF &rect) const; + QRectF mapRectFromScene(const QRectF &rect) const; + QPolygonF mapFromItem(const QGraphicsItem *item, const QPolygonF &polygon) const; + QPolygonF mapFromParent(const QPolygonF &polygon) const; + QPolygonF mapFromScene(const QPolygonF &polygon) const; + QPainterPath mapFromItem(const QGraphicsItem *item, const QPainterPath &path) const; + QPainterPath mapFromParent(const QPainterPath &path) const; + QPainterPath mapFromScene(const QPainterPath &path) const; + + inline QPointF mapToItem(const QGraphicsItem *item, qreal x, qreal y) const; + inline QPointF mapToParent(qreal x, qreal y) const; + inline QPointF mapToScene(qreal x, qreal y) const; + inline QPolygonF mapToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; + inline QPolygonF mapToParent(qreal x, qreal y, qreal w, qreal h) const; + inline QPolygonF mapToScene(qreal x, qreal y, qreal w, qreal h) const; + inline QRectF mapRectToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; + inline QRectF mapRectToParent(qreal x, qreal y, qreal w, qreal h) const; + inline QRectF mapRectToScene(qreal x, qreal y, qreal w, qreal h) const; + inline QPointF mapFromItem(const QGraphicsItem *item, qreal x, qreal y) const; + inline QPointF mapFromParent(qreal x, qreal y) const; + inline QPointF mapFromScene(qreal x, qreal y) const; + inline QPolygonF mapFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; + inline QPolygonF mapFromParent(qreal x, qreal y, qreal w, qreal h) const; + inline QPolygonF mapFromScene(qreal x, qreal y, qreal w, qreal h) const; + inline QRectF mapRectFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; + inline QRectF mapRectFromParent(qreal x, qreal y, qreal w, qreal h) const; + inline QRectF mapRectFromScene(qreal x, qreal y, qreal w, qreal h) const; + + bool isAncestorOf(const QGraphicsItem *child) const; + QGraphicsItem *commonAncestorItem(const QGraphicsItem *other) const; + bool isUnderMouse() const; + + // Custom data + QVariant data(int key) const; + void setData(int key, const QVariant &value); + + Qt::InputMethodHints inputMethodHints() const; + void setInputMethodHints(Qt::InputMethodHints hints); + + enum { + Type = 1, + UserType = 65536 + }; + virtual int type() const; + + void installSceneEventFilter(QGraphicsItem *filterItem); + void removeSceneEventFilter(QGraphicsItem *filterItem); + +protected: + virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); + virtual bool sceneEvent(QEvent *event); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); + + enum Extension { + UserExtension = 0x80000000 + }; + virtual bool supportsExtension(Extension extension) const; + virtual void setExtension(Extension extension, const QVariant &variant); + virtual QVariant extension(const QVariant &variant) const; + +protected: + QGraphicsItem(QGraphicsItemPrivate &dd, + QGraphicsItem *parent, QGraphicsScene *scene); + QScopedPointer<QGraphicsItemPrivate> d_ptr; + + void addToIndex(); + void removeFromIndex(); + void prepareGeometryChange(); + +private: + Q_DISABLE_COPY(QGraphicsItem) + Q_DECLARE_PRIVATE(QGraphicsItem) + friend class QGraphicsItemGroup; + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; + friend class QGraphicsSceneFindItemBspTreeVisitor; + friend class QGraphicsSceneBspTree; + friend class QGraphicsView; + friend class QGraphicsViewPrivate; + friend class QGraphicsObject; + friend class QGraphicsWidget; + friend class QGraphicsWidgetPrivate; + friend class QGraphicsProxyWidgetPrivate; + friend class QGraphicsSceneIndex; + friend class QGraphicsSceneIndexPrivate; + friend class QGraphicsSceneBspTreeIndex; + friend class QGraphicsSceneBspTreeIndexPrivate; + friend class QGraphicsItemEffectSourcePrivate; + friend class QGraphicsTransformPrivate; + friend class QGestureManager; + friend class ::tst_QGraphicsItem; + friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); + friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsItem::GraphicsItemFlags) +Q_DECLARE_INTERFACE(QGraphicsItem, "com.trolltech.Qt.QGraphicsItem") + +inline void QGraphicsItem::setPos(qreal ax, qreal ay) +{ setPos(QPointF(ax, ay)); } +inline void QGraphicsItem::ensureVisible(qreal ax, qreal ay, qreal w, qreal h, int xmargin, int ymargin) +{ ensureVisible(QRectF(ax, ay, w, h), xmargin, ymargin); } +inline void QGraphicsItem::update(qreal ax, qreal ay, qreal width, qreal height) +{ update(QRectF(ax, ay, width, height)); } +inline bool QGraphicsItem::isObscured(qreal ax, qreal ay, qreal w, qreal h) const +{ return isObscured(QRectF(ax, ay, w, h)); } +inline QPointF QGraphicsItem::mapToItem(const QGraphicsItem *item, qreal ax, qreal ay) const +{ return mapToItem(item, QPointF(ax, ay)); } +inline QPointF QGraphicsItem::mapToParent(qreal ax, qreal ay) const +{ return mapToParent(QPointF(ax, ay)); } +inline QPointF QGraphicsItem::mapToScene(qreal ax, qreal ay) const +{ return mapToScene(QPointF(ax, ay)); } +inline QPointF QGraphicsItem::mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay) const +{ return mapFromItem(item, QPointF(ax, ay)); } +inline QPointF QGraphicsItem::mapFromParent(qreal ax, qreal ay) const +{ return mapFromParent(QPointF(ax, ay)); } +inline QPointF QGraphicsItem::mapFromScene(qreal ax, qreal ay) const +{ return mapFromScene(QPointF(ax, ay)); } +inline QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const +{ return mapToItem(item, QRectF(ax, ay, w, h)); } +inline QPolygonF QGraphicsItem::mapToParent(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapToParent(QRectF(ax, ay, w, h)); } +inline QPolygonF QGraphicsItem::mapToScene(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapToScene(QRectF(ax, ay, w, h)); } +inline QRectF QGraphicsItem::mapRectToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const +{ return mapRectToItem(item, QRectF(ax, ay, w, h)); } +inline QRectF QGraphicsItem::mapRectToParent(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapRectToParent(QRectF(ax, ay, w, h)); } +inline QRectF QGraphicsItem::mapRectToScene(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapRectToScene(QRectF(ax, ay, w, h)); } +inline QPolygonF QGraphicsItem::mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const +{ return mapFromItem(item, QRectF(ax, ay, w, h)); } +inline QPolygonF QGraphicsItem::mapFromParent(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapFromParent(QRectF(ax, ay, w, h)); } +inline QPolygonF QGraphicsItem::mapFromScene(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapFromScene(QRectF(ax, ay, w, h)); } +inline QRectF QGraphicsItem::mapRectFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const +{ return mapRectFromItem(item, QRectF(ax, ay, w, h)); } +inline QRectF QGraphicsItem::mapRectFromParent(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapRectFromParent(QRectF(ax, ay, w, h)); } +inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapRectFromScene(QRectF(ax, ay, w, h)); } + + +class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem +{ + Q_OBJECT + Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) + Q_PROPERTY(QPointF pos READ pos WRITE setPos) + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) + Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) + Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged) + Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) + Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) + Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) + Q_INTERFACES(QGraphicsItem) +public: + QGraphicsObject(QGraphicsItem *parent = 0); + + // ### Qt 5: Disambiguate +#ifdef Q_NO_USING_KEYWORD + const QObjectList &children() const { return QObject::children(); } +#else + using QObject::children; +#endif + + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); + void ungrabGesture(Qt::GestureType type); + +Q_SIGNALS: + void parentChanged(); + void opacityChanged(); + void visibleChanged(); + void enabledChanged(); + void xChanged(); + void yChanged(); + void zChanged(); + void rotationChanged(); + void scaleChanged(); + +protected: + QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); +private: + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; +}; + + +class QAbstractGraphicsShapeItemPrivate; +class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem +{ +public: + QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QAbstractGraphicsShapeItem(); + + QPen pen() const; + void setPen(const QPen &pen); + + QBrush brush() const; + void setBrush(const QBrush &brush); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + +protected: + QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd, + QGraphicsItem *parent, QGraphicsScene *scene); + +private: + Q_DISABLE_COPY(QAbstractGraphicsShapeItem) + Q_DECLARE_PRIVATE(QAbstractGraphicsShapeItem) +}; + +class QGraphicsPathItemPrivate; +class Q_GUI_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem +{ +public: + QGraphicsPathItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsPathItem(); + + QPainterPath path() const; + void setPath(const QPainterPath &path); + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 2 }; + int type() const; + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsPathItem) + Q_DECLARE_PRIVATE(QGraphicsPathItem) +}; + +class QGraphicsRectItemPrivate; +class Q_GUI_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem +{ +public: + QGraphicsRectItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsRectItem(); + + QRectF rect() const; + void setRect(const QRectF &rect); + inline void setRect(qreal x, qreal y, qreal w, qreal h); + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 3 }; + int type() const; + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsRectItem) + Q_DECLARE_PRIVATE(QGraphicsRectItem) +}; + +inline void QGraphicsRectItem::setRect(qreal ax, qreal ay, qreal w, qreal h) +{ setRect(QRectF(ax, ay, w, h)); } + +class QGraphicsEllipseItemPrivate; +class Q_GUI_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem +{ +public: + QGraphicsEllipseItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsEllipseItem(); + + QRectF rect() const; + void setRect(const QRectF &rect); + inline void setRect(qreal x, qreal y, qreal w, qreal h); + + int startAngle() const; + void setStartAngle(int angle); + + int spanAngle() const; + void setSpanAngle(int angle); + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 4 }; + int type() const; + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsEllipseItem) + Q_DECLARE_PRIVATE(QGraphicsEllipseItem) +}; + +inline void QGraphicsEllipseItem::setRect(qreal ax, qreal ay, qreal w, qreal h) +{ setRect(QRectF(ax, ay, w, h)); } + +class QGraphicsPolygonItemPrivate; +class Q_GUI_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem +{ +public: + QGraphicsPolygonItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsPolygonItem(const QPolygonF &polygon, + QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsPolygonItem(); + + QPolygonF polygon() const; + void setPolygon(const QPolygonF &polygon); + + Qt::FillRule fillRule() const; + void setFillRule(Qt::FillRule rule); + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 5 }; + int type() const; + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsPolygonItem) + Q_DECLARE_PRIVATE(QGraphicsPolygonItem) +}; + +class QGraphicsLineItemPrivate; +class Q_GUI_EXPORT QGraphicsLineItem : public QGraphicsItem +{ +public: + QGraphicsLineItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsLineItem(); + + QPen pen() const; + void setPen(const QPen &pen); + + QLineF line() const; + void setLine(const QLineF &line); + inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2) + { setLine(QLineF(x1, y1, x2, y2)); } + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 6 }; + int type() const; + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsLineItem) + Q_DECLARE_PRIVATE(QGraphicsLineItem) +}; + +class QGraphicsPixmapItemPrivate; +class Q_GUI_EXPORT QGraphicsPixmapItem : public QGraphicsItem +{ +public: + enum ShapeMode { + MaskShape, + BoundingRectShape, + HeuristicMaskShape + }; + + QGraphicsPixmapItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsPixmapItem(); + + QPixmap pixmap() const; + void setPixmap(const QPixmap &pixmap); + + Qt::TransformationMode transformationMode() const; + void setTransformationMode(Qt::TransformationMode mode); + + QPointF offset() const; + void setOffset(const QPointF &offset); + inline void setOffset(qreal x, qreal y); + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 7 }; + int type() const; + + ShapeMode shapeMode() const; + void setShapeMode(ShapeMode mode); + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsPixmapItem) + Q_DECLARE_PRIVATE(QGraphicsPixmapItem) +}; + +inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) +{ setOffset(QPointF(ax, ay)); } + +class QGraphicsTextItemPrivate; +class QTextDocument; +class QTextCursor; +class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject +{ + Q_OBJECT + QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) + QDOC_PROPERTY(QTextCursor textCursor READ textCursor WRITE setTextCursor) + +public: + QGraphicsTextItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsTextItem(); + + QString toHtml() const; + void setHtml(const QString &html); + + QString toPlainText() const; + void setPlainText(const QString &text); + + QFont font() const; + void setFont(const QFont &font); + + void setDefaultTextColor(const QColor &c); + QColor defaultTextColor() const; + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 8 }; + int type() const; + + void setTextWidth(qreal width); + qreal textWidth() const; + + void adjustSize(); + + void setDocument(QTextDocument *document); + QTextDocument *document() const; + + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + + void setTabChangesFocus(bool b); + bool tabChangesFocus() const; + + void setOpenExternalLinks(bool open); + bool openExternalLinks() const; + + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + +Q_SIGNALS: + void linkActivated(const QString &); + void linkHovered(const QString &); + +protected: + bool sceneEvent(QEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); + void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + void dropEvent(QGraphicsSceneDragDropEvent *event); + void inputMethodEvent(QInputMethodEvent *event); + void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsTextItem) + Q_PRIVATE_SLOT(dd, void _q_updateBoundingRect(const QSizeF &)) + Q_PRIVATE_SLOT(dd, void _q_update(QRectF)) + Q_PRIVATE_SLOT(dd, void _q_ensureVisible(QRectF)) + QGraphicsTextItemPrivate *dd; + friend class QGraphicsTextItemPrivate; +}; + +class QGraphicsSimpleTextItemPrivate; +class Q_GUI_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem +{ +public: + QGraphicsSimpleTextItem(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsSimpleTextItem(); + + void setText(const QString &text); + QString text() const; + + void setFont(const QFont &font); + QFont font() const; + + QRectF boundingRect() const; + QPainterPath shape() const; + bool contains(const QPointF &point) const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 9 }; + int type() const; + +protected: + bool supportsExtension(Extension extension) const; + void setExtension(Extension extension, const QVariant &variant); + QVariant extension(const QVariant &variant) const; + +private: + Q_DISABLE_COPY(QGraphicsSimpleTextItem) + Q_DECLARE_PRIVATE(QGraphicsSimpleTextItem) +}; + +class QGraphicsItemGroupPrivate; +class Q_GUI_EXPORT QGraphicsItemGroup : public QGraphicsItem +{ +public: + QGraphicsItemGroup(QGraphicsItem *parent = 0 +#ifndef Q_QDOC + // ### obsolete argument + , QGraphicsScene *scene = 0 +#endif + ); + ~QGraphicsItemGroup(); + + void addToGroup(QGraphicsItem *item); + void removeFromGroup(QGraphicsItem *item); + + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + + bool isObscuredBy(const QGraphicsItem *item) const; + QPainterPath opaqueArea() const; + + enum { Type = 10 }; + int type() const; + +private: + Q_DISABLE_COPY(QGraphicsItemGroup) + Q_DECLARE_PRIVATE(QGraphicsItemGroup) +}; + +template <class T> inline T qgraphicsitem_cast(QGraphicsItem *item) +{ + return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type) + || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0; +} + +template <class T> inline T qgraphicsitem_cast(const QGraphicsItem *item) +{ + return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type) + || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags); +#endif + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QGraphicsItem *) +Q_DECLARE_METATYPE(QGraphicsScene *) + +QT_BEGIN_NAMESPACE + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSITEM_H diff --git a/qtinterface/qt4/Qt/qgraphicsitemanimation.h b/qtinterface/qt4/Qt/qgraphicsitemanimation.h new file mode 100644 index 0000000..6eede9e --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsitemanimation.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSITEMANIMATION_H +#define QGRAPHICSITEMANIMATION_H + +#include <QtCore/qobject.h> + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGraphicsItem; +class QMatrix; +class QPointF; +class QTimeLine; +template <class T1, class T2> struct QPair; + +class QGraphicsItemAnimationPrivate; +class Q_GUI_EXPORT QGraphicsItemAnimation : public QObject +{ + Q_OBJECT +public: + QGraphicsItemAnimation(QObject *parent = 0); + virtual ~QGraphicsItemAnimation(); + + QGraphicsItem *item() const; + void setItem(QGraphicsItem *item); + + QTimeLine *timeLine() const; + void setTimeLine(QTimeLine *timeLine); + + QPointF posAt(qreal step) const; + QList<QPair<qreal, QPointF> > posList() const; + void setPosAt(qreal step, const QPointF &pos); + + QMatrix matrixAt(qreal step) const; + + qreal rotationAt(qreal step) const; + QList<QPair<qreal, qreal> > rotationList() const; + void setRotationAt(qreal step, qreal angle); + + qreal xTranslationAt(qreal step) const; + qreal yTranslationAt(qreal step) const; + QList<QPair<qreal, QPointF> > translationList() const; + void setTranslationAt(qreal step, qreal dx, qreal dy); + + qreal verticalScaleAt(qreal step) const; + qreal horizontalScaleAt(qreal step) const; + QList<QPair<qreal, QPointF> > scaleList() const; + void setScaleAt(qreal step, qreal sx, qreal sy); + + qreal verticalShearAt(qreal step) const; + qreal horizontalShearAt(qreal step) const; + QList<QPair<qreal, QPointF> > shearList() const; + void setShearAt(qreal step, qreal sh, qreal sv); + + void clear(); + +public Q_SLOTS: + void setStep(qreal x); + void reset(); + +protected: + virtual void beforeAnimationStep(qreal step); + virtual void afterAnimationStep(qreal step); + +private: + Q_DISABLE_COPY(QGraphicsItemAnimation) + QGraphicsItemAnimationPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_GRAPHICSVIEW +#endif diff --git a/qtinterface/qt4/Qt/qgraphicslayout.h b/qtinterface/qt4/Qt/qgraphicslayout.h new file mode 100644 index 0000000..f85a2d9 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicslayout.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSLAYOUT_H +#define QGRAPHICSLAYOUT_H + +#include <QtGui/qgraphicslayoutitem.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsLayoutPrivate; +class QGraphicsLayoutItem; +class QGraphicsWidget; + +class Q_GUI_EXPORT QGraphicsLayout : public QGraphicsLayoutItem +{ +public: + QGraphicsLayout(QGraphicsLayoutItem *parent = 0); + ~QGraphicsLayout(); + + void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom); + void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + + void activate(); + bool isActivated() const; + virtual void invalidate(); + virtual void updateGeometry(); + + virtual void widgetEvent(QEvent *e); + + virtual int count() const = 0; + virtual QGraphicsLayoutItem *itemAt(int i) const = 0; + virtual void removeAt(int index) = 0; + +protected: + QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *); + void addChildLayoutItem(QGraphicsLayoutItem *layoutItem); + +private: + Q_DISABLE_COPY(QGraphicsLayout) + Q_DECLARE_PRIVATE(QGraphicsLayout) + friend class QGraphicsWidget; +}; + +Q_DECLARE_INTERFACE(QGraphicsLayout, "com.trolltech.Qt.QGraphicsLayout") + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qgraphicslayoutitem.h b/qtinterface/qt4/Qt/qgraphicslayoutitem.h new file mode 100644 index 0000000..5150d7d --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicslayoutitem.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSLAYOUTITEM_H +#define QGRAPHICSLAYOUTITEM_H + +#include <QtCore/qscopedpointer.h> +#include <QtGui/qsizepolicy.h> +#include <QtGui/qevent.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsLayoutItemPrivate; +class QGraphicsItem; +class Q_GUI_EXPORT QGraphicsLayoutItem +{ +public: + QGraphicsLayoutItem(QGraphicsLayoutItem *parent = 0, bool isLayout = false); + virtual ~QGraphicsLayoutItem(); + + void setSizePolicy(const QSizePolicy &policy); + void setSizePolicy(QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy, QSizePolicy::ControlType controlType = QSizePolicy::DefaultType); + QSizePolicy sizePolicy() const; + + void setMinimumSize(const QSizeF &size); + inline void setMinimumSize(qreal w, qreal h); + QSizeF minimumSize() const; + void setMinimumWidth(qreal width); + inline qreal minimumWidth() const; + void setMinimumHeight(qreal height); + inline qreal minimumHeight() const; + + void setPreferredSize(const QSizeF &size); + inline void setPreferredSize(qreal w, qreal h); + QSizeF preferredSize() const; + void setPreferredWidth(qreal width); + inline qreal preferredWidth() const; + void setPreferredHeight(qreal height); + inline qreal preferredHeight() const; + + void setMaximumSize(const QSizeF &size); + inline void setMaximumSize(qreal w, qreal h); + QSizeF maximumSize() const; + void setMaximumWidth(qreal width); + inline qreal maximumWidth() const; + void setMaximumHeight(qreal height); + inline qreal maximumHeight() const; + + virtual void setGeometry(const QRectF &rect); + QRectF geometry() const; + virtual void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + QRectF contentsRect() const; + + QSizeF effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + + virtual void updateGeometry(); //### rename to sizeHintChanged() + + QGraphicsLayoutItem *parentLayoutItem() const; + void setParentLayoutItem(QGraphicsLayoutItem *parent); + + bool isLayout() const; + // ###Qt5: Make automatic reparenting work regardless of item/object/widget type. + QGraphicsItem *graphicsItem() const; + bool ownedByLayout() const; + +protected: + void setGraphicsItem(QGraphicsItem *item); + void setOwnedByLayout(bool ownedByLayout); + QGraphicsLayoutItem(QGraphicsLayoutItemPrivate &dd); + + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const = 0; + QScopedPointer<QGraphicsLayoutItemPrivate> d_ptr; + +private: + QSizeF *effectiveSizeHints(const QSizeF &constraint) const; + Q_DECLARE_PRIVATE(QGraphicsLayoutItem) + + friend class QGraphicsLayout; +}; + +Q_DECLARE_INTERFACE(QGraphicsLayoutItem, "com.trolltech.Qt.QGraphicsLayoutItem") + +inline void QGraphicsLayoutItem::setMinimumSize(qreal aw, qreal ah) +{ setMinimumSize(QSizeF(aw, ah)); } +inline void QGraphicsLayoutItem::setPreferredSize(qreal aw, qreal ah) +{ setPreferredSize(QSizeF(aw, ah)); } +inline void QGraphicsLayoutItem::setMaximumSize(qreal aw, qreal ah) +{ setMaximumSize(QSizeF(aw, ah)); } + +inline qreal QGraphicsLayoutItem::minimumWidth() const +{ return effectiveSizeHint(Qt::MinimumSize).width(); } +inline qreal QGraphicsLayoutItem::minimumHeight() const +{ return effectiveSizeHint(Qt::MinimumSize).height(); } + +inline qreal QGraphicsLayoutItem::preferredWidth() const +{ return effectiveSizeHint(Qt::PreferredSize).width(); } +inline qreal QGraphicsLayoutItem::preferredHeight() const +{ return effectiveSizeHint(Qt::PreferredSize).height(); } + +inline qreal QGraphicsLayoutItem::maximumWidth() const +{ return effectiveSizeHint(Qt::MaximumSize).width(); } +inline qreal QGraphicsLayoutItem::maximumHeight() const +{ return effectiveSizeHint(Qt::MaximumSize).height(); } + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qgraphicslinearlayout.h b/qtinterface/qt4/Qt/qgraphicslinearlayout.h new file mode 100644 index 0000000..b6b08e3 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicslinearlayout.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSLINEARLAYOUT_H +#define QGRAPHICSLINEARLAYOUT_H + +#include <QtGui/qgraphicsitem.h> +#include <QtGui/qgraphicslayout.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsLinearLayoutPrivate; + +class Q_GUI_EXPORT QGraphicsLinearLayout : public QGraphicsLayout +{ +public: + QGraphicsLinearLayout(QGraphicsLayoutItem *parent = 0); + QGraphicsLinearLayout(Qt::Orientation orientation, QGraphicsLayoutItem *parent = 0); + virtual ~QGraphicsLinearLayout(); + + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + + inline void addItem(QGraphicsLayoutItem *item) { insertItem(-1, item); } + inline void addStretch(int stretch = 1) { insertStretch(-1, stretch); } + + void insertItem(int index, QGraphicsLayoutItem *item); + void insertStretch(int index, int stretch = 1); + + void removeItem(QGraphicsLayoutItem *item); + void removeAt(int index); + + void setSpacing(qreal spacing); + qreal spacing() const; + void setItemSpacing(int index, qreal spacing); + qreal itemSpacing(int index) const; + + void setStretchFactor(QGraphicsLayoutItem *item, int stretch); + int stretchFactor(QGraphicsLayoutItem *item) const; + + void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment); + Qt::Alignment alignment(QGraphicsLayoutItem *item) const; + + void setGeometry(const QRectF &rect); + + int count() const; + QGraphicsLayoutItem *itemAt(int index) const; + + void invalidate(); + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + +#if 0 // ### + Q5SizePolicy::ControlTypes controlTypes(LayoutSide side) const; +#endif + + void dump(int indent = 0) const; + +protected: +#if 0 + QSize contentsSizeHint(Qt::SizeHint which, const QSize &constraint = QSize()) const; +#endif + +private: + Q_DISABLE_COPY(QGraphicsLinearLayout) + Q_DECLARE_PRIVATE(QGraphicsLinearLayout) +}; + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qgraphicsproxywidget.h b/qtinterface/qt4/Qt/qgraphicsproxywidget.h new file mode 100644 index 0000000..176996a --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsproxywidget.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSPROXYWIDGET_H +#define QGRAPHICSPROXYWIDGET_H + +#include <QtGui/qgraphicswidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsProxyWidgetPrivate; + +class Q_GUI_EXPORT QGraphicsProxyWidget : public QGraphicsWidget +{ + Q_OBJECT +public: + QGraphicsProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); + ~QGraphicsProxyWidget(); + + void setWidget(QWidget *widget); + QWidget *widget() const; + + QRectF subWidgetRect(const QWidget *widget) const; + + void setGeometry(const QRectF &rect); + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + enum { + Type = 12 + }; + int type() const; + + QGraphicsProxyWidget *createProxyForChildWidget(QWidget *child); + +protected: + QVariant itemChange(GraphicsItemChange change, const QVariant &value); + + bool event(QEvent *event); + bool eventFilter(QObject *object, QEvent *event); + + void showEvent(QShowEvent *event); + void hideEvent(QHideEvent *event); + +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); +#endif + +#ifndef QT_NO_DRAGANDDROP + void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + void dropEvent(QGraphicsSceneDragDropEvent *event); +#endif + + void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + void grabMouseEvent(QEvent *event); + void ungrabMouseEvent(QEvent *event); + + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QGraphicsSceneWheelEvent *event); +#endif + + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + + void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); + bool focusNextPrevChild(bool next); + // ### Qt 4.5: + // QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + // void inputMethodEvent(QInputMethodEvent *event); + + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + void resizeEvent(QGraphicsSceneResizeEvent *event); + +protected Q_SLOTS: + QGraphicsProxyWidget *newProxyWidget(const QWidget *); + +private: + Q_DISABLE_COPY(QGraphicsProxyWidget) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsProxyWidget) + Q_PRIVATE_SLOT(d_func(), void _q_removeWidgetSlot()) + + friend class QWidget; + friend class QWidgetPrivate; + friend class QGraphicsItem; +}; + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qgraphicsscene.h b/qtinterface/qt4/Qt/qgraphicsscene.h new file mode 100644 index 0000000..950b7cb --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsscene.h @@ -0,0 +1,326 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENE_H +#define QGRAPHICSSCENE_H + +#include <QtCore/qobject.h> +#include <QtCore/qpoint.h> +#include <QtCore/qrect.h> +#include <QtGui/qbrush.h> +#include <QtGui/qfont.h> +#include <QtGui/qtransform.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qpen.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +template<typename T> class QList; +class QFocusEvent; +class QFont; +class QFontMetrics; +class QGraphicsEllipseItem; +class QGraphicsItem; +class QGraphicsItemGroup; +class QGraphicsLineItem; +class QGraphicsPathItem; +class QGraphicsPixmapItem; +class QGraphicsPolygonItem; +class QGraphicsProxyWidget; +class QGraphicsRectItem; +class QGraphicsSceneContextMenuEvent; +class QGraphicsSceneDragDropEvent; +class QGraphicsSceneEvent; +class QGraphicsSceneHelpEvent; +class QGraphicsSceneHoverEvent; +class QGraphicsSceneMouseEvent; +class QGraphicsSceneWheelEvent; +class QGraphicsSimpleTextItem; +class QGraphicsTextItem; +class QGraphicsView; +class QGraphicsWidget; +class QGraphicsSceneIndex; +class QHelpEvent; +class QInputMethodEvent; +class QKeyEvent; +class QLineF; +class QPainterPath; +class QPixmap; +class QPointF; +class QPolygonF; +class QRectF; +class QSizeF; +class QStyle; +class QStyleOptionGraphicsItem; + +class QGraphicsScenePrivate; +class Q_GUI_EXPORT QGraphicsScene : public QObject +{ + Q_OBJECT + Q_PROPERTY(QBrush backgroundBrush READ backgroundBrush WRITE setBackgroundBrush) + Q_PROPERTY(QBrush foregroundBrush READ foregroundBrush WRITE setForegroundBrush) + Q_PROPERTY(ItemIndexMethod itemIndexMethod READ itemIndexMethod WRITE setItemIndexMethod) + Q_PROPERTY(QRectF sceneRect READ sceneRect WRITE setSceneRect) + Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) + Q_PROPERTY(QPalette palette READ palette WRITE setPalette) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(bool sortCacheEnabled READ isSortCacheEnabled WRITE setSortCacheEnabled) + Q_PROPERTY(bool stickyFocus READ stickyFocus WRITE setStickyFocus) + +public: + enum ItemIndexMethod { + BspTreeIndex, + NoIndex = -1 + }; + + enum SceneLayer { + ItemLayer = 0x1, + BackgroundLayer = 0x2, + ForegroundLayer = 0x4, + AllLayers = 0xffff + }; + Q_DECLARE_FLAGS(SceneLayers, SceneLayer) + + QGraphicsScene(QObject *parent = 0); + QGraphicsScene(const QRectF &sceneRect, QObject *parent = 0); + QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent = 0); + virtual ~QGraphicsScene(); + + QRectF sceneRect() const; + inline qreal width() const { return sceneRect().width(); } + inline qreal height() const { return sceneRect().height(); } + void setSceneRect(const QRectF &rect); + inline void setSceneRect(qreal x, qreal y, qreal w, qreal h) + { setSceneRect(QRectF(x, y, w, h)); } + + void render(QPainter *painter, + const QRectF &target = QRectF(), const QRectF &source = QRectF(), + Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio); + + ItemIndexMethod itemIndexMethod() const; + void setItemIndexMethod(ItemIndexMethod method); + + bool isSortCacheEnabled() const; + void setSortCacheEnabled(bool enabled); + + int bspTreeDepth() const; + void setBspTreeDepth(int depth); + + QRectF itemsBoundingRect() const; + + QList<QGraphicsItem *> items() const; + QList<QGraphicsItem *> items(Qt::SortOrder order) const; // ### Qt 5: unify + + QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + + QList<QGraphicsItem *> items(const QPointF &pos) const; // ### obsolete + QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete + QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete + QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete + + QList<QGraphicsItem *> collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + + QGraphicsItem *itemAt(const QPointF &pos) const; // ### obsolete + QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const; + + inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const + { return items(QRectF(x, y, w, h), mode); } // ### obsolete + inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, + const QTransform &deviceTransform = QTransform()) const + { return items(QRectF(x, y, w, h), mode, order, deviceTransform); } + inline QGraphicsItem *itemAt(qreal x, qreal y) const // ### obsolete + { return itemAt(QPointF(x, y)); } + inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const + { return itemAt(QPointF(x, y), deviceTransform); } + + QList<QGraphicsItem *> selectedItems() const; + QPainterPath selectionArea() const; + void setSelectionArea(const QPainterPath &path); // ### obsolete + void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform); + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode); // ### obsolete + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform); + + QGraphicsItemGroup *createItemGroup(const QList<QGraphicsItem *> &items); + void destroyItemGroup(QGraphicsItemGroup *group); + + void addItem(QGraphicsItem *item); + QGraphicsEllipseItem *addEllipse(const QRectF &rect, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsLineItem *addLine(const QLineF &line, const QPen &pen = QPen()); + QGraphicsPathItem *addPath(const QPainterPath &path, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsPixmapItem *addPixmap(const QPixmap &pixmap); + QGraphicsPolygonItem *addPolygon(const QPolygonF &polygon, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsRectItem *addRect(const QRectF &rect, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsTextItem *addText(const QString &text, const QFont &font = QFont()); + QGraphicsSimpleTextItem *addSimpleText(const QString &text, const QFont &font = QFont()); + QGraphicsProxyWidget *addWidget(QWidget *widget, Qt::WindowFlags wFlags = 0); + inline QGraphicsEllipseItem *addEllipse(qreal x, qreal y, qreal w, qreal h, const QPen &pen = QPen(), const QBrush &brush = QBrush()) + { return addEllipse(QRectF(x, y, w, h), pen, brush); } + inline QGraphicsLineItem *addLine(qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen = QPen()) + { return addLine(QLineF(x1, y1, x2, y2), pen); } + inline QGraphicsRectItem *addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen = QPen(), const QBrush &brush = QBrush()) + { return addRect(QRectF(x, y, w, h), pen, brush); } + void removeItem(QGraphicsItem *item); + + QGraphicsItem *focusItem() const; + void setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason = Qt::OtherFocusReason); + bool hasFocus() const; + void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); + void clearFocus(); + + void setStickyFocus(bool enabled); + bool stickyFocus() const; + + QGraphicsItem *mouseGrabberItem() const; + + QBrush backgroundBrush() const; + void setBackgroundBrush(const QBrush &brush); + + QBrush foregroundBrush() const; + void setForegroundBrush(const QBrush &brush); + + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + QList <QGraphicsView *> views() const; + + inline void update(qreal x, qreal y, qreal w, qreal h) + { update(QRectF(x, y, w, h)); } + inline void invalidate(qreal x, qreal y, qreal w, qreal h, SceneLayers layers = AllLayers) + { invalidate(QRectF(x, y, w, h), layers); } + + QStyle *style() const; + void setStyle(QStyle *style); + + QFont font() const; + void setFont(const QFont &font); + + QPalette palette() const; + void setPalette(const QPalette &palette); + + bool isActive() const; + QGraphicsItem *activePanel() const; + void setActivePanel(QGraphicsItem *item); + QGraphicsWidget *activeWindow() const; + void setActiveWindow(QGraphicsWidget *widget); + + bool sendEvent(QGraphicsItem *item, QEvent *event); + +public Q_SLOTS: + void update(const QRectF &rect = QRectF()); + void invalidate(const QRectF &rect = QRectF(), SceneLayers layers = AllLayers); + void advance(); + void clearSelection(); + void clear(); + +protected: + bool event(QEvent *event); + bool eventFilter(QObject *watched, QEvent *event); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual void helpEvent(QGraphicsSceneHelpEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + + virtual void drawBackground(QPainter *painter, const QRectF &rect); + virtual void drawForeground(QPainter *painter, const QRectF &rect); + virtual void drawItems(QPainter *painter, int numItems, + QGraphicsItem *items[], + const QStyleOptionGraphicsItem options[], + QWidget *widget = 0); + +protected Q_SLOTS: + bool focusNextPrevChild(bool next); + +Q_SIGNALS: + void changed(const QList<QRectF> ®ion); + void sceneRectChanged(const QRectF &rect); + void selectionChanged(); + +private: + Q_DECLARE_PRIVATE(QGraphicsScene) + Q_DISABLE_COPY(QGraphicsScene) + Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated()) + Q_PRIVATE_SLOT(d_func(), void _q_polishItems()) + Q_PRIVATE_SLOT(d_func(), void _q_processDirtyItems()) + Q_PRIVATE_SLOT(d_func(), void _q_updateScenePosDescendants()) + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + friend class QGraphicsView; + friend class QGraphicsViewPrivate; + friend class QGraphicsWidget; + friend class QGraphicsWidgetPrivate; + friend class QGraphicsEffect; + friend class QGraphicsSceneIndex; + friend class QGraphicsSceneIndexPrivate; + friend class QGraphicsSceneBspTreeIndex; + friend class QGraphicsSceneBspTreeIndexPrivate; + friend class QGraphicsItemEffectSourcePrivate; + friend class QGesture; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers) + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qgraphicssceneevent.h b/qtinterface/qt4/Qt/qgraphicssceneevent.h new file mode 100644 index 0000000..fa167ff --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicssceneevent.h @@ -0,0 +1,316 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENEEVENT_H +#define QGRAPHICSSCENEEVENT_H + +#include <QtCore/qcoreevent.h> +#include <QtCore/qpoint.h> +#include <QtCore/qscopedpointer.h> +#include <QtCore/qrect.h> +#include <QtGui/qpolygon.h> +#include <QtCore/qset.h> +#include <QtCore/qhash.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QMimeData; +class QPointF; +class QSizeF; +class QWidget; + +class QGraphicsSceneEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneEvent : public QEvent +{ +public: + QGraphicsSceneEvent(Type type); + ~QGraphicsSceneEvent(); + + QWidget *widget() const; + void setWidget(QWidget *widget); + +protected: + QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); + QScopedPointer<QGraphicsSceneEventPrivate> d_ptr; + Q_DECLARE_PRIVATE(QGraphicsSceneEvent) +}; + +class QGraphicsSceneMouseEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent +{ +public: + QGraphicsSceneMouseEvent(Type type = None); + ~QGraphicsSceneMouseEvent(); + + QPointF pos() const; + void setPos(const QPointF &pos); + + QPointF scenePos() const; + void setScenePos(const QPointF &pos); + + QPoint screenPos() const; + void setScreenPos(const QPoint &pos); + + QPointF buttonDownPos(Qt::MouseButton button) const; + void setButtonDownPos(Qt::MouseButton button, const QPointF &pos); + + QPointF buttonDownScenePos(Qt::MouseButton button) const; + void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos); + + QPoint buttonDownScreenPos(Qt::MouseButton button) const; + void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos); + + QPointF lastPos() const; + void setLastPos(const QPointF &pos); + + QPointF lastScenePos() const; + void setLastScenePos(const QPointF &pos); + + QPoint lastScreenPos() const; + void setLastScreenPos(const QPoint &pos); + + Qt::MouseButtons buttons() const; + void setButtons(Qt::MouseButtons buttons); + + Qt::MouseButton button() const; + void setButton(Qt::MouseButton button); + + Qt::KeyboardModifiers modifiers() const; + void setModifiers(Qt::KeyboardModifiers modifiers); + +private: + Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) +}; + +class QGraphicsSceneWheelEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent +{ +public: + QGraphicsSceneWheelEvent(Type type = None); + ~QGraphicsSceneWheelEvent(); + + QPointF pos() const; + void setPos(const QPointF &pos); + + QPointF scenePos() const; + void setScenePos(const QPointF &pos); + + QPoint screenPos() const; + void setScreenPos(const QPoint &pos); + + Qt::MouseButtons buttons() const; + void setButtons(Qt::MouseButtons buttons); + + Qt::KeyboardModifiers modifiers() const; + void setModifiers(Qt::KeyboardModifiers modifiers); + + int delta() const; + void setDelta(int delta); + + Qt::Orientation orientation() const; + void setOrientation(Qt::Orientation orientation); + +private: + Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) +}; + +class QGraphicsSceneContextMenuEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent +{ +public: + enum Reason { Mouse, Keyboard, Other }; + + QGraphicsSceneContextMenuEvent(Type type = None); + ~QGraphicsSceneContextMenuEvent(); + + QPointF pos() const; + void setPos(const QPointF &pos); + + QPointF scenePos() const; + void setScenePos(const QPointF &pos); + + QPoint screenPos() const; + void setScreenPos(const QPoint &pos); + + Qt::KeyboardModifiers modifiers() const; + void setModifiers(Qt::KeyboardModifiers modifiers); + + Reason reason() const; + void setReason(Reason reason); + +private: + Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) +}; + +class QGraphicsSceneHoverEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent +{ +public: + QGraphicsSceneHoverEvent(Type type = None); + ~QGraphicsSceneHoverEvent(); + + QPointF pos() const; + void setPos(const QPointF &pos); + + QPointF scenePos() const; + void setScenePos(const QPointF &pos); + + QPoint screenPos() const; + void setScreenPos(const QPoint &pos); + + QPointF lastPos() const; + void setLastPos(const QPointF &pos); + + QPointF lastScenePos() const; + void setLastScenePos(const QPointF &pos); + + QPoint lastScreenPos() const; + void setLastScreenPos(const QPoint &pos); + + Qt::KeyboardModifiers modifiers() const; + void setModifiers(Qt::KeyboardModifiers modifiers); + +private: + Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) +}; + +class QGraphicsSceneHelpEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent +{ +public: + QGraphicsSceneHelpEvent(Type type = None); + ~QGraphicsSceneHelpEvent(); + + QPointF scenePos() const; + void setScenePos(const QPointF &pos); + + QPoint screenPos() const; + void setScreenPos(const QPoint &pos); + +private: + Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) +}; + +class QGraphicsSceneDragDropEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent +{ +public: + QGraphicsSceneDragDropEvent(Type type = None); + ~QGraphicsSceneDragDropEvent(); + + QPointF pos() const; + void setPos(const QPointF &pos); + + QPointF scenePos() const; + void setScenePos(const QPointF &pos); + + QPoint screenPos() const; + void setScreenPos(const QPoint &pos); + + Qt::MouseButtons buttons() const; + void setButtons(Qt::MouseButtons buttons); + + Qt::KeyboardModifiers modifiers() const; + void setModifiers(Qt::KeyboardModifiers modifiers); + + Qt::DropActions possibleActions() const; + void setPossibleActions(Qt::DropActions actions); + + Qt::DropAction proposedAction() const; + void setProposedAction(Qt::DropAction action); + void acceptProposedAction(); + + Qt::DropAction dropAction() const; + void setDropAction(Qt::DropAction action); + + QWidget *source() const; + void setSource(QWidget *source); + + const QMimeData *mimeData() const; + void setMimeData(const QMimeData *data); + +private: + Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) +}; + +class QGraphicsSceneResizeEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent +{ + Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) +public: + QGraphicsSceneResizeEvent(); + ~QGraphicsSceneResizeEvent(); + + QSizeF oldSize() const; + void setOldSize(const QSizeF &size); + + QSizeF newSize() const; + void setNewSize(const QSizeF &size); +}; + +class QGraphicsSceneMoveEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent +{ + Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) +public: + QGraphicsSceneMoveEvent(); + ~QGraphicsSceneMoveEvent(); + + QPointF oldPos() const; + void setOldPos(const QPointF &pos); + + QPointF newPos() const; + void setNewPos(const QPointF &pos); +}; + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qgraphicssvgitem.h b/qtinterface/qt4/Qt/qgraphicssvgitem.h new file mode 100644 index 0000000..5f9ba72 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicssvgitem.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSvg module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSSVGITEM_H +#define QGRAPHICSSVGITEM_H + +#include <QtGui/qgraphicsitem.h> + +#ifndef QT_NO_GRAPHICSSVGITEM + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Svg) + +class QSvgRenderer; +class QGraphicsSvgItemPrivate; + +class Q_SVG_EXPORT QGraphicsSvgItem : public QGraphicsObject +{ + Q_OBJECT + Q_INTERFACES(QGraphicsItem) + Q_PROPERTY(QString elementId READ elementId WRITE setElementId) + Q_PROPERTY(QSize maximumCacheSize READ maximumCacheSize WRITE setMaximumCacheSize) + +public: + QGraphicsSvgItem(QGraphicsItem *parentItem=0); + QGraphicsSvgItem(const QString &fileName, QGraphicsItem *parentItem=0); + + void setSharedRenderer(QSvgRenderer *renderer); + QSvgRenderer *renderer() const; + + void setElementId(const QString &id); + QString elementId() const; + + void setCachingEnabled(bool); + bool isCachingEnabled() const; + + void setMaximumCacheSize(const QSize &size); + QSize maximumCacheSize() const; + + virtual QRectF boundingRect() const; + + virtual void paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget=0); + + enum { Type = 13 }; + virtual int type() const; + +private: + Q_DISABLE_COPY(QGraphicsSvgItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsSvgItem) + + Q_PRIVATE_SLOT(d_func(), void _q_repaintItem()) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_GRAPHICSSVGITEM +#endif // QGRAPHICSSVGITEM_H diff --git a/qtinterface/qt4/Qt/qgraphicstransform.h b/qtinterface/qt4/Qt/qgraphicstransform.h new file mode 100644 index 0000000..cf6e025 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicstransform.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSTRANSFORM_H +#define QGRAPHICSTRANSFORM_H + +#include <QtCore/QObject> +#include <QtGui/QVector3D> +#include <QtGui/QTransform> +#include <QtGui/QMatrix4x4> + +#ifndef QT_NO_GRAPHICSVIEW +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGraphicsItem; +class QGraphicsTransformPrivate; + +class Q_GUI_EXPORT QGraphicsTransform : public QObject +{ + Q_OBJECT +public: + QGraphicsTransform(QObject *parent = 0); + ~QGraphicsTransform(); + + virtual void applyTo(QMatrix4x4 *matrix) const = 0; + +protected Q_SLOTS: + void update(); + +protected: + QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent); + +private: + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + Q_DECLARE_PRIVATE(QGraphicsTransform) +}; + +class QGraphicsScalePrivate; + +class Q_GUI_EXPORT QGraphicsScale : public QGraphicsTransform +{ + Q_OBJECT + + Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged) + Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY scaleChanged) + Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY scaleChanged) + Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY scaleChanged) +public: + QGraphicsScale(QObject *parent = 0); + ~QGraphicsScale(); + + QVector3D origin() const; + void setOrigin(const QVector3D &point); + + qreal xScale() const; + void setXScale(qreal); + + qreal yScale() const; + void setYScale(qreal); + + qreal zScale() const; + void setZScale(qreal); + + void applyTo(QMatrix4x4 *matrix) const; + +Q_SIGNALS: + void originChanged(); + void scaleChanged(); + +private: + Q_DECLARE_PRIVATE(QGraphicsScale) +}; + +class QGraphicsRotationPrivate; + +class Q_GUI_EXPORT QGraphicsRotation : public QGraphicsTransform +{ + Q_OBJECT + + Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged) + Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) + Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged) +public: + QGraphicsRotation(QObject *parent = 0); + ~QGraphicsRotation(); + + QVector3D origin() const; + void setOrigin(const QVector3D &point); + + qreal angle() const; + void setAngle(qreal); + + QVector3D axis() const; + void setAxis(const QVector3D &axis); + void setAxis(Qt::Axis axis); + + void applyTo(QMatrix4x4 *matrix) const; + +Q_SIGNALS: + void originChanged(); + void angleChanged(); + void axisChanged(); + +private: + Q_DECLARE_PRIVATE(QGraphicsRotation) +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif //QT_NO_GRAPHICSVIEW + +#endif // QFXTRANSFORM_H diff --git a/qtinterface/qt4/Qt/qgraphicsview.h b/qtinterface/qt4/Qt/qgraphicsview.h new file mode 100644 index 0000000..881315c --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicsview.h @@ -0,0 +1,316 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSVIEW_H +#define QGRAPHICSVIEW_H + +#include <QtCore/qmetatype.h> +#include <QtGui/qpainter.h> +#include <QtGui/qscrollarea.h> +#include <QtGui/qgraphicsscene.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsItem; +class QPainterPath; +class QPolygonF; +class QStyleOptionGraphicsItem; + +class QGraphicsViewPrivate; +class Q_GUI_EXPORT QGraphicsView : public QAbstractScrollArea +{ + Q_OBJECT + Q_FLAGS(QPainter::RenderHints CacheMode OptimizationFlags) + Q_ENUMS(ViewportAnchor DragMode ViewportUpdateMode) + Q_PROPERTY(QBrush backgroundBrush READ backgroundBrush WRITE setBackgroundBrush) + Q_PROPERTY(QBrush foregroundBrush READ foregroundBrush WRITE setForegroundBrush) + Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) + Q_PROPERTY(QRectF sceneRect READ sceneRect WRITE setSceneRect) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints) + Q_PROPERTY(DragMode dragMode READ dragMode WRITE setDragMode) + Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) + Q_PROPERTY(ViewportAnchor transformationAnchor READ transformationAnchor WRITE setTransformationAnchor) + Q_PROPERTY(ViewportAnchor resizeAnchor READ resizeAnchor WRITE setResizeAnchor) + Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode) +#ifndef QT_NO_RUBBERBAND + Q_PROPERTY(Qt::ItemSelectionMode rubberBandSelectionMode READ rubberBandSelectionMode WRITE setRubberBandSelectionMode) +#endif + Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags) + +public: + enum ViewportAnchor { + NoAnchor, + AnchorViewCenter, + AnchorUnderMouse + }; + + enum CacheModeFlag { + CacheNone = 0x0, + CacheBackground = 0x1 + }; + Q_DECLARE_FLAGS(CacheMode, CacheModeFlag) + + enum DragMode { + NoDrag, + ScrollHandDrag, + RubberBandDrag + }; + + enum ViewportUpdateMode { + FullViewportUpdate, + MinimalViewportUpdate, + SmartViewportUpdate, + NoViewportUpdate, + BoundingRectViewportUpdate + }; + + enum OptimizationFlag { + DontClipPainter = 0x1, // obsolete + DontSavePainterState = 0x2, + DontAdjustForAntialiasing = 0x4, + IndirectPainting = 0x8 + }; + Q_DECLARE_FLAGS(OptimizationFlags, OptimizationFlag) + + QGraphicsView(QWidget *parent = 0); + QGraphicsView(QGraphicsScene *scene, QWidget *parent = 0); + ~QGraphicsView(); + + QSize sizeHint() const; + + QPainter::RenderHints renderHints() const; + void setRenderHint(QPainter::RenderHint hint, bool enabled = true); + void setRenderHints(QPainter::RenderHints hints); + + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment alignment); + + ViewportAnchor transformationAnchor() const; + void setTransformationAnchor(ViewportAnchor anchor); + + ViewportAnchor resizeAnchor() const; + void setResizeAnchor(ViewportAnchor anchor); + + ViewportUpdateMode viewportUpdateMode() const; + void setViewportUpdateMode(ViewportUpdateMode mode); + + OptimizationFlags optimizationFlags() const; + void setOptimizationFlag(OptimizationFlag flag, bool enabled = true); + void setOptimizationFlags(OptimizationFlags flags); + + DragMode dragMode() const; + void setDragMode(DragMode mode); + +#ifndef QT_NO_RUBBERBAND + Qt::ItemSelectionMode rubberBandSelectionMode() const; + void setRubberBandSelectionMode(Qt::ItemSelectionMode mode); +#endif + + CacheMode cacheMode() const; + void setCacheMode(CacheMode mode); + void resetCachedContent(); + + bool isInteractive() const; + void setInteractive(bool allowed); + + QGraphicsScene *scene() const; + void setScene(QGraphicsScene *scene); + + QRectF sceneRect() const; + void setSceneRect(const QRectF &rect); + inline void setSceneRect(qreal x, qreal y, qreal w, qreal h); + + QMatrix matrix() const; + void setMatrix(const QMatrix &matrix, bool combine = false); + void resetMatrix(); + QTransform transform() const; + QTransform viewportTransform() const; + bool isTransformed() const; + void setTransform(const QTransform &matrix, bool combine = false); + void resetTransform(); + void rotate(qreal angle); + void scale(qreal sx, qreal sy); + void shear(qreal sh, qreal sv); + void translate(qreal dx, qreal dy); + + void centerOn(const QPointF &pos); + inline void centerOn(qreal x, qreal y); + void centerOn(const QGraphicsItem *item); + void ensureVisible(const QRectF &rect, int xmargin = 50, int ymargin = 50); + inline void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50); + void ensureVisible(const QGraphicsItem *item, int xmargin = 50, int ymargin = 50); + void fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode = Qt::IgnoreAspectRatio); + inline void fitInView(qreal x, qreal y, qreal w, qreal h, + Qt::AspectRatioMode aspectRadioMode = Qt::IgnoreAspectRatio); + void fitInView(const QGraphicsItem *item, + Qt::AspectRatioMode aspectRadioMode = Qt::IgnoreAspectRatio); + + void render(QPainter *painter, const QRectF &target = QRectF(), const QRect &source = QRect(), + Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio); + + QList<QGraphicsItem *> items() const; + QList<QGraphicsItem *> items(const QPoint &pos) const; + inline QList<QGraphicsItem *> items(int x, int y) const; + QList<QGraphicsItem *> items(const QRect &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + inline QList<QGraphicsItem *> items(int x, int y, int w, int h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList<QGraphicsItem *> items(const QPolygon &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QGraphicsItem *itemAt(const QPoint &pos) const; + inline QGraphicsItem *itemAt(int x, int y) const; + + QPointF mapToScene(const QPoint &point) const; + QPolygonF mapToScene(const QRect &rect) const; + QPolygonF mapToScene(const QPolygon &polygon) const; + QPainterPath mapToScene(const QPainterPath &path) const; + QPoint mapFromScene(const QPointF &point) const; + QPolygon mapFromScene(const QRectF &rect) const; + QPolygon mapFromScene(const QPolygonF &polygon) const; + QPainterPath mapFromScene(const QPainterPath &path) const; + inline QPointF mapToScene(int x, int y) const; + inline QPolygonF mapToScene(int x, int y, int w, int h) const; + inline QPoint mapFromScene(qreal x, qreal y) const; + inline QPolygon mapFromScene(qreal x, qreal y, qreal w, qreal h) const; + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + QBrush backgroundBrush() const; + void setBackgroundBrush(const QBrush &brush); + + QBrush foregroundBrush() const; + void setForegroundBrush(const QBrush &brush); + +public Q_SLOTS: + void updateScene(const QList<QRectF> &rects); + void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers); + void updateSceneRect(const QRectF &rect); + +protected Q_SLOTS: + void setupViewport(QWidget *widget); + +protected: + QGraphicsView(QGraphicsViewPrivate &, QWidget *parent = 0); + bool event(QEvent *event); + bool viewportEvent(QEvent *event); + +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *event); +#endif + void dragEnterEvent(QDragEnterEvent *event); + void dragLeaveEvent(QDragLeaveEvent *event); + void dragMoveEvent(QDragMoveEvent *event); + void dropEvent(QDropEvent *event); + void focusInEvent(QFocusEvent *event); + bool focusNextPrevChild(bool next); + void focusOutEvent(QFocusEvent *event); + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *event); +#endif + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + void scrollContentsBy(int dx, int dy); + void showEvent(QShowEvent *event); + void inputMethodEvent(QInputMethodEvent *event); + + virtual void drawBackground(QPainter *painter, const QRectF &rect); + virtual void drawForeground(QPainter *painter, const QRectF &rect); + virtual void drawItems(QPainter *painter, int numItems, + QGraphicsItem *items[], + const QStyleOptionGraphicsItem options[]); + +private: + Q_DECLARE_PRIVATE(QGraphicsView) + Q_DISABLE_COPY(QGraphicsView) +#ifndef QT_NO_CURSOR + Q_PRIVATE_SLOT(d_func(), void _q_setViewportCursor(const QCursor &)) + Q_PRIVATE_SLOT(d_func(), void _q_unsetViewportCursor()) +#endif + friend class QGraphicsSceneWidget; + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; + friend class QGraphicsItemPrivate; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsView::CacheMode) +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsView::OptimizationFlags) + +inline void QGraphicsView::setSceneRect(qreal ax, qreal ay, qreal aw, qreal ah) +{ setSceneRect(QRectF(ax, ay, aw, ah)); } +inline void QGraphicsView::centerOn(qreal ax, qreal ay) +{ centerOn(QPointF(ax, ay)); } +inline void QGraphicsView::ensureVisible(qreal ax, qreal ay, qreal aw, qreal ah, int xmargin, int ymargin) +{ ensureVisible(QRectF(ax, ay, aw, ah), xmargin, ymargin); } +inline void QGraphicsView::fitInView(qreal ax, qreal ay, qreal w, qreal h, Qt::AspectRatioMode mode) +{ fitInView(QRectF(ax, ay, w, h), mode); } +inline QList<QGraphicsItem *> QGraphicsView::items(int ax, int ay) const +{ return items(QPoint(ax, ay)); } +inline QList<QGraphicsItem *> QGraphicsView::items(int ax, int ay, int w, int h, Qt::ItemSelectionMode mode) const +{ return items(QRect(ax, ay, w, h), mode); } +inline QGraphicsItem *QGraphicsView::itemAt(int ax, int ay) const +{ return itemAt(QPoint(ax, ay)); } +inline QPointF QGraphicsView::mapToScene(int ax, int ay) const +{ return mapToScene(QPoint(ax, ay)); } +inline QPolygonF QGraphicsView::mapToScene(int ax, int ay, int w, int h) const +{ return mapToScene(QRect(ax, ay, w, h)); } +inline QPoint QGraphicsView::mapFromScene(qreal ax, qreal ay) const +{ return mapFromScene(QPointF(ax, ay)); } +inline QPolygon QGraphicsView::mapFromScene(qreal ax, qreal ay, qreal w, qreal h) const +{ return mapFromScene(QRectF(ax, ay, w, h)); } + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSVIEW_H diff --git a/qtinterface/qt4/Qt/qgraphicswebview.h b/qtinterface/qt4/Qt/qgraphicswebview.h new file mode 100644 index 0000000..f3afb4c --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicswebview.h @@ -0,0 +1,142 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QGraphicsWebView_h +#define QGraphicsWebView_h + +#include "qwebkitglobal.h" +#include "qwebpage.h" +#include <QtCore/qurl.h> +#include <QtGui/qevent.h> +#include <QtGui/qgraphicswidget.h> +#include <QtGui/qicon.h> +#include <QtGui/qpainter.h> +#include <QtNetwork/qnetworkaccessmanager.h> + +class QWebPage; +class QWebHistory; +class QWebSettings; + +class QGraphicsWebViewPrivate; + +class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget { + Q_OBJECT + + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) + + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + + Q_PROPERTY(bool modified READ isModified) + +public: + explicit QGraphicsWebView(QGraphicsItem* parent = 0); + ~QGraphicsWebView(); + + QWebPage* page() const; + void setPage(QWebPage*); + + QUrl url() const; + void setUrl(const QUrl&); + + QString title() const; + QIcon icon() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal); + + bool isModified() const; + + void load(const QUrl &url); + void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray()); + + void setHtml(const QString& html, const QUrl& baseUrl = QUrl()); + // FIXME: Consider rename to setHtml? + void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl()); + + QWebHistory* history() const; + QWebSettings* settings() const; + + QAction* pageAction(QWebPage::WebAction action) const; + void triggerPageAction(QWebPage::WebAction action, bool checked = false); + + bool findText(const QString& subString, QWebPage::FindFlags options = 0); + + virtual void setGeometry(const QRectF& rect); + virtual void updateGeometry(); + virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value); + virtual bool event(QEvent*); + + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint) const; + + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + +public Q_SLOTS: + void stop(); + void back(); + void forward(); + void reload(); + +Q_SIGNALS: + void loadStarted(); + void loadFinished(bool); + + void loadProgress(int progress); + void urlChanged(const QUrl&); + void titleChanged(const QString&); + void iconChanged(); + void statusBarMessage(const QString& message); + void linkClicked(const QUrl&); + +protected: + virtual void mousePressEvent(QGraphicsSceneMouseEvent*); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QGraphicsSceneWheelEvent*); +#endif + virtual void keyPressEvent(QKeyEvent*); + virtual void keyReleaseEvent(QKeyEvent*); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*); +#endif + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*); + virtual void dropEvent(QGraphicsSceneDragDropEvent*); + virtual void focusInEvent(QFocusEvent*); + virtual void focusOutEvent(QFocusEvent*); + virtual void inputMethodEvent(QInputMethodEvent*); + virtual bool focusNextPrevChild(bool next); + + virtual bool sceneEvent(QEvent*); + +private: + Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) + + QGraphicsWebViewPrivate* const d; + friend class QGraphicsWebViewPrivate; +}; + +#endif // QGraphicsWebView_h diff --git a/qtinterface/qt4/Qt/qgraphicswidget.h b/qtinterface/qt4/Qt/qgraphicswidget.h new file mode 100644 index 0000000..c8e8d28 --- /dev/null +++ b/qtinterface/qt4/Qt/qgraphicswidget.h @@ -0,0 +1,249 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSWIDGET_H +#define QGRAPHICSWIDGET_H + +#include <QtGui/qfont.h> +#include <QtGui/qgraphicslayoutitem.h> +#include <QtGui/qgraphicsitem.h> +#include <QtGui/qpalette.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFont; +class QFontMetrics; +class QGraphicsLayout; +class QGraphicsSceneMoveEvent; +class QGraphicsWidgetPrivate; +class QGraphicsSceneResizeEvent; +class QStyle; +class QStyleOption; + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsWidgetPrivate; + +class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLayoutItem +{ + Q_OBJECT + Q_INTERFACES(QGraphicsItem QGraphicsLayoutItem) + Q_PROPERTY(QPalette palette READ palette WRITE setPalette) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) + Q_PROPERTY(QSizeF size READ size WRITE resize) + Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) + Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) + Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) + Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) + Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) + Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry) +public: + QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); + ~QGraphicsWidget(); + + QGraphicsLayout *layout() const; + void setLayout(QGraphicsLayout *layout); + void adjustSize(); + + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection(Qt::LayoutDirection direction); + void unsetLayoutDirection(); + + QStyle *style() const; + void setStyle(QStyle *style); + + QFont font() const; + void setFont(const QFont &font); + + QPalette palette() const; + void setPalette(const QPalette &palette); + + void resize(const QSizeF &size); + inline void resize(qreal w, qreal h) { resize(QSizeF(w, h)); } + QSizeF size() const; + + void setGeometry(const QRectF &rect); + inline void setGeometry(qreal x, qreal y, qreal w, qreal h); + inline QRectF rect() const { return QRectF(QPointF(), size()); } + + void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom); + void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + + void setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom); + void getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + void unsetWindowFrameMargins(); + QRectF windowFrameGeometry() const; + QRectF windowFrameRect() const; + + // Window handling + Qt::WindowFlags windowFlags() const; + Qt::WindowType windowType() const; + void setWindowFlags(Qt::WindowFlags wFlags); + bool isActiveWindow() const; + void setWindowTitle(const QString &title); + QString windowTitle() const; + + // Focus handling + Qt::FocusPolicy focusPolicy() const; + void setFocusPolicy(Qt::FocusPolicy policy); + static void setTabOrder(QGraphicsWidget *first, QGraphicsWidget *second); + QGraphicsWidget *focusWidget() const; + +#ifndef QT_NO_SHORTCUT + int grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context = Qt::WindowShortcut); + void releaseShortcut(int id); + void setShortcutEnabled(int id, bool enabled = true); + void setShortcutAutoRepeat(int id, bool enabled = true); +#endif + +#ifndef QT_NO_ACTION + //actions + void addAction(QAction *action); + void addActions(QList<QAction*> actions); + void insertAction(QAction *before, QAction *action); + void insertActions(QAction *before, QList<QAction*> actions); + void removeAction(QAction *action); + QList<QAction*> actions() const; +#endif + + void setAttribute(Qt::WidgetAttribute attribute, bool on = true); + bool testAttribute(Qt::WidgetAttribute attribute) const; + + enum { + Type = 11 + }; + int type() const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + QRectF boundingRect() const; + QPainterPath shape() const; + +#if 0 + void dumpFocusChain(); +#endif + + // ### Qt 5: Disambiguate +#ifdef Q_NO_USING_KEYWORD + const QObjectList &children() const { return QObject::children(); } +#else + using QObject::children; +#endif + +public Q_SLOTS: + bool close(); + +protected: + virtual void initStyleOption(QStyleOption *option) const; + + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + void updateGeometry(); + + // Notification + QVariant itemChange(GraphicsItemChange change, const QVariant &value); + virtual QVariant propertyChange(const QString &propertyName, const QVariant &value); + + // Scene events + bool sceneEvent(QEvent *event); + virtual bool windowFrameEvent(QEvent *e); + virtual Qt::WindowFrameSection windowFrameSectionAt(const QPointF& pos) const; + + // Base event handlers + bool event(QEvent *event); + //virtual void actionEvent(QActionEvent *event); + virtual void changeEvent(QEvent *event); + virtual void closeEvent(QCloseEvent *event); + //void create(WId window = 0, bool initializeWindow = true, bool destroyOldWindow = true); + //void destroy(bool destroyWindow = true, bool destroySubWindows = true); + void focusInEvent(QFocusEvent *event); + virtual bool focusNextPrevChild(bool next); + void focusOutEvent(QFocusEvent *event); + virtual void hideEvent(QHideEvent *event); + //virtual bool macEvent(EventHandlerCallRef caller, EventRef event); + //virtual int metric(PaintDeviceMetric m ) const; + virtual void moveEvent(QGraphicsSceneMoveEvent *event); + virtual void polishEvent(); + //virtual bool qwsEvent(QWSEvent *event); + //void resetInputContext (); + virtual void resizeEvent(QGraphicsSceneResizeEvent *event); + virtual void showEvent(QShowEvent *event); + //virtual void tabletEvent(QTabletEvent *event); + //virtual bool winEvent(MSG *message, long *result); + //virtual bool x11Event(XEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void grabMouseEvent(QEvent *event); + virtual void ungrabMouseEvent(QEvent *event); + virtual void grabKeyboardEvent(QEvent *event); + virtual void ungrabKeyboardEvent(QEvent *event); + QGraphicsWidget(QGraphicsWidgetPrivate &, QGraphicsItem *parent, QGraphicsScene *, Qt::WindowFlags wFlags = 0); + +private: + Q_DISABLE_COPY(QGraphicsWidget) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsWidget) + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; + friend class QGraphicsView; + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + friend class QGraphicsLayout; + friend class QWidget; + friend class QApplication; +}; + +inline void QGraphicsWidget::setGeometry(qreal ax, qreal ay, qreal aw, qreal ah) +{ setGeometry(QRectF(ax, ay, aw, ah)); } + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qgridlayout.h b/qtinterface/qt4/Qt/qgridlayout.h new file mode 100644 index 0000000..e906a97 --- /dev/null +++ b/qtinterface/qt4/Qt/qgridlayout.h @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRIDLAYOUT_H +#define QGRIDLAYOUT_H + +#include <QtGui/qlayout.h> +#ifdef QT_INCLUDE_COMPAT +#include <QtGui/qwidget.h> +#endif + +#include <limits.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGridLayoutPrivate; + +class Q_GUI_EXPORT QGridLayout : public QLayout +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QGridLayout) + QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) + QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) + +public: + explicit QGridLayout(QWidget *parent); + QGridLayout(); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QGridLayout(QWidget *parent, int nRows , int nCols = 1, int border = 0, + int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QGridLayout(int nRows , int nCols = 1, int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QGridLayout(QLayout *parentLayout, int nRows = 1, int nCols = 1, int spacing = -1, + const char *name = 0); +#endif + ~QGridLayout(); + + QSize sizeHint() const; + QSize minimumSize() const; + QSize maximumSize() const; + + void setHorizontalSpacing(int spacing); + int horizontalSpacing() const; + void setVerticalSpacing(int spacing); + int verticalSpacing() const; + void setSpacing(int spacing); + int spacing() const; + + void setRowStretch(int row, int stretch); + void setColumnStretch(int column, int stretch); + int rowStretch(int row) const; + int columnStretch(int column) const; + + void setRowMinimumHeight(int row, int minSize); + void setColumnMinimumWidth(int column, int minSize); + int rowMinimumHeight(int row) const; + int columnMinimumWidth(int column) const; + + int columnCount() const; + int rowCount() const; + + QRect cellRect(int row, int column) const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QRect cellGeometry(int row, int column) const {return cellRect(row, column);} +#endif + + bool hasHeightForWidth() const; + int heightForWidth(int) const; + int minimumHeightForWidth(int) const; + + Qt::Orientations expandingDirections() const; + void invalidate(); + + inline void addWidget(QWidget *w) { QLayout::addWidget(w); } + void addWidget(QWidget *, int row, int column, Qt::Alignment = 0); + void addWidget(QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = 0); + void addLayout(QLayout *, int row, int column, Qt::Alignment = 0); + void addLayout(QLayout *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = 0); + + void setOriginCorner(Qt::Corner); + Qt::Corner originCorner() const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void setOrigin(Qt::Corner corner) { setOriginCorner(corner); } + inline QT3_SUPPORT Qt::Corner origin() const { return originCorner(); } +#endif + QLayoutItem *itemAt(int index) const; + QLayoutItem *itemAtPosition(int row, int column) const; + QLayoutItem *takeAt(int index); + int count() const; + void setGeometry(const QRect&); + + void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = 0); + + void setDefaultPositioning(int n, Qt::Orientation orient); + void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan); + +protected: +#ifdef QT3_SUPPORT + QT3_SUPPORT bool findWidget(QWidget* w, int *r, int *c); +#endif + void addItem(QLayoutItem *); + +private: + Q_DISABLE_COPY(QGridLayout) + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT void expand(int rows, int cols); + inline QT3_SUPPORT void addRowSpacing(int row, int minsize) { addItem(new QSpacerItem(0,minsize), row, 0); } + inline QT3_SUPPORT void addColSpacing(int col, int minsize) { addItem(new QSpacerItem(minsize,0), 0, col); } + inline QT3_SUPPORT void addMultiCellWidget(QWidget *w, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0) + { addWidget(w, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); } + inline QT3_SUPPORT void addMultiCell(QLayoutItem *l, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0) + { addItem(l, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); } + inline QT3_SUPPORT void addMultiCellLayout(QLayout *layout, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0) + { addLayout(layout, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); } + + inline QT3_SUPPORT int numRows() const { return rowCount(); } + inline QT3_SUPPORT int numCols() const { return columnCount(); } + inline QT3_SUPPORT void setColStretch(int col, int stretch) {setColumnStretch(col, stretch); } + inline QT3_SUPPORT int colStretch(int col) const {return columnStretch(col); } + inline QT3_SUPPORT void setColSpacing(int col, int minSize) { setColumnMinimumWidth(col, minSize); } + inline QT3_SUPPORT int colSpacing(int col) const { return columnMinimumWidth(col); } + inline QT3_SUPPORT void setRowSpacing(int row, int minSize) {setRowMinimumHeight(row, minSize); } + inline QT3_SUPPORT int rowSpacing(int row) const {return rowMinimumHeight(row); } +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRIDLAYOUT_H diff --git a/qtinterface/qt4/Qt/qgroupbox.h b/qtinterface/qt4/Qt/qgroupbox.h new file mode 100644 index 0000000..ed4a75b --- /dev/null +++ b/qtinterface/qt4/Qt/qgroupbox.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGROUPBOX_H +#define QGROUPBOX_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_GROUPBOX + +class QGroupBoxPrivate; +class QStyleOptionGroupBox; +class Q_GUI_EXPORT QGroupBox : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(bool flat READ isFlat WRITE setFlat) + Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable) + Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true) +public: + explicit QGroupBox(QWidget* parent=0); + explicit QGroupBox(const QString &title, QWidget* parent=0); + ~QGroupBox(); + + QString title() const; + void setTitle(const QString &title); + + Qt::Alignment alignment() const; + void setAlignment(int alignment); + + QSize minimumSizeHint() const; + + bool isFlat() const; + void setFlat(bool flat); + bool isCheckable() const; + void setCheckable(bool checkable); + bool isChecked() const; + +public Q_SLOTS: + void setChecked(bool checked); + +Q_SIGNALS: + void clicked(bool checked = false); + void toggled(bool); + +protected: + bool event(QEvent *event); + void childEvent(QChildEvent *event); + void resizeEvent(QResizeEvent *event); + void paintEvent(QPaintEvent *event); + void focusInEvent(QFocusEvent *event); + void changeEvent(QEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void initStyleOption(QStyleOptionGroupBox *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QGroupBox(QWidget* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QGroupBox(const QString &title, QWidget* parent, const char* name); +#endif + +private: + Q_DISABLE_COPY(QGroupBox) + Q_DECLARE_PRIVATE(QGroupBox) + Q_PRIVATE_SLOT(d_func(), void _q_setChildrenEnabled(bool b)) +}; + +#endif // QT_NO_GROUPBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGROUPBOX_H diff --git a/qtinterface/qt4/Qt/qgtkstyle.h b/qtinterface/qt4/Qt/qgtkstyle.h new file mode 100644 index 0000000..d9b270b --- /dev/null +++ b/qtinterface/qt4/Qt/qgtkstyle.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGTKSTYLE_H +#define QGTKSTYLE_H + +#include <QtGui/QCleanlooksStyle> +#include <QtGui/QPalette> +#include <QtGui/QFont> +#include <QtGui/QFileDialog> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_GTK) + +class QPainterPath; +class QGtkStylePrivate; + +class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QGtkStyle) + +public: + QGtkStyle(); + QGtkStyle(QGtkStylePrivate &dd); + + ~QGtkStyle(); + + QPalette standardPalette() const; + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const; + void drawControl(ControlElement control, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, + QPainter *painter, const QWidget *widget) const; + void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, + const QPixmap &pixmap) const; + void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, + bool enabled, const QString& text, QPalette::ColorRole textRole) const; + + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, + const QWidget *widget = 0) const; + int styleHint(StyleHint hint, const QStyleOption *option, + const QWidget *widget, QStyleHintReturn *returnData) const; + + QStyle::SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, + const QPoint &pt, const QWidget *w) const; + + QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, + SubControl subControl, const QWidget *widget) const; + QRect subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const; + QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + + + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option, + const QWidget *widget) const; + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, + const QStyleOption *opt) const; + + void polish(QWidget *widget); + void polish(QApplication *app); + void polish(QPalette &palette); + + void unpolish(QWidget *widget); + void unpolish(QApplication *app); + + static bool getGConfBool(const QString &key, bool fallback = 0); + static QString getGConfString(const QString &key, const QString &fallback = QString()); + + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; +}; + +#endif //!defined(QT_NO_STYLE_QGTK) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QGTKSTYLE_H diff --git a/qtinterface/qt4/Qt/qguifunctions_wince.h b/qtinterface/qt4/Qt/qguifunctions_wince.h new file mode 100644 index 0000000..97881f8 --- /dev/null +++ b/qtinterface/qt4/Qt/qguifunctions_wince.h @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGUIFUNCTIONS_WCE_H +#define QGUIFUNCTIONS_WCE_H +#ifdef Q_OS_WINCE +#include <QtCore/qfunctions_wince.h> +#define UNDER_NT +#include <wingdi.h> + +#ifdef QT_BUILD_GUI_LIB +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE +QT_MODULE(Gui) +QT_END_NAMESPACE +QT_END_HEADER +#endif + +// application defines +#define SPI_SETNONCLIENTMETRICS 72 +#define SPI_SETICONTITLELOGFONT 0x0022 +#define WM_ACTIVATEAPP 0x001c +#define SW_PARENTCLOSING 1 +#define SW_OTHERMAXIMIZED 2 +#define SW_PARENTOPENING 3 +#define SW_OTHERRESTORED 4 +#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) + +// drag n drop +#ifndef CFSTR_PERFORMEDDROPEFFECT +#define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect") +#endif +int qt_wince_GetDIBits(HDC, HBITMAP, uint, uint, void*, LPBITMAPINFO, uint); +#define GetDIBits(a,b,c,d,e,f,g) qt_wince_GetDIBits(a,b,c,d,e,f,g) + +// QWidget +#define SW_SHOWMINIMIZED SW_MINIMIZE + +// QRegion +#define ALTERNATE 0 +#define WINDING 1 + +// QFontEngine +typedef struct _FIXED { + WORD fract; + short value; +} FIXED; + +typedef struct tagPOINTFX { + FIXED x; + FIXED y; +} POINTFX; + +typedef struct _MAT2 { + FIXED eM11; + FIXED eM12; + FIXED eM21; + FIXED eM22; +} MAT2; + +typedef struct _GLYPHMETRICS { + UINT gmBlackBoxX; + UINT gmBlackBoxY; + POINT gmptGlyphOrigin; + short gmCellIncX; + short gmCellIncY; +} GLYPHMETRICS; + +typedef struct tagTTPOLYGONHEADER +{ + DWORD cb; + DWORD dwType; + POINTFX pfxStart; +} TTPOLYGONHEADER; + +typedef struct tagTTPOLYCURVE +{ + WORD wType; + WORD cpfx; + POINTFX apfx[1]; +} TTPOLYCURVE; + +#define GGO_NATIVE 2 +#define GGO_GLYPH_INDEX 0x0080 +#define TT_PRIM_LINE 1 +#define TT_PRIM_QSPLINE 2 +#define TT_PRIM_CSPLINE 3 +#define ANSI_VAR_FONT 12 + +HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd); +#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f) + + +// Clipboard -------------------------------------------------------- +#define WM_CHANGECBCHAIN 1 +#define WM_DRAWCLIPBOARD 2 + +BOOL qt_wince_ChangeClipboardChain( + HWND hWndRemove, // handle to window to remove + HWND hWndNewNext // handle to next window +); +#define ChangeClipboardChain(a,b) qt_wince_ChangeClipboardChain(a,b); + +HWND qt_wince_SetClipboardViewer( + HWND hWndNewViewer // handle to clipboard viewer window +); +#define SetClipboardViewer(a) qt_wince_SetClipboardViewer(a) + +// Graphics --------------------------------------------------------- +COLORREF qt_wince_PALETTEINDEX( WORD wPaletteIndex ); +#define PALETTEINDEX(a) qt_wince_PALETTEINDEX(a) + +#endif // Q_OS_WINCE +#endif // QGUIFUNCTIONS_WCE_H diff --git a/qtinterface/qt4/Qt/qhash.h b/qtinterface/qt4/Qt/qhash.h new file mode 100644 index 0000000..b8a8eaf --- /dev/null +++ b/qtinterface/qt4/Qt/qhash.h @@ -0,0 +1,1040 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHASH_H +#define QHASH_H + +#include <QtCore/qatomic.h> +#include <QtCore/qchar.h> +#include <QtCore/qiterator.h> +#include <QtCore/qlist.h> +#include <QtCore/qpair.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QBitArray; +class QByteArray; +class QString; +class QStringRef; + +inline uint qHash(char key) { return uint(key); } +inline uint qHash(uchar key) { return uint(key); } +inline uint qHash(signed char key) { return uint(key); } +inline uint qHash(ushort key) { return uint(key); } +inline uint qHash(short key) { return uint(key); } +inline uint qHash(uint key) { return key; } +inline uint qHash(int key) { return uint(key); } +inline uint qHash(ulong key) +{ + if (sizeof(ulong) > sizeof(uint)) { + return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U)); + } else { + return uint(key & (~0U)); + } +} +inline uint qHash(long key) { return qHash(ulong(key)); } +inline uint qHash(quint64 key) +{ + if (sizeof(quint64) > sizeof(uint)) { + return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U)); + } else { + return uint(key & (~0U)); + } +} +inline uint qHash(qint64 key) { return qHash(quint64(key)); } +inline uint qHash(QChar key) { return qHash(key.unicode()); } +Q_CORE_EXPORT uint qHash(const QByteArray &key); +Q_CORE_EXPORT uint qHash(const QString &key); +Q_CORE_EXPORT uint qHash(const QStringRef &key); +Q_CORE_EXPORT uint qHash(const QBitArray &key); + +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4311 ) // disable pointer truncation warning +#endif +template <class T> inline uint qHash(const T *key) +{ + return qHash(reinterpret_cast<quintptr>(key)); +} +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif + +template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key) +{ + uint h1 = qHash(key.first); + uint h2 = qHash(key.second); + return ((h1 << 16) | (h1 >> 16)) ^ h2; +} + +struct Q_CORE_EXPORT QHashData +{ + struct Node { + Node *next; + uint h; + }; + + Node *fakeNext; + Node **buckets; + QBasicAtomicInt ref; + int size; + int nodeSize; + short userNumBits; + short numBits; + int numBuckets; + uint sharable : 1; + uint strictAlignment : 1; + uint reserved : 30; + + void *allocateNode(); // ### Qt5 remove me + void *allocateNode(int nodeAlign); + void freeNode(void *node); + QHashData *detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize); // ### Qt5 remove me + QHashData *detach_helper2(void (*node_duplicate)(Node *, void *), void (*node_delete)(Node *), + int nodeSize, int nodeAlign); + void mightGrow(); + bool willGrow(); + void hasShrunk(); + void rehash(int hint); + void free_helper(void (*node_delete)(Node *)); + void destroyAndFree(); // ### Qt5 remove me + Node *firstNode(); +#ifdef QT_QHASH_DEBUG + void dump(); + void checkSanity(); +#endif + static Node *nextNode(Node *node); + static Node *previousNode(Node *node); + + static QHashData shared_null; +}; + +inline void QHashData::mightGrow() // ### Qt 5: eliminate +{ + if (size >= numBuckets) + rehash(numBits + 1); +} + +inline bool QHashData::willGrow() +{ + if (size >= numBuckets) { + rehash(numBits + 1); + return true; + } else { + return false; + } +} + +inline void QHashData::hasShrunk() +{ + if (size <= (numBuckets >> 3) && numBits > userNumBits) { + QT_TRY { + rehash(qMax(int(numBits) - 2, int(userNumBits))); + } QT_CATCH(const std::bad_alloc &) { + // ignore bad allocs - shrinking shouldn't throw. rehash is exception safe. + } + } +} + +inline QHashData::Node *QHashData::firstNode() +{ + Node *e = reinterpret_cast<Node *>(this); + Node **bucket = buckets; + int n = numBuckets; + while (n--) { + if (*bucket != e) + return *bucket; + ++bucket; + } + return e; +} + +struct QHashDummyValue +{ +}; + +inline bool operator==(const QHashDummyValue & /* v1 */, const QHashDummyValue & /* v2 */) +{ + return true; +} + +Q_DECLARE_TYPEINFO(QHashDummyValue, Q_MOVABLE_TYPE | Q_DUMMY_TYPE); + +template <class Key, class T> +struct QHashDummyNode +{ + QHashDummyNode *next; + uint h; + Key key; + + inline QHashDummyNode(const Key &key0) : key(key0) {} +}; + +template <class Key, class T> +struct QHashNode +{ + QHashNode *next; + uint h; + Key key; + T value; + + inline QHashNode(const Key &key0) : key(key0) {} // ### remove in 5.0 + inline QHashNode(const Key &key0, const T &value0) : key(key0), value(value0) {} + inline bool same_key(uint h0, const Key &key0) { return h0 == h && key0 == key; } +}; + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +#define Q_HASH_DECLARE_INT_NODES(key_type) \ + template <class T> \ + struct QHashDummyNode<key_type, T> { \ + QHashDummyNode *next; \ + union { uint h; key_type key; }; \ +\ + inline QHashDummyNode(key_type /* key0 */) {} \ + }; \ +\ + template <class T> \ + struct QHashNode<key_type, T> { \ + QHashNode *next; \ + union { uint h; key_type key; }; \ + T value; \ +\ + inline QHashNode(key_type /* key0 */) {} \ + inline QHashNode(key_type /* key0 */, const T &value0) : value(value0) {} \ + inline bool same_key(uint h0, key_type) { return h0 == h; } \ + } + +#if defined(Q_BYTE_ORDER) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN +Q_HASH_DECLARE_INT_NODES(short); +Q_HASH_DECLARE_INT_NODES(ushort); +#endif +Q_HASH_DECLARE_INT_NODES(int); +Q_HASH_DECLARE_INT_NODES(uint); +#undef Q_HASH_DECLARE_INT_NODES +#endif // QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + +template <class Key, class T> +class QHash +{ + typedef QHashDummyNode<Key, T> DummyNode; + typedef QHashNode<Key, T> Node; + + union { + QHashData *d; + QHashNode<Key, T> *e; + }; + + static inline Node *concrete(QHashData::Node *node) { + return reinterpret_cast<Node *>(node); + } + +#ifdef Q_ALIGNOF + static inline int alignOfNode() { return qMax<int>(sizeof(void*), Q_ALIGNOF(Node)); } + static inline int alignOfDummyNode() { return qMax<int>(sizeof(void*), Q_ALIGNOF(DummyNode)); } +#else + static inline int alignOfNode() { return 0; } + static inline int alignOfDummyNode() { return 0; } +#endif + +public: + inline QHash() : d(&QHashData::shared_null) { d->ref.ref(); } + inline QHash(const QHash<Key, T> &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); } + inline ~QHash() { if (!d->ref.deref()) freeData(d); } + + QHash<Key, T> &operator=(const QHash<Key, T> &other); + + bool operator==(const QHash<Key, T> &other) const; + inline bool operator!=(const QHash<Key, T> &other) const { return !(*this == other); } + + inline int size() const { return d->size; } + + inline bool isEmpty() const { return d->size == 0; } + + inline int capacity() const { return d->numBuckets; } + void reserve(int size); + inline void squeeze() { reserve(1); } + + inline void detach() { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + void clear(); + + int remove(const Key &key); + T take(const Key &key); + + bool contains(const Key &key) const; + const Key key(const T &value) const; + const Key key(const T &value, const Key &defaultKey) const; + const T value(const Key &key) const; + const T value(const Key &key, const T &defaultValue) const; + T &operator[](const Key &key); + const T operator[](const Key &key) const; + + QList<Key> uniqueKeys() const; + QList<Key> keys() const; + QList<Key> keys(const T &value) const; + QList<T> values() const; + QList<T> values(const Key &key) const; + int count(const Key &key) const; + + class const_iterator; + + class iterator + { + friend class const_iterator; + QHashData::Node *i; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + // ### Qt 5: get rid of 'operator Node *' + inline operator Node *() const { return concrete(i); } + inline iterator() : i(0) { } + explicit inline iterator(void *node) : i(reinterpret_cast<QHashData::Node *>(node)) { } + + inline const Key &key() const { return concrete(i)->key; } + inline T &value() const { return concrete(i)->value; } + inline T &operator*() const { return concrete(i)->value; } + inline T *operator->() const { return &concrete(i)->value; } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + + inline iterator &operator++() { + i = QHashData::nextNode(i); + return *this; + } + inline iterator operator++(int) { + iterator r = *this; + i = QHashData::nextNode(i); + return r; + } + inline iterator &operator--() { + i = QHashData::previousNode(i); + return *this; + } + inline iterator operator--(int) { + iterator r = *this; + i = QHashData::previousNode(i); + return r; + } + inline iterator operator+(int j) const + { iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; } + inline iterator operator-(int j) const { return operator+(-j); } + inline iterator &operator+=(int j) { return *this = *this + j; } + inline iterator &operator-=(int j) { return *this = *this - j; } + + // ### Qt 5: not sure this is necessary anymore +#ifdef QT_STRICT_ITERATORS + private: +#else + public: +#endif + inline bool operator==(const const_iterator &o) const + { return i == o.i; } + inline bool operator!=(const const_iterator &o) const + { return i != o.i; } + + private: + // ### Qt 5: remove + inline operator bool() const { return false; } + }; + friend class iterator; + + class const_iterator + { + friend class iterator; + QHashData::Node *i; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + // ### Qt 5: get rid of 'operator Node *' + inline operator Node *() const { return concrete(i); } + inline const_iterator() : i(0) { } + explicit inline const_iterator(void *node) + : i(reinterpret_cast<QHashData::Node *>(node)) { } +#ifdef QT_STRICT_ITERATORS + explicit inline const_iterator(const iterator &o) +#else + inline const_iterator(const iterator &o) +#endif + { i = o.i; } + + inline const Key &key() const { return concrete(i)->key; } + inline const T &value() const { return concrete(i)->value; } + inline const T &operator*() const { return concrete(i)->value; } + inline const T *operator->() const { return &concrete(i)->value; } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + + inline const_iterator &operator++() { + i = QHashData::nextNode(i); + return *this; + } + inline const_iterator operator++(int) { + const_iterator r = *this; + i = QHashData::nextNode(i); + return r; + } + inline const_iterator &operator--() { + i = QHashData::previousNode(i); + return *this; + } + inline const_iterator operator--(int) { + const_iterator r = *this; + i = QHashData::previousNode(i); + return r; + } + inline const_iterator operator+(int j) const + { const_iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; } + inline const_iterator operator-(int j) const { return operator+(-j); } + inline const_iterator &operator+=(int j) { return *this = *this + j; } + inline const_iterator &operator-=(int j) { return *this = *this - j; } + + // ### Qt 5: not sure this is necessary anymore +#ifdef QT_STRICT_ITERATORS + private: + inline bool operator==(const iterator &o) const { return operator==(const_iterator(o)); } + inline bool operator!=(const iterator &o) const { return operator!=(const_iterator(o)); } +#endif + + private: + // ### Qt 5: remove + inline operator bool() const { return false; } + }; + friend class const_iterator; + + // STL style + inline iterator begin() { detach(); return iterator(d->firstNode()); } + inline const_iterator begin() const { return const_iterator(d->firstNode()); } + inline const_iterator constBegin() const { return const_iterator(d->firstNode()); } + inline iterator end() { detach(); return iterator(e); } + inline const_iterator end() const { return const_iterator(e); } + inline const_iterator constEnd() const { return const_iterator(e); } + iterator erase(iterator it); + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline int count() const { return d->size; } + iterator find(const Key &key); + const_iterator find(const Key &key) const; + const_iterator constFind(const Key &key) const; + iterator insert(const Key &key, const T &value); + iterator insertMulti(const Key &key, const T &value); + QHash<Key, T> &unite(const QHash<Key, T> &other); + + // STL compatibility + typedef T mapped_type; + typedef Key key_type; + typedef ptrdiff_t difference_type; + typedef int size_type; + + inline bool empty() const { return isEmpty(); } + +#ifdef QT_QHASH_DEBUG + inline void dump() const { d->dump(); } + inline void checkSanity() const { d->checkSanity(); } +#endif + +private: + void detach_helper(); + void freeData(QHashData *d); + Node **findNode(const Key &key, uint *hp = 0) const; + Node *createNode(uint h, const Key &key, const T &value, Node **nextNode); + void deleteNode(Node *node); + static void deleteNode2(QHashData::Node *node); + + static void duplicateNode(QHashData::Node *originalNode, void *newNode); +}; + + +template <class Key, class T> +Q_INLINE_TEMPLATE void QHash<Key, T>::deleteNode(Node *node) +{ + deleteNode2(reinterpret_cast<QHashData::Node*>(node)); + d->freeNode(node); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE void QHash<Key, T>::deleteNode2(QHashData::Node *node) +{ +#ifdef Q_CC_BOR + concrete(node)->~QHashNode<Key, T>(); +#elif defined(QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION) + concrete(node)->~QHashNode(); +#else + concrete(node)->~Node(); +#endif +} + +template <class Key, class T> +void QHash<Key, T>::duplicateNode(QHashData::Node *node, void *newNode) +{ + Node *concreteNode = concrete(node); + if (QTypeInfo<T>::isDummy) { + (void) new (newNode) DummyNode(concreteNode->key); + } else { + (void) new (newNode) Node(concreteNode->key, concreteNode->value); + } +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QHash<Key, T>::Node * +QHash<Key, T>::createNode(uint ah, const Key &akey, const T &avalue, Node **anextNode) +{ + Node *node; + + if (QTypeInfo<T>::isDummy) { + node = reinterpret_cast<Node *>(new (d->allocateNode(alignOfDummyNode())) DummyNode(akey)); + } else { + node = new (d->allocateNode(alignOfNode())) Node(akey, avalue); + } + + node->h = ah; + node->next = *anextNode; + *anextNode = node; + ++d->size; + return node; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::unite(const QHash<Key, T> &other) +{ + QHash<Key, T> copy(other); + const_iterator it = copy.constEnd(); + while (it != copy.constBegin()) { + --it; + insertMulti(it.key(), it.value()); + } + return *this; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE void QHash<Key, T>::freeData(QHashData *x) +{ + x->free_helper(deleteNode2); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE void QHash<Key, T>::clear() +{ + *this = QHash<Key,T>(); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE void QHash<Key, T>::detach_helper() +{ + QHashData *x = d->detach_helper2(duplicateNode, deleteNode2, + QTypeInfo<T>::isDummy ? sizeof(DummyNode) : sizeof(Node), + QTypeInfo<T>::isDummy ? alignOfDummyNode() : alignOfNode()); + if (!d->ref.deref()) + freeData(d); + d = x; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::operator=(const QHash<Key, T> &other) +{ + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + freeData(d); + d = other.d; + if (!d->sharable) + detach_helper(); + } + return *this; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE const T QHash<Key, T>::value(const Key &akey) const +{ + Node *node; + if (d->size == 0 || (node = *findNode(akey)) == e) { + return T(); + } else { + return node->value; + } +} + +template <class Key, class T> +Q_INLINE_TEMPLATE const T QHash<Key, T>::value(const Key &akey, const T &adefaultValue) const +{ + Node *node; + if (d->size == 0 || (node = *findNode(akey)) == e) { + return adefaultValue; + } else { + return node->value; + } +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::uniqueKeys() const +{ + QList<Key> res; + const_iterator i = begin(); + if (i != end()) { + for (;;) { + const Key &aKey = i.key(); + res.append(aKey); + do { + if (++i == end()) + goto break_out_of_outer_loop; + } while (aKey == i.key()); + } + } +break_out_of_outer_loop: + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::keys() const +{ + QList<Key> res; + const_iterator i = begin(); + while (i != end()) { + res.append(i.key()); + ++i; + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::keys(const T &avalue) const +{ + QList<Key> res; + const_iterator i = begin(); + while (i != end()) { + if (i.value() == avalue) + res.append(i.key()); + ++i; + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE const Key QHash<Key, T>::key(const T &avalue) const +{ + return key(avalue, Key()); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE const Key QHash<Key, T>::key(const T &avalue, const Key &defaultValue) const +{ + const_iterator i = begin(); + while (i != end()) { + if (i.value() == avalue) + return i.key(); + ++i; + } + + return defaultValue; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values() const +{ + QList<T> res; + const_iterator i = begin(); + while (i != end()) { + res.append(i.value()); + ++i; + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values(const Key &akey) const +{ + QList<T> res; + Node *node = *findNode(akey); + if (node != e) { + do { + res.append(node->value); + } while ((node = node->next) != e && node->key == akey); + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE int QHash<Key, T>::count(const Key &akey) const +{ + int cnt = 0; + Node *node = *findNode(akey); + if (node != e) { + do { + ++cnt; + } while ((node = node->next) != e && node->key == akey); + } + return cnt; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE const T QHash<Key, T>::operator[](const Key &akey) const +{ + return value(akey); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE T &QHash<Key, T>::operator[](const Key &akey) +{ + detach(); + + uint h; + Node **node = findNode(akey, &h); + if (*node == e) { + if (d->willGrow()) + node = findNode(akey, &h); + return createNode(h, akey, T(), node)->value; + } + return (*node)->value; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QHash<Key, T>::iterator QHash<Key, T>::insert(const Key &akey, + const T &avalue) +{ + detach(); + + uint h; + Node **node = findNode(akey, &h); + if (*node == e) { + if (d->willGrow()) + node = findNode(akey, &h); + return iterator(createNode(h, akey, avalue, node)); + } + + if (!QTypeInfo<T>::isDummy) + (*node)->value = avalue; + return iterator(*node); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QHash<Key, T>::iterator QHash<Key, T>::insertMulti(const Key &akey, + const T &avalue) +{ + detach(); + d->willGrow(); + + uint h; + Node **nextNode = findNode(akey, &h); + return iterator(createNode(h, akey, avalue, nextNode)); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE int QHash<Key, T>::remove(const Key &akey) +{ + if (isEmpty()) // prevents detaching shared null + return 0; + detach(); + + int oldSize = d->size; + Node **node = findNode(akey); + if (*node != e) { + bool deleteNext = true; + do { + Node *next = (*node)->next; + deleteNext = (next != e && next->key == (*node)->key); + deleteNode(*node); + *node = next; + --d->size; + } while (deleteNext); + d->hasShrunk(); + } + return oldSize - d->size; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE T QHash<Key, T>::take(const Key &akey) +{ + if (isEmpty()) // prevents detaching shared null + return T(); + detach(); + + Node **node = findNode(akey); + if (*node != e) { + T t = (*node)->value; + Node *next = (*node)->next; + deleteNode(*node); + *node = next; + --d->size; + d->hasShrunk(); + return t; + } + return T(); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE typename QHash<Key, T>::iterator QHash<Key, T>::erase(iterator it) +{ + if (it == iterator(e)) + return it; + + iterator ret = it; + ++ret; + + Node *node = it; + Node **node_ptr = reinterpret_cast<Node **>(&d->buckets[node->h % d->numBuckets]); + while (*node_ptr != node) + node_ptr = &(*node_ptr)->next; + *node_ptr = node->next; + deleteNode(node); + --d->size; + return ret; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE void QHash<Key, T>::reserve(int asize) +{ + detach(); + d->rehash(-qMax(asize, 1)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QHash<Key, T>::const_iterator QHash<Key, T>::find(const Key &akey) const +{ + return const_iterator(*findNode(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QHash<Key, T>::const_iterator QHash<Key, T>::constFind(const Key &akey) const +{ + return const_iterator(*findNode(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QHash<Key, T>::iterator QHash<Key, T>::find(const Key &akey) +{ + detach(); + return iterator(*findNode(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE bool QHash<Key, T>::contains(const Key &akey) const +{ + return *findNode(akey) != e; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE typename QHash<Key, T>::Node **QHash<Key, T>::findNode(const Key &akey, + uint *ahp) const +{ + Node **node; + uint h = qHash(akey); + + if (d->numBuckets) { + node = reinterpret_cast<Node **>(&d->buckets[h % d->numBuckets]); + Q_ASSERT(*node == e || (*node)->next); + while (*node != e && !(*node)->same_key(h, akey)) + node = &(*node)->next; + } else { + node = const_cast<Node **>(reinterpret_cast<const Node * const *>(&e)); + } + if (ahp) + *ahp = h; + return node; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE bool QHash<Key, T>::operator==(const QHash<Key, T> &other) const +{ + if (size() != other.size()) + return false; + if (d == other.d) + return true; + + const_iterator it = begin(); + + while (it != end()) { + const Key &akey = it.key(); + + const_iterator it2 = other.find(akey); + do { + if (it2 == other.end() || !(it2.key() == akey)) + return false; + if (!QTypeInfo<T>::isDummy && !(it.value() == it2.value())) + return false; + ++it; + ++it2; + } while (it != end() && it.key() == akey); + } + return true; +} + +template <class Key, class T> +class QMultiHash : public QHash<Key, T> +{ +public: + QMultiHash() {} + QMultiHash(const QHash<Key, T> &other) : QHash<Key, T>(other) {} + + inline typename QHash<Key, T>::iterator replace(const Key &key, const T &value) + { return QHash<Key, T>::insert(key, value); } + + inline typename QHash<Key, T>::iterator insert(const Key &key, const T &value) + { return QHash<Key, T>::insertMulti(key, value); } + + inline QMultiHash &operator+=(const QMultiHash &other) + { unite(other); return *this; } + inline QMultiHash operator+(const QMultiHash &other) const + { QMultiHash result = *this; result += other; return result; } + +#if !defined(Q_NO_USING_KEYWORD) && !defined(Q_CC_RVCT) + // RVCT compiler doesn't handle using-keyword right when used functions are overloaded in child class + using QHash<Key, T>::contains; + using QHash<Key, T>::remove; + using QHash<Key, T>::count; + using QHash<Key, T>::find; + using QHash<Key, T>::constFind; +#else + inline bool contains(const Key &key) const + { return QHash<Key, T>::contains(key); } + inline int remove(const Key &key) + { return QHash<Key, T>::remove(key); } + inline int count(const Key &key) const + { return QHash<Key, T>::count(key); } + inline int count() const + { return QHash<Key, T>::count(); } + inline typename QHash<Key, T>::iterator find(const Key &key) + { return QHash<Key, T>::find(key); } + inline typename QHash<Key, T>::const_iterator find(const Key &key) const + { return QHash<Key, T>::find(key); } + inline typename QHash<Key, T>::const_iterator constFind(const Key &key) const + { return QHash<Key, T>::constFind(key); } +#endif + + bool contains(const Key &key, const T &value) const; + + int remove(const Key &key, const T &value); + + int count(const Key &key, const T &value) const; + + typename QHash<Key, T>::iterator find(const Key &key, const T &value) { + typename QHash<Key, T>::iterator i(find(key)); + typename QHash<Key, T>::iterator end(this->end()); + while (i != end && i.key() == key) { + if (i.value() == value) + return i; + ++i; + } + return end; + } + typename QHash<Key, T>::const_iterator find(const Key &key, const T &value) const { + typename QHash<Key, T>::const_iterator i(constFind(key)); + typename QHash<Key, T>::const_iterator end(QHash<Key, T>::constEnd()); + while (i != end && i.key() == key) { + if (i.value() == value) + return i; + ++i; + } + return end; + } + typename QHash<Key, T>::const_iterator constFind(const Key &key, const T &value) const + { return find(key, value); } +private: + T &operator[](const Key &key); + const T operator[](const Key &key) const; +}; + +template <class Key, class T> +Q_INLINE_TEMPLATE bool QMultiHash<Key, T>::contains(const Key &key, const T &value) const +{ + return constFind(key, value) != QHash<Key, T>::constEnd(); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE int QMultiHash<Key, T>::remove(const Key &key, const T &value) +{ + int n = 0; + typename QHash<Key, T>::iterator i(find(key)); + typename QHash<Key, T>::iterator end(QHash<Key, T>::end()); + while (i != end && i.key() == key) { + if (i.value() == value) { +#if defined(Q_CC_RVCT) + // RVCT has problems with scoping, apparently. + i = QHash<Key, T>::erase(i); +#else + i = erase(i); +#endif + ++n; + } else { + ++i; + } + } + return n; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &key, const T &value) const +{ + int n = 0; + typename QHash<Key, T>::const_iterator i(constFind(key)); + typename QHash<Key, T>::const_iterator end(QHash<Key, T>::constEnd()); + while (i != end && i.key() == key) { + if (i.value() == value) + ++n; + ++i; + } + return n; +} + +Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash) +Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHASH_H diff --git a/qtinterface/qt4/Qt/qheaderview.h b/qtinterface/qt4/Qt/qheaderview.h new file mode 100644 index 0000000..eabab66 --- /dev/null +++ b/qtinterface/qt4/Qt/qheaderview.h @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHEADERVIEW_H +#define QHEADERVIEW_H + +#include <QtGui/qabstractitemview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class QHeaderViewPrivate; +class QStyleOptionHeader; + +class Q_GUI_EXPORT QHeaderView : public QAbstractItemView +{ + Q_OBJECT + Q_PROPERTY(bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown) + Q_PROPERTY(bool highlightSections READ highlightSections WRITE setHighlightSections) + Q_PROPERTY(bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection) + Q_PROPERTY(bool cascadingSectionResizes READ cascadingSectionResizes WRITE setCascadingSectionResizes) + Q_PROPERTY(int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize) + Q_PROPERTY(int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize) + Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment) + Q_ENUMS(ResizeMode) + +public: + + enum ResizeMode + { + Interactive, + Stretch, + Fixed, + ResizeToContents, + Custom = Fixed + }; + + explicit QHeaderView(Qt::Orientation orientation, QWidget *parent = 0); + virtual ~QHeaderView(); + + void setModel(QAbstractItemModel *model); + + Qt::Orientation orientation() const; + int offset() const; + int length() const; + QSize sizeHint() const; + int sectionSizeHint(int logicalIndex) const; + + int visualIndexAt(int position) const; + int logicalIndexAt(int position) const; + + inline int logicalIndexAt(int x, int y) const; + inline int logicalIndexAt(const QPoint &pos) const; + + int sectionSize(int logicalIndex) const; + int sectionPosition(int logicalIndex) const; + int sectionViewportPosition(int logicalIndex) const; + + void moveSection(int from, int to); + void swapSections(int first, int second); + void resizeSection(int logicalIndex, int size); + void resizeSections(QHeaderView::ResizeMode mode); + + bool isSectionHidden(int logicalIndex) const; + void setSectionHidden(int logicalIndex, bool hide); + int hiddenSectionCount() const; + + inline void hideSection(int logicalIndex); + inline void showSection(int logicalIndex); + + int count() const; + int visualIndex(int logicalIndex) const; + int logicalIndex(int visualIndex) const; + + void setMovable(bool movable); + bool isMovable() const; + + void setClickable(bool clickable); + bool isClickable() const; + + void setHighlightSections(bool highlight); + bool highlightSections() const; + + void setResizeMode(ResizeMode mode); + void setResizeMode(int logicalIndex, ResizeMode mode); + ResizeMode resizeMode(int logicalIndex) const; + int stretchSectionCount() const; + + void setSortIndicatorShown(bool show); + bool isSortIndicatorShown() const; + + void setSortIndicator(int logicalIndex, Qt::SortOrder order); + int sortIndicatorSection() const; + Qt::SortOrder sortIndicatorOrder() const; + + bool stretchLastSection() const; + void setStretchLastSection(bool stretch); + + bool cascadingSectionResizes() const; + void setCascadingSectionResizes(bool enable); + + int defaultSectionSize() const; + void setDefaultSectionSize(int size); + + int minimumSectionSize() const; + void setMinimumSectionSize(int size); + + Qt::Alignment defaultAlignment() const; + void setDefaultAlignment(Qt::Alignment alignment); + + void doItemsLayout(); + bool sectionsMoved() const; + bool sectionsHidden() const; + +#ifndef QT_NO_DATASTREAM + QByteArray saveState() const; + bool restoreState(const QByteArray &state); +#endif + + void reset(); + +public Q_SLOTS: + void setOffset(int offset); + void setOffsetToSectionPosition(int visualIndex); + void setOffsetToLastSection(); + void headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast); + +Q_SIGNALS: + void sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex); + void sectionResized(int logicalIndex, int oldSize, int newSize); + void sectionPressed(int logicalIndex); + void sectionClicked(int logicalIndex); + void sectionEntered(int logicalIndex); + void sectionDoubleClicked(int logicalIndex); + void sectionCountChanged(int oldCount, int newCount); + void sectionHandleDoubleClicked(int logicalIndex); + void sectionAutoResize(int logicalIndex, QHeaderView::ResizeMode mode); + void geometriesChanged(); + void sortIndicatorChanged(int logicalIndex, Qt::SortOrder order); + +protected Q_SLOTS: + void updateSection(int logicalIndex); + void resizeSections(); + void sectionsInserted(const QModelIndex &parent, int logicalFirst, int logicalLast); + void sectionsAboutToBeRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast); + +protected: + QHeaderView(QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent = 0); + void initialize(); + + void initializeSections(); + void initializeSections(int start, int end); + void currentChanged(const QModelIndex ¤t, const QModelIndex &old); + + bool event(QEvent *e); + void paintEvent(QPaintEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); + bool viewportEvent(QEvent *e); + + virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; + virtual QSize sectionSizeFromContents(int logicalIndex) const; + + int horizontalOffset() const; + int verticalOffset() const; + void updateGeometries(); + void scrollContentsBy(int dx, int dy); + + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void rowsInserted(const QModelIndex &parent, int start, int end); + + QRect visualRect(const QModelIndex &index) const; + void scrollTo(const QModelIndex &index, ScrollHint hint); + + QModelIndex indexAt(const QPoint &p) const; + bool isIndexHidden(const QModelIndex &index) const; + + QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers); + void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags); + QRegion visualRegionForSelection(const QItemSelection &selection) const; + void initStyleOption(QStyleOptionHeader *option) const; + +private: + Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)) + Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged()) + Q_DECLARE_PRIVATE(QHeaderView) + Q_DISABLE_COPY(QHeaderView) +}; + +inline int QHeaderView::logicalIndexAt(int ax, int ay) const +{ return orientation() == Qt::Horizontal ? logicalIndexAt(ax) : logicalIndexAt(ay); } +inline int QHeaderView::logicalIndexAt(const QPoint &apos) const +{ return logicalIndexAt(apos.x(), apos.y()); } +inline void QHeaderView::hideSection(int alogicalIndex) +{ setSectionHidden(alogicalIndex, true); } +inline void QHeaderView::showSection(int alogicalIndex) +{ setSectionHidden(alogicalIndex, false); } + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHEADERVIEW_H diff --git a/qtinterface/qt4/Qt/qhelp_global.h b/qtinterface/qt4/Qt/qhelp_global.h new file mode 100644 index 0000000..631601d --- /dev/null +++ b/qtinterface/qt4/Qt/qhelp_global.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELP_GLOBAL_H +#define QHELP_GLOBAL_H + +#include <QtCore/qglobal.h> +#include <QtCore/QString> +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +#if !defined(QT_SHARED) && !defined(QT_DLL) +# define QHELP_EXPORT +#elif defined(QHELP_LIB) +# define QHELP_EXPORT Q_DECL_EXPORT +#else +# define QHELP_EXPORT Q_DECL_IMPORT +#endif + +class QHelpGlobal { +public: + static QString uniquifyConnectionName(const QString &name, void *pointer); + static QString documentTitle(const QString &content); + static QString codecFromData(const QByteArray &data); + +private: + static QString codecFromHtmlData(const QByteArray &data); + static QString codecFromXmlData(const QByteArray &data); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHELP_GLOBAL_H diff --git a/qtinterface/qt4/Qt/qhelpcontentwidget.h b/qtinterface/qt4/Qt/qhelpcontentwidget.h new file mode 100644 index 0000000..fed0eaf --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpcontentwidget.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPCONTENTWIDGET_H +#define QHELPCONTENTWIDGET_H + +#include <QtHelp/qhelp_global.h> + +#include <QtCore/QQueue> +#include <QtCore/QString> +#include <QtGui/QTreeView> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QHelpEnginePrivate; +class QHelpDBReader; +class QHelpContentItemPrivate; +class QHelpContentModelPrivate; +class QHelpEngine; +class QHelpContentProvider; + +class QHELP_EXPORT QHelpContentItem +{ +public: + ~QHelpContentItem(); + + QHelpContentItem *child(int row) const; + int childCount() const; + QString title() const; + QUrl url() const; + int row() const; + QHelpContentItem *parent() const; + int childPosition(QHelpContentItem *child) const; + +private: + QHelpContentItem(const QString &name, const QString &link, + QHelpDBReader *reader, QHelpContentItem *parent = 0); + void appendChild(QHelpContentItem *child); + + QHelpContentItemPrivate *d; + friend class QHelpContentProvider; +}; + +class QHELP_EXPORT QHelpContentModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + ~QHelpContentModel(); + + void createContents(const QString &customFilterName); + QHelpContentItem *contentItemAt(const QModelIndex &index) const; + + QVariant data(const QModelIndex &index, int role) const; + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + bool isCreatingContents() const; + +Q_SIGNALS: + void contentsCreationStarted(); + void contentsCreated(); + +private Q_SLOTS: + void insertContents(); + void invalidateContents(bool onShutDown = false); + +private: + QHelpContentModel(QHelpEnginePrivate *helpEngine); + QHelpContentModelPrivate *d; + friend class QHelpEnginePrivate; +}; + +class QHELP_EXPORT QHelpContentWidget : public QTreeView +{ + Q_OBJECT + +public: + QModelIndex indexOf(const QUrl &link); + +Q_SIGNALS: + void linkActivated(const QUrl &link); + +private Q_SLOTS: + void showLink(const QModelIndex &index); + +private: + bool searchContentItem(QHelpContentModel *model, + const QModelIndex &parent, const QString &path); + QModelIndex m_syncIndex; + +private: + QHelpContentWidget(); + friend class QHelpEngine; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qhelpengine.h b/qtinterface/qt4/Qt/qhelpengine.h new file mode 100644 index 0000000..04a6f8c --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpengine.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPENGINE_H +#define QHELPENGINE_H + +#include <QtHelp/qhelpenginecore.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QHelpContentModel; +class QHelpContentWidget; +class QHelpIndexModel; +class QHelpIndexWidget; +class QHelpEnginePrivate; +class QHelpSearchEngine; + +class QHELP_EXPORT QHelpEngine : public QHelpEngineCore +{ + Q_OBJECT + +public: + QHelpEngine(const QString &collectionFile, QObject *parent = 0); + ~QHelpEngine(); + + QHelpContentModel *contentModel() const; + QHelpIndexModel *indexModel() const; + + QHelpContentWidget *contentWidget(); + QHelpIndexWidget *indexWidget(); + + QHelpSearchEngine *searchEngine(); + +private: + QHelpEnginePrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qhelpenginecore.h b/qtinterface/qt4/Qt/qhelpenginecore.h new file mode 100644 index 0000000..de5bff4 --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpenginecore.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPENGINECORE_H +#define QHELPENGINECORE_H + +#include <QtHelp/qhelp_global.h> + +#include <QtCore/QUrl> +#include <QtCore/QMap> +#include <QtCore/QObject> +#include <QtCore/QVariant> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QHelpEngineCorePrivate; + +class QHELP_EXPORT QHelpEngineCore : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool autoSaveFilter READ autoSaveFilter WRITE setAutoSaveFilter) + Q_PROPERTY(QString collectionFile READ collectionFile WRITE setCollectionFile) + Q_PROPERTY(QString currentFilter READ currentFilter WRITE setCurrentFilter) + +public: + QHelpEngineCore(const QString &collectionFile, QObject *parent = 0); + virtual ~QHelpEngineCore(); + + bool setupData(); + + QString collectionFile() const; + void setCollectionFile(const QString &fileName); + + bool copyCollectionFile(const QString &fileName); + + static QString namespaceName(const QString &documentationFileName); + bool registerDocumentation(const QString &documentationFileName); + bool unregisterDocumentation(const QString &namespaceName); + QString documentationFileName(const QString &namespaceName); + + QStringList customFilters() const; + bool removeCustomFilter(const QString &filterName); + bool addCustomFilter(const QString &filterName, + const QStringList &attributes); + + QStringList filterAttributes() const; + QStringList filterAttributes(const QString &filterName) const; + + QString currentFilter() const; + void setCurrentFilter(const QString &filterName); + + QStringList registeredDocumentations() const; + QList<QStringList> filterAttributeSets(const QString &namespaceName) const; + QList<QUrl> files(const QString namespaceName, + const QStringList &filterAttributes, + const QString &extensionFilter = QString()); + QUrl findFile(const QUrl &url) const; + QByteArray fileData(const QUrl &url) const; + + QMap<QString, QUrl> linksForIdentifier(const QString &id) const; + + bool removeCustomValue(const QString &key); + QVariant customValue(const QString &key, + const QVariant &defaultValue = QVariant()) const; + bool setCustomValue(const QString &key, const QVariant &value); + + static QVariant metaData(const QString &documentationFileName, + const QString &name); + + QString error() const; + + void setAutoSaveFilter(bool save); + bool autoSaveFilter() const; + +Q_SIGNALS: + void setupStarted(); + void setupFinished(); + void currentFilterChanged(const QString &newFilter); + void warning(const QString &msg); + +protected: + QHelpEngineCore(QHelpEngineCorePrivate *helpEngineCorePrivate, + QObject *parent); + +private: + QHelpEngineCorePrivate *d; + friend class QHelpEngineCorePrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHELPENGINECORE_H diff --git a/qtinterface/qt4/Qt/qhelpindexwidget.h b/qtinterface/qt4/Qt/qhelpindexwidget.h new file mode 100644 index 0000000..bea098a --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpindexwidget.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPINDEXWIDGET_H +#define QHELPINDEXWIDGET_H + +#include <QtHelp/qhelp_global.h> + +#include <QtCore/QUrl> +#include <QtGui/QStringListModel> +#include <QtGui/QListView> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QHelpEnginePrivate; +class QHelpIndexModelPrivate; + +class QHELP_EXPORT QHelpIndexModel : public QStringListModel +{ + Q_OBJECT + +public: + void createIndex(const QString &customFilterName); + QModelIndex filter(const QString &filter, + const QString &wildcard = QString()); + + QMap<QString, QUrl> linksForKeyword(const QString &keyword) const; + bool isCreatingIndex() const; + +Q_SIGNALS: + void indexCreationStarted(); + void indexCreated(); + +private Q_SLOTS: + void insertIndices(); + void invalidateIndex(bool onShutDown = false); + +private: + QHelpIndexModel(QHelpEnginePrivate *helpEngine); + ~QHelpIndexModel(); + + QHelpIndexModelPrivate *d; + friend class QHelpEnginePrivate; +}; + +class QHELP_EXPORT QHelpIndexWidget : public QListView +{ + Q_OBJECT + +Q_SIGNALS: + void linkActivated(const QUrl &link, const QString &keyword); + void linksActivated(const QMap<QString, QUrl> &links, + const QString &keyword); + +public Q_SLOTS: + void filterIndices(const QString &filter, + const QString &wildcard = QString()); + void activateCurrentItem(); + +private Q_SLOTS: + void showLink(const QModelIndex &index); + +private: + QHelpIndexWidget(); + friend class QHelpEngine; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qhelpsearchengine.h b/qtinterface/qt4/Qt/qhelpsearchengine.h new file mode 100644 index 0000000..0fc5871 --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpsearchengine.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPSEARCHENGINE_H +#define QHELPSEARCHENGINE_H + +#include <QtHelp/qhelp_global.h> + +#include <QtCore/QMap> +#include <QtCore/QUrl> +#include <QtCore/QObject> +#include <QtCore/QString> +#include <QtCore/QStringList> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QHelpEngineCore; +class QHelpSearchQueryWidget; +class QHelpSearchResultWidget; +class QHelpSearchEnginePrivate; + +class QHELP_EXPORT QHelpSearchQuery +{ +public: + enum FieldName { DEFAULT = 0, FUZZY, WITHOUT, PHRASE, ALL, ATLEAST }; + + QHelpSearchQuery() + : fieldName(DEFAULT) { wordList.clear(); } + QHelpSearchQuery(FieldName field, const QStringList &wordList) + : fieldName(field), wordList(wordList) {} + + FieldName fieldName; + QStringList wordList; +}; + +class QHELP_EXPORT QHelpSearchEngine : public QObject +{ + Q_OBJECT + +public: + QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *parent = 0); + ~QHelpSearchEngine(); + + QHelpSearchQueryWidget* queryWidget(); + QHelpSearchResultWidget* resultWidget(); + +#ifdef QT_DEPRECATED + QT_DEPRECATED int hitsCount() const; +#endif + int hitCount() const; + + typedef QPair<QString, QString> SearchHit; + QList<SearchHit> hits(int start, int end) const; + + QList<QHelpSearchQuery> query() const; + +public Q_SLOTS: + void reindexDocumentation(); + void cancelIndexing(); + + void search(const QList<QHelpSearchQuery> &queryList); + void cancelSearching(); + +Q_SIGNALS: + void indexingStarted(); + void indexingFinished(); + + void searchingStarted(); + void searchingFinished(int hits); + +private Q_SLOTS: + void indexDocumentation(); + +private: + QHelpSearchEnginePrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHELPSEARCHENGINE_H diff --git a/qtinterface/qt4/Qt/qhelpsearchquerywidget.h b/qtinterface/qt4/Qt/qhelpsearchquerywidget.h new file mode 100644 index 0000000..55dc505 --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpsearchquerywidget.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPSEARCHQUERYWIDGET_H +#define QHELPSEARCHQUERYWIDGET_H + +#include <QtHelp/qhelp_global.h> +#include <QtHelp/qhelpsearchengine.h> + +#include <QtCore/QMap> +#include <QtCore/QString> +#include <QtCore/QStringList> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QFocusEvent; +class QHelpSearchQueryWidgetPrivate; + +class QHELP_EXPORT QHelpSearchQueryWidget : public QWidget +{ + Q_OBJECT + +public: + QHelpSearchQueryWidget(QWidget *parent = 0); + ~QHelpSearchQueryWidget(); + + QList<QHelpSearchQuery> query() const; + +Q_SIGNALS: + void search(); + +private: + virtual void focusInEvent(QFocusEvent *focusEvent); + virtual void changeEvent(QEvent *event); + +private: + QHelpSearchQueryWidgetPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHELPSEARCHQUERYWIDGET_H diff --git a/qtinterface/qt4/Qt/qhelpsearchresultwidget.h b/qtinterface/qt4/Qt/qhelpsearchresultwidget.h new file mode 100644 index 0000000..425f8d6 --- /dev/null +++ b/qtinterface/qt4/Qt/qhelpsearchresultwidget.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Assistant of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHELPSEARCHRESULTWIDGET_H +#define QHELPSEARCHRESULTWIDGET_H + +#include <QtHelp/qhelpsearchengine.h> +#include <QtHelp/qhelp_global.h> + +#include <QtCore/QUrl> +#include <QtCore/QPoint> +#include <QtCore/QObject> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Help) + +class QHelpSearchResultWidgetPrivate; + +class QHELP_EXPORT QHelpSearchResultWidget : public QWidget +{ + Q_OBJECT + +public: + ~QHelpSearchResultWidget(); + QUrl linkAt(const QPoint &point); + +Q_SIGNALS: + void requestShowLink(const QUrl &url); + +private: + friend class QHelpSearchEngine; + + QHelpSearchResultWidgetPrivate *d; + QHelpSearchResultWidget(QHelpSearchEngine *engine); + virtual void changeEvent(QEvent *event); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHELPSEARCHRESULTWIDGET_H diff --git a/qtinterface/qt4/Qt/qhistorystate.h b/qtinterface/qt4/Qt/qhistorystate.h new file mode 100644 index 0000000..c776a56 --- /dev/null +++ b/qtinterface/qt4/Qt/qhistorystate.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHISTORYSTATE_H +#define QHISTORYSTATE_H + +#include <QtCore/qabstractstate.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QHistoryStatePrivate; +class Q_CORE_EXPORT QHistoryState : public QAbstractState +{ + Q_OBJECT + Q_PROPERTY(QAbstractState* defaultState READ defaultState WRITE setDefaultState) + Q_PROPERTY(HistoryType historyType READ historyType WRITE setHistoryType) + Q_ENUMS(HistoryType) +public: + enum HistoryType { + ShallowHistory, + DeepHistory + }; + + QHistoryState(QState *parent = 0); + QHistoryState(HistoryType type, QState *parent = 0); + ~QHistoryState(); + + QAbstractState *defaultState() const; + void setDefaultState(QAbstractState *state); + + HistoryType historyType() const; + void setHistoryType(HistoryType type); + +protected: + void onEntry(QEvent *event); + void onExit(QEvent *event); + + bool event(QEvent *e); + +private: + Q_DISABLE_COPY(QHistoryState) + Q_DECLARE_PRIVATE(QHistoryState) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qhostaddress.h b/qtinterface/qt4/Qt/qhostaddress.h new file mode 100644 index 0000000..09ddbd0 --- /dev/null +++ b/qtinterface/qt4/Qt/qhostaddress.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHOSTADDRESS_H +#define QHOSTADDRESS_H + +#include <QtCore/qpair.h> +#include <QtCore/qstring.h> +#include <QtCore/qscopedpointer.h> +#include <QtNetwork/qabstractsocket.h> + +struct sockaddr; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QHostAddressPrivate; + +class Q_NETWORK_EXPORT QIPv6Address +{ +public: + inline quint8 &operator [](int index) { return c[index]; } + inline quint8 operator [](int index) const { return c[index]; } + quint8 c[16]; +}; + +typedef QIPv6Address Q_IPV6ADDR; + +class Q_NETWORK_EXPORT QHostAddress +{ +public: + enum SpecialAddress { + Null, + Broadcast, + LocalHost, + LocalHostIPv6, + Any, + AnyIPv6 + }; + + QHostAddress(); + explicit QHostAddress(quint32 ip4Addr); + explicit QHostAddress(quint8 *ip6Addr); + explicit QHostAddress(const Q_IPV6ADDR &ip6Addr); + explicit QHostAddress(const sockaddr *sockaddr); + explicit QHostAddress(const QString &address); + QHostAddress(const QHostAddress ©); + QHostAddress(SpecialAddress address); + ~QHostAddress(); + + QHostAddress &operator=(const QHostAddress &other); + QHostAddress &operator=(const QString &address); + + void setAddress(quint32 ip4Addr); + void setAddress(quint8 *ip6Addr); + void setAddress(const Q_IPV6ADDR &ip6Addr); + void setAddress(const sockaddr *sockaddr); + bool setAddress(const QString &address); + + QAbstractSocket::NetworkLayerProtocol protocol() const; + quint32 toIPv4Address() const; + Q_IPV6ADDR toIPv6Address() const; + + QString toString() const; + + QString scopeId() const; + void setScopeId(const QString &id); + + bool operator ==(const QHostAddress &address) const; + bool operator ==(SpecialAddress address) const; + inline bool operator !=(const QHostAddress &address) const + { return !operator==(address); } + inline bool operator !=(SpecialAddress address) const + { return !operator==(address); } + bool isNull() const; + void clear(); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT quint32 ip4Addr() const { return toIPv4Address(); } + inline QT3_SUPPORT bool isIPv4Address() const { return protocol() == QAbstractSocket::IPv4Protocol + || protocol() == QAbstractSocket::UnknownNetworkLayerProtocol; } + inline QT3_SUPPORT bool isIp4Addr() const { return protocol() == QAbstractSocket::IPv4Protocol + || protocol() == QAbstractSocket::UnknownNetworkLayerProtocol; } + inline QT3_SUPPORT bool isIPv6Address() const { return protocol() == QAbstractSocket::IPv6Protocol; } +#endif + + bool isInSubnet(const QHostAddress &subnet, int netmask) const; + bool isInSubnet(const QPair<QHostAddress, int> &subnet) const; + + static QPair<QHostAddress, int> parseSubnet(const QString &subnet); + +protected: + QScopedPointer<QHostAddressPrivate> d; +}; + +inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddress &address2) +{ return address2 == address1; } + +#ifndef QT_NO_DEBUG_STREAM +Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QHostAddress &); +#endif + + +Q_NETWORK_EXPORT uint qHash(const QHostAddress &key); + +#ifndef QT_NO_DATASTREAM +Q_NETWORK_EXPORT QDataStream &operator<<(QDataStream &, const QHostAddress &); +Q_NETWORK_EXPORT QDataStream &operator>>(QDataStream &, QHostAddress &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER +#endif // QHOSTADDRESS_H diff --git a/qtinterface/qt4/Qt/qhostinfo.h b/qtinterface/qt4/Qt/qhostinfo.h new file mode 100644 index 0000000..d23befe --- /dev/null +++ b/qtinterface/qt4/Qt/qhostinfo.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHOSTINFO_H +#define QHOSTINFO_H + +#include <QtCore/qlist.h> +#include <QtCore/qscopedpointer.h> +#include <QtNetwork/qhostaddress.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QObject; +class QHostInfoPrivate; + +class Q_NETWORK_EXPORT QHostInfo +{ +public: + enum HostInfoError { + NoError, + HostNotFound, + UnknownError + }; + + QHostInfo(int lookupId = -1); + QHostInfo(const QHostInfo &d); + QHostInfo &operator=(const QHostInfo &d); + ~QHostInfo(); + + QString hostName() const; + void setHostName(const QString &name); + + QList<QHostAddress> addresses() const; + void setAddresses(const QList<QHostAddress> &addresses); + + HostInfoError error() const; + void setError(HostInfoError error); + + QString errorString() const; + void setErrorString(const QString &errorString); + + void setLookupId(int id); + int lookupId() const; + + static int lookupHost(const QString &name, QObject *receiver, const char *member); + static void abortHostLookup(int lookupId); + + static QHostInfo fromName(const QString &name); + static QString localHostName(); + static QString localDomainName(); + +private: + QScopedPointer<QHostInfoPrivate> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QHOSTINFO_H diff --git a/qtinterface/qt4/Qt/qhttp.h b/qtinterface/qt4/Qt/qhttp.h new file mode 100644 index 0000000..ed72f36 --- /dev/null +++ b/qtinterface/qt4/Qt/qhttp.h @@ -0,0 +1,315 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $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); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT qint64 readBlock(char *data, quint64 maxlen) + { return read(data, qint64(maxlen)); } +#endif + 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/qtinterface/qt4/Qt/qicon.h b/qtinterface/qt4/Qt/qicon.h new file mode 100644 index 0000000..155854d --- /dev/null +++ b/qtinterface/qt4/Qt/qicon.h @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QICON_H +#define QICON_H + +#include <QtCore/qglobal.h> +#include <QtCore/qsize.h> +#include <QtCore/qlist.h> +#include <QtGui/qpixmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIconPrivate; +class QIconEngine; +class QIconEngineV2; + +class Q_GUI_EXPORT QIcon +{ +public: + enum Mode { Normal, Disabled, Active, Selected }; + enum State { On, Off }; + + QIcon(); + QIcon(const QPixmap &pixmap); + QIcon(const QIcon &other); + explicit QIcon(const QString &fileName); // file or resource name + explicit QIcon(QIconEngine *engine); + explicit QIcon(QIconEngineV2 *engine); + ~QIcon(); + QIcon &operator=(const QIcon &other); + operator QVariant() const; + + QPixmap pixmap(const QSize &size, Mode mode = Normal, State state = Off) const; + inline QPixmap pixmap(int w, int h, Mode mode = Normal, State state = Off) const + { return pixmap(QSize(w, h), mode, state); } + inline QPixmap pixmap(int extent, Mode mode = Normal, State state = Off) const + { return pixmap(QSize(extent, extent), mode, state); } + + QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const; + + void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const; + inline void paint(QPainter *painter, int x, int y, int w, int h, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const + { paint(painter, QRect(x, y, w, h), alignment, mode, state); } + + bool isNull() const; + bool isDetached() const; + void detach(); + + int serialNumber() const; + qint64 cacheKey() const; + + void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off); + void addFile(const QString &fileName, const QSize &size = QSize(), Mode mode = Normal, State state = Off); + + QList<QSize> availableSizes(Mode mode = Normal, State state = Off) const; + + static QIcon fromTheme(const QString &name, const QIcon &fallback = QIcon()); + static bool hasThemeIcon(const QString &name); + + static QStringList themeSearchPaths(); + static void setThemeSearchPaths(const QStringList &searchpath); + + static QString themeName(); + static void setThemeName(const QString &path); + + +#ifdef QT3_SUPPORT + enum Size { Small, Large, Automatic = Small }; + static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size); + static QT3_SUPPORT QSize pixmapSize(Size which); + inline QT3_SUPPORT void reset(const QPixmap &pixmap, Size /*size*/) { *this = QIcon(pixmap); } + inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap, Size, Mode mode = Normal, State state = Off) + { addPixmap(pixmap, mode, state); } + inline QT3_SUPPORT void setPixmap(const QString &fileName, Size, Mode mode = Normal, State state = Off) + { addPixmap(QPixmap(fileName), mode, state); } + QT3_SUPPORT QPixmap pixmap(Size size, Mode mode, State state = Off) const; + QT3_SUPPORT QPixmap pixmap(Size size, bool enabled, State state = Off) const; + QT3_SUPPORT QPixmap pixmap() const; +#endif + + Q_DUMMY_COMPARISON_OPERATOR(QIcon) + +private: + QIconPrivate *d; +#if !defined(QT_NO_DATASTREAM) + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); +#endif + +public: + typedef QIconPrivate * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_SHARED(QIcon) +Q_DECLARE_TYPEINFO(QIcon, Q_MOVABLE_TYPE); + +#if !defined(QT_NO_DATASTREAM) +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); +#endif + +#ifdef QT3_SUPPORT +typedef QIcon QIconSet; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QICON_H diff --git a/qtinterface/qt4/Qt/qiconengine.h b/qtinterface/qt4/Qt/qiconengine.h new file mode 100644 index 0000000..f71c4d1 --- /dev/null +++ b/qtinterface/qt4/Qt/qiconengine.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QICONENGINE_H +#define QICONENGINE_H + +#include <QtCore/qglobal.h> +#include <QtCore/qlist.h> +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QIconEngine +{ +public: + virtual ~QIconEngine(); + virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0; + virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); + virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); + + virtual void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state); + virtual void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state); + +#if 0 + virtual int frameCount(QIcon::Mode fromMode, QIcon::State fromState, QIcon::Mode toMode, QIcon::State toState); + virtual void paintFrame(QPainter *painter, const QRect &rect, int frameNumber, QIcon::Mode fromMode, QIcon::State fromState, QIcon::Mode toMode, QIcon::State toState); +#endif +}; + +// ### Qt 5: move the below into QIconEngine +class Q_GUI_EXPORT QIconEngineV2 : public QIconEngine +{ +public: + virtual QString key() const; + virtual QIconEngineV2 *clone() const; + virtual bool read(QDataStream &in); + virtual bool write(QDataStream &out) const; + virtual void virtual_hook(int id, void *data); + +public: + enum IconEngineHook { AvailableSizesHook = 1 }; + + struct AvailableSizesArgument + { + QIcon::Mode mode; + QIcon::State state; + QList<QSize> sizes; + }; + + // ### Qt 5: make this function const and virtual. + QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal, + QIcon::State state = QIcon::Off); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QICONENGINE_H diff --git a/qtinterface/qt4/Qt/qiconengineplugin.h b/qtinterface/qt4/Qt/qiconengineplugin.h new file mode 100644 index 0000000..bf93032 --- /dev/null +++ b/qtinterface/qt4/Qt/qiconengineplugin.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QICONENGINEPLUGIN_H +#define QICONENGINEPLUGIN_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIconEngine; +class QIconEngineV2; + +struct Q_GUI_EXPORT QIconEngineFactoryInterface : public QFactoryInterface +{ + virtual QIconEngine *create(const QString &filename) = 0; +}; + +#define QIconEngineFactoryInterface_iid \ + "com.trolltech.Qt.QIconEngineFactoryInterface" +Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid) + +class Q_GUI_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QIconEngineFactoryInterface:QFactoryInterface) +public: + QIconEnginePlugin(QObject *parent = 0); + ~QIconEnginePlugin(); + + virtual QStringList keys() const = 0; + virtual QIconEngine *create(const QString &filename) = 0; +}; + +// ### Qt 5: remove version 2 +struct Q_GUI_EXPORT QIconEngineFactoryInterfaceV2 : public QFactoryInterface +{ + virtual QIconEngineV2 *create(const QString &filename = QString()) = 0; +}; + +#define QIconEngineFactoryInterfaceV2_iid \ + "com.trolltech.Qt.QIconEngineFactoryInterfaceV2" +Q_DECLARE_INTERFACE(QIconEngineFactoryInterfaceV2, QIconEngineFactoryInterfaceV2_iid) + +class Q_GUI_EXPORT QIconEnginePluginV2 : public QObject, public QIconEngineFactoryInterfaceV2 +{ + Q_OBJECT + Q_INTERFACES(QIconEngineFactoryInterfaceV2:QFactoryInterface) +public: + QIconEnginePluginV2(QObject *parent = 0); + ~QIconEnginePluginV2(); + + virtual QStringList keys() const = 0; + virtual QIconEngineV2 *create(const QString &filename = QString()) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QICONENGINEPLUGIN_H diff --git a/qtinterface/qt4/Qt/qiconset.h b/qtinterface/qt4/Qt/qiconset.h new file mode 100644 index 0000000..cfb226e --- /dev/null +++ b/qtinterface/qt4/Qt/qiconset.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui/qicon.h> + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3Support) + +QT_END_NAMESPACE diff --git a/qtinterface/qt4/Qt/qimage.h b/qtinterface/qt4/Qt/qimage.h new file mode 100644 index 0000000..b9fc1b7 --- /dev/null +++ b/qtinterface/qt4/Qt/qimage.h @@ -0,0 +1,361 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGE_H +#define QIMAGE_H + +#include <QtGui/qtransform.h> +#include <QtGui/qpaintdevice.h> +#include <QtGui/qrgb.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qrect.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIODevice; +class QStringList; +class QMatrix; +class QTransform; +class QVariant; +template <class T> class QList; +template <class T> class QVector; + +struct QImageData; +class QImageDataMisc; // internal +#ifndef QT_NO_IMAGE_TEXT +class Q_GUI_EXPORT QImageTextKeyLang { +public: + QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } + QImageTextKeyLang() { } + + QByteArray key; + QByteArray lang; + + bool operator< (const QImageTextKeyLang& other) const + { return key < other.key || (key==other.key && lang < other.lang); } + bool operator== (const QImageTextKeyLang& other) const + { return key==other.key && lang==other.lang; } + inline bool operator!= (const QImageTextKeyLang &other) const + { return !operator==(other); } +}; +#endif //QT_NO_IMAGE_TEXT + + +class Q_GUI_EXPORT QImage : public QPaintDevice +{ +public: + enum InvertMode { InvertRgb, InvertRgba }; + enum Format { + Format_Invalid, + Format_Mono, + Format_MonoLSB, + Format_Indexed8, + Format_RGB32, + Format_ARGB32, + Format_ARGB32_Premultiplied, + Format_RGB16, + Format_ARGB8565_Premultiplied, + Format_RGB666, + Format_ARGB6666_Premultiplied, + Format_RGB555, + Format_ARGB8555_Premultiplied, + Format_RGB888, + Format_RGB444, + Format_ARGB4444_Premultiplied, +#if 0 + // reserved for future use + Format_RGB15, + Format_Grayscale16, + Format_Grayscale8, + Format_Grayscale4, + Format_Grayscale4LSB, + Format_Grayscale2, + Format_Grayscale2LSB +#endif +#ifndef qdoc + NImageFormats +#endif + }; + + QImage(); + QImage(const QSize &size, Format format); + QImage(int width, int height, Format format); + QImage(uchar *data, int width, int height, Format format); + QImage(const uchar *data, int width, int height, Format format); + QImage(uchar *data, int width, int height, int bytesPerLine, Format format); + QImage(const uchar *data, int width, int height, int bytesPerLine, Format format); + +#ifndef QT_NO_IMAGEFORMAT_XPM + explicit QImage(const char * const xpm[]); +#endif + explicit QImage(const QString &fileName, const char *format = 0); +#ifndef QT_NO_CAST_FROM_ASCII + explicit QImage(const char *fileName, const char *format = 0); +#endif + + QImage(const QImage &); + ~QImage(); + + QImage &operator=(const QImage &); + bool isNull() const; + + int devType() const; + + bool operator==(const QImage &) const; + bool operator!=(const QImage &) const; + operator QVariant() const; + void detach(); + bool isDetached() const; + + QImage copy(const QRect &rect = QRect()) const; + inline QImage copy(int x, int y, int w, int h) const + { return copy(QRect(x, y, w, h)); } + + Format format() const; + + QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const Q_REQUIRED_RESULT; + QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const Q_REQUIRED_RESULT; + + int width() const; + int height() const; + QSize size() const; + QRect rect() const; + + int depth() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numColors() const; +#endif + int colorCount() const; + + QRgb color(int i) const; + void setColor(int i, QRgb c); +#ifdef QT_DEPRECATED + QT_DEPRECATED void setNumColors(int); +#endif + void setColorCount(int); + + bool allGray() const; + bool isGrayscale() const; + + uchar *bits(); + const uchar *bits() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numBytes() const; +#endif + int byteCount() const; + + uchar *scanLine(int); + const uchar *scanLine(int) const; + int bytesPerLine() const; + + bool valid(int x, int y) const; + bool valid(const QPoint &pt) const; + + int pixelIndex(int x, int y) const; + int pixelIndex(const QPoint &pt) const; + + QRgb pixel(int x, int y) const; + QRgb pixel(const QPoint &pt) const; + + void setPixel(int x, int y, uint index_or_rgb); + void setPixel(const QPoint &pt, uint index_or_rgb); + + QVector<QRgb> colorTable() const; + void setColorTable(const QVector<QRgb> colors); + + void fill(uint pixel); + + bool hasAlphaChannel() const; + void setAlphaChannel(const QImage &alphaChannel); + QImage alphaChannel() const; + QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const; +#ifndef QT_NO_IMAGE_HEURISTIC_MASK + QImage createHeuristicMask(bool clipTight = true) const; +#endif + QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const; + + inline QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const + { return scaled(QSize(w, h), aspectMode, mode); } + QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QMatrix trueMatrix(const QMatrix &, int w, int h); + QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QTransform trueMatrix(const QTransform &, int w, int h); + QImage mirrored(bool horizontally = false, bool vertically = true) const; + QImage rgbSwapped() const; + void invertPixels(InvertMode = InvertRgb); + + + bool load(QIODevice *device, const char* format); + bool load(const QString &fileName, const char* format=0); + bool loadFromData(const uchar *buf, int len, const char *format = 0); + inline bool loadFromData(const QByteArray &data, const char* aformat=0) + { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); } + + bool save(const QString &fileName, const char* format=0, int quality=-1) const; + bool save(QIODevice *device, const char* format=0, int quality=-1) const; + + static QImage fromData(const uchar *data, int size, const char *format = 0); + inline static QImage fromData(const QByteArray &data, const char *format = 0) + { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); } + + int serialNumber() const; + qint64 cacheKey() const; + + QPaintEngine *paintEngine() const; + + // Auxiliary data + int dotsPerMeterX() const; + int dotsPerMeterY() const; + void setDotsPerMeterX(int); + void setDotsPerMeterY(int); + QPoint offset() const; + void setOffset(const QPoint&); +#ifndef QT_NO_IMAGE_TEXT + QStringList textKeys() const; + QString text(const QString &key = QString()) const; + void setText(const QString &key, const QString &value); + + // The following functions are obsolete as of 4.1 + QString text(const char* key, const char* lang=0) const; + QList<QImageTextKeyLang> textList() const; + QStringList textLanguages() const; + QString text(const QImageTextKeyLang&) const; + void setText(const char* key, const char* lang, const QString&); +#endif + +#ifdef QT3_SUPPORT + enum Endian { BigEndian, LittleEndian, IgnoreEndian }; + QT3_SUPPORT_CONSTRUCTOR QImage(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + QT3_SUPPORT_CONSTRUCTOR QImage(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, const QRgb *colortable, int numColors, Endian bitOrder); +#ifdef Q_WS_QWS + QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, int pbl, const QRgb *colortable, int numColors, Endian bitOrder); +#endif + inline QT3_SUPPORT Endian bitOrder() const { + Format f = format(); + return f == Format_Mono ? BigEndian : (f == Format_MonoLSB ? LittleEndian : IgnoreEndian); + } + QT3_SUPPORT QImage convertDepth(int, Qt::ImageConversionFlags flags = Qt::AutoColor) const; + QT3_SUPPORT QImage convertDepthWithPalette(int, QRgb* p, int pc, Qt::ImageConversionFlags flags = Qt::AutoColor) const; + QT3_SUPPORT QImage convertBitOrder(Endian) const; + QT3_SUPPORT bool hasAlphaBuffer() const; + QT3_SUPPORT void setAlphaBuffer(bool); + QT3_SUPPORT uchar **jumpTable(); + QT3_SUPPORT const uchar * const *jumpTable() const; + inline QT3_SUPPORT void reset() { *this = QImage(); } + static inline QT3_SUPPORT Endian systemByteOrder() + { return QSysInfo::ByteOrder == QSysInfo::BigEndian ? BigEndian : LittleEndian; } + inline QT3_SUPPORT QImage swapRGB() const { return rgbSwapped(); } + inline QT3_SUPPORT QImage mirror(bool horizontally = false, bool vertically = true) const + { return mirrored(horizontally, vertically); } + QT3_SUPPORT bool create(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + QT3_SUPPORT bool create(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + inline QT3_SUPPORT QImage xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } + inline QT3_SUPPORT QImage smoothScale(int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const + { return scaled(QSize(w, h), mode, Qt::SmoothTransformation); } + inline QImage QT3_SUPPORT smoothScale(const QSize &s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const + { return scaled(s, mode, Qt::SmoothTransformation); } + inline QT3_SUPPORT QImage scaleWidth(int w) const { return scaledToWidth(w); } + inline QT3_SUPPORT QImage scaleHeight(int h) const { return scaledToHeight(h); } + inline QT3_SUPPORT void invertPixels(bool invertAlpha) { invertAlpha ? invertPixels(InvertRgba) : invertPixels(InvertRgb); } + inline QT3_SUPPORT QImage copy(int x, int y, int w, int h, Qt::ImageConversionFlags) const + { return copy(QRect(x, y, w, h)); } + inline QT3_SUPPORT QImage copy(const QRect &rect, Qt::ImageConversionFlags) const + { return copy(rect); } + static QT3_SUPPORT Endian systemBitOrder(); + inline QT3_SUPPORT_CONSTRUCTOR QImage(const QByteArray &data) + { d = 0; *this = QImage::fromData(data); } +#endif + +protected: + virtual int metric(PaintDeviceMetric metric) const; + +private: + friend class QWSOnScreenSurface; + QImageData *d; + + friend class QRasterPixmapData; + 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; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_SHARED(QImage) +Q_DECLARE_TYPEINFO(QImage, Q_MOVABLE_TYPE); + +// Inline functions... + +Q_GUI_EXPORT_INLINE bool QImage::valid(const QPoint &pt) const { return valid(pt.x(), pt.y()); } +Q_GUI_EXPORT_INLINE int QImage::pixelIndex(const QPoint &pt) const { return pixelIndex(pt.x(), pt.y());} +Q_GUI_EXPORT_INLINE QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); } +Q_GUI_EXPORT_INLINE void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); } + +// QImage stream functions + +#if !defined(QT_NO_DATASTREAM) +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &); +#endif + +#ifdef QT3_SUPPORT +Q_GUI_EXPORT QT3_SUPPORT void bitBlt(QImage* dst, int dx, int dy, const QImage* src, + int sx=0, int sy=0, int sw=-1, int sh=-1, Qt::ImageConversionFlags flags = Qt::AutoColor); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QIMAGE_H diff --git a/qtinterface/qt4/Qt/qimageiohandler.h b/qtinterface/qt4/Qt/qimageiohandler.h new file mode 100644 index 0000000..4c5fb1f --- /dev/null +++ b/qtinterface/qt4/Qt/qimageiohandler.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGEIOHANDLER_H +#define QIMAGEIOHANDLER_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QImage; +class QRect; +class QSize; +class QVariant; + +class QImageIOHandlerPrivate; +class Q_GUI_EXPORT QImageIOHandler +{ + Q_DECLARE_PRIVATE(QImageIOHandler) +public: + QImageIOHandler(); + virtual ~QImageIOHandler(); + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setFormat(const QByteArray &format); + void setFormat(const QByteArray &format) const; + QByteArray format() const; + + virtual QByteArray name() const; + + virtual bool canRead() const = 0; + virtual bool read(QImage *image) = 0; + virtual bool write(const QImage &image); + + enum ImageOption { + Size, + ClipRect, + Description, + ScaledClipRect, + ScaledSize, + CompressionRatio, + Gamma, + Quality, + Name, + SubType, + IncrementalReading, + Endianness, + Animation, + BackgroundColor, + ImageFormat + }; + virtual QVariant option(ImageOption option) const; + virtual void setOption(ImageOption option, const QVariant &value); + virtual bool supportsOption(ImageOption option) const; + + // incremental loading + virtual bool jumpToNextImage(); + virtual bool jumpToImage(int imageNumber); + virtual int loopCount() const; + virtual int imageCount() const; + virtual int nextImageDelay() const; + virtual int currentImageNumber() const; + virtual QRect currentImageRect() const; + +protected: + QImageIOHandler(QImageIOHandlerPrivate &dd); + QScopedPointer<QImageIOHandlerPrivate> d_ptr; +private: + Q_DISABLE_COPY(QImageIOHandler) +}; + +struct Q_GUI_EXPORT QImageIOHandlerFactoryInterface : public QFactoryInterface +{ + virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0; +}; + +#define QImageIOHandlerFactoryInterface_iid "com.trolltech.Qt.QImageIOHandlerFactoryInterface" +Q_DECLARE_INTERFACE(QImageIOHandlerFactoryInterface, QImageIOHandlerFactoryInterface_iid) + +class Q_GUI_EXPORT QImageIOPlugin : public QObject, public QImageIOHandlerFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QImageIOHandlerFactoryInterface:QFactoryInterface) +public: + explicit QImageIOPlugin(QObject *parent = 0); + virtual ~QImageIOPlugin(); + + enum Capability { + CanRead = 0x1, + CanWrite = 0x2, + CanReadIncremental = 0x4 + }; + Q_DECLARE_FLAGS(Capabilities, Capability) + + virtual Capabilities capabilities(QIODevice *device, const QByteArray &format) const = 0; + virtual QStringList keys() const = 0; + virtual QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const = 0; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QImageIOPlugin::Capabilities) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QIMAGEIOHANDLER_H diff --git a/qtinterface/qt4/Qt/qimagereader.h b/qtinterface/qt4/Qt/qimagereader.h new file mode 100644 index 0000000..c32c89b --- /dev/null +++ b/qtinterface/qt4/Qt/qimagereader.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGEREADER_H +#define QIMAGEREADER_H + +#include <QtCore/qbytearray.h> +#include <QtGui/qimage.h> +#include <QtGui/qimageiohandler.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QColor; +class QIODevice; +class QRect; +class QSize; +class QStringList; + +class QImageReaderPrivate; +class Q_GUI_EXPORT QImageReader +{ +public: + enum ImageReaderError { + UnknownError, + FileNotFoundError, + DeviceError, + UnsupportedFormatError, + InvalidDataError + }; + + QImageReader(); + explicit QImageReader(QIODevice *device, const QByteArray &format = QByteArray()); + explicit QImageReader(const QString &fileName, const QByteArray &format = QByteArray()); + ~QImageReader(); + + void setFormat(const QByteArray &format); + QByteArray format() const; + + void setAutoDetectImageFormat(bool enabled); + bool autoDetectImageFormat() const; + + void setDecideFormatFromContent(bool ignored); + bool decideFormatFromContent() const; + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setFileName(const QString &fileName); + QString fileName() const; + + QSize size() const; + + QImage::Format imageFormat() const; + + QStringList textKeys() const; + QString text(const QString &key) const; + + void setClipRect(const QRect &rect); + QRect clipRect() const; + + void setScaledSize(const QSize &size); + QSize scaledSize() const; + + void setQuality(int quality); + int quality() const; + + void setScaledClipRect(const QRect &rect); + QRect scaledClipRect() const; + + void setBackgroundColor(const QColor &color); + QColor backgroundColor() const; + + bool supportsAnimation() const; + + bool canRead() const; + QImage read(); + bool read(QImage *image); + + bool jumpToNextImage(); + bool jumpToImage(int imageNumber); + int loopCount() const; + int imageCount() const; + int nextImageDelay() const; + int currentImageNumber() const; + QRect currentImageRect() const; + + ImageReaderError error() const; + QString errorString() const; + + bool supportsOption(QImageIOHandler::ImageOption option) const; + + static QByteArray imageFormat(const QString &fileName); + static QByteArray imageFormat(QIODevice *device); + static QList<QByteArray> supportedImageFormats(); + +private: + Q_DISABLE_COPY(QImageReader) + QImageReaderPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QIMAGEREADER_H diff --git a/qtinterface/qt4/Qt/qimagewriter.h b/qtinterface/qt4/Qt/qimagewriter.h new file mode 100644 index 0000000..e469be7 --- /dev/null +++ b/qtinterface/qt4/Qt/qimagewriter.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGEWRITER_H +#define QIMAGEWRITER_H + +#include <QtCore/qbytearray.h> +#include <QtCore/qlist.h> +#include <QtGui/qimageiohandler.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIODevice; +class QImage; + +class QImageWriterPrivate; +class Q_GUI_EXPORT QImageWriter +{ +public: + enum ImageWriterError { + UnknownError, + DeviceError, + UnsupportedFormatError + }; + + QImageWriter(); + explicit QImageWriter(QIODevice *device, const QByteArray &format); + explicit QImageWriter(const QString &fileName, const QByteArray &format = QByteArray()); + ~QImageWriter(); + + void setFormat(const QByteArray &format); + QByteArray format() const; + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setFileName(const QString &fileName); + QString fileName() const; + + void setQuality(int quality); + int quality() const; + + void setCompression(int compression); + int compression() const; + + void setGamma(float gamma); + float gamma() const; + + // Obsolete as of 4.1 + void setDescription(const QString &description); + QString description() const; + + void setText(const QString &key, const QString &text); + + bool canWrite() const; + bool write(const QImage &image); + + ImageWriterError error() const; + QString errorString() const; + + bool supportsOption(QImageIOHandler::ImageOption option) const; + + static QList<QByteArray> supportedImageFormats(); + +private: + Q_DISABLE_COPY(QImageWriter) + QImageWriterPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QIMAGEWRITER_H diff --git a/qtinterface/qt4/Qt/qinputcontext.h b/qtinterface/qt4/Qt/qinputcontext.h new file mode 100644 index 0000000..510be1f --- /dev/null +++ b/qtinterface/qt4/Qt/qinputcontext.h @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Definition of QInputContext class +** +** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. +** +** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own +** license. You may use this file under your Qt license. Following +** description is copied from their original file headers. Contact +** immodule-qt@freedesktop.org if any conditions of this licensing are +** not clear to you. +** +****************************************************************************/ + +#ifndef QINPUTCONTEXT_H +#define QINPUTCONTEXT_H + +#include <QtCore/qobject.h> +#include <QtCore/qglobal.h> +#include <QtGui/qevent.h> +#include <QtCore/qstring.h> +#include <QtCore/qlist.h> +#include <QtGui/qaction.h> + +#ifndef QT_NO_IM + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; +class QFont; +class QPopupMenu; +class QInputContextPrivate; +#ifdef Q_OS_SYMBIAN +class QSymbianEvent; +#endif + +class Q_GUI_EXPORT QInputContext : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QInputContext) +public: + explicit QInputContext(QObject* parent = 0); + virtual ~QInputContext(); + + virtual QString identifierName() = 0; + virtual QString language() = 0; + + virtual void reset() = 0; + virtual void update(); + + virtual void mouseHandler( int x, QMouseEvent *event); + virtual QFont font() const; + virtual bool isComposing() const = 0; + + QWidget *focusWidget() const; + virtual void setFocusWidget( QWidget *w ); + + virtual void widgetDestroyed(QWidget *w); + + virtual QList<QAction *> actions(); + +#if defined(Q_WS_X11) + virtual bool x11FilterEvent( QWidget *keywidget, XEvent *event ); +#endif // Q_WS_X11 +#if defined(Q_OS_SYMBIAN) + virtual bool symbianFilterEvent( QWidget *keywidget, const QSymbianEvent *event ); +#endif // Q_OS_SYMBIAN + virtual bool filterEvent( const QEvent *event ); + + void sendEvent(const QInputMethodEvent &event); + + enum StandardFormat { + PreeditFormat, + SelectionFormat + }; + QTextFormat standardFormat(StandardFormat s) const; +private: + friend class QWidget; + friend class QWidgetPrivate; + friend class QInputContextFactory; + friend class QApplication; +private: // Disabled copy constructor and operator= + QInputContext( const QInputContext & ); + QInputContext &operator=( const QInputContext & ); + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //Q_NO_IM + +#endif // QINPUTCONTEXT_H diff --git a/qtinterface/qt4/Qt/qinputcontextfactory.h b/qtinterface/qt4/Qt/qinputcontextfactory.h new file mode 100644 index 0000000..cabfe08 --- /dev/null +++ b/qtinterface/qt4/Qt/qinputcontextfactory.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Definition of QInputContextFactory class +** +** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. +** +** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own +** license. You may use this file under your Qt license. Following +** description is copied from their original file headers. Contact +** immodule-qt@freedesktop.org if any conditions of this licensing are +** not clear to you. +** +****************************************************************************/ + +#ifndef QINPUTCONTEXTFACTORY_H +#define QINPUTCONTEXTFACTORY_H + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_IM + +class QInputContext; +class QWidget; + +class Q_GUI_EXPORT QInputContextFactory +{ +public: + static QStringList keys(); + static QInputContext *create( const QString &key, QObject *parent ); // should be a toplevel widget + static QStringList languages( const QString &key ); + static QString displayName( const QString &key ); + static QString description( const QString &key ); +}; + +#endif // QT_NO_IM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QINPUTCONTEXTFACTORY_H diff --git a/qtinterface/qt4/Qt/qinputcontextplugin.h b/qtinterface/qt4/Qt/qinputcontextplugin.h new file mode 100644 index 0000000..3c18ac0 --- /dev/null +++ b/qtinterface/qt4/Qt/qinputcontextplugin.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Definition of QInputContextPlugin class +** +** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. +** +** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own +** license. You may use this file under your Qt license. Following +** description is copied from their original file headers. Contact +** immodule-qt@freedesktop.org if any conditions of this licensing are +** not clear to you. +** +****************************************************************************/ + +#ifndef QINPUTCONTEXTPLUGIN_H +#define QINPUTCONTEXTPLUGIN_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_IM) + +class QInputContext; +class QInputContextPluginPrivate; + +struct Q_GUI_EXPORT QInputContextFactoryInterface : public QFactoryInterface +{ + virtual QInputContext *create( const QString &key ) = 0; + virtual QStringList languages( const QString &key ) = 0; + virtual QString displayName( const QString &key ) = 0; + virtual QString description( const QString &key ) = 0; +}; + +#define QInputContextFactoryInterface_iid "com.trolltech.Qt.QInputContextFactoryInterface" +Q_DECLARE_INTERFACE(QInputContextFactoryInterface, QInputContextFactoryInterface_iid) + +class Q_GUI_EXPORT QInputContextPlugin : public QObject, public QInputContextFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QInputContextFactoryInterface:QFactoryInterface) +public: + explicit QInputContextPlugin(QObject *parent = 0); + ~QInputContextPlugin(); + + virtual QStringList keys() const = 0; + virtual QInputContext *create( const QString &key ) = 0; + virtual QStringList languages( const QString &key ) = 0; + virtual QString displayName( const QString &key ) = 0; + virtual QString description( const QString &key ) = 0; +}; + +#endif // QT_NO_IM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QINPUTCONTEXTPLUGIN_H diff --git a/qtinterface/qt4/Qt/qinputdialog.h b/qtinterface/qt4/Qt/qinputdialog.h new file mode 100644 index 0000000..e4eeaa7 --- /dev/null +++ b/qtinterface/qt4/Qt/qinputdialog.h @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QINPUTDIALOG_H +#define QINPUTDIALOG_H + +#include <QtGui/qdialog.h> +#include <QtCore/qstring.h> +#include <QtGui/qlineedit.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_INPUTDIALOG + +class QInputDialogPrivate; + +class Q_GUI_EXPORT QInputDialog : public QDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QInputDialog) +// Q_ENUMS(InputMode InputDialogOption) + QDOC_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) + QDOC_PROPERTY(QString labelText READ labelText WRITE setLabelText) + QDOC_PROPERTY(InputDialogOptions options READ options WRITE setOptions) + QDOC_PROPERTY(QString textValue READ textValue WRITE setTextValue NOTIFY textValueChanged) + QDOC_PROPERTY(int intValue READ intValue WRITE setIntValue NOTIFY intValueChanged) + QDOC_PROPERTY(int doubleValue READ doubleValue WRITE setDoubleValue NOTIFY doubleValueChanged) + QDOC_PROPERTY(QLineEdit::EchoMode textEchoMode READ textEchoMode WRITE setTextEchoMode) + QDOC_PROPERTY(bool comboBoxEditable READ isComboBoxEditable WRITE setComboBoxEditable) + QDOC_PROPERTY(QStringList comboBoxItems READ comboBoxItems WRITE setComboBoxItems) + QDOC_PROPERTY(int intMinimum READ intMinimum WRITE setIntMinimum) + QDOC_PROPERTY(int intMaximum READ intMaximum WRITE setIntMaximum) + QDOC_PROPERTY(int intStep READ intStep WRITE setIntStep) + QDOC_PROPERTY(double doubleMinimum READ doubleMinimum WRITE setDoubleMinimum) + QDOC_PROPERTY(double doubleMaximum READ doubleMaximum WRITE setDoubleMaximum) + QDOC_PROPERTY(int doubleDecimals READ doubleDecimals WRITE setDoubleDecimals) + QDOC_PROPERTY(QString okButtonText READ okButtonText WRITE setOkButtonText) + QDOC_PROPERTY(QString cancelButtonText READ cancelButtonText WRITE setCancelButtonText) + +public: + enum InputDialogOption { + NoButtons = 0x00000001, + UseListViewForComboBoxItems = 0x00000002 + }; + + Q_DECLARE_FLAGS(InputDialogOptions, InputDialogOption) + + enum InputMode { + TextInput, + IntInput, + DoubleInput + }; + + QInputDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QInputDialog(); + + void setInputMode(InputMode mode); + InputMode inputMode() const; + + void setLabelText(const QString &text); + QString labelText() const; + + void setOption(InputDialogOption option, bool on = true); + bool testOption(InputDialogOption option) const; + void setOptions(InputDialogOptions options); + InputDialogOptions options() const; + + void setTextValue(const QString &text); + QString textValue() const; + + void setTextEchoMode(QLineEdit::EchoMode mode); + QLineEdit::EchoMode textEchoMode() const; + + void setComboBoxEditable(bool editable); + bool isComboBoxEditable() const; + + void setComboBoxItems(const QStringList &items); + QStringList comboBoxItems() const; + + void setIntValue(int value); + int intValue() const; + + void setIntMinimum(int min); + int intMinimum() const; + + void setIntMaximum(int max); + int intMaximum() const; + + void setIntRange(int min, int max); + + void setIntStep(int step); + int intStep() const; + + void setDoubleValue(double value); + double doubleValue() const; + + void setDoubleMinimum(double min); + double doubleMinimum() const; + + void setDoubleMaximum(double max); + double doubleMaximum() const; + + void setDoubleRange(double min, double max); + + void setDoubleDecimals(int decimals); + int doubleDecimals() const; + + void setOkButtonText(const QString &text); + QString okButtonText() const; + + void setCancelButtonText(const QString &text); + QString cancelButtonText() const; + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + + QSize minimumSizeHint() const; + QSize sizeHint() const; + + void setVisible(bool visible); + + static QString getText(QWidget *parent, const QString &title, const QString &label, + QLineEdit::EchoMode echo = QLineEdit::Normal, + const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0); + static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0, + int minValue = -2147483647, int maxValue = 2147483647, + int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0); + static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0, + double minValue = -2147483647, double maxValue = 2147483647, + int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = 0); + static QString getItem(QWidget *parent, const QString &title, const QString &label, + const QStringList &items, int current = 0, bool editable = true, + bool *ok = 0, Qt::WindowFlags flags = 0); + + // obsolete + static int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0, + int minValue = -2147483647, int maxValue = 2147483647, + int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0); + +#ifdef QT3_SUPPORT + inline static QT3_SUPPORT QString getText(const QString &title, const QString &label, + QLineEdit::EchoMode echo = QLineEdit::Normal, + const QString &text = QString(), bool *ok = 0, + QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) + { return getText(parent, title, label, echo, text, ok, flags); } + inline static QT3_SUPPORT int getInteger(const QString &title, const QString &label, int value = 0, + int minValue = -2147483647, int maxValue = 2147483647, + int step = 1, bool *ok = 0, + QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) + { return getInteger(parent, title, label, value, minValue, maxValue, step, ok, flags); } + inline static QT3_SUPPORT double getDouble(const QString &title, const QString &label, double value = 0, + double minValue = -2147483647, double maxValue = 2147483647, + int decimals = 1, bool *ok = 0, + QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) + { return getDouble(parent, title, label, value, minValue, maxValue, decimals, ok, flags); } + inline static QT3_SUPPORT QString getItem(const QString &title, const QString &label, const QStringList &list, + int current = 0, bool editable = true, bool *ok = 0, + QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0) + { return getItem(parent, title, label, list, current, editable, ok, flags); } +#endif + +Q_SIGNALS: + // ### emit signals! + void textValueChanged(const QString &text); + void textValueSelected(const QString &text); + void intValueChanged(int value); + void intValueSelected(int value); + void doubleValueChanged(double value); + void doubleValueSelected(double value); + + +public: + void done(int result); // ### Qt 5: Make protected. + +private: + Q_DISABLE_COPY(QInputDialog) + Q_PRIVATE_SLOT(d_func(), void _q_textChanged(const QString&)) + Q_PRIVATE_SLOT(d_func(), void _q_currentRowChanged(const QModelIndex&, const QModelIndex&)) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions) + +#endif // QT_NO_INPUTDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QINPUTDIALOG_H diff --git a/qtinterface/qt4/Qt/qiodevice.h b/qtinterface/qt4/Qt/qiodevice.h new file mode 100644 index 0000000..d213dd7 --- /dev/null +++ b/qtinterface/qt4/Qt/qiodevice.h @@ -0,0 +1,254 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIODEVICE_H +#define QIODEVICE_H + +#ifndef QT_NO_QOBJECT +#include <QtCore/qobject.h> +#else +#include <QtCore/qobjectdefs.h> +#include <QtCore/qscopedpointer.h> +#endif +#include <QtCore/qstring.h> + +#ifdef open +#error qiodevice.h must be included before any header file that defines open +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QByteArray; +class QIODevicePrivate; + +class Q_CORE_EXPORT QIODevice +#ifndef QT_NO_QOBJECT + : public QObject +#endif +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif +public: + enum OpenModeFlag { + NotOpen = 0x0000, + ReadOnly = 0x0001, + WriteOnly = 0x0002, + ReadWrite = ReadOnly | WriteOnly, + Append = 0x0004, + Truncate = 0x0008, + Text = 0x0010, + Unbuffered = 0x0020 + }; + Q_DECLARE_FLAGS(OpenMode, OpenModeFlag) + + QIODevice(); +#ifndef QT_NO_QOBJECT + explicit QIODevice(QObject *parent); +#endif + virtual ~QIODevice(); + + OpenMode openMode() const; + + void setTextModeEnabled(bool enabled); + bool isTextModeEnabled() const; + + bool isOpen() const; + bool isReadable() const; + bool isWritable() const; + virtual bool isSequential() const; + + virtual bool open(OpenMode mode); + virtual void close(); + + // ### Qt 5: pos() and seek() should not be virtual, and + // ### seek() should call a virtual seekData() function. + virtual qint64 pos() const; + virtual qint64 size() const; + virtual bool seek(qint64 pos); + virtual bool atEnd() const; + virtual bool reset(); + + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + + qint64 read(char *data, qint64 maxlen); + QByteArray read(qint64 maxlen); + QByteArray readAll(); + qint64 readLine(char *data, qint64 maxlen); + QByteArray readLine(qint64 maxlen = 0); + virtual bool canReadLine() const; + + qint64 write(const char *data, qint64 len); + qint64 write(const char *data); + inline qint64 write(const QByteArray &data) + { return write(data.constData(), data.size()); } + + qint64 peek(char *data, qint64 maxlen); + QByteArray peek(qint64 maxlen); + + virtual bool waitForReadyRead(int msecs); + virtual bool waitForBytesWritten(int msecs); + + void ungetChar(char c); + bool putChar(char c); + bool getChar(char *c); + + QString errorString() const; + +#ifndef QT_NO_QOBJECT +Q_SIGNALS: + void readyRead(); + void bytesWritten(qint64 bytes); + void aboutToClose(); + void readChannelFinished(); +#endif + +protected: +#ifdef QT_NO_QOBJECT + QIODevice(QIODevicePrivate &dd); +#else + QIODevice(QIODevicePrivate &dd, QObject *parent = 0); +#endif + virtual qint64 readData(char *data, qint64 maxlen) = 0; + virtual qint64 readLineData(char *data, qint64 maxlen); + virtual qint64 writeData(const char *data, qint64 len) = 0; + + void setOpenMode(OpenMode openMode); + + void setErrorString(const QString &errorString); + +#ifdef QT_NO_QOBJECT + QScopedPointer<QIODevicePrivate> d_ptr; +#endif + +private: + Q_DECLARE_PRIVATE(QIODevice) + Q_DISABLE_COPY(QIODevice) + +#ifdef QT3_SUPPORT +public: + typedef qint64 Offset; + + inline QT3_SUPPORT int flags() const { return static_cast<int>(openMode()); } + inline QT3_SUPPORT int mode() const { return static_cast<int>(openMode()); } + inline QT3_SUPPORT int state() const; + + inline QT3_SUPPORT bool isDirectAccess() const { return !isSequential(); } + inline QT3_SUPPORT bool isSequentialAccess() const { return isSequential(); } + inline QT3_SUPPORT bool isCombinedAccess() const { return false; } + inline QT3_SUPPORT bool isBuffered() const { return true; } + inline QT3_SUPPORT bool isRaw() const { return false; } + inline QT3_SUPPORT bool isSynchronous() const { return true; } + inline QT3_SUPPORT bool isAsynchronous() const { return false; } + inline QT3_SUPPORT bool isTranslated() const { return (openMode() & Text) != 0; } + inline QT3_SUPPORT bool isInactive() const { return !isOpen(); } + + typedef int Status; + QT3_SUPPORT Status status() const; + QT3_SUPPORT void resetStatus(); + + inline QT3_SUPPORT Offset at() const { return pos(); } + inline QT3_SUPPORT bool at(Offset offset) { return seek(offset); } + + inline QT3_SUPPORT qint64 readBlock(char *data, quint64 maxlen) { return read(data, maxlen); } + inline QT3_SUPPORT qint64 writeBlock(const char *data, quint64 len) { return write(data, len); } + inline QT3_SUPPORT qint64 writeBlock(const QByteArray &data) { return write(data); } + + inline QT3_SUPPORT int getch() { char c; return getChar(&c) ? int(uchar(c)) : -1; } + inline QT3_SUPPORT int putch(int c) { return putChar(char(c)) ? int(uchar(c)) : -1; } + inline QT3_SUPPORT int ungetch(int c) { ungetChar(uchar(c)); return c; } +#endif +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QIODevice::OpenMode) + +#ifdef QT3_SUPPORT +static QT3_SUPPORT_VARIABLE const uint IO_Direct = 0x0100; +static QT3_SUPPORT_VARIABLE const uint IO_Sequential = 0x0200; +static QT3_SUPPORT_VARIABLE const uint IO_Combined = 0x0300; +static QT3_SUPPORT_VARIABLE const uint IO_TypeMask = 0x0300; + +static QT3_SUPPORT_VARIABLE const uint IO_Raw = 0x0000; +static QT3_SUPPORT_VARIABLE const uint IO_Async = 0x0000; + +#define IO_ReadOnly QIODevice::ReadOnly +#define IO_WriteOnly QIODevice::WriteOnly +#define IO_ReadWrite QIODevice::ReadWrite +#define IO_Append QIODevice::Append +#define IO_Truncate QIODevice::Truncate +#define IO_Translate QIODevice::Text +#define IO_ModeMask 0x00ff + +static QT3_SUPPORT_VARIABLE const uint IO_Open = 0x1000; +static QT3_SUPPORT_VARIABLE const uint IO_StateMask = 0xf000; + +static QT3_SUPPORT_VARIABLE const uint IO_Ok = 0; +static QT3_SUPPORT_VARIABLE const uint IO_ReadError = 1; +static QT3_SUPPORT_VARIABLE const uint IO_WriteError = 2; +static QT3_SUPPORT_VARIABLE const uint IO_FatalError = 3; +static QT3_SUPPORT_VARIABLE const uint IO_ResourceError = 4; +static QT3_SUPPORT_VARIABLE const uint IO_OpenError = 5; +static QT3_SUPPORT_VARIABLE const uint IO_ConnectError = 5; +static QT3_SUPPORT_VARIABLE const uint IO_AbortError = 6; +static QT3_SUPPORT_VARIABLE const uint IO_TimeOutError = 7; +static QT3_SUPPORT_VARIABLE const uint IO_UnspecifiedError = 8; + +inline QT3_SUPPORT int QIODevice::state() const +{ + return isOpen() ? 0x1000 : 0; +} +#endif + +#if !defined(QT_NO_DEBUG_STREAM) +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, QIODevice::OpenMode modes); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QIODEVICE_H diff --git a/qtinterface/qt4/Qt/qitemdelegate.h b/qtinterface/qt4/Qt/qitemdelegate.h new file mode 100644 index 0000000..635b99f --- /dev/null +++ b/qtinterface/qt4/Qt/qitemdelegate.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QITEMDELEGATE_H +#define QITEMDELEGATE_H + +#include <QtGui/qabstractitemdelegate.h> +#include <QtCore/qstring.h> +#include <QtGui/qpixmap.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class QItemDelegatePrivate; +class QItemEditorFactory; + +class Q_GUI_EXPORT QItemDelegate : public QAbstractItemDelegate +{ + Q_OBJECT + Q_PROPERTY(bool clipping READ hasClipping WRITE setClipping) + +public: + explicit QItemDelegate(QObject *parent = 0); + ~QItemDelegate(); + + bool hasClipping() const; + void setClipping(bool clip); + + // painting + void paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + // editing + QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; + + void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + // editor factory + QItemEditorFactory *itemEditorFactory() const; + void setItemEditorFactory(QItemEditorFactory *factory); + +protected: + virtual void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, + const QRect &rect, const QString &text) const; + virtual void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option, + const QRect &rect, const QPixmap &pixmap) const; + virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option, + const QRect &rect) const; + virtual void drawCheck(QPainter *painter, const QStyleOptionViewItem &option, + const QRect &rect, Qt::CheckState state) const; + void drawBackground(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + void doLayout(const QStyleOptionViewItem &option, + QRect *checkRect, QRect *iconRect, QRect *textRect, bool hint) const; + + QRect rect(const QStyleOptionViewItem &option, const QModelIndex &index, int role) const; + + bool eventFilter(QObject *object, QEvent *event); + bool editorEvent(QEvent *event, QAbstractItemModel *model, + const QStyleOptionViewItem &option, const QModelIndex &index); + + QStyleOptionViewItem setOptions(const QModelIndex &index, + const QStyleOptionViewItem &option) const; + + 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, + const QVariant &variant) const; + QRect textRectangle(QPainter *painter, const QRect &rect, + const QFont &font, const QString &text) const; + +private: + Q_DECLARE_PRIVATE(QItemDelegate) + Q_DISABLE_COPY(QItemDelegate) + + Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) +}; + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QITEMDELEGATE_H diff --git a/qtinterface/qt4/Qt/qitemeditorfactory.h b/qtinterface/qt4/Qt/qitemeditorfactory.h new file mode 100644 index 0000000..fdb304c --- /dev/null +++ b/qtinterface/qt4/Qt/qitemeditorfactory.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QITEMEDITORFACTORY_H +#define QITEMEDITORFACTORY_H + +#include <QtCore/qmetaobject.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qhash.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class QWidget; + +class Q_GUI_EXPORT QItemEditorCreatorBase +{ +public: + virtual ~QItemEditorCreatorBase() {} + + virtual QWidget *createWidget(QWidget *parent) const = 0; + virtual QByteArray valuePropertyName() const = 0; +}; + +template <class T> +class QItemEditorCreator : public QItemEditorCreatorBase +{ +public: + inline QItemEditorCreator(const QByteArray &valuePropertyName); + inline QWidget *createWidget(QWidget *parent) const { return new T(parent); } + inline QByteArray valuePropertyName() const { return propertyName; } + +private: + QByteArray propertyName; +}; + +template <class T> +class QStandardItemEditorCreator: public QItemEditorCreatorBase +{ +public: + inline QStandardItemEditorCreator() + : propertyName(T::staticMetaObject.userProperty().name()) + {} + inline QWidget *createWidget(QWidget *parent) const { return new T(parent); } + inline QByteArray valuePropertyName() const { return propertyName; } + +private: + QByteArray propertyName; +}; + + +template <class T> +Q_INLINE_TEMPLATE QItemEditorCreator<T>::QItemEditorCreator(const QByteArray &avaluePropertyName) + : propertyName(avaluePropertyName) {} + +class Q_GUI_EXPORT QItemEditorFactory +{ +public: + inline QItemEditorFactory() {} + virtual ~QItemEditorFactory(); + + virtual QWidget *createEditor(QVariant::Type type, QWidget *parent) const; + virtual QByteArray valuePropertyName(QVariant::Type type) const; + + void registerEditor(QVariant::Type type, QItemEditorCreatorBase *creator); + + static const QItemEditorFactory *defaultFactory(); + static void setDefaultFactory(QItemEditorFactory *factory); + +private: + QHash<QVariant::Type, QItemEditorCreatorBase *> creatorMap; +}; + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QITEMEDITORFACTORY_H diff --git a/qtinterface/qt4/Qt/qitemselectionmodel.h b/qtinterface/qt4/Qt/qitemselectionmodel.h new file mode 100644 index 0000000..e50e3ef --- /dev/null +++ b/qtinterface/qt4/Qt/qitemselectionmodel.h @@ -0,0 +1,229 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QITEMSELECTIONMODEL_H +#define QITEMSELECTIONMODEL_H + +#include <QtCore/qset.h> +#include <QtCore/qvector.h> +#include <QtCore/qlist.h> +#include <QtCore/qabstractitemmodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class Q_GUI_EXPORT QItemSelectionRange +{ + +public: + inline QItemSelectionRange() {} + inline QItemSelectionRange(const QItemSelectionRange &other) + : tl(other.tl), br(other.br) {} + inline QItemSelectionRange(const QModelIndex &topLeft, const QModelIndex &bottomRight); + explicit inline QItemSelectionRange(const QModelIndex &index) + { tl = index; br = tl; } + + inline int top() const { return tl.row(); } + inline int left() const { return tl.column(); } + inline int bottom() const { return br.row(); } + inline int right() const { return br.column(); } + inline int width() const { return br.column() - tl.column() + 1; } + inline int height() const { return br.row() - tl.row() + 1; } + + inline QModelIndex topLeft() const { return QModelIndex(tl); } + inline QModelIndex bottomRight() const { return QModelIndex(br); } + inline QModelIndex parent() const { return tl.parent(); } + inline const QAbstractItemModel *model() const { return tl.model(); } + + inline bool contains(const QModelIndex &index) const + { + return (parent() == index.parent() + && tl.row() <= index.row() && tl.column() <= index.column() + && br.row() >= index.row() && br.column() >= index.column()); + } + + inline bool contains(int row, int column, const QModelIndex &parentIndex) const + { + return (parent() == parentIndex + && tl.row() <= row && tl.column() <= column + && br.row() >= row && br.column() >= column); + } + + bool intersects(const QItemSelectionRange &other) const; + QItemSelectionRange intersect(const QItemSelectionRange &other) const; // ### Qt 5: make QT4_SUPPORT + inline QItemSelectionRange intersected(const QItemSelectionRange &other) const + { return intersect(other); } + + inline bool operator==(const QItemSelectionRange &other) const + { return (tl == other.tl && br == other.br); } + inline bool operator!=(const QItemSelectionRange &other) const + { return !operator==(other); } + + inline bool isValid() const + { + return (tl.isValid() && br.isValid() && tl.parent() == br.parent() + && top() <= bottom() && left() <= right()); + } + + QModelIndexList indexes() const; + +private: + QPersistentModelIndex tl, br; +}; +Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_MOVABLE_TYPE); + +inline QItemSelectionRange::QItemSelectionRange(const QModelIndex &atopLeft, + const QModelIndex &abottomRight) +{ tl = atopLeft; br = abottomRight; } + +class QItemSelection; +class QItemSelectionModelPrivate; + +class Q_GUI_EXPORT QItemSelectionModel : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QItemSelectionModel) + Q_FLAGS(SelectionFlags) + +public: + + enum SelectionFlag { + NoUpdate = 0x0000, + Clear = 0x0001, + Select = 0x0002, + Deselect = 0x0004, + Toggle = 0x0008, + Current = 0x0010, + Rows = 0x0020, + Columns = 0x0040, + SelectCurrent = Select | Current, + ToggleCurrent = Toggle | Current, + ClearAndSelect = Clear | Select + }; + + Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag) + + explicit QItemSelectionModel(QAbstractItemModel *model); + explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent); + virtual ~QItemSelectionModel(); + + QModelIndex currentIndex() const; + + bool isSelected(const QModelIndex &index) const; + bool isRowSelected(int row, const QModelIndex &parent) const; + bool isColumnSelected(int column, const QModelIndex &parent) const; + + bool rowIntersectsSelection(int row, const QModelIndex &parent) const; + bool columnIntersectsSelection(int column, const QModelIndex &parent) const; + + bool hasSelection() const; + + QModelIndexList selectedIndexes() const; + QModelIndexList selectedRows(int column = 0) const; + QModelIndexList selectedColumns(int row = 0) const; + const QItemSelection selection() const; + + const QAbstractItemModel *model() const; + +public Q_SLOTS: + void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command); + virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command); + virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command); + virtual void clear(); + virtual void reset(); + + void clearSelection(); + +Q_SIGNALS: + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + void currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous); + void currentColumnChanged(const QModelIndex ¤t, const QModelIndex &previous); + +protected: + QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model); + void emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection); + +private: + Q_DISABLE_COPY(QItemSelectionModel) + Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeRemoved(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeInserted(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeInserted(const QModelIndex&, int, int)) + Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) +}; + +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_GUI_EXPORT QItemSelection : public QList<QItemSelectionRange> +{ +public: + QItemSelection() {} + QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void select(const QModelIndex &topLeft, const QModelIndex &bottomRight); + bool contains(const QModelIndex &index) const; + QModelIndexList indexes() const; + void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command); + static void split(const QItemSelectionRange &range, + const QItemSelectionRange &other, + QItemSelection *result); +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &); +#endif + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QITEMSELECTIONMODEL_H diff --git a/qtinterface/qt4/Qt/qiterator.h b/qtinterface/qt4/Qt/qiterator.h new file mode 100644 index 0000000..bfd2559 --- /dev/null +++ b/qtinterface/qt4/Qt/qiterator.h @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QITERATOR_H +#define QITERATOR_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +namespace std { + struct bidirectional_iterator_tag; + struct random_access_iterator_tag; +} + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \ +\ +template <class T> \ +class Q##C##Iterator \ +{ \ + typedef typename Q##C<T>::const_iterator const_iterator; \ + Q##C<T> c; \ + const_iterator i; \ +public: \ + inline Q##C##Iterator(const Q##C<T> &container) \ + : c(container), i(c.constBegin()) {} \ + inline Q##C##Iterator &operator=(const Q##C<T> &container) \ + { c = container; i = c.constBegin(); return *this; } \ + inline void toFront() { i = c.constBegin(); } \ + inline void toBack() { i = c.constEnd(); } \ + inline bool hasNext() const { return i != c.constEnd(); } \ + inline const T &next() { return *i++; } \ + inline const T &peekNext() const { return *i; } \ + inline bool hasPrevious() const { return i != c.constBegin(); } \ + inline const T &previous() { return *--i; } \ + inline const T &peekPrevious() const { const_iterator p = i; return *--p; } \ + inline bool findNext(const T &t) \ + { while (i != c.constEnd()) if (*i++ == t) return true; return false; } \ + inline bool findPrevious(const T &t) \ + { while (i != c.constBegin()) if (*(--i) == t) return true; \ + return false; } \ +}; + +#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C) \ +\ +template <class T> \ +class QMutable##C##Iterator \ +{ \ + typedef typename Q##C<T>::iterator iterator; \ + typedef typename Q##C<T>::const_iterator const_iterator; \ + Q##C<T> *c; \ + iterator i, n; \ + inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ +public: \ + inline QMutable##C##Iterator(Q##C<T> &container) \ + : c(&container) \ + { c->setSharable(false); i = c->begin(); n = c->end(); } \ + inline ~QMutable##C##Iterator() \ + { c->setSharable(true); } \ + inline QMutable##C##Iterator &operator=(Q##C<T> &container) \ + { c->setSharable(true); c = &container; c->setSharable(false); \ + i = c->begin(); n = c->end(); return *this; } \ + inline void toFront() { i = c->begin(); n = c->end(); } \ + inline void toBack() { i = c->end(); n = i; } \ + inline bool hasNext() const { return c->constEnd() != const_iterator(i); } \ + inline T &next() { n = i++; return *n; } \ + inline T &peekNext() const { return *i; } \ + inline bool hasPrevious() const { return c->constBegin() != const_iterator(i); } \ + inline T &previous() { n = --i; return *n; } \ + inline T &peekPrevious() const { iterator p = i; return *--p; } \ + inline void remove() \ + { if (c->constEnd() != const_iterator(n)) { i = c->erase(n); n = c->end(); } } \ + inline void setValue(const T &t) const { if (c->constEnd() != const_iterator(n)) *n = t; } \ + inline T &value() { Q_ASSERT(item_exists()); return *n; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline void insert(const T &t) { n = i = c->insert(i, t); ++i; } \ + inline bool findNext(const T &t) \ + { while (c->constEnd() != const_iterator(n = i)) if (*i++ == t) return true; return false; } \ + inline bool findPrevious(const T &t) \ + { while (c->constBegin() != const_iterator(i)) if (*(n = --i) == t) return true; \ + n = c->end(); return false; } \ +}; + +#define Q_DECLARE_ASSOCIATIVE_ITERATOR(C) \ +\ +template <class Key, class T> \ +class Q##C##Iterator \ +{ \ + typedef typename Q##C<Key,T>::const_iterator const_iterator; \ + typedef const_iterator Item; \ + Q##C<Key,T> c; \ + const_iterator i, n; \ + inline bool item_exists() const { return n != c.constEnd(); } \ +public: \ + inline Q##C##Iterator(const Q##C<Key,T> &container) \ + : c(container), i(c.constBegin()), n(c.constEnd()) {} \ + inline Q##C##Iterator &operator=(const Q##C<Key,T> &container) \ + { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } \ + inline void toFront() { i = c.constBegin(); n = c.constEnd(); } \ + inline void toBack() { i = c.constEnd(); n = c.constEnd(); } \ + inline bool hasNext() const { return i != c.constEnd(); } \ + inline Item next() { n = i++; return n; } \ + inline Item peekNext() const { return i; } \ + inline bool hasPrevious() const { return i != c.constBegin(); } \ + inline Item previous() { n = --i; return n; } \ + inline Item peekPrevious() const { const_iterator p = i; return --p; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ + inline bool findNext(const T &t) \ + { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } \ + inline bool findPrevious(const T &t) \ + { while (i != c.constBegin()) if (*(n = --i) == t) return true; \ + n = c.constEnd(); return false; } \ +}; + +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C) \ +\ +template <class Key, class T> \ +class QMutable##C##Iterator \ +{ \ + typedef typename Q##C<Key,T>::iterator iterator; \ + typedef typename Q##C<Key,T>::const_iterator const_iterator; \ + typedef iterator Item; \ + Q##C<Key,T> *c; \ + iterator i, n; \ + inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ +public: \ + inline QMutable##C##Iterator(Q##C<Key,T> &container) \ + : c(&container) \ + { c->setSharable(false); i = c->begin(); n = c->end(); } \ + inline ~QMutable##C##Iterator() \ + { c->setSharable(true); } \ + inline QMutable##C##Iterator &operator=(Q##C<Key,T> &container) \ + { c->setSharable(true); c = &container; c->setSharable(false); i = c->begin(); n = c->end(); return *this; } \ + inline void toFront() { i = c->begin(); n = c->end(); } \ + inline void toBack() { i = c->end(); n = c->end(); } \ + inline bool hasNext() const { return const_iterator(i) != c->constEnd(); } \ + inline Item next() { n = i++; return n; } \ + inline Item peekNext() const { return i; } \ + inline bool hasPrevious() const { return const_iterator(i) != c->constBegin(); } \ + inline Item previous() { n = --i; return n; } \ + inline Item peekPrevious() const { iterator p = i; return --p; } \ + inline void remove() \ + { if (const_iterator(n) != c->constEnd()) { i = c->erase(n); n = c->end(); } } \ + inline void setValue(const T &t) { if (const_iterator(n) != c->constEnd()) *n = t; } \ + inline T &value() { Q_ASSERT(item_exists()); return *n; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ + inline bool findNext(const T &t) \ + { while (const_iterator(n = i) != c->constEnd()) if (*i++ == t) return true; return false; } \ + inline bool findPrevious(const T &t) \ + { while (const_iterator(i) != c->constBegin()) if (*(n = --i) == t) return true; \ + n = c->end(); return false; } \ +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QITERATOR_H diff --git a/qtinterface/qt4/Qt/qkbd_qws.h b/qtinterface/qt4/Qt/qkbd_qws.h new file mode 100644 index 0000000..09cb571 --- /dev/null +++ b/qtinterface/qt4/Qt/qkbd_qws.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBD_QWS_H +#define QKBD_QWS_H + +#include <QtGui/qapplication.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_KEYBOARD + +class QWSKbPrivate; + +class Q_GUI_EXPORT QWSKeyboardHandler +{ +public: + QWSKeyboardHandler(); + QWSKeyboardHandler(const QString &device); + virtual ~QWSKeyboardHandler(); + + virtual void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, + bool isPress, bool autoRepeat); + + enum KeycodeAction { + None = 0, + + CapsLockOff = 0x01000000, + CapsLockOn = 0x01000001, + NumLockOff = 0x02000000, + NumLockOn = 0x02000001, + ScrollLockOff = 0x03000000, + ScrollLockOn = 0x03000001, + + Reboot = 0x04000000, + + PreviousConsole = 0x05000000, + NextConsole = 0x05000001, + SwitchConsoleFirst = 0x06000000, + SwitchConsoleLast = 0x0600007f, + SwitchConsoleMask = 0x0000007f, + }; + + KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat); + +protected: + int transformDirKey(int key); + void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod); + void endAutoRepeat(); + +private: + QWSKbPrivate *d; +}; + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBD_QWS_H diff --git a/qtinterface/qt4/Qt/qkbddriverfactory_qws.h b/qtinterface/qt4/Qt/qkbddriverfactory_qws.h new file mode 100644 index 0000000..1189092 --- /dev/null +++ b/qtinterface/qt4/Qt/qkbddriverfactory_qws.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDDRIVERFACTORY_QWS_H +#define QKBDDRIVERFACTORY_QWS_H + +#include <QtCore/qstringlist.h> + +#ifndef QT_NO_QWS_KEYBOARD + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QString; +class QWSKeyboardHandler; + +class Q_GUI_EXPORT QKbdDriverFactory +{ +public: + static QStringList keys(); + static QWSKeyboardHandler *create(const QString&, const QString&); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_QWS_KEYBOARD +#endif // QKBDDRIVERFACTORY_QWS_H diff --git a/qtinterface/qt4/Qt/qkbddriverplugin_qws.h b/qtinterface/qt4/Qt/qkbddriverplugin_qws.h new file mode 100644 index 0000000..aca8756 --- /dev/null +++ b/qtinterface/qt4/Qt/qkbddriverplugin_qws.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDDRIVERPLUGIN_QWS_H +#define QKBDDRIVERPLUGIN_QWS_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LIBRARY + +class QWSKeyboardHandler; + +struct Q_GUI_EXPORT QWSKeyboardHandlerFactoryInterface : public QFactoryInterface +{ + virtual QWSKeyboardHandler* create(const QString &name, const QString &device) = 0; +}; + +#define QWSKeyboardHandlerFactoryInterface_iid "com.trolltech.Qt.QWSKeyboardHandlerFactoryInterface" +Q_DECLARE_INTERFACE(QWSKeyboardHandlerFactoryInterface, QWSKeyboardHandlerFactoryInterface_iid) + +class Q_GUI_EXPORT QKbdDriverPlugin : public QObject, public QWSKeyboardHandlerFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QWSKeyboardHandlerFactoryInterface:QFactoryInterface) +public: + explicit QKbdDriverPlugin(QObject *parent = 0); + ~QKbdDriverPlugin(); + + virtual QStringList keys() const = 0; + virtual QWSKeyboardHandler* create(const QString& driver, const QString &device) = 0; +}; + +#endif // QT_NO_LIBRARY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDDRIVERPLUGIN_QWS_H diff --git a/qtinterface/qt4/Qt/qkbdlinuxinput_qws.h b/qtinterface/qt4/Qt/qkbdlinuxinput_qws.h new file mode 100644 index 0000000..eefe71e --- /dev/null +++ b/qtinterface/qt4/Qt/qkbdlinuxinput_qws.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDLINUXINPUT_QWS_H +#define QKBDLINUXINPUT_QWS_H + +#include <QtGui/qkbd_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_KEYBOARD + +#ifndef QT_NO_QWS_KBD_LINUXINPUT + +class QWSLinuxInputKbPrivate; + +class QWSLinuxInputKeyboardHandler : public QWSKeyboardHandler +{ +public: + QWSLinuxInputKeyboardHandler(const QString&); + virtual ~QWSLinuxInputKeyboardHandler(); + + virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value); + +private: + QWSLinuxInputKbPrivate *d; +}; + +#endif // QT_NO_QWS_KBD_LINUXINPUT + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDLINUXINPUT_QWS_H diff --git a/qtinterface/qt4/Qt/qkbdqnx_qws.h b/qtinterface/qt4/Qt/qkbdqnx_qws.h new file mode 100644 index 0000000..797741f --- /dev/null +++ b/qtinterface/qt4/Qt/qkbdqnx_qws.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDQNX_QWS_H +#define QKBDQNX_QWS_H + +#include <QtGui/qapplication.h> +#include <QtGui/qkbd_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_QNX) + +class Q_GUI_EXPORT QWSQnxKeyboardHandler : public QObject, public QWSKeyboardHandler +{ + Q_OBJECT +public: + QWSQnxKeyboardHandler(const QString &device); + ~QWSQnxKeyboardHandler(); + +private Q_SLOTS: + void socketActivated(); + +private: + int keyboardFD; +}; + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDQNX_QWS_H diff --git a/qtinterface/qt4/Qt/qkbdtty_qws.h b/qtinterface/qt4/Qt/qkbdtty_qws.h new file mode 100644 index 0000000..6a296f9 --- /dev/null +++ b/qtinterface/qt4/Qt/qkbdtty_qws.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDTTY_QWS_H +#define QKBDTTY_QWS_H + +#include <QtGui/qkbd_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_KEYBOARD + +#ifndef QT_NO_QWS_KBD_TTY + +class QWSTtyKbPrivate; + +class QWSTtyKeyboardHandler : public QWSKeyboardHandler +{ +public: + explicit QWSTtyKeyboardHandler(const QString&); + virtual ~QWSTtyKeyboardHandler(); + + virtual bool filterKeycode(char &code); + +private: + QWSTtyKbPrivate *d; +}; + +#endif // QT_NO_QWS_KBD_TTY + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDTTY_QWS_H diff --git a/qtinterface/qt4/Qt/qkbdum_qws.h b/qtinterface/qt4/Qt/qkbdum_qws.h new file mode 100644 index 0000000..0a535d0 --- /dev/null +++ b/qtinterface/qt4/Qt/qkbdum_qws.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDUM_QWS_H +#define QKBDUM_QWS_H + +#include <QtGui/qkbd_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_KEYBOARD + +#ifndef QT_NO_QWS_KBD_UM + +class QWSUmKeyboardHandlerPrivate; + +class QWSUmKeyboardHandler : public QWSKeyboardHandler +{ +public: + QWSUmKeyboardHandler(const QString &); + virtual ~QWSUmKeyboardHandler(); + +private: + + QWSUmKeyboardHandlerPrivate *d; +}; +#endif // QT_NO_QWS_KBD_UM + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDUM_QWS_H diff --git a/qtinterface/qt4/Qt/qkbdvfb_qws.h b/qtinterface/qt4/Qt/qkbdvfb_qws.h new file mode 100644 index 0000000..3133f72 --- /dev/null +++ b/qtinterface/qt4/Qt/qkbdvfb_qws.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKBDVFB_QWS_H +#define QKBDVFB_QWS_H + +#include <QtGui/qkbd_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_KEYBOARD + +#ifndef QT_NO_QWS_KBD_QVFB + +class QSocketNotifier; + +class QVFbKeyboardHandler : public QObject, public QWSKeyboardHandler +{ + Q_OBJECT +public: + QVFbKeyboardHandler(const QString &device); + virtual ~QVFbKeyboardHandler(); + +private Q_SLOTS: + void readKeyboardData(); + +private: + QString terminalName; + int kbdFD; + int kbdIdx; + int kbdBufferLen; + unsigned char *kbdBuffer; + QSocketNotifier *notifier; +}; + +#endif // QT_NO_QWS_KBD_QVFB + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDVFB_QWS_H diff --git a/qtinterface/qt4/Qt/qkeyeventtransition.h b/qtinterface/qt4/Qt/qkeyeventtransition.h new file mode 100644 index 0000000..8305ff9 --- /dev/null +++ b/qtinterface/qt4/Qt/qkeyeventtransition.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKEYEVENTTRANSITION_H +#define QKEYEVENTTRANSITION_H + +#include <QtCore/qeventtransition.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_STATEMACHINE + +class QKeyEventTransitionPrivate; +class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition +{ + Q_OBJECT + Q_PROPERTY(int key READ key WRITE setKey) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) +public: + QKeyEventTransition(QState *sourceState = 0); + QKeyEventTransition(QObject *object, QEvent::Type type, int key, + QState *sourceState = 0); + ~QKeyEventTransition(); + + int key() const; + void setKey(int key); + + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); + +protected: + void onTransition(QEvent *event); + bool eventTest(QEvent *event); + +private: + Q_DISABLE_COPY(QKeyEventTransition) + Q_DECLARE_PRIVATE(QKeyEventTransition) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qkeysequence.h b/qtinterface/qt4/Qt/qkeysequence.h new file mode 100644 index 0000000..1ae3cb2 --- /dev/null +++ b/qtinterface/qt4/Qt/qkeysequence.h @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKEYSEQUENCE_H +#define QKEYSEQUENCE_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SHORTCUT + +/***************************************************************************** + QKeySequence stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +class QKeySequence; +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks); +#endif + +#ifdef qdoc +void qt_set_sequence_auto_mnemonic(bool b); +#endif + +class QVariant; +class QKeySequencePrivate; + +class Q_GUI_EXPORT QKeySequence +{ +public: + enum StandardKey { + UnknownKey, + HelpContents, + WhatsThis, + Open, + Close, + Save, + New, + Delete, + Cut, + Copy, + Paste, + Undo, + Redo, + Back, + Forward, + Refresh, + ZoomIn, + ZoomOut, + Print, + AddTab, + NextChild, + PreviousChild, + Find, + FindNext, + FindPrevious, + Replace, + SelectAll, + Bold, + Italic, + Underline, + MoveToNextChar, + MoveToPreviousChar, + MoveToNextWord, + MoveToPreviousWord, + MoveToNextLine, + MoveToPreviousLine, + MoveToNextPage, + MoveToPreviousPage, + MoveToStartOfLine, + MoveToEndOfLine, + MoveToStartOfBlock, + MoveToEndOfBlock, + MoveToStartOfDocument, + MoveToEndOfDocument, + SelectNextChar, + SelectPreviousChar, + SelectNextWord, + SelectPreviousWord, + SelectNextLine, + SelectPreviousLine, + SelectNextPage, + SelectPreviousPage, + SelectStartOfLine, + SelectEndOfLine, + SelectStartOfBlock, + SelectEndOfBlock, + SelectStartOfDocument, + SelectEndOfDocument, + DeleteStartOfWord, + DeleteEndOfWord, + DeleteEndOfLine, + InsertParagraphSeparator, + InsertLineSeparator, + SaveAs, + Preferences, + Quit + }; + + QKeySequence(); + QKeySequence(const QString &key); + QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0); + QKeySequence(const QKeySequence &ks); + QKeySequence(StandardKey key); + ~QKeySequence(); + + uint count() const; // ### Qt 5: return 'int' + bool isEmpty() const; + + enum SequenceMatch { + NoMatch, + PartialMatch, + ExactMatch +#ifdef QT3_SUPPORT + , Identical = ExactMatch +#endif + }; + + enum SequenceFormat { + NativeText, + PortableText + }; + + QString toString(SequenceFormat format = PortableText) const; + static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText); + + SequenceMatch matches(const QKeySequence &seq) const; + static QKeySequence mnemonic(const QString &text); + static QList<QKeySequence> keyBindings(StandardKey key); + + // ### Qt 5: kill 'operator QString' - it's evil + operator QString() const; + operator QVariant() const; + operator int() const; + int operator[](uint i) const; + QKeySequence &operator=(const QKeySequence &other); + bool operator==(const QKeySequence &other) const; + inline bool operator!= (const QKeySequence &other) const + { return !(*this == other); } + bool operator< (const QKeySequence &ks) const; + inline bool operator> (const QKeySequence &other) const + { return other < *this; } + inline bool operator<= (const QKeySequence &other) const + { return !(other < *this); } + inline bool operator>= (const QKeySequence &other) const + { return !(*this < other); } + + bool isDetached() const; +private: + static int decodeString(const QString &ks); + static QString encodeString(int key); + int assign(const QString &str); + void setKey(int key, int index); + + QKeySequencePrivate *d; + + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks); + friend class Q3AccelManager; + friend class QShortcutMap; + friend class QShortcut; + +public: + typedef QKeySequencePrivate * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; +Q_DECLARE_TYPEINFO(QKeySequence, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QKeySequence) + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QKeySequence &); +#endif + +#else + +class Q_GUI_EXPORT QKeySequence +{ +public: + QKeySequence() {} + QKeySequence(int) {} +}; + +#endif // QT_NO_SHORTCUT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKEYSEQUENCE_H diff --git a/qtinterface/qt4/Qt/qlabel.h b/qtinterface/qt4/Qt/qlabel.h new file mode 100644 index 0000000..a7b231b --- /dev/null +++ b/qtinterface/qt4/Qt/qlabel.h @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLABEL_H +#define QLABEL_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QLabelPrivate; + +class Q_GUI_EXPORT QLabel : public QFrame +{ + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat) + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) + Q_PROPERTY(bool scaledContents READ hasScaledContents WRITE setScaledContents) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) + Q_PROPERTY(int margin READ margin WRITE setMargin) + Q_PROPERTY(int indent READ indent WRITE setIndent) + Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) + Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) + +public: + explicit QLabel(QWidget *parent=0, Qt::WindowFlags f=0); + explicit QLabel(const QString &text, QWidget *parent=0, Qt::WindowFlags f=0); + ~QLabel(); + + QString text() const; + const QPixmap *pixmap() const; +#ifndef QT_NO_PICTURE + const QPicture *picture() const; +#endif +#ifndef QT_NO_MOVIE + QMovie *movie() const; +#endif + + Qt::TextFormat textFormat() const; + void setTextFormat(Qt::TextFormat); + + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment); + + void setWordWrap(bool on); + bool wordWrap() const; + + int indent() const; + void setIndent(int); + + int margin() const; + void setMargin(int); + + bool hasScaledContents() const; + void setScaledContents(bool); + QSize sizeHint() const; + QSize minimumSizeHint() const; +#ifndef QT_NO_SHORTCUT + void setBuddy(QWidget *); + QWidget *buddy() const; +#endif + int heightForWidth(int) const; + + bool openExternalLinks() const; + void setOpenExternalLinks(bool open); + + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + +public Q_SLOTS: + void setText(const QString &); + void setPixmap(const QPixmap &); +#ifndef QT_NO_PICTURE + void setPicture(const QPicture &); +#endif +#ifndef QT_NO_MOVIE + void setMovie(QMovie *movie); +#endif + void setNum(int); + void setNum(double); + void clear(); + +Q_SIGNALS: + void linkActivated(const QString& link); + void linkHovered(const QString& link); + +protected: + bool event(QEvent *e); + void keyPressEvent(QKeyEvent *ev); + void paintEvent(QPaintEvent *); + void changeEvent(QEvent *); + void mousePressEvent(QMouseEvent *ev); + void mouseMoveEvent(QMouseEvent *ev); + void mouseReleaseEvent(QMouseEvent *ev); + void contextMenuEvent(QContextMenuEvent *ev); + void focusInEvent(QFocusEvent *ev); + void focusOutEvent(QFocusEvent *ev); + bool focusNextPrevChild(bool next); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QLabel(QWidget *parent, const char* name, Qt::WindowFlags f=0); + QT3_SUPPORT_CONSTRUCTOR QLabel(const QString &text, QWidget *parent, const char* name, + Qt::WindowFlags f=0); + QT3_SUPPORT_CONSTRUCTOR QLabel(QWidget *buddy, const QString &, + QWidget *parent=0, const char* name=0, Qt::WindowFlags f=0); + QT3_SUPPORT void setAlignment(int alignment); + + // don't mark the next function with QT3_SUPPORT + inline void setAlignment(Qt::AlignmentFlag flag) { setAlignment((Qt::Alignment)flag); } +#endif + +private: + Q_DISABLE_COPY(QLabel) + Q_DECLARE_PRIVATE(QLabel) +#ifndef QT_NO_MOVIE + Q_PRIVATE_SLOT(d_func(), void _q_movieUpdated(const QRect&)) + Q_PRIVATE_SLOT(d_func(), void _q_movieResized(const QSize&)) +#endif + Q_PRIVATE_SLOT(d_func(), void _q_linkHovered(const QString &)) + + friend class QTipLabel; + friend class QMessageBoxPrivate; + friend class QBalloonTip; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLABEL_H diff --git a/qtinterface/qt4/Qt/qlayout.h b/qtinterface/qt4/Qt/qlayout.h new file mode 100644 index 0000000..5077d77 --- /dev/null +++ b/qtinterface/qt4/Qt/qlayout.h @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLAYOUT_H +#define QLAYOUT_H + +#include <QtCore/qobject.h> +#include <QtGui/qlayoutitem.h> +#include <QtGui/qsizepolicy.h> +#include <QtCore/qrect.h> +#include <QtCore/qmargins.h> + +#include <limits.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QLayout; +class QSize; + +#ifdef QT3_SUPPORT +class Q_GUI_EXPORT QLayoutIterator +{ +public: + inline QT3_SUPPORT_CONSTRUCTOR QLayoutIterator(QLayout *i) : layout(i), index(0) {} + inline QLayoutIterator(const QLayoutIterator &i) + : layout(i.layout), index(i.index) {} + inline QLayoutIterator &operator=(const QLayoutIterator &i) { + layout = i.layout; + index = i.index; + return *this; + } + inline QT3_SUPPORT QLayoutItem *operator++(); + inline QT3_SUPPORT QLayoutItem *current(); + inline QT3_SUPPORT QLayoutItem *takeCurrent(); + inline QT3_SUPPORT void deleteCurrent(); + +private: + // hack to avoid deprecated warning + friend class QLayout; + inline QLayoutIterator(QLayout *i, bool) : layout(i), index(0) {} + QLayout *layout; + int index; +}; +#endif + +class QLayoutPrivate; + +class Q_GUI_EXPORT QLayout : public QObject, public QLayoutItem +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QLayout) + + Q_ENUMS(SizeConstraint) + Q_PROPERTY(int margin READ margin WRITE setMargin) + Q_PROPERTY(int spacing READ spacing WRITE setSpacing) + Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint) +public: + enum SizeConstraint { + SetDefaultConstraint, + SetNoConstraint, + SetMinimumSize, + SetFixedSize, + SetMaximumSize, + SetMinAndMaxSize +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , Auto = SetDefaultConstraint, + FreeResize = SetNoConstraint, + Minimum = SetMinimumSize, + Fixed = SetFixedSize +#endif + }; + + QLayout(QWidget *parent); + QLayout(); + ~QLayout(); + + int margin() const; + int spacing() const; + + void setMargin(int); + void setSpacing(int); + + void setContentsMargins(int left, int top, int right, int bottom); + void setContentsMargins(const QMargins &margins); + void getContentsMargins(int *left, int *top, int *right, int *bottom) const; + QMargins contentsMargins() const; + QRect contentsRect() const; + + bool setAlignment(QWidget *w, Qt::Alignment alignment); + bool setAlignment(QLayout *l, Qt::Alignment alignment); +#ifdef Q_NO_USING_KEYWORD + inline void setAlignment(Qt::Alignment alignment) { QLayoutItem::setAlignment(alignment); } +#else + using QLayoutItem::setAlignment; +#endif + + void setSizeConstraint(SizeConstraint); + SizeConstraint sizeConstraint() const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void setResizeMode(SizeConstraint s) {setSizeConstraint(s);} + inline QT3_SUPPORT SizeConstraint resizeMode() const {return sizeConstraint();} +#endif + void setMenuBar(QWidget *w); + QWidget *menuBar() const; + + QWidget *parentWidget() const; + + void invalidate(); + QRect geometry() const; + bool activate(); + void update(); + + void addWidget(QWidget *w); + virtual void addItem(QLayoutItem *) = 0; + + void removeWidget(QWidget *w); + void removeItem(QLayoutItem *); + + Qt::Orientations expandingDirections() const; + QSize minimumSize() const; + QSize maximumSize() const; + virtual void setGeometry(const QRect&); + virtual QLayoutItem *itemAt(int index) const = 0; + virtual QLayoutItem *takeAt(int index) = 0; + virtual int indexOf(QWidget *) const; + virtual int count() const = 0; + bool isEmpty() const; + + int totalHeightForWidth(int w) const; + QSize totalMinimumSize() const; + QSize totalMaximumSize() const; + QSize totalSizeHint() const; + QLayout *layout(); + + void setEnabled(bool); + bool isEnabled() const; + +#ifdef QT3_SUPPORT + QT3_SUPPORT void freeze(int w=0, int h=0); + QT3_SUPPORT bool isTopLevel() const; +#endif + + static QSize closestAcceptableSize(const QWidget *w, const QSize &s); + +protected: + void widgetEvent(QEvent *); + void childEvent(QChildEvent *e); + void addChildLayout(QLayout *l); + void addChildWidget(QWidget *w); +#ifdef QT3_SUPPORT + QT3_SUPPORT void deleteAllItems(); +#endif + + QRect alignmentRect(const QRect&) const; +protected: + QLayout(QLayoutPrivate &d, QLayout*, QWidget*); + +private: + Q_DISABLE_COPY(QLayout) + + static void activateRecursiveHelper(QLayoutItem *item); + + friend class QApplicationPrivate; + friend class QWidget; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QLayout(QWidget *parent, int margin, int spacing = -1, + const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QLayout(QLayout *parentLayout, int spacing = -1, const char *name = 0); + QT3_SUPPORT_CONSTRUCTOR QLayout(int spacing, const char *name = 0); + inline QT3_SUPPORT QWidget *mainWidget() const { return parentWidget(); } + inline QT3_SUPPORT void remove(QWidget *w) { removeWidget(w); } + inline QT3_SUPPORT void add(QWidget *w) { addWidget(w); } + + QT3_SUPPORT void setAutoAdd(bool a); + QT3_SUPPORT bool autoAdd() const; + inline QT3_SUPPORT QLayoutIterator iterator() { return QLayoutIterator(this,true); } + + inline QT3_SUPPORT int defaultBorder() const { return spacing(); } +#endif +}; + +#ifdef QT3_SUPPORT +inline QLayoutItem *QLayoutIterator::operator++() { return layout->itemAt(++index); } +inline QLayoutItem *QLayoutIterator::current() { return layout->itemAt(index); } +inline QLayoutItem *QLayoutIterator::takeCurrent() { return layout->takeAt(index); } +inline void QLayoutIterator::deleteCurrent() { delete layout->takeAt(index); } +#endif + +//### support old includes +#if 1 //def QT3_SUPPORT +QT_BEGIN_INCLUDE_NAMESPACE +#include <QtGui/qboxlayout.h> +#include <QtGui/qgridlayout.h> +QT_END_INCLUDE_NAMESPACE +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLAYOUT_H diff --git a/qtinterface/qt4/Qt/qlayoutitem.h b/qtinterface/qt4/Qt/qlayoutitem.h new file mode 100644 index 0000000..f934223 --- /dev/null +++ b/qtinterface/qt4/Qt/qlayoutitem.h @@ -0,0 +1,182 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLAYOUTITEM_H +#define QLAYOUTITEM_H + +#include <QtGui/qsizepolicy.h> +#include <QtCore/qrect.h> + +#include <limits.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +static const int QLAYOUTSIZE_MAX = INT_MAX/256/16; + +class QLayout; +class QLayoutItem; +class QSpacerItem; +class QWidget; +class QSize; + +class Q_GUI_EXPORT QLayoutItem +{ +public: + inline explicit QLayoutItem(Qt::Alignment alignment = 0); + virtual ~QLayoutItem(); + virtual QSize sizeHint() const = 0; + virtual QSize minimumSize() const = 0; + virtual QSize maximumSize() const = 0; + virtual Qt::Orientations expandingDirections() const = 0; + virtual void setGeometry(const QRect&) = 0; + virtual QRect geometry() const = 0; + virtual bool isEmpty() const = 0; + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int) const; + virtual int minimumHeightForWidth(int) const; + virtual void invalidate(); + + virtual QWidget *widget(); + virtual QLayout *layout(); + virtual QSpacerItem *spacerItem(); + + Qt::Alignment alignment() const { return align; } + void setAlignment(Qt::Alignment a); + QSizePolicy::ControlTypes controlTypes() const; + +protected: + Qt::Alignment align; +}; + +inline QLayoutItem::QLayoutItem(Qt::Alignment aalignment) + : align(aalignment) { } + +class Q_GUI_EXPORT QSpacerItem : public QLayoutItem +{ +public: + QSpacerItem(int w, int h, + QSizePolicy::Policy hData = QSizePolicy::Minimum, + QSizePolicy::Policy vData = QSizePolicy::Minimum) + : width(w), height(h), sizeP(hData, vData) { } + void changeSize(int w, int h, + QSizePolicy::Policy hData = QSizePolicy::Minimum, + QSizePolicy::Policy vData = QSizePolicy::Minimum); + QSize sizeHint() const; + QSize minimumSize() const; + QSize maximumSize() const; + Qt::Orientations expandingDirections() const; + bool isEmpty() const; + void setGeometry(const QRect&); + QRect geometry() const; + QSpacerItem *spacerItem(); + +private: + int width; + int height; + QSizePolicy sizeP; + QRect rect; +}; + +class Q_GUI_EXPORT QWidgetItem : public QLayoutItem +{ + Q_DISABLE_COPY(QWidgetItem) + +public: + explicit QWidgetItem(QWidget *w) : wid(w) { } + QSize sizeHint() const; + QSize minimumSize() const; + QSize maximumSize() const; + Qt::Orientations expandingDirections() const; + bool isEmpty() const; + void setGeometry(const QRect&); + QRect geometry() const; + virtual QWidget *widget(); + + bool hasHeightForWidth() const; + int heightForWidth(int) const; + +protected: + QWidget *wid; +}; + +class Q_GUI_EXPORT QWidgetItemV2 : public QWidgetItem +{ +public: + explicit QWidgetItemV2(QWidget *widget); + ~QWidgetItemV2(); + + QSize sizeHint() const; + QSize minimumSize() const; + QSize maximumSize() const; + int heightForWidth(int width) const; + +private: + enum { Dirty = -123, HfwCacheMaxSize = 3 }; + + inline bool useSizeCache() const; + void updateCacheIfNecessary() const; + inline void invalidateSizeCache() { + q_cachedMinimumSize.setWidth(Dirty); + q_hfwCacheSize = 0; + } + + mutable QSize q_cachedMinimumSize; + mutable QSize q_cachedSizeHint; + mutable QSize q_cachedMaximumSize; + mutable QSize q_cachedHfws[HfwCacheMaxSize]; + mutable short q_firstCachedHfw; + mutable short q_hfwCacheSize; + void *d; + + friend class QWidgetPrivate; + + Q_DISABLE_COPY(QWidgetItemV2) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLAYOUTITEM_H diff --git a/qtinterface/qt4/Qt/qlcdnumber.h b/qtinterface/qt4/Qt/qlcdnumber.h new file mode 100644 index 0000000..f7e733f --- /dev/null +++ b/qtinterface/qt4/Qt/qlcdnumber.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLCDNUMBER_H +#define QLCDNUMBER_H + +#include <QtGui/qframe.h> +#include <QtCore/qbitarray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LCDNUMBER + +class QLCDNumberPrivate; +class Q_GUI_EXPORT QLCDNumber : public QFrame // LCD number widget +{ + Q_OBJECT + Q_ENUMS(Mode SegmentStyle) + Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint) + Q_PROPERTY(int numDigits READ numDigits WRITE setNumDigits) + Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount) + Q_PROPERTY(Mode mode READ mode WRITE setMode) + Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle) + Q_PROPERTY(double value READ value WRITE display) + Q_PROPERTY(int intValue READ intValue WRITE display) + +public: + explicit QLCDNumber(QWidget* parent = 0); + explicit QLCDNumber(uint numDigits, QWidget* parent = 0); + ~QLCDNumber(); + + enum Mode { + Hex, Dec, Oct, Bin +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin +#endif + }; + enum SegmentStyle { + Outline, Filled, Flat + }; + + bool smallDecimalPoint() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numDigits() const; + QT_DEPRECATED void setNumDigits(int nDigits); +#endif + int digitCount() const; + void setDigitCount(int nDigits); + + bool checkOverflow(double num) const; + bool checkOverflow(int num) const; + + Mode mode() const; + void setMode(Mode); + + SegmentStyle segmentStyle() const; + void setSegmentStyle(SegmentStyle); + + double value() const; + int intValue() const; + + QSize sizeHint() const; + +public Q_SLOTS: + void display(const QString &str); + void display(int num); + void display(double num); + void setHexMode(); + void setDecMode(); + void setOctMode(); + void setBinMode(); + void setSmallDecimalPoint(bool); + +Q_SIGNALS: + void overflow(); + +protected: + bool event(QEvent *e); + void paintEvent(QPaintEvent *); + +public: +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QLCDNumber(QWidget* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QLCDNumber(uint numDigits, QWidget* parent, const char* name); + + QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + QT3_SUPPORT int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } +#endif + +private: + Q_DISABLE_COPY(QLCDNumber) + Q_DECLARE_PRIVATE(QLCDNumber) +}; + +#endif // QT_NO_LCDNUMBER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLCDNUMBER_H diff --git a/qtinterface/qt4/Qt/qlibrary.h b/qtinterface/qt4/Qt/qlibrary.h new file mode 100644 index 0000000..1dcce92 --- /dev/null +++ b/qtinterface/qt4/Qt/qlibrary.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLIBRARY_H +#define QLIBRARY_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN) +#undef QT_NO_LIBRARY +#pragma message("QT_NO_LIBRARY is not supported on Windows") +#endif + +#ifndef QT_NO_LIBRARY + +class QLibraryPrivate; + +class Q_CORE_EXPORT QLibrary : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString fileName READ fileName WRITE setFileName) + Q_PROPERTY(LoadHints loadHints READ loadHints WRITE setLoadHints) + Q_FLAGS(LoadHint LoadHints) +public: + enum LoadHint { + ResolveAllSymbolsHint = 0x01, + ExportExternalSymbolsHint = 0x02, + LoadArchiveMemberHint = 0x04 + }; + Q_DECLARE_FLAGS(LoadHints, LoadHint) + + explicit QLibrary(QObject *parent = 0); + explicit QLibrary(const QString& fileName, QObject *parent = 0); + explicit QLibrary(const QString& fileName, int verNum, QObject *parent = 0); + explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = 0); + ~QLibrary(); + + void *resolve(const char *symbol); + static void *resolve(const QString &fileName, const char *symbol); + static void *resolve(const QString &fileName, int verNum, const char *symbol); + static void *resolve(const QString &fileName, const QString &version, const char *symbol); + + bool load(); + bool unload(); + bool isLoaded() const; + + static bool isLibrary(const QString &fileName); + + void setFileName(const QString &fileName); + QString fileName() const; + + void setFileNameAndVersion(const QString &fileName, int verNum); + void setFileNameAndVersion(const QString &fileName, const QString &version); + QString errorString() const; + + void setLoadHints(LoadHints hints); + LoadHints loadHints() const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QString library() const { return fileName(); } + inline QT3_SUPPORT void setAutoUnload( bool ) {} +#endif +private: + QLibraryPrivate *d; + bool did_load; + Q_DISABLE_COPY(QLibrary) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints) + +#endif //QT_NO_LIBRARY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QLIBRARY_H diff --git a/qtinterface/qt4/Qt/qlibraryinfo.h b/qtinterface/qt4/Qt/qlibraryinfo.h new file mode 100644 index 0000000..d71780c --- /dev/null +++ b/qtinterface/qt4/Qt/qlibraryinfo.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLIBRARYINFO_H +#define QLIBRARYINFO_H + +#include <QtCore/qstring.h> +#include <QtCore/QDate> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_SETTINGS + +class Q_CORE_EXPORT QLibraryInfo +{ +public: + static QString licensee(); + static QString licensedProducts(); + + static QString buildKey(); +#ifndef QT_NO_DATESTRING + static QDate buildDate(); +#endif //QT_NO_DATESTRING + + enum LibraryLocation + { + PrefixPath, + DocumentationPath, + HeadersPath, + LibrariesPath, + BinariesPath, + PluginsPath, + DataPath, + TranslationsPath, + SettingsPath, + DemosPath, + ExamplesPath + }; + static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path() + +private: + QLibraryInfo(); +}; + +#endif /* QT_NO_SETTINGS */ + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLIBRARYINFO_H diff --git a/qtinterface/qt4/Qt/qline.h b/qtinterface/qt4/Qt/qline.h new file mode 100644 index 0000000..d4c34f9 --- /dev/null +++ b/qtinterface/qt4/Qt/qline.h @@ -0,0 +1,424 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLINE_H +#define QLINE_H + +#include <QtCore/qpoint.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +/******************************************************************************* + * class QLine + *******************************************************************************/ + +class Q_CORE_EXPORT QLine +{ +public: + inline QLine(); + inline QLine(const QPoint &pt1, const QPoint &pt2); + inline QLine(int x1, int y1, int x2, int y2); + + inline bool isNull() const; + + inline QPoint p1() const; + inline QPoint p2() const; + + inline int x1() const; + inline int y1() const; + + inline int x2() const; + inline int y2() const; + + inline int dx() const; + inline int dy() const; + + inline void translate(const QPoint &p); + inline void translate(int dx, int dy); + + inline QLine translated(const QPoint &p) const; + inline QLine translated(int dx, int dy) const; + + inline void setP1(const QPoint &p1); + inline void setP2(const QPoint &p2); + inline void setPoints(const QPoint &p1, const QPoint &p2); + inline void setLine(int x1, int y1, int x2, int y2); + + inline bool operator==(const QLine &d) const; + inline bool operator!=(const QLine &d) const { return !(*this == d); } + +private: + QPoint pt1, pt2; +}; +Q_DECLARE_TYPEINFO(QLine, Q_MOVABLE_TYPE); + +/******************************************************************************* + * class QLine inline members + *******************************************************************************/ + +inline QLine::QLine() { } + +inline QLine::QLine(const QPoint &pt1_, const QPoint &pt2_) : pt1(pt1_), pt2(pt2_) { } + +inline QLine::QLine(int x1pos, int y1pos, int x2pos, int y2pos) : pt1(QPoint(x1pos, y1pos)), pt2(QPoint(x2pos, y2pos)) { } + +inline bool QLine::isNull() const +{ + return pt1 == pt2; +} + +inline int QLine::x1() const +{ + return pt1.x(); +} + +inline int QLine::y1() const +{ + return pt1.y(); +} + +inline int QLine::x2() const +{ + return pt2.x(); +} + +inline int QLine::y2() const +{ + return pt2.y(); +} + +inline QPoint QLine::p1() const +{ + return pt1; +} + +inline QPoint QLine::p2() const +{ + return pt2; +} + +inline int QLine::dx() const +{ + return pt2.x() - pt1.x(); +} + +inline int QLine::dy() const +{ + return pt2.y() - pt1.y(); +} + +inline void QLine::translate(const QPoint &point) +{ + pt1 += point; + pt2 += point; +} + +inline void QLine::translate(int adx, int ady) +{ + this->translate(QPoint(adx, ady)); +} + +inline QLine QLine::translated(const QPoint &p) const +{ + return QLine(pt1 + p, pt2 + p); +} + +inline QLine QLine::translated(int adx, int ady) const +{ + return translated(QPoint(adx, ady)); +} + +inline void QLine::setP1(const QPoint &aP1) +{ + pt1 = aP1; +} + +inline void QLine::setP2(const QPoint &aP2) +{ + pt2 = aP2; +} + +inline void QLine::setPoints(const QPoint &aP1, const QPoint &aP2) +{ + pt1 = aP1; + pt2 = aP2; +} + +inline void QLine::setLine(int aX1, int aY1, int aX2, int aY2) +{ + pt1 = QPoint(aX1, aY1); + pt2 = QPoint(aX2, aY2); +} + +inline bool QLine::operator==(const QLine &d) const +{ + return pt1 == d.pt1 && pt2 == d.pt2; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLine &p); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLine &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLine &); +#endif + +/******************************************************************************* + * class QLineF + *******************************************************************************/ +class Q_CORE_EXPORT QLineF { +public: + + enum IntersectType { NoIntersection, BoundedIntersection, UnboundedIntersection }; + + inline QLineF(); + inline QLineF(const QPointF &pt1, const QPointF &pt2); + inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2); + inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { } + + static QLineF fromPolar(qreal length, qreal angle); + + bool isNull() const; + + inline QPointF p1() const; + inline QPointF p2() const; + + inline qreal x1() const; + inline qreal y1() const; + + inline qreal x2() const; + inline qreal y2() const; + + inline qreal dx() const; + inline qreal dy() const; + + qreal length() const; + void setLength(qreal len); + + qreal angle() const; + void setAngle(qreal angle); + + qreal angleTo(const QLineF &l) const; + + QLineF unitVector() const; + QLineF normalVector() const; + + // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType + IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const; + + qreal angle(const QLineF &l) const; + + QPointF pointAt(qreal t) const; + inline void translate(const QPointF &p); + inline void translate(qreal dx, qreal dy); + + inline QLineF translated(const QPointF &p) const; + inline QLineF translated(qreal dx, qreal dy) const; + + inline void setP1(const QPointF &p1); + inline void setP2(const QPointF &p2); + inline void setPoints(const QPointF &p1, const QPointF &p2); + inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2); + + inline bool operator==(const QLineF &d) const; + inline bool operator!=(const QLineF &d) const { return !(*this == d); } + + QLine toLine() const; + +private: + QPointF pt1, pt2; +}; +Q_DECLARE_TYPEINFO(QLineF, Q_MOVABLE_TYPE); + +/******************************************************************************* + * class QLineF inline members + *******************************************************************************/ + +inline QLineF::QLineF() +{ +} + +inline QLineF::QLineF(const QPointF &apt1, const QPointF &apt2) + : pt1(apt1), pt2(apt2) +{ +} + +inline QLineF::QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos) + : pt1(x1pos, y1pos), pt2(x2pos, y2pos) +{ +} + +inline qreal QLineF::x1() const +{ + return pt1.x(); +} + +inline qreal QLineF::y1() const +{ + return pt1.y(); +} + +inline qreal QLineF::x2() const +{ + return pt2.x(); +} + +inline qreal QLineF::y2() const +{ + return pt2.y(); +} + +inline QPointF QLineF::p1() const +{ + return pt1; +} + +inline QPointF QLineF::p2() const +{ + return pt2; +} + +inline qreal QLineF::dx() const +{ + return pt2.x() - pt1.x(); +} + +inline qreal QLineF::dy() const +{ + return pt2.y() - pt1.y(); +} + +inline QLineF QLineF::normalVector() const +{ + return QLineF(p1(), p1() + QPointF(dy(), -dx())); +} + +inline void QLineF::translate(const QPointF &point) +{ + pt1 += point; + pt2 += point; +} + +inline void QLineF::translate(qreal adx, qreal ady) +{ + this->translate(QPointF(adx, ady)); +} + +inline QLineF QLineF::translated(const QPointF &p) const +{ + return QLineF(pt1 + p, pt2 + p); +} + +inline QLineF QLineF::translated(qreal adx, qreal ady) const +{ + return translated(QPointF(adx, ady)); +} + +inline void QLineF::setLength(qreal len) +{ + if (isNull()) + return; + QLineF v = unitVector(); + pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); +} + +inline QPointF QLineF::pointAt(qreal t) const +{ + qreal vx = pt2.x() - pt1.x(); + qreal vy = pt2.y() - pt1.y(); + return QPointF(pt1.x() + vx * t, pt1.y() + vy * t); +} + +inline QLine QLineF::toLine() const +{ + return QLine(pt1.toPoint(), pt2.toPoint()); +} + + +inline void QLineF::setP1(const QPointF &aP1) +{ + pt1 = aP1; +} + +inline void QLineF::setP2(const QPointF &aP2) +{ + pt2 = aP2; +} + +inline void QLineF::setPoints(const QPointF &aP1, const QPointF &aP2) +{ + pt1 = aP1; + pt2 = aP2; +} + +inline void QLineF::setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2) +{ + pt1 = QPointF(aX1, aY1); + pt2 = QPointF(aX2, aY2); +} + + +inline bool QLineF::operator==(const QLineF &d) const +{ + return pt1 == d.pt1 && pt2 == d.pt2; +} + + + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLineF &p); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLineF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLineF &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLINE_H diff --git a/qtinterface/qt4/Qt/qlineedit.h b/qtinterface/qt4/Qt/qlineedit.h new file mode 100644 index 0000000..3911ace --- /dev/null +++ b/qtinterface/qt4/Qt/qlineedit.h @@ -0,0 +1,300 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLINEEDIT_H +#define QLINEEDIT_H + +#include <QtGui/qframe.h> +#include <QtCore/qstring.h> +#include <QtCore/qmargins.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LINEEDIT + +class QValidator; +class QMenu; +class QLineEditPrivate; +class QCompleter; +class QStyleOptionFrame; +class QAbstractSpinBox; +class QDateTimeEdit; + +class Q_GUI_EXPORT QLineEdit : public QWidget +{ + Q_OBJECT + + Q_ENUMS(EchoMode) + Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true) + Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) + Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) + Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode) + Q_PROPERTY(QString displayText READ displayText) + Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) + Q_PROPERTY(bool hasSelectedText READ hasSelectedText) + Q_PROPERTY(QString selectedText READ selectedText) + Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool undoAvailable READ isUndoAvailable) + Q_PROPERTY(bool redoAvailable READ isRedoAvailable) + Q_PROPERTY(bool acceptableInput READ hasAcceptableInput) +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) + Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) +#endif + +public: + explicit QLineEdit(QWidget* parent=0); + explicit QLineEdit(const QString &, QWidget* parent=0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QLineEdit(QWidget* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QLineEdit(const QString &, QWidget* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QLineEdit(const QString &, const QString &, QWidget* parent=0, const char* name=0); +#endif + ~QLineEdit(); + + QString text() const; + + QString displayText() const; + +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) + QString placeholderText() const; + void setPlaceholderText(const QString &); +#endif + + int maxLength() const; + void setMaxLength(int); + + void setFrame(bool); + bool hasFrame() const; + + enum EchoMode { Normal, NoEcho, Password, PasswordEchoOnEdit }; + EchoMode echoMode() const; + void setEchoMode(EchoMode); + + bool isReadOnly() const; + void setReadOnly(bool); + +#ifndef QT_NO_VALIDATOR + void setValidator(const QValidator *); + const QValidator * validator() const; +#endif + +#ifndef QT_NO_COMPLETER + void setCompleter(QCompleter *completer); + QCompleter *completer() const; +#endif + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + int cursorPosition() const; + void setCursorPosition(int); + int cursorPositionAt(const QPoint &pos); + + void setAlignment(Qt::Alignment flag); + Qt::Alignment alignment() const; + + void cursorForward(bool mark, int steps = 1); + void cursorBackward(bool mark, int steps = 1); + void cursorWordForward(bool mark); + void cursorWordBackward(bool mark); + void backspace(); + void del(); + void home(bool mark); + void end(bool mark); + + bool isModified() const; + void setModified(bool); + + void setSelection(int, int); + bool hasSelectedText() const; + QString selectedText() const; + int selectionStart() const; + + bool isUndoAvailable() const; + bool isRedoAvailable() const; + + void setDragEnabled(bool b); + bool dragEnabled() const; + + QString inputMask() const; + void setInputMask(const QString &inputMask); + bool hasAcceptableInput() const; + + void setTextMargins(int left, int top, int right, int bottom); + void setTextMargins(const QMargins &margins); + void getTextMargins(int *left, int *top, int *right, int *bottom) const; + QMargins textMargins() const; + +public Q_SLOTS: + void setText(const QString &); + void clear(); + void selectAll(); + void undo(); + void redo(); +#ifndef QT_NO_CLIPBOARD + void cut(); + void copy() const; + void paste(); +#endif + +public: + void deselect(); + void insert(const QString &); +#ifndef QT_NO_CONTEXTMENU + QMenu *createStandardContextMenu(); +#endif + +Q_SIGNALS: + void textChanged(const QString &); + void textEdited(const QString &); + void cursorPositionChanged(int, int); + void returnPressed(); + void editingFinished(); + void selectionChanged(); + +protected: + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseDoubleClickEvent(QMouseEvent *); + void keyPressEvent(QKeyEvent *); + void focusInEvent(QFocusEvent *); + void focusOutEvent(QFocusEvent *); + void paintEvent(QPaintEvent *); +#ifndef QT_NO_DRAGANDDROP + void dragEnterEvent(QDragEnterEvent *); + void dragMoveEvent(QDragMoveEvent *e); + void dragLeaveEvent(QDragLeaveEvent *e); + void dropEvent(QDropEvent *); +#endif + void changeEvent(QEvent *); +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *); +#endif +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void repaintArea(int, int) { update(); } +#endif + + void inputMethodEvent(QInputMethodEvent *); + void initStyleOption(QStyleOptionFrame *option) const; +public: + QVariant inputMethodQuery(Qt::InputMethodQuery) const; + bool event(QEvent *); +protected: + QRect cursorRect() const; + +public: +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void clearModified() { setModified(false); } + inline QT3_SUPPORT void cursorLeft(bool mark, int steps = 1) { cursorForward(mark, -steps); } + inline QT3_SUPPORT void cursorRight(bool mark, int steps = 1) { cursorForward(mark, steps); } + QT3_SUPPORT bool validateAndSet(const QString &, int, int, int); + inline QT3_SUPPORT bool frame() const { return hasFrame(); } +#ifndef QT_NO_VALIDATOR + inline QT3_SUPPORT void clearValidator() { setValidator(0); } +#endif + inline QT3_SUPPORT bool hasMarkedText() const { return hasSelectedText(); } + inline QT3_SUPPORT QString markedText() const { return selectedText(); } + QT3_SUPPORT bool edited() const; + QT3_SUPPORT void setEdited(bool); + QT3_SUPPORT int characterAt(int, QChar*) const; + QT3_SUPPORT bool getSelection(int *, int *); + + QT3_SUPPORT void setFrameRect(QRect) {} + QT3_SUPPORT QRect frameRect() const { return QRect(); } + enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel, + HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel, + PopupPanel, LineEditPanel, TabWidgetPanel, MShape }; + QT3_SUPPORT void setFrameShadow(DummyFrame) {} + QT3_SUPPORT DummyFrame frameShadow() const { return Plain; } + QT3_SUPPORT void setFrameShape(DummyFrame) {} + QT3_SUPPORT DummyFrame frameShape() const { return NoFrame; } + QT3_SUPPORT void setFrameStyle(int) {} + QT3_SUPPORT int frameStyle() const { return 0; } + QT3_SUPPORT int frameWidth() const { return 0; } + QT3_SUPPORT void setLineWidth(int) {} + QT3_SUPPORT int lineWidth() const { return 0; } + QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + QT3_SUPPORT int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } + QT3_SUPPORT void setMidLineWidth(int) {} + QT3_SUPPORT int midLineWidth() const { return 0; } + +Q_SIGNALS: + QT_MOC_COMPAT void lostFocus(); +#endif + +private: + friend class QAbstractSpinBox; +#ifdef QT_KEYPAD_NAVIGATION + friend class QDateTimeEdit; +#endif + Q_DISABLE_COPY(QLineEdit) + Q_DECLARE_PRIVATE(QLineEdit) + Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) + Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) + Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) +#ifndef QT_NO_COMPLETER + Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(QString)) +#endif +#ifdef QT_KEYPAD_NAVIGATION + Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool)) +#endif + Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged()) +}; + +#endif // QT_NO_LINEEDIT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLINEEDIT_H diff --git a/qtinterface/qt4/Qt/qlinkedlist.h b/qtinterface/qt4/Qt/qlinkedlist.h new file mode 100644 index 0000000..3ec9e3c --- /dev/null +++ b/qtinterface/qt4/Qt/qlinkedlist.h @@ -0,0 +1,518 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLINKEDLIST_H +#define QLINKEDLIST_H + +#include <QtCore/qiterator.h> +#include <QtCore/qatomic.h> + +#ifndef QT_NO_STL +#include <iterator> +#include <list> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +struct Q_CORE_EXPORT QLinkedListData +{ + QLinkedListData *n, *p; + QBasicAtomicInt ref; + int size; + uint sharable : 1; + + static QLinkedListData shared_null; +}; + +template <typename T> +struct QLinkedListNode +{ + inline QLinkedListNode(const T &arg): t(arg) { } + QLinkedListNode *n, *p; + T t; +}; + +template <class T> +class QLinkedList +{ + typedef QLinkedListNode<T> Node; + union { QLinkedListData *d; QLinkedListNode<T> *e; }; + +public: + inline QLinkedList() : d(&QLinkedListData::shared_null) { d->ref.ref(); } + inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); } + ~QLinkedList(); + QLinkedList<T> &operator=(const QLinkedList<T> &); + bool operator==(const QLinkedList<T> &l) const; + inline bool operator!=(const QLinkedList<T> &l) const { return !(*this == l); } + + inline int size() const { return d->size; } + inline void detach() + { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + inline bool isEmpty() const { return d->size == 0; } + + void clear(); + + void append(const T &); + void prepend(const T &); + T takeFirst(); + T takeLast(); + int removeAll(const T &t); + bool removeOne(const T &t); + bool contains(const T &t) const; + int count(const T &t) const; + + class const_iterator; + + class iterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + Node *i; + inline iterator() : i(0) {} + inline iterator(Node *n) : i(n) {} + inline iterator(const iterator &o) : i(o.i) {} + inline iterator &operator=(const iterator &o) { i = o.i; return *this; } + inline T &operator*() const { return i->t; } + inline T *operator->() const { return &i->t; } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator==(const const_iterator &o) const + { return i == o.i; } + inline bool operator!=(const const_iterator &o) const + { return i != o.i; } + inline iterator &operator++() { i = i->n; return *this; } + inline iterator operator++(int) { Node *n = i; i = i->n; return n; } + inline iterator &operator--() { i = i->p; return *this; } + inline iterator operator--(int) { Node *n = i; i = i->p; return n; } + inline iterator operator+(int j) const + { Node *n = i; if (j > 0) while (j--) n = n->n; else while (j++) n = n->p; return n; } + inline iterator operator-(int j) const { return operator+(-j); } + inline iterator &operator+=(int j) { return *this = *this + j; } + inline iterator &operator-=(int j) { return *this = *this - j; } + }; + friend class iterator; + + class const_iterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + Node *i; + inline const_iterator() : i(0) {} + inline const_iterator(Node *n) : i(n) {} + inline const_iterator(const const_iterator &o) : i(o.i){} + inline const_iterator(iterator ci) : i(ci.i){} + inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; } + inline const T &operator*() const { return i->t; } + inline const T *operator->() const { return &i->t; } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline const_iterator &operator++() { i = i->n; return *this; } + inline const_iterator operator++(int) { Node *n = i; i = i->n; return n; } + inline const_iterator &operator--() { i = i->p; return *this; } + inline const_iterator operator--(int) { Node *n = i; i = i->p; return n; } + inline const_iterator operator+(int j) const + { Node *n = i; if (j > 0) while (j--) n = n->n; else while (j++) n = n->p; return n; } + inline const_iterator operator-(int j) const { return operator+(-j); } + inline const_iterator &operator+=(int j) { return *this = *this + j; } + inline const_iterator &operator-=(int j) { return *this = *this - j; } + }; + friend class const_iterator; + + // stl style + inline iterator begin() { detach(); return e->n; } + inline const_iterator begin() const { return e->n; } + inline const_iterator constBegin() const { return e->n; } + inline iterator end() { detach(); return e; } + inline const_iterator end() const { return e; } + inline const_iterator constEnd() const { return e; } + iterator insert(iterator before, const T &t); + iterator erase(iterator pos); + iterator erase(iterator first, iterator last); + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline int count() const { return d->size; } + 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()); } + const T& last() const { Q_ASSERT(!isEmpty()); return *(--end()); } + inline void removeFirst() { Q_ASSERT(!isEmpty()); erase(begin()); } + inline void removeLast() { Q_ASSERT(!isEmpty()); erase(--end()); } + inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; } + inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; } + + // stl compatibility + inline void push_back(const T &t) { append(t); } + inline void push_front(const T &t) { prepend(t); } + inline T& front() { return first(); } + inline const T& front() const { return first(); } + inline T& back() { return last(); } + inline const T& back() const { return last(); } + inline void pop_front() { removeFirst(); } + inline void pop_back() { removeLast(); } + inline bool empty() const { return isEmpty(); } + typedef int size_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef ptrdiff_t difference_type; + +#ifndef QT_NO_STL + static inline QLinkedList<T> fromStdList(const std::list<T> &list) + { QLinkedList<T> tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } + inline std::list<T> toStdList() const + { std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } +#endif + +#ifdef QT3_SUPPORT + // compatibility + inline QT3_SUPPORT iterator remove(iterator pos) { return erase(pos); } + inline QT3_SUPPORT int findIndex(const T& t) const + { int i=0; for (const_iterator it = begin(); it != end(); ++it, ++i) if(*it == t) return i; return -1;} + inline QT3_SUPPORT iterator find(iterator from, const T& t) + { while (from != end() && !(*from == t)) ++from; return from; } + inline QT3_SUPPORT iterator find(const T& t) + { return find(begin(), t); } + inline QT3_SUPPORT const_iterator find(const_iterator from, const T& t) const + { while (from != end() && !(*from == t)) ++from; return from; } + inline QT3_SUPPORT const_iterator find(const T& t) const + { return find(begin(), t); } +#endif + + // comfort + QLinkedList<T> &operator+=(const QLinkedList<T> &l); + QLinkedList<T> operator+(const QLinkedList<T> &l) const; + inline QLinkedList<T> &operator+=(const T &t) { append(t); return *this; } + inline QLinkedList<T> &operator<< (const T &t) { append(t); return *this; } + inline QLinkedList<T> &operator<<(const QLinkedList<T> &l) { *this += l; return *this; } + +private: + void detach_helper(); + void free(QLinkedListData*); +}; + +template <typename T> +inline QLinkedList<T>::~QLinkedList() +{ + if (!d) + return; + if (!d->ref.deref()) + free(d); +} + +template <typename T> +void QLinkedList<T>::detach_helper() +{ + union { QLinkedListData *d; Node *e; } x; + x.d = new QLinkedListData; + x.d->ref = 1; + x.d->size = d->size; + x.d->sharable = true; + Node *original = e->n; + Node *copy = x.e; + while (original != e) { + QT_TRY { + copy->n = new Node(original->t); + copy->n->p = copy; + original = original->n; + copy = copy->n; + } QT_CATCH(...) { + copy->n = x.e; + free(x.d); + QT_RETHROW; + } + } + copy->n = x.e; + x.e->p = copy; + if (!d->ref.deref()) + free(d); + d = x.d; +} + +template <typename T> +void QLinkedList<T>::free(QLinkedListData *x) +{ + Node *y = reinterpret_cast<Node*>(x); + Node *i = y->n; + if (x->ref == 0) { + while(i != y) { + Node *n = i; + i = i->n; + delete n; + } + delete x; + } +} + +template <typename T> +void QLinkedList<T>::clear() +{ + *this = QLinkedList<T>(); +} + +template <typename T> +QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &l) +{ + if (d != l.d) { + l.d->ref.ref(); + if (!d->ref.deref()) + free(d); + d = l.d; + if (!d->sharable) + detach_helper(); + } + return *this; +} + +template <typename T> +bool QLinkedList<T>::operator== (const QLinkedList<T> &l) const +{ + if (d->size != l.d->size) + return false; + if (e == l.e) + return true; + Node *i = e->n; + Node *il = l.e->n; + while (i != e) { + if (! (i->t == il->t)) + return false; + i = i->n; + il = il->n; + } + return true; +} + +template <typename T> +void QLinkedList<T>::append(const T &t) +{ + detach(); + Node *i = new Node(t); + i->n = e; + i->p = e->p; + i->p->n = i; + e->p = i; + d->size++; +} + +template <typename T> +void QLinkedList<T>::prepend(const T &t) +{ + detach(); + Node *i = new Node(t); + i->n = e->n; + i->p = e; + i->n->p = i; + e->n = i; + d->size++; +} + +template <typename T> +int QLinkedList<T>::removeAll(const T &_t) +{ + detach(); + const T t = _t; + Node *i = e->n; + int c = 0; + while (i != e) { + if (i->t == t) { + Node *n = i; + i->n->p = i->p; + i->p->n = i->n; + i = i->n; + delete n; + c++; + } else { + i = i->n; + } + } + d->size-=c; + return c; +} + +template <typename T> +bool QLinkedList<T>::removeOne(const T &_t) +{ + detach(); + iterator it = qFind(begin(), end(), _t); + if (it != end()) { + erase(it); + return true; + } + return false; +} + +template <typename T> +inline T QLinkedList<T>::takeFirst() +{ + T t = first(); + removeFirst(); + return t; +} + +template <typename T> +inline T QLinkedList<T>::takeLast() +{ + T t = last(); + removeLast(); + return t; +} + +template <typename T> +bool QLinkedList<T>::contains(const T &t) const +{ + Node *i = e; + while ((i = i->n) != e) + if (i->t == t) + return true; + return false; +} + +template <typename T> +int QLinkedList<T>::count(const T &t) const +{ + Node *i = e; + int c = 0; + while ((i = i->n) != e) + if (i->t == t) + c++; + return c; +} + + +template <typename T> +typename QLinkedList<T>::iterator QLinkedList<T>::insert(iterator before, const T &t) +{ + Node *i = before.i; + Node *m = new Node(t); + m->n = i; + m->p = i->p; + m->p->n = m; + i->p = m; + d->size++; + return m; +} + +template <typename T> +typename QLinkedList<T>::iterator QLinkedList<T>::erase(typename QLinkedList<T>::iterator afirst, + typename QLinkedList<T>::iterator alast) +{ + while (afirst != alast) + erase(afirst++); + return alast; +} + + +template <typename T> +typename QLinkedList<T>::iterator QLinkedList<T>::erase(iterator pos) +{ + detach(); + Node *i = pos.i; + if (i != e) { + Node *n = i; + i->n->p = i->p; + i->p->n = i->n; + i = i->n; + delete n; + d->size--; + } + return i; +} + +template <typename T> +QLinkedList<T> &QLinkedList<T>::operator+=(const QLinkedList<T> &l) +{ + detach(); + int n = l.d->size; + d->size += n; + Node *original = l.e->n; + while (n--) { + QT_TRY { + Node *copy = new Node(original->t); + original = original->n; + copy->n = e; + copy->p = e->p; + copy->p->n = copy; + e->p = copy; + } QT_CATCH(...) { + // restore the original list + while (n++<d->size) + removeLast(); + QT_RETHROW; + } + } + return *this; +} + +template <typename T> +QLinkedList<T> QLinkedList<T>::operator+(const QLinkedList<T> &l) const +{ + QLinkedList<T> n = *this; + n += l; + return n; +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(LinkedList) +Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(LinkedList) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLINKEDLIST_H diff --git a/qtinterface/qt4/Qt/qlist.h b/qtinterface/qt4/Qt/qlist.h new file mode 100644 index 0000000..4874fb0 --- /dev/null +++ b/qtinterface/qt4/Qt/qlist.h @@ -0,0 +1,784 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLIST_H +#define QLIST_H + +#include <QtCore/qiterator.h> +#include <QtCore/qatomic.h> +#include <QtCore/qalgorithms.h> + +#ifndef QT_NO_STL +#include <iterator> +#include <list> +#endif + +#include <new> +#include <string.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <typename T> class QVector; +template <typename T> class QSet; + +struct Q_CORE_EXPORT QListData { + struct Data { + QBasicAtomicInt ref; + int alloc, begin, end; + uint sharable : 1; + void *array[1]; + }; + enum { DataHeaderSize = sizeof(Data) - sizeof(void *) }; + + Data *detach(); // remove in 5.0 + Data *detach2(); // remove in 5.0 + Data *detach3(); + void realloc(int alloc); + static Data shared_null; + Data *d; + void **erase(void **xi); + void **append(); + void **append(const QListData &l); + void **append2(const QListData &l); // remove in 5.0 + void **prepend(); + void **insert(int i); + void remove(int i); + void remove(int i, int n); + void move(int from, int to); + inline int size() const { return d->end - d->begin; } + inline bool isEmpty() const { return d->end == d->begin; } + inline void **at(int i) const { return d->array + d->begin + i; } + inline void **begin() const { return d->array + d->begin; } + inline void **end() const { return d->array + d->end; } +}; + +template <typename T> +class QList +{ + struct Node { void *v; +#if defined(Q_CC_BOR) + Q_INLINE_TEMPLATE T &t(); +#else + Q_INLINE_TEMPLATE T &t() + { return *reinterpret_cast<T*>(QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic + ? v : this); } +#endif + }; + + union { QListData p; QListData::Data *d; }; + +public: + inline QList() : d(&QListData::shared_null) { d->ref.ref(); } + inline QList(const QList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } + ~QList(); + QList<T> &operator=(const QList<T> &l); + bool operator==(const QList<T> &l) const; + inline bool operator!=(const QList<T> &l) const { return !(*this == l); } + + inline int size() const { return p.size(); } + + inline void detach() { if (d->ref != 1) detach_helper(); } + + inline void detachShared() + { + // The "this->" qualification is needed for GCCE. + if (d->ref != 1 && this->d != &QListData::shared_null) + detach_helper(); + } + + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + inline bool isEmpty() const { return p.isEmpty(); } + + void clear(); + + const T &at(int i) const; + const T &operator[](int i) const; + T &operator[](int i); + + void append(const T &t); + void append(const QList<T> &t); + void prepend(const T &t); + void insert(int i, const T &t); + void replace(int i, const T &t); + void removeAt(int i); + int removeAll(const T &t); + bool removeOne(const T &t); + T takeAt(int i); + T takeFirst(); + T takeLast(); + void move(int from, int to); + void swap(int i, int j); + int indexOf(const T &t, int from = 0) const; + int lastIndexOf(const T &t, int from = -1) const; + QBool contains(const T &t) const; + int count(const T &t) const; + + class const_iterator; + + class iterator { + public: + Node *i; + typedef std::random_access_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + inline iterator() : i(0) {} + inline iterator(Node *n) : i(n) {} + inline iterator(const iterator &o): i(o.i){} + inline T &operator*() const { return i->t(); } + inline T *operator->() const { return &i->t(); } + inline T &operator[](int j) const { return i[j].t(); } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator<(const iterator& other) const { return i < other.i; } + inline bool operator<=(const iterator& other) const { return i <= other.i; } + inline bool operator>(const iterator& other) const { return i > other.i; } + inline bool operator>=(const iterator& other) const { return i >= other.i; } +#ifndef QT_STRICT_ITERATORS + inline bool operator==(const const_iterator &o) const + { return i == o.i; } + inline bool operator!=(const const_iterator &o) const + { return i != o.i; } + inline bool operator<(const const_iterator& other) const + { return i < other.i; } + inline bool operator<=(const const_iterator& other) const + { return i <= other.i; } + inline bool operator>(const const_iterator& other) const + { return i > other.i; } + inline bool operator>=(const const_iterator& other) const + { return i >= other.i; } +#endif + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { Node *n = i; ++i; return n; } + inline iterator &operator--() { i--; return *this; } + inline iterator operator--(int) { Node *n = i; i--; return n; } + inline iterator &operator+=(int j) { i+=j; return *this; } + inline iterator &operator-=(int j) { i-=j; return *this; } + inline iterator operator+(int j) const { return iterator(i+j); } + inline iterator operator-(int j) const { return iterator(i-j); } + inline int operator-(iterator j) const { return int(i - j.i); } + }; + friend class iterator; + + class const_iterator { + public: + Node *i; + typedef std::random_access_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() : i(0) {} + inline const_iterator(Node *n) : i(n) {} + inline const_iterator(const const_iterator &o): i(o.i) {} +#ifdef QT_STRICT_ITERATORS + inline explicit const_iterator(const iterator &o): i(o.i) {} +#else + inline const_iterator(const iterator &o): i(o.i) {} +#endif + inline const T &operator*() const { return i->t(); } + inline const T *operator->() const { return &i->t(); } + inline const T &operator[](int j) const { return i[j].t(); } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline bool operator<(const const_iterator& other) const { return i < other.i; } + inline bool operator<=(const const_iterator& other) const { return i <= other.i; } + inline bool operator>(const const_iterator& other) const { return i > other.i; } + inline bool operator>=(const const_iterator& other) const { return i >= other.i; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { Node *n = i; ++i; return n; } + inline const_iterator &operator--() { i--; return *this; } + inline const_iterator operator--(int) { Node *n = i; i--; return n; } + inline const_iterator &operator+=(int j) { i+=j; return *this; } + inline const_iterator &operator-=(int j) { i-=j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(i+j); } + inline const_iterator operator-(int j) const { return const_iterator(i-j); } + inline int operator-(const_iterator j) const { return i - j.i; } + }; + friend class const_iterator; + + // stl style + inline iterator begin() { detach(); return reinterpret_cast<Node *>(p.begin()); } + inline const_iterator begin() const { return reinterpret_cast<Node *>(p.begin()); } + inline const_iterator constBegin() const { return reinterpret_cast<Node *>(p.begin()); } + inline iterator end() { detach(); return reinterpret_cast<Node *>(p.end()); } + inline const_iterator end() const { return reinterpret_cast<Node *>(p.end()); } + inline const_iterator constEnd() const { return reinterpret_cast<Node *>(p.end()); } + iterator insert(iterator before, const T &t); + iterator erase(iterator pos); + iterator erase(iterator first, iterator last); + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline int count() const { return p.size(); } + inline int length() const { return p.size(); } // Same as count() + 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()); } + const T& last() const { Q_ASSERT(!isEmpty()); return *(--end()); } + inline void removeFirst() { Q_ASSERT(!isEmpty()); erase(begin()); } + inline void removeLast() { Q_ASSERT(!isEmpty()); erase(--end()); } + inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; } + inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; } + QList<T> mid(int pos, int length = -1) const; + + T value(int i) const; + T value(int i, const T &defaultValue) const; + + // stl compatibility + inline void push_back(const T &t) { append(t); } + inline void push_front(const T &t) { prepend(t); } + inline T& front() { return first(); } + inline const T& front() const { return first(); } + inline T& back() { return last(); } + inline const T& back() const { return last(); } + inline void pop_front() { removeFirst(); } + inline void pop_back() { removeLast(); } + inline bool empty() const { return isEmpty(); } + typedef int size_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef ptrdiff_t difference_type; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT iterator remove(iterator pos) { return erase(pos); } + inline QT3_SUPPORT int remove(const T &t) { return removeAll(t); } + inline QT3_SUPPORT int findIndex(const T& t) const { return indexOf(t); } + inline QT3_SUPPORT iterator find(const T& t) + { int i = indexOf(t); return (i == -1 ? end() : (begin()+i)); } + inline QT3_SUPPORT const_iterator find (const T& t) const + { int i = indexOf(t); return (i == -1 ? end() : (begin()+i)); } + inline QT3_SUPPORT iterator find(iterator from, const T& t) + { int i = indexOf(t, from - begin()); return i == -1 ? end() : begin()+i; } + inline QT3_SUPPORT const_iterator find(const_iterator from, const T& t) const + { int i = indexOf(t, from - begin()); return i == -1 ? end() : begin()+i; } +#endif + + // comfort + QList<T> &operator+=(const QList<T> &l); + inline QList<T> operator+(const QList<T> &l) const + { QList n = *this; n += l; return n; } + inline QList<T> &operator+=(const T &t) + { append(t); return *this; } + inline QList<T> &operator<< (const T &t) + { append(t); return *this; } + inline QList<T> &operator<<(const QList<T> &l) + { *this += l; return *this; } + + QVector<T> toVector() const; + QSet<T> toSet() const; + + static QList<T> fromVector(const QVector<T> &vector); + static QList<T> fromSet(const QSet<T> &set); + +#ifndef QT_NO_STL + static inline QList<T> fromStdList(const std::list<T> &list) + { QList<T> tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } + inline std::list<T> toStdList() const + { std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } +#endif + +private: + void detach_helper(); + void free(QListData::Data *d); + + void node_construct(Node *n, const T &t); + void node_destruct(Node *n); + void node_copy(Node *from, Node *to, Node *src); + void node_destruct(Node *from, Node *to); +}; + +#if defined(Q_CC_BOR) +template <typename T> +Q_INLINE_TEMPLATE T &QList<T>::Node::t() +{ return QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic ? *(T*)v:*(T*)this; } +#endif + +template <typename T> +Q_INLINE_TEMPLATE void QList<T>::node_construct(Node *n, const T &t) +{ + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t); + else if (QTypeInfo<T>::isComplex) new (n) T(t); + else *reinterpret_cast<T*>(n) = t; +} + +template <typename T> +Q_INLINE_TEMPLATE void QList<T>::node_destruct(Node *n) +{ + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) delete reinterpret_cast<T*>(n->v); + else if (QTypeInfo<T>::isComplex) reinterpret_cast<T*>(n)->~T(); +} + +template <typename T> +Q_INLINE_TEMPLATE void QList<T>::node_copy(Node *from, Node *to, Node *src) +{ + Node *current = from; + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) { + QT_TRY { + while(current != to) { + current->v = new T(*reinterpret_cast<T*>(src->v)); + ++current; + ++src; + } + } QT_CATCH(...) { + while (current-- != from) + delete reinterpret_cast<T*>(current->v); + QT_RETHROW; + } + + } else if (QTypeInfo<T>::isComplex) { + QT_TRY { + while(current != to) { + new (current) T(*reinterpret_cast<T*>(src)); + ++current; + ++src; + } + } QT_CATCH(...) { + while (current-- != from) + (reinterpret_cast<T*>(current))->~T(); + QT_RETHROW; + } + } else { + if (src != from && to - from > 0) + memcpy(from, src, (to - from) * sizeof(Node *)); + } +} + +template <typename T> +Q_INLINE_TEMPLATE void QList<T>::node_destruct(Node *from, Node *to) +{ + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) + while(from != to) --to, delete reinterpret_cast<T*>(to->v); + else if (QTypeInfo<T>::isComplex) + while (from != to) --to, reinterpret_cast<T*>(to)->~T(); +} + +template <typename T> +Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l) +{ + if (d != l.d) { + l.d->ref.ref(); + if (!d->ref.deref()) + free(d); + d = l.d; + if (!d->sharable) + detach_helper(); + } + return *this; +} +template <typename T> +inline typename QList<T>::iterator QList<T>::insert(iterator before, const T &t) +{ + int iBefore = int(before.i - reinterpret_cast<Node *>(p.begin())); + Node *n = reinterpret_cast<Node *>(p.insert(iBefore)); + QT_TRY { + node_construct(n, t); + } QT_CATCH(...) { + p.remove(iBefore); + QT_RETHROW; + } + return n; +} +template <typename T> +inline typename QList<T>::iterator QList<T>::erase(iterator it) +{ node_destruct(it.i); + return reinterpret_cast<Node *>(p.erase(reinterpret_cast<void**>(it.i))); } +template <typename T> +inline const T &QList<T>::at(int i) const +{ Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::at", "index out of range"); + return reinterpret_cast<Node *>(p.at(i))->t(); } +template <typename T> +inline const T &QList<T>::operator[](int i) const +{ Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::operator[]", "index out of range"); + return reinterpret_cast<Node *>(p.at(i))->t(); } +template <typename T> +inline T &QList<T>::operator[](int i) +{ Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::operator[]", "index out of range"); + detach(); return reinterpret_cast<Node *>(p.at(i))->t(); } +template <typename T> +inline void QList<T>::removeAt(int i) +{ if(i >= 0 && i < p.size()) { detach(); + node_destruct(reinterpret_cast<Node *>(p.at(i))); p.remove(i); } } +template <typename T> +inline T QList<T>::takeAt(int i) +{ Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::take", "index out of range"); + detach(); Node *n = reinterpret_cast<Node *>(p.at(i)); T t = n->t(); node_destruct(n); + p.remove(i); return t; } +template <typename T> +inline T QList<T>::takeFirst() +{ T t = first(); removeFirst(); return t; } +template <typename T> +inline T QList<T>::takeLast() +{ T t = last(); removeLast(); return t; } + +template <typename T> +Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t) +{ + detach(); + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) { + Node *n = reinterpret_cast<Node *>(p.append()); + QT_TRY { + node_construct(n, t); + } QT_CATCH(...) { + --d->end; + QT_RETHROW; + } + } else { + const T cpy(t); + Node *n = reinterpret_cast<Node *>(p.append()); + QT_TRY { + node_construct(n, cpy); + } QT_CATCH(...) { + --d->end; + QT_RETHROW; + } + } +} + +template <typename T> +inline void QList<T>::prepend(const T &t) +{ + detach(); + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) { + Node *n = reinterpret_cast<Node *>(p.prepend()); + QT_TRY { + node_construct(n, t); + } QT_CATCH(...) { + ++d->begin; + QT_RETHROW; + } + } else { + const T cpy(t); + Node *n = reinterpret_cast<Node *>(p.prepend()); + QT_TRY { + node_construct(n, cpy); + } QT_CATCH(...) { + ++d->begin; + QT_RETHROW; + } + } +} + +template <typename T> +inline void QList<T>::insert(int i, const T &t) +{ + detach(); + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) { + Node *n = reinterpret_cast<Node *>(p.insert(i)); + QT_TRY { + node_construct(n, t); + } QT_CATCH(...) { + p.remove(i); + QT_RETHROW; + } + } else { + const T cpy(t); + Node *n = reinterpret_cast<Node *>(p.insert(i)); + QT_TRY { + node_construct(n, cpy); + } QT_CATCH(...) { + p.remove(i); + QT_RETHROW; + } + } +} + +template <typename T> +inline void QList<T>::replace(int i, const T &t) +{ + Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::replace", "index out of range"); + detach(); + if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) { + reinterpret_cast<Node *>(p.at(i))->t() = t; + } else { + const T cpy(t); + reinterpret_cast<Node *>(p.at(i))->t() = cpy; + } +} + +template <typename T> +inline void QList<T>::swap(int i, int j) +{ + Q_ASSERT_X(i >= 0 && i < p.size() && j >= 0 && j < p.size(), + "QList<T>::swap", "index out of range"); + detach(); + void *t = d->array[d->begin + i]; + d->array[d->begin + i] = d->array[d->begin + j]; + d->array[d->begin + j] = t; +} + +template <typename T> +inline void QList<T>::move(int from, int to) +{ + Q_ASSERT_X(from >= 0 && from < p.size() && to >= 0 && to < p.size(), + "QList<T>::move", "index out of range"); + detach(); + p.move(from, to); +} + +template<typename T> +Q_OUTOFLINE_TEMPLATE QList<T> QList<T>::mid(int pos, int alength) const +{ + if (alength < 0) + alength = size() - pos; + if (pos == 0 && alength == size()) + return *this; + QList<T> cpy; + if (pos + alength > size()) + alength = size() - pos; + for (int i = pos; i < pos + alength; ++i) + cpy += at(i); + return cpy; +} + +template<typename T> +Q_OUTOFLINE_TEMPLATE T QList<T>::value(int i) const +{ + if (i < 0 || i >= p.size()) { + return T(); + } + return reinterpret_cast<Node *>(p.at(i))->t(); +} + +template<typename T> +Q_OUTOFLINE_TEMPLATE T QList<T>::value(int i, const T& defaultValue) const +{ + return ((i < 0 || i >= p.size()) ? defaultValue : reinterpret_cast<Node *>(p.at(i))->t()); +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper() +{ + Node *n = reinterpret_cast<Node *>(p.begin()); + QListData::Data *x = p.detach3(); + QT_TRY { + node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.end()), n); + } QT_CATCH(...) { + qFree(d); + d = x; + QT_RETHROW; + } + + if (!x->ref.deref()) + free(x); +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QList<T>::~QList() +{ + if (d && !d->ref.deref()) + free(d); +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE bool QList<T>::operator==(const QList<T> &l) const +{ + if (p.size() != l.p.size()) + return false; + if (d == l.d) + return true; + Node *i = reinterpret_cast<Node *>(p.end()); + Node *b = reinterpret_cast<Node *>(p.begin()); + Node *li = reinterpret_cast<Node *>(l.p.end()); + while (i != b) { + --i; --li; + if (!(i->t() == li->t())) + return false; + } + return true; +} + +// ### Qt 5: rename freeData() to avoid confusion with std::free() +template <typename T> +Q_OUTOFLINE_TEMPLATE void QList<T>::free(QListData::Data *data) +{ + node_destruct(reinterpret_cast<Node *>(data->array + data->begin), + reinterpret_cast<Node *>(data->array + data->end)); + if (data->ref == 0) + qFree(data); +} + + +template <typename T> +Q_OUTOFLINE_TEMPLATE void QList<T>::clear() +{ + *this = QList<T>(); +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t) +{ + detachShared(); + const T t = _t; + int removedCount=0, i=0; + Node *n; + while (i < p.size()) + if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) { + node_destruct(n); + p.remove(i); + ++removedCount; + } else { + ++i; + } + return removedCount; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE bool QList<T>::removeOne(const T &_t) +{ + detachShared(); + int index = indexOf(_t); + if (index != -1) { + removeAt(index); + return true; + } + return false; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE typename QList<T>::iterator QList<T>::erase(typename QList<T>::iterator afirst, + typename QList<T>::iterator alast) +{ + for (Node *n = afirst.i; n < alast.i; ++n) + node_destruct(n); + int idx = afirst - begin(); + p.remove(idx, alast - afirst); + return begin() + idx; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l) +{ + detach(); + Node *n = reinterpret_cast<Node *>(p.append2(l.p)); + QT_TRY{ + node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin())); + } QT_CATCH(...) { + // restore the old end + d->end -= int(reinterpret_cast<Node *>(p.end()) - n); + QT_RETHROW; + } + return *this; +} + +template <typename T> +inline void QList<T>::append(const QList<T> &t) +{ + *this += t; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE int QList<T>::indexOf(const T &t, int from) const +{ + if (from < 0) + from = qMax(from + p.size(), 0); + if (from < p.size()) { + Node *n = reinterpret_cast<Node *>(p.at(from -1)); + Node *e = reinterpret_cast<Node *>(p.end()); + while (++n != e) + if (n->t() == t) + return int(n - reinterpret_cast<Node *>(p.begin())); + } + return -1; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE int QList<T>::lastIndexOf(const T &t, int from) const +{ + if (from < 0) + from += p.size(); + else if (from >= p.size()) + from = p.size()-1; + if (from >= 0) { + Node *b = reinterpret_cast<Node *>(p.begin()); + Node *n = reinterpret_cast<Node *>(p.at(from + 1)); + while (n-- != b) { + if (n->t() == t) + return n - b; + } + } + return -1; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QBool QList<T>::contains(const T &t) const +{ + Node *b = reinterpret_cast<Node *>(p.begin()); + Node *i = reinterpret_cast<Node *>(p.end()); + while (i-- != b) + if (i->t() == t) + return QBool(true); + return QBool(false); +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE int QList<T>::count(const T &t) const +{ + int c = 0; + Node *b = reinterpret_cast<Node *>(p.begin()); + Node *i = reinterpret_cast<Node *>(p.end()); + while (i-- != b) + if (i->t() == t) + ++c; + return c; +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(List) +Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLIST_H diff --git a/qtinterface/qt4/Qt/qlistview.h b/qtinterface/qt4/Qt/qlistview.h new file mode 100644 index 0000000..bf3f4f1 --- /dev/null +++ b/qtinterface/qt4/Qt/qlistview.h @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLISTVIEW_H +#define QLISTVIEW_H + +#include <QtGui/qabstractitemview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LISTVIEW + +class QListViewPrivate; + +class Q_GUI_EXPORT QListView : public QAbstractItemView +{ + Q_OBJECT + Q_ENUMS(Movement Flow ResizeMode LayoutMode ViewMode) + Q_PROPERTY(Movement movement READ movement WRITE setMovement) + Q_PROPERTY(Flow flow READ flow WRITE setFlow) + Q_PROPERTY(bool isWrapping READ isWrapping WRITE setWrapping) + Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) + Q_PROPERTY(LayoutMode layoutMode READ layoutMode WRITE setLayoutMode) + Q_PROPERTY(int spacing READ spacing WRITE setSpacing) + Q_PROPERTY(QSize gridSize READ gridSize WRITE setGridSize) + Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) + Q_PROPERTY(int modelColumn READ modelColumn WRITE setModelColumn) + Q_PROPERTY(bool uniformItemSizes READ uniformItemSizes WRITE setUniformItemSizes) + Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize) + Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) + Q_PROPERTY(bool selectionRectVisible READ isSelectionRectVisible WRITE setSelectionRectVisible) + +public: + enum Movement { Static, Free, Snap }; + enum Flow { LeftToRight, TopToBottom }; + enum ResizeMode { Fixed, Adjust }; + enum LayoutMode { SinglePass, Batched }; + enum ViewMode { ListMode, IconMode }; + + explicit QListView(QWidget *parent = 0); + ~QListView(); + + void setMovement(Movement movement); + Movement movement() const; + + void setFlow(Flow flow); + Flow flow() const; + + void setWrapping(bool enable); + bool isWrapping() const; + + void setResizeMode(ResizeMode mode); + ResizeMode resizeMode() const; + + void setLayoutMode(LayoutMode mode); + LayoutMode layoutMode() const; + + void setSpacing(int space); + int spacing() const; + + void setBatchSize(int batchSize); + int batchSize() const; + + void setGridSize(const QSize &size); + QSize gridSize() const; + + void setViewMode(ViewMode mode); + ViewMode viewMode() const; + + void clearPropertyFlags(); + + bool isRowHidden(int row) const; + void setRowHidden(int row, bool hide); + + void setModelColumn(int column); + int modelColumn() const; + + void setUniformItemSizes(bool enable); + bool uniformItemSizes() const; + + void setWordWrap(bool on); + bool wordWrap() const; + + void setSelectionRectVisible(bool show); + bool isSelectionRectVisible() const; + + QRect visualRect(const QModelIndex &index) const; + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); + QModelIndex indexAt(const QPoint &p) const; + + void doItemsLayout(); + void reset(); + void setRootIndex(const QModelIndex &index); + +Q_SIGNALS: + void indexesMoved(const QModelIndexList &indexes); + +protected: + QListView(QListViewPrivate &, QWidget *parent = 0); + + bool event(QEvent *e); + + void scrollContentsBy(int dx, int dy); + + void resizeContents(int width, int height); + QSize contentsSize() const; + + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void rowsInserted(const QModelIndex &parent, int start, int end); + void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + + void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + + void timerEvent(QTimerEvent *e); + void resizeEvent(QResizeEvent *e); +#ifndef QT_NO_DRAGANDDROP + void dragMoveEvent(QDragMoveEvent *e); + void dragLeaveEvent(QDragLeaveEvent *e); + void dropEvent(QDropEvent *e); + void startDrag(Qt::DropActions supportedActions); + + void internalDrop(QDropEvent *e); + void internalDrag(Qt::DropActions supportedActions); +#endif // QT_NO_DRAGANDDROP + + QStyleOptionViewItem viewOptions() const; + void paintEvent(QPaintEvent *e); + + int horizontalOffset() const; + int verticalOffset() const; + QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + QRect rectForIndex(const QModelIndex &index) const; + void setPositionForIndex(const QPoint &position, const QModelIndex &index); + + void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + QRegion visualRegionForSelection(const QItemSelection &selection) const; + QModelIndexList selectedIndexes() const; + + void updateGeometries(); + + bool isIndexHidden(const QModelIndex &index) const; + + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + +private: + friend class QAccessibleItemView; + int visualIndex(const QModelIndex &index) const; + + Q_DECLARE_PRIVATE(QListView) + Q_DISABLE_COPY(QListView) +}; + +#endif // QT_NO_LISTVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLISTVIEW_H diff --git a/qtinterface/qt4/Qt/qlistwidget.h b/qtinterface/qt4/Qt/qlistwidget.h new file mode 100644 index 0000000..1fc7b67 --- /dev/null +++ b/qtinterface/qt4/Qt/qlistwidget.h @@ -0,0 +1,335 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLISTWIDGET_H +#define QLISTWIDGET_H + +#include <QtGui/qlistview.h> +#include <QtCore/qvariant.h> +#include <QtCore/qvector.h> +#include <QtGui/qitemselectionmodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LISTWIDGET + +class QListWidget; +class QListModel; +class QWidgetItemData; +class QListWidgetItemPrivate; + +class Q_GUI_EXPORT QListWidgetItem +{ + friend class QListModel; + friend class QListWidget; +public: + enum ItemType { Type = 0, UserType = 1000 }; + explicit QListWidgetItem(QListWidget *view = 0, int type = Type); + explicit QListWidgetItem(const QString &text, QListWidget *view = 0, int type = Type); + explicit QListWidgetItem(const QIcon &icon, const QString &text, + QListWidget *view = 0, int type = Type); + QListWidgetItem(const QListWidgetItem &other); + virtual ~QListWidgetItem(); + + virtual QListWidgetItem *clone() const; + + inline QListWidget *listWidget() const { return view; } + + inline void setSelected(bool select); + inline bool isSelected() const; + + inline void setHidden(bool hide); + inline bool isHidden() const; + + inline Qt::ItemFlags flags() const { return itemFlags; } + void setFlags(Qt::ItemFlags flags); + + inline QString text() const + { return data(Qt::DisplayRole).toString(); } + inline void setText(const QString &text); + + inline QIcon icon() const + { return qvariant_cast<QIcon>(data(Qt::DecorationRole)); } + inline void setIcon(const QIcon &icon); + + inline QString statusTip() const + { return data(Qt::StatusTipRole).toString(); } + inline void setStatusTip(const QString &statusTip); + +#ifndef QT_NO_TOOLTIP + inline QString toolTip() const + { return data(Qt::ToolTipRole).toString(); } + inline void setToolTip(const QString &toolTip); +#endif + +#ifndef QT_NO_WHATSTHIS + inline QString whatsThis() const + { return data(Qt::WhatsThisRole).toString(); } + inline void setWhatsThis(const QString &whatsThis); +#endif + + inline QFont font() const + { return qvariant_cast<QFont>(data(Qt::FontRole)); } + inline void setFont(const QFont &font); + + inline int textAlignment() const + { return data(Qt::TextAlignmentRole).toInt(); } + inline void setTextAlignment(int alignment) + { setData(Qt::TextAlignmentRole, alignment); } + + inline QColor backgroundColor() const + { return qvariant_cast<QColor>(data(Qt::BackgroundColorRole)); } + virtual void setBackgroundColor(const QColor &color) + { setData(Qt::BackgroundColorRole, color); } + + inline QBrush background() const + { return qvariant_cast<QBrush>(data(Qt::BackgroundRole)); } + inline void setBackground(const QBrush &brush) + { setData(Qt::BackgroundRole, brush); } + + inline QColor textColor() const + { return qvariant_cast<QColor>(data(Qt::TextColorRole)); } + inline void setTextColor(const QColor &color) + { setData(Qt::TextColorRole, color); } + + inline QBrush foreground() const + { return qvariant_cast<QBrush>(data(Qt::ForegroundRole)); } + inline void setForeground(const QBrush &brush) + { setData(Qt::ForegroundRole, brush); } + + inline Qt::CheckState checkState() const + { return static_cast<Qt::CheckState>(data(Qt::CheckStateRole).toInt()); } + inline void setCheckState(Qt::CheckState state) + { setData(Qt::CheckStateRole, static_cast<int>(state)); } + + inline QSize sizeHint() const + { return qvariant_cast<QSize>(data(Qt::SizeHintRole)); } + inline void setSizeHint(const QSize &size) + { setData(Qt::SizeHintRole, size); } + + virtual QVariant data(int role) const; + virtual void setData(int role, const QVariant &value); + + virtual bool operator<(const QListWidgetItem &other) const; + +#ifndef QT_NO_DATASTREAM + virtual void read(QDataStream &in); + virtual void write(QDataStream &out) const; +#endif + QListWidgetItem &operator=(const QListWidgetItem &other); + + inline int type() const { return rtti; } + +private: + int rtti; + QVector<void *> dummy; + QListWidget *view; + QListWidgetItemPrivate *d; + Qt::ItemFlags itemFlags; +}; + +inline void QListWidgetItem::setText(const QString &atext) +{ setData(Qt::DisplayRole, atext); } + +inline void QListWidgetItem::setIcon(const QIcon &aicon) +{ setData(Qt::DecorationRole, aicon); } + +inline void QListWidgetItem::setStatusTip(const QString &astatusTip) +{ setData(Qt::StatusTipRole, astatusTip); } + +#ifndef QT_NO_TOOLTIP +inline void QListWidgetItem::setToolTip(const QString &atoolTip) +{ setData(Qt::ToolTipRole, atoolTip); } +#endif + +#ifndef QT_NO_WHATSTHIS +inline void QListWidgetItem::setWhatsThis(const QString &awhatsThis) +{ setData(Qt::WhatsThisRole, awhatsThis); } +#endif + +inline void QListWidgetItem::setFont(const QFont &afont) +{ setData(Qt::FontRole, afont); } + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QListWidgetItem &item); +#endif + +class QListWidgetPrivate; + +class Q_GUI_EXPORT QListWidget : public QListView +{ + Q_OBJECT + Q_PROPERTY(int count READ count) + Q_PROPERTY(int currentRow READ currentRow WRITE setCurrentRow NOTIFY currentRowChanged USER true) + Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled) + + friend class QListWidgetItem; + friend class QListModel; +public: + explicit QListWidget(QWidget *parent = 0); + ~QListWidget(); + + QListWidgetItem *item(int row) const; + int row(const QListWidgetItem *item) const; + void insertItem(int row, QListWidgetItem *item); + void insertItem(int row, const QString &label); + void insertItems(int row, const QStringList &labels); + inline void addItem(const QString &label) { insertItem(count(), label); } + inline void addItem(QListWidgetItem *item); + inline void addItems(const QStringList &labels) { insertItems(count(), labels); } + QListWidgetItem *takeItem(int row); + int count() const; + + QListWidgetItem *currentItem() const; + void setCurrentItem(QListWidgetItem *item); + void setCurrentItem(QListWidgetItem *item, QItemSelectionModel::SelectionFlags command); + + int currentRow() const; + void setCurrentRow(int row); + void setCurrentRow(int row, QItemSelectionModel::SelectionFlags command); + + QListWidgetItem *itemAt(const QPoint &p) const; + inline QListWidgetItem *itemAt(int x, int y) const; + QRect visualItemRect(const QListWidgetItem *item) const; + + void sortItems(Qt::SortOrder order = Qt::AscendingOrder); + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + + void editItem(QListWidgetItem *item); + void openPersistentEditor(QListWidgetItem *item); + void closePersistentEditor(QListWidgetItem *item); + + QWidget *itemWidget(QListWidgetItem *item) const; + void setItemWidget(QListWidgetItem *item, QWidget *widget); + inline void removeItemWidget(QListWidgetItem *item); + + bool isItemSelected(const QListWidgetItem *item) const; + void setItemSelected(const QListWidgetItem *item, bool select); + QList<QListWidgetItem*> selectedItems() const; + QList<QListWidgetItem*> findItems(const QString &text, Qt::MatchFlags flags) const; + + bool isItemHidden(const QListWidgetItem *item) const; + void setItemHidden(const QListWidgetItem *item, bool hide); + void dropEvent(QDropEvent *event); + +public Q_SLOTS: + void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible); + void clear(); + +Q_SIGNALS: + void itemPressed(QListWidgetItem *item); + void itemClicked(QListWidgetItem *item); + void itemDoubleClicked(QListWidgetItem *item); + void itemActivated(QListWidgetItem *item); + void itemEntered(QListWidgetItem *item); + void itemChanged(QListWidgetItem *item); + + void currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); + void currentTextChanged(const QString ¤tText); + void currentRowChanged(int currentRow); + + void itemSelectionChanged(); + +protected: + bool event(QEvent *e); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QList<QListWidgetItem*> items) const; +#ifndef QT_NO_DRAGANDDROP + virtual bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action); + virtual Qt::DropActions supportedDropActions() const; +#endif + QList<QListWidgetItem*> items(const QMimeData *data) const; + + QModelIndex indexFromItem(QListWidgetItem *item) const; + QListWidgetItem *itemFromIndex(const QModelIndex &index) const; + +private: + void setModel(QAbstractItemModel *model); + Qt::SortOrder sortOrder() const; + + Q_DECLARE_PRIVATE(QListWidget) + Q_DISABLE_COPY(QListWidget) + + Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemClicked(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemDoubleClicked(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemActivated(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemEntered(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex ¤t)) + Q_PRIVATE_SLOT(d_func(), void _q_sort()) + Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)) +}; + +inline void QListWidget::removeItemWidget(QListWidgetItem *aItem) +{ setItemWidget(aItem, 0); } + +inline void QListWidget::addItem(QListWidgetItem *aitem) +{ insertItem(count(), aitem); } + +inline QListWidgetItem *QListWidget::itemAt(int ax, int ay) const +{ return itemAt(QPoint(ax, ay)); } + +inline void QListWidgetItem::setSelected(bool aselect) +{ if (view) view->setItemSelected(this, aselect); } + +inline bool QListWidgetItem::isSelected() const +{ return (view ? view->isItemSelected(this) : false); } + +inline void QListWidgetItem::setHidden(bool ahide) +{ if (view) view->setItemHidden(this, ahide); } + +inline bool QListWidgetItem::isHidden() const +{ return (view ? view->isItemHidden(this) : false); } + +#endif // QT_NO_LISTWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLISTWIDGET_H diff --git a/qtinterface/qt4/Qt/qlocale.h b/qtinterface/qt4/Qt/qlocale.h new file mode 100644 index 0000000..a3fe7a7 --- /dev/null +++ b/qtinterface/qt4/Qt/qlocale.h @@ -0,0 +1,676 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLOCALE_H +#define QLOCALE_H + +#include <QtCore/qstring.h> +#include <QtCore/qobjectdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QDataStream; +class QDate; +class QDateTime; +class QTime; +class QVariant; +class QTextStream; +class QTextStreamPrivate; + +class QLocale; + +#ifndef QT_NO_SYSTEMLOCALE +class Q_CORE_EXPORT QSystemLocale +{ +public: + QSystemLocale(); + virtual ~QSystemLocale(); + + enum QueryType { + LanguageId, // uint + CountryId, // uint + DecimalPoint, // QString + GroupSeparator, // QString + ZeroDigit, // QString + NegativeSign, // QString + DateFormatLong, // QString + DateFormatShort, // QString + TimeFormatLong, // QString + TimeFormatShort, // QString + DayNameLong, // QString, in: int + DayNameShort, // QString, in: int + MonthNameLong, // QString, in: int + MonthNameShort, // QString, in: int + DateToStringLong, // QString, in: QDate + DateToStringShort, // QString in: QDate + TimeToStringLong, // QString in: QTime + TimeToStringShort, // QString in: QTime + DateTimeFormatLong, // QString + DateTimeFormatShort, // QString + DateTimeToStringLong, // QString in: QDateTime + DateTimeToStringShort, // QString in: QDateTime + MeasurementSystem, // uint + PositiveSign, // QString + AMText, // QString + PMText // QString + }; + virtual QVariant query(QueryType type, QVariant in) const; + virtual QLocale fallbackLocale() const; + +private: + QSystemLocale(bool); + friend QSystemLocale *QSystemLocale_globalSystemLocale(); +}; +#endif + +struct QLocalePrivate; +class Q_CORE_EXPORT QLocale +{ + Q_GADGET + Q_ENUMS(Language) + Q_ENUMS(Country) + friend class QString; + friend class QByteArray; + friend class QIntValidator; + friend class QDoubleValidator; + friend class QTextStream; + friend class QTextStreamPrivate; + +public: + enum Language { + C = 1, + Abkhazian = 2, + Afan = 3, + Afar = 4, + Afrikaans = 5, + Albanian = 6, + Amharic = 7, + Arabic = 8, + Armenian = 9, + Assamese = 10, + Aymara = 11, + Azerbaijani = 12, + Bashkir = 13, + Basque = 14, + Bengali = 15, + Bhutani = 16, + Bihari = 17, + Bislama = 18, + Breton = 19, + Bulgarian = 20, + Burmese = 21, + Byelorussian = 22, + Cambodian = 23, + Catalan = 24, + Chinese = 25, + Corsican = 26, + Croatian = 27, + Czech = 28, + Danish = 29, + Dutch = 30, + English = 31, + Esperanto = 32, + Estonian = 33, + Faroese = 34, + FijiLanguage = 35, + Finnish = 36, + French = 37, + Frisian = 38, + Gaelic = 39, + Galician = 40, + Georgian = 41, + German = 42, + Greek = 43, + Greenlandic = 44, + Guarani = 45, + Gujarati = 46, + Hausa = 47, + Hebrew = 48, + Hindi = 49, + Hungarian = 50, + Icelandic = 51, + Indonesian = 52, + Interlingua = 53, + Interlingue = 54, + Inuktitut = 55, + Inupiak = 56, + Irish = 57, + Italian = 58, + Japanese = 59, + Javanese = 60, + Kannada = 61, + Kashmiri = 62, + Kazakh = 63, + Kinyarwanda = 64, + Kirghiz = 65, + Korean = 66, + Kurdish = 67, + Kurundi = 68, + Laothian = 69, + Latin = 70, + Latvian = 71, + Lingala = 72, + Lithuanian = 73, + Macedonian = 74, + Malagasy = 75, + Malay = 76, + Malayalam = 77, + Maltese = 78, + Maori = 79, + Marathi = 80, + Moldavian = 81, + Mongolian = 82, + NauruLanguage = 83, + Nepali = 84, + Norwegian = 85, + NorwegianBokmal = Norwegian, + Occitan = 86, + Oriya = 87, + Pashto = 88, + Persian = 89, + Polish = 90, + Portuguese = 91, + Punjabi = 92, + Quechua = 93, + RhaetoRomance = 94, + Romanian = 95, + Russian = 96, + Samoan = 97, + Sangho = 98, + Sanskrit = 99, + Serbian = 100, + SerboCroatian = 101, + Sesotho = 102, + Setswana = 103, + Shona = 104, + Sindhi = 105, + Singhalese = 106, + Siswati = 107, + Slovak = 108, + Slovenian = 109, + Somali = 110, + Spanish = 111, + Sundanese = 112, + Swahili = 113, + Swedish = 114, + Tagalog = 115, + Tajik = 116, + Tamil = 117, + Tatar = 118, + Telugu = 119, + Thai = 120, + Tibetan = 121, + Tigrinya = 122, + TongaLanguage = 123, + Tsonga = 124, + Turkish = 125, + Turkmen = 126, + Twi = 127, + Uigur = 128, + Ukrainian = 129, + Urdu = 130, + Uzbek = 131, + Vietnamese = 132, + Volapuk = 133, + Welsh = 134, + Wolof = 135, + Xhosa = 136, + Yiddish = 137, + Yoruba = 138, + Zhuang = 139, + Zulu = 140, + NorwegianNynorsk = 141, + Nynorsk = NorwegianNynorsk, // ### obsolete + Bosnian = 142, + Divehi = 143, + Manx = 144, + Cornish = 145, + Akan = 146, + Konkani = 147, + Ga = 148, + Igbo = 149, + Kamba = 150, + Syriac = 151, + Blin = 152, + Geez = 153, + Koro = 154, + Sidamo = 155, + Atsam = 156, + Tigre = 157, + Jju = 158, + Friulian = 159, + Venda = 160, + Ewe = 161, + Walamo = 162, + Hawaiian = 163, + Tyap = 164, + Chewa = 165, + LastLanguage = Chewa + }; + + enum Country { + AnyCountry = 0, + Afghanistan = 1, + Albania = 2, + Algeria = 3, + AmericanSamoa = 4, + Andorra = 5, + Angola = 6, + Anguilla = 7, + Antarctica = 8, + AntiguaAndBarbuda = 9, + Argentina = 10, + Armenia = 11, + Aruba = 12, + Australia = 13, + Austria = 14, + Azerbaijan = 15, + Bahamas = 16, + Bahrain = 17, + Bangladesh = 18, + Barbados = 19, + Belarus = 20, + Belgium = 21, + Belize = 22, + Benin = 23, + Bermuda = 24, + Bhutan = 25, + Bolivia = 26, + BosniaAndHerzegowina = 27, + Botswana = 28, + BouvetIsland = 29, + Brazil = 30, + BritishIndianOceanTerritory = 31, + BruneiDarussalam = 32, + Bulgaria = 33, + BurkinaFaso = 34, + Burundi = 35, + Cambodia = 36, + Cameroon = 37, + Canada = 38, + CapeVerde = 39, + CaymanIslands = 40, + CentralAfricanRepublic = 41, + Chad = 42, + Chile = 43, + China = 44, + ChristmasIsland = 45, + CocosIslands = 46, + Colombia = 47, + Comoros = 48, + DemocraticRepublicOfCongo = 49, + PeoplesRepublicOfCongo = 50, + CookIslands = 51, + CostaRica = 52, + IvoryCoast = 53, + Croatia = 54, + Cuba = 55, + Cyprus = 56, + CzechRepublic = 57, + Denmark = 58, + Djibouti = 59, + Dominica = 60, + DominicanRepublic = 61, + EastTimor = 62, + Ecuador = 63, + Egypt = 64, + ElSalvador = 65, + EquatorialGuinea = 66, + Eritrea = 67, + Estonia = 68, + Ethiopia = 69, + FalklandIslands = 70, + FaroeIslands = 71, + FijiCountry = 72, + Finland = 73, + France = 74, + MetropolitanFrance = 75, + FrenchGuiana = 76, + FrenchPolynesia = 77, + FrenchSouthernTerritories = 78, + Gabon = 79, + Gambia = 80, + Georgia = 81, + Germany = 82, + Ghana = 83, + Gibraltar = 84, + Greece = 85, + Greenland = 86, + Grenada = 87, + Guadeloupe = 88, + Guam = 89, + Guatemala = 90, + Guinea = 91, + GuineaBissau = 92, + Guyana = 93, + Haiti = 94, + HeardAndMcDonaldIslands = 95, + Honduras = 96, + HongKong = 97, + Hungary = 98, + Iceland = 99, + India = 100, + Indonesia = 101, + Iran = 102, + Iraq = 103, + Ireland = 104, + Israel = 105, + Italy = 106, + Jamaica = 107, + Japan = 108, + Jordan = 109, + Kazakhstan = 110, + Kenya = 111, + Kiribati = 112, + DemocraticRepublicOfKorea = 113, + RepublicOfKorea = 114, + Kuwait = 115, + Kyrgyzstan = 116, + Lao = 117, + Latvia = 118, + Lebanon = 119, + Lesotho = 120, + Liberia = 121, + LibyanArabJamahiriya = 122, + Liechtenstein = 123, + Lithuania = 124, + Luxembourg = 125, + Macau = 126, + Macedonia = 127, + Madagascar = 128, + Malawi = 129, + Malaysia = 130, + Maldives = 131, + Mali = 132, + Malta = 133, + MarshallIslands = 134, + Martinique = 135, + Mauritania = 136, + Mauritius = 137, + Mayotte = 138, + Mexico = 139, + Micronesia = 140, + Moldova = 141, + Monaco = 142, + Mongolia = 143, + Montserrat = 144, + Morocco = 145, + Mozambique = 146, + Myanmar = 147, + Namibia = 148, + NauruCountry = 149, + Nepal = 150, + Netherlands = 151, + NetherlandsAntilles = 152, + NewCaledonia = 153, + NewZealand = 154, + Nicaragua = 155, + Niger = 156, + Nigeria = 157, + Niue = 158, + NorfolkIsland = 159, + NorthernMarianaIslands = 160, + Norway = 161, + Oman = 162, + Pakistan = 163, + Palau = 164, + PalestinianTerritory = 165, + Panama = 166, + PapuaNewGuinea = 167, + Paraguay = 168, + Peru = 169, + Philippines = 170, + Pitcairn = 171, + Poland = 172, + Portugal = 173, + PuertoRico = 174, + Qatar = 175, + Reunion = 176, + Romania = 177, + RussianFederation = 178, + Rwanda = 179, + SaintKittsAndNevis = 180, + StLucia = 181, + StVincentAndTheGrenadines = 182, + Samoa = 183, + SanMarino = 184, + SaoTomeAndPrincipe = 185, + SaudiArabia = 186, + Senegal = 187, + Seychelles = 188, + SierraLeone = 189, + Singapore = 190, + Slovakia = 191, + Slovenia = 192, + SolomonIslands = 193, + Somalia = 194, + SouthAfrica = 195, + SouthGeorgiaAndTheSouthSandwichIslands = 196, + Spain = 197, + SriLanka = 198, + StHelena = 199, + StPierreAndMiquelon = 200, + Sudan = 201, + Suriname = 202, + SvalbardAndJanMayenIslands = 203, + Swaziland = 204, + Sweden = 205, + Switzerland = 206, + SyrianArabRepublic = 207, + Taiwan = 208, + Tajikistan = 209, + Tanzania = 210, + Thailand = 211, + Togo = 212, + Tokelau = 213, + TongaCountry = 214, + TrinidadAndTobago = 215, + Tunisia = 216, + Turkey = 217, + Turkmenistan = 218, + TurksAndCaicosIslands = 219, + Tuvalu = 220, + Uganda = 221, + Ukraine = 222, + UnitedArabEmirates = 223, + UnitedKingdom = 224, + UnitedStates = 225, + UnitedStatesMinorOutlyingIslands = 226, + Uruguay = 227, + Uzbekistan = 228, + Vanuatu = 229, + VaticanCityState = 230, + Venezuela = 231, + VietNam = 232, + BritishVirginIslands = 233, + USVirginIslands = 234, + WallisAndFutunaIslands = 235, + WesternSahara = 236, + Yemen = 237, + Yugoslavia = 238, + Zambia = 239, + Zimbabwe = 240, + SerbiaAndMontenegro = 241, + LastCountry = SerbiaAndMontenegro + }; + + enum MeasurementSystem { MetricSystem, ImperialSystem }; + + enum FormatType { LongFormat, ShortFormat, NarrowFormat }; + enum NumberOption { + OmitGroupSeparator = 0x01, + RejectGroupSeparator = 0x02 + }; + Q_DECLARE_FLAGS(NumberOptions, NumberOption) + + QLocale(); + QLocale(const QString &name); + QLocale(Language language, Country country = AnyCountry); + QLocale(const QLocale &other); + + QLocale &operator=(const QLocale &other); + + Language language() const; + Country country() const; + QString name() const; + + short toShort(const QString &s, bool *ok = 0, int base = 0) const; + ushort toUShort(const QString &s, bool *ok = 0, int base = 0) const; + int toInt(const QString &s, bool *ok = 0, int base = 0) const; + uint toUInt(const QString &s, bool *ok = 0, int base = 0) const; + qlonglong toLongLong(const QString &s, bool *ok = 0, int base = 0) const; + qlonglong toULongLong(const QString &s, bool *ok = 0, int base = 0) const; + float toFloat(const QString &s, bool *ok = 0) const; + double toDouble(const QString &s, bool *ok = 0) const; + + QString toString(qlonglong i) const; + QString toString(qulonglong i) const; + inline QString toString(short i) const; + inline QString toString(ushort i) const; + inline QString toString(int i) const; + inline QString toString(uint i) const; + QString toString(double i, char f = 'g', int prec = 6) const; + inline QString toString(float i, char f = 'g', int prec = 6) const; + QString toString(const QDate &date, const QString &formatStr) const; + QString toString(const QDate &date, FormatType format = LongFormat) const; + QString toString(const QTime &time, const QString &formatStr) const; + QString toString(const QTime &time, FormatType format = LongFormat) const; + QString toString(const QDateTime &dateTime, FormatType format = LongFormat) const; + QString toString(const QDateTime &dateTime, const QString &format) const; + + QString dateFormat(FormatType format = LongFormat) const; + QString timeFormat(FormatType format = LongFormat) const; + QString dateTimeFormat(FormatType format = LongFormat) const; +#ifndef QT_NO_DATESTRING + QDate toDate(const QString &string, FormatType = LongFormat) const; + QTime toTime(const QString &string, FormatType = LongFormat) const; + QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const; + QDate toDate(const QString &string, const QString &format) const; + QTime toTime(const QString &string, const QString &format) const; + QDateTime toDateTime(const QString &string, const QString &format) const; +#endif + + // ### Qt 5: We need to return QString from these function since + // unicode data contains several characters for these fields. + QChar decimalPoint() const; + QChar groupSeparator() const; + QChar percent() const; + QChar zeroDigit() const; + QChar negativeSign() const; + QChar positiveSign() const; + QChar exponential() const; + + QString monthName(int, FormatType format = LongFormat) const; + QString standaloneMonthName(int, FormatType format = LongFormat) const; + QString dayName(int, FormatType format = LongFormat) const; + QString standaloneDayName(int, FormatType format = LongFormat) const; + + QString amText() const; + QString pmText() const; + + MeasurementSystem measurementSystem() const; + + inline bool operator==(const QLocale &other) const; + inline bool operator!=(const QLocale &other) const; + + static QString languageToString(Language language); + static QString countryToString(Country country); + static void setDefault(const QLocale &locale); + + static QLocale c() { return QLocale(C); } + static QLocale system(); + + static QList<Country> countriesForLanguage(Language lang); + + void setNumberOptions(NumberOptions options); + NumberOptions numberOptions() const; + +//private: // this should be private, but can't be + struct Data { + quint16 index; + quint16 numberOptions; + } +#if (defined(__arm__) || defined(__ARMEL__)) + Q_PACKED +#endif + ; +private: + friend struct QLocalePrivate; + // ### We now use this field to pack an index into locale_data and NumberOptions. + // ### Qt 5: change to a QLocaleData *d; uint numberOptions. + union { + void *v; + Data p; + }; + const QLocalePrivate *d() const; +}; +Q_DECLARE_TYPEINFO(QLocale, Q_MOVABLE_TYPE); +Q_DECLARE_OPERATORS_FOR_FLAGS(QLocale::NumberOptions) + +inline QString QLocale::toString(short i) const + { return toString(qlonglong(i)); } +inline QString QLocale::toString(ushort i) const + { return toString(qulonglong(i)); } +inline QString QLocale::toString(int i) const + { return toString(qlonglong(i)); } +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(); } + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLocale &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLocale &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLOCALE_H diff --git a/qtinterface/qt4/Qt/qlocalserver.h b/qtinterface/qt4/Qt/qlocalserver.h new file mode 100644 index 0000000..d8f3117 --- /dev/null +++ b/qtinterface/qt4/Qt/qlocalserver.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLOCALSERVER_H +#define QLOCALSERVER_H + +#include <QtNetwork/qabstractsocket.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_LOCALSERVER + +class QLocalSocket; +class QLocalServerPrivate; + +class Q_NETWORK_EXPORT QLocalServer : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QLocalServer) + +Q_SIGNALS: + void newConnection(); + +public: + QLocalServer(QObject *parent = 0); + ~QLocalServer(); + + void close(); + QString errorString() const; + virtual bool hasPendingConnections() const; + bool isListening() const; + bool listen(const QString &name); + int maxPendingConnections() const; + virtual QLocalSocket *nextPendingConnection(); + QString serverName() const; + QString fullServerName() const; + static bool removeServer(const QString &name); + QAbstractSocket::SocketError serverError() const; + void setMaxPendingConnections(int numConnections); + bool waitForNewConnection(int msec = 0, bool *timedOut = 0); + +protected: + virtual void incomingConnection(quintptr socketDescriptor); + +private: + Q_DISABLE_COPY(QLocalServer) + Q_PRIVATE_SLOT(d_func(), void _q_onNewConnection()) +}; + +#endif // QT_NO_LOCALSERVER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLOCALSERVER_H + diff --git a/qtinterface/qt4/Qt/qlocalsocket.h b/qtinterface/qt4/Qt/qlocalsocket.h new file mode 100644 index 0000000..b2085d8 --- /dev/null +++ b/qtinterface/qt4/Qt/qlocalsocket.h @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLOCALSOCKET_H +#define QLOCALSOCKET_H + +#include <QtCore/qiodevice.h> +#include <QtNetwork/qabstractsocket.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_LOCALSOCKET + +class QLocalSocketPrivate; + +class Q_NETWORK_EXPORT QLocalSocket : public QIODevice +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QLocalSocket) + +public: + enum LocalSocketError + { + ConnectionRefusedError = QAbstractSocket::ConnectionRefusedError, + PeerClosedError = QAbstractSocket::RemoteHostClosedError, + ServerNotFoundError = QAbstractSocket::HostNotFoundError, + SocketAccessError = QAbstractSocket::SocketAccessError, + SocketResourceError = QAbstractSocket::SocketResourceError, + SocketTimeoutError = QAbstractSocket::SocketTimeoutError, + DatagramTooLargeError = QAbstractSocket::DatagramTooLargeError, + ConnectionError = QAbstractSocket::NetworkError, + UnsupportedSocketOperationError = QAbstractSocket::UnsupportedSocketOperationError, + UnknownSocketError = QAbstractSocket::UnknownSocketError + }; + + enum LocalSocketState + { + UnconnectedState = QAbstractSocket::UnconnectedState, + ConnectingState = QAbstractSocket::ConnectingState, + ConnectedState = QAbstractSocket::ConnectedState, + ClosingState = QAbstractSocket::ClosingState + }; + + QLocalSocket(QObject *parent = 0); + ~QLocalSocket(); + + void connectToServer(const QString &name, OpenMode openMode = ReadWrite); + void disconnectFromServer(); + + QString serverName() const; + QString fullServerName() const; + + void abort(); + virtual bool isSequential() const; + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + virtual bool canReadLine() const; + virtual void close(); + LocalSocketError error() const; + bool flush(); + bool isValid() const; + qint64 readBufferSize() const; + void setReadBufferSize(qint64 size); + + bool setSocketDescriptor(quintptr socketDescriptor, + LocalSocketState socketState = ConnectedState, + OpenMode openMode = ReadWrite); + quintptr socketDescriptor() const; + + LocalSocketState state() const; + bool waitForBytesWritten(int msecs = 30000); + bool waitForConnected(int msecs = 30000); + bool waitForDisconnected(int msecs = 30000); + bool waitForReadyRead(int msecs = 30000); + +Q_SIGNALS: + void connected(); + void disconnected(); + void error(QLocalSocket::LocalSocketError socketError); + void stateChanged(QLocalSocket::LocalSocketState socketState); + +protected: + virtual qint64 readData(char*, qint64); + virtual qint64 writeData(const char*, qint64); + +private: + Q_DISABLE_COPY(QLocalSocket) +#if defined(QT_LOCALSOCKET_TCP) + 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()) +#else + Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState)) + Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError)) + Q_PRIVATE_SLOT(d_func(), void _q_connectToSocket()) + Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt()) +#endif +}; + +#ifndef QT_NO_DEBUG_STREAM +#include <QtCore/qdebug.h> +Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketError); +Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketState); +#endif + +#endif // QT_NO_LOCALSOCKET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLOCALSOCKET_H diff --git a/qtinterface/qt4/Qt/qmaccocoaviewcontainer_mac.h b/qtinterface/qt4/Qt/qmaccocoaviewcontainer_mac.h new file mode 100644 index 0000000..ffc0887 --- /dev/null +++ b/qtinterface/qt4/Qt/qmaccocoaviewcontainer_mac.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOCOAVIEWCONTAINER_H +#define QCOCOAVIEWCONTAINER_H + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QMacCocoaViewContainerPrivate; + +class Q_GUI_EXPORT QMacCocoaViewContainer : public QWidget +{ + Q_OBJECT +public: + QMacCocoaViewContainer(void *cocoaViewToWrap, QWidget *parent = 0); + virtual ~QMacCocoaViewContainer(); + + void setCocoaView(void *cocoaViewToWrap); + void *cocoaView() const; + +private: + Q_DECLARE_PRIVATE(QMacCocoaViewContainer) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QCOCOAVIEWCONTAINER_H diff --git a/qtinterface/qt4/Qt/qmacdefines_mac.h b/qtinterface/qt4/Qt/qmacdefines_mac.h new file mode 100644 index 0000000..ecd6872 --- /dev/null +++ b/qtinterface/qt4/Qt/qmacdefines_mac.h @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Copyright (c) 2007-2008, Apple, Inc. +** +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** +** * Neither the name of Apple, Inc. nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +****************************************************************************/ + +/* + * qmacdefines_mac_p.h + * All the defines you'll ever need for Qt/Mac :-) + */ + +/* This is just many defines. Therefore it doesn't need things like: +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +QT_END_NAMESPACE + +QT_END_HEADER + +Yes, it is an informative comment ;-) +*/ + +#include <QtCore/qglobal.h> + +#undef OLD_DEBUG +#ifdef DEBUG +# define OLD_DEBUG DEBUG +# undef DEBUG +#endif +#define DEBUG 0 +#ifdef qDebug +# define old_qDebug qDebug +# undef qDebug +#endif + +#ifdef __LP64__ +typedef signed int OSStatus; +#else +typedef signed long OSStatus; +#endif + +#ifdef __OBJC__ +# ifdef slots +# define old_slots slots +# undef slots +# endif +#include <Cocoa/Cocoa.h> +# ifdef old_slots +# undef slots +# define slots +# undef old_slots +# endif +#endif +#ifdef QT_MAC_USE_COCOA + typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef; + typedef struct OpaqueEventRef * EventRef; + typedef struct OpaqueMenuRef * MenuRef; + typedef struct OpaquePasteboardRef* PasteboardRef; + typedef struct OpaqueRgnHandle * RgnHandle; + typedef const struct __HIShape *HIShapeRef; + typedef struct __HIShape *HIMutableShapeRef; + typedef struct CGRect CGRect; + typedef struct CGImage *CGImageRef; + typedef struct CGContext *CGContextRef; + typedef struct GDevice * GDPtr; + typedef GDPtr * GDHandle; + typedef struct OpaqueIconRef * IconRef; +# ifdef __OBJC__ + typedef NSWindow* OSWindowRef; + typedef NSView *OSViewRef; + typedef NSMenu *OSMenuRef; + typedef NSEvent *OSEventRef; +# else + typedef void *OSWindowRef; + typedef void *OSViewRef; + typedef void *OSMenuRef; + typedef void *OSEventRef; +# endif +#else // Carbon + typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef; + typedef struct OpaqueEventRef * EventRef; + typedef struct OpaqueMenuRef * MenuRef; + typedef struct OpaquePasteboardRef* PasteboardRef; + typedef struct OpaqueRgnHandle * RgnHandle; + typedef const struct __HIShape *HIShapeRef; + typedef struct __HIShape *HIMutableShapeRef; + typedef struct CGRect CGRect; + typedef struct CGImage *CGImageRef; + typedef struct CGContext *CGContextRef; + typedef struct GDevice * GDPtr; + typedef GDPtr * GDHandle; + typedef struct OpaqueIconRef * IconRef; + typedef struct OpaqueWindowPtr * WindowRef; + typedef struct OpaqueControlRef * HIViewRef; + typedef WindowRef OSWindowRef; + typedef HIViewRef OSViewRef; + typedef MenuRef OSMenuRef; + typedef EventRef OSEventRef; +#endif // QT_MAC_USE_COCOA + +typedef PasteboardRef OSPasteboardRef; +typedef struct AEDesc AEDescList; +typedef AEDescList AERecord; +typedef AERecord AppleEvent; + +#ifdef check +#undef check +#endif + +#undef DEBUG +#ifdef OLD_DEBUG +# define DEBUG OLD_DEBUG +# undef OLD_DEBUG +#endif + +#ifdef old_qDebug +# undef qDebug +# define qDebug QT_NO_QDEBUG_MACRO +# undef old_qDebug +#endif diff --git a/qtinterface/qt4/Qt/qmacnativewidget_mac.h b/qtinterface/qt4/Qt/qmacnativewidget_mac.h new file mode 100644 index 0000000..4cf4340 --- /dev/null +++ b/qtinterface/qt4/Qt/qmacnativewidget_mac.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMACNATIVEWIDGET_H +#define QMACNATIVEWIDGET_H + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QMacNativeWidgetPrivate; +class Q_GUI_EXPORT QMacNativeWidget : public QWidget +{ + Q_OBJECT +public: + QMacNativeWidget(void *parentRef = 0); + ~QMacNativeWidget(); + + QSize sizeHint() const; + +protected: + bool event(QEvent *ev); + +private: + Q_DECLARE_PRIVATE(QMacNativeWidget) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMACNATIVEWIDGET_H diff --git a/qtinterface/qt4/Qt/qmacstyle_mac.h b/qtinterface/qt4/Qt/qmacstyle_mac.h new file mode 100644 index 0000000..51ae276 --- /dev/null +++ b/qtinterface/qt4/Qt/qmacstyle_mac.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMACSTYLE_MAC_H +#define QMACSTYLE_MAC_H + +#include <QtGui/qwindowsstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) + +class QPalette; + +#if defined(QT_PLUGIN) +#define Q_GUI_EXPORT_STYLE_MAC +#else +#define Q_GUI_EXPORT_STYLE_MAC Q_GUI_EXPORT +#endif + +class QMacStylePrivate; +class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle +{ + Q_OBJECT +public: + QMacStyle(); + virtual ~QMacStyle(); + + void polish(QWidget *w); + void unpolish(QWidget *w); + + void polish(QApplication*); + void unpolish(QApplication*); + + void polish(QPalette &pal); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, + const QWidget *w = 0) const; + SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, + const QPoint &pt, const QWidget *w = 0) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, + const QWidget *w = 0) const; + QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, + const QSize &contentsSize, const QWidget *w = 0) const; + + int pixelMetric(PixelMetric pm, const QStyleOption *opt = 0, const QWidget *widget = 0) const; + + QPalette standardPalette() const; + + virtual int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0, + QStyleHintReturn *shret = 0) const; + + enum FocusRectPolicy { FocusEnabled, FocusDisabled, FocusDefault }; + static void setFocusRectPolicy(QWidget *w, FocusRectPolicy policy); + static FocusRectPolicy focusRectPolicy(const QWidget *w); + + enum WidgetSizePolicy { SizeSmall, SizeLarge, SizeMini, SizeDefault +#ifdef QT3_SUPPORT + , SizeNone = SizeDefault +#endif + }; + static void setWidgetSizePolicy(const QWidget *w, WidgetSizePolicy policy); + static WidgetSizePolicy widgetSizePolicy(const QWidget *w); + + QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt, + const QWidget *widget = 0) const; + + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, + const QStyleOption *opt) const; + + virtual void drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, + bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + + bool event(QEvent *e); + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; + int layoutSpacingImplementation(QSizePolicy::ControlType control1, + QSizePolicy::ControlType control2, + Qt::Orientation orientation, + const QStyleOption *option = 0, + const QWidget *widget = 0) const; + +private: + Q_DISABLE_COPY(QMacStyle) + + QMacStylePrivate *d; +}; + +#endif // Q_WS_MAC + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMACSTYLE_H diff --git a/qtinterface/qt4/Qt/qmainwindow.h b/qtinterface/qt4/Qt/qmainwindow.h new file mode 100644 index 0000000..dace451 --- /dev/null +++ b/qtinterface/qt4/Qt/qmainwindow.h @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDYNAMICMAINWINDOW_H +#define QDYNAMICMAINWINDOW_H + +#include <QtGui/qwidget.h> +#include <QtGui/qtabwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MAINWINDOW + +class QDockWidget; +class QMainWindowPrivate; +class QMenuBar; +class QStatusBar; +class QToolBar; +class QMenu; + +class Q_GUI_EXPORT QMainWindow : public QWidget +{ + Q_OBJECT + + Q_ENUMS(DockOption) + Q_FLAGS(DockOptions) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle) +#ifndef QT_NO_DOCKWIDGET + Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) +#ifndef QT_NO_TABBAR + Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode) +#endif // QT_NO_TABBAR +#ifndef QT_NO_TABWIDGET + Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape) +#endif // QT_NO_TABWIDGET + Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled) +#endif // QT_NO_DOCKWIDGET + Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions) +#ifndef QT_NO_TOOLBAR + Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac) +#endif + +public: + enum DockOption { + AnimatedDocks = 0x01, + AllowNestedDocks = 0x02, + AllowTabbedDocks = 0x04, + ForceTabbedDocks = 0x08, // implies AllowTabbedDocks, !AllowNestedDocks + VerticalTabs = 0x10 // implies AllowTabbedDocks + }; + Q_DECLARE_FLAGS(DockOptions, DockOption) + + explicit QMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QMainWindow(); + + QSize iconSize() const; + void setIconSize(const QSize &iconSize); + + Qt::ToolButtonStyle toolButtonStyle() const; + void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle); + +#ifndef QT_NO_DOCKWIDGET + bool isAnimated() const; + bool isDockNestingEnabled() const; +#endif + +#ifndef QT_NO_TABBAR + bool documentMode() const; + void setDocumentMode(bool enabled); +#endif + +#ifndef QT_NO_TABWIDGET + QTabWidget::TabShape tabShape() const; + void setTabShape(QTabWidget::TabShape tabShape); + QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const; + void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition); +#endif // QT_NO_TABWIDGET + + void setDockOptions(DockOptions options); + DockOptions dockOptions() const; + + bool isSeparator(const QPoint &pos) const; + +#ifndef QT_NO_MENUBAR + QMenuBar *menuBar() const; + void setMenuBar(QMenuBar *menubar); + + QWidget *menuWidget() const; + void setMenuWidget(QWidget *menubar); +#endif + +#ifndef QT_NO_STATUSBAR + QStatusBar *statusBar() const; + void setStatusBar(QStatusBar *statusbar); +#endif + + QWidget *centralWidget() const; + void setCentralWidget(QWidget *widget); + +#ifndef QT_NO_DOCKWIDGET + void setCorner(Qt::Corner corner, Qt::DockWidgetArea area); + Qt::DockWidgetArea corner(Qt::Corner corner) const; +#endif + +#ifndef QT_NO_TOOLBAR + void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea); + void insertToolBarBreak(QToolBar *before); + + void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar); + void addToolBar(QToolBar *toolbar); + QToolBar *addToolBar(const QString &title); + void insertToolBar(QToolBar *before, QToolBar *toolbar); + void removeToolBar(QToolBar *toolbar); + void removeToolBarBreak(QToolBar *before); + + void setUnifiedTitleAndToolBarOnMac(bool set); + bool unifiedTitleAndToolBarOnMac() const; + + Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const; + bool toolBarBreak(QToolBar *toolbar) const; +#endif +#ifndef QT_NO_DOCKWIDGET + void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget); + void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget, + Qt::Orientation orientation); + void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget, + Qt::Orientation orientation); + void tabifyDockWidget(QDockWidget *first, QDockWidget *second); + QList<QDockWidget*> tabifiedDockWidgets(QDockWidget *dockwidget) const; + void removeDockWidget(QDockWidget *dockwidget); + bool restoreDockWidget(QDockWidget *dockwidget); + + Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const; +#endif // QT_NO_DOCKWIDGET + + QByteArray saveState(int version = 0) const; + bool restoreState(const QByteArray &state, int version = 0); + +#ifndef QT_NO_MENU + virtual QMenu *createPopupMenu(); +#endif + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QMainWindow(QWidget *parent, const char *name, Qt::WindowFlags flags = 0); +#endif + +#ifndef QT_NO_DOCKWIDGET +public Q_SLOTS: + void setAnimated(bool enabled); + void setDockNestingEnabled(bool enabled); +#endif + +Q_SIGNALS: + void iconSizeChanged(const QSize &iconSize); + void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle); + +protected: +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *event); +#endif + bool event(QEvent *event); + +private: + Q_DECLARE_PRIVATE(QMainWindow) + Q_DISABLE_COPY(QMainWindow) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions) + +#endif // QT_NO_MAINWINDOW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDYNAMICMAINWINDOW_H diff --git a/qtinterface/qt4/Qt/qmap.h b/qtinterface/qt4/Qt/qmap.h new file mode 100644 index 0000000..e818b21 --- /dev/null +++ b/qtinterface/qt4/Qt/qmap.h @@ -0,0 +1,1066 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMAP_H +#define QMAP_H + +#include <QtCore/qatomic.h> +#include <QtCore/qiterator.h> +#include <QtCore/qlist.h> + +#ifndef QT_NO_STL +#include <map> +#endif + +#include <new> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +struct Q_CORE_EXPORT QMapData +{ + struct Node { + Node *backward; + Node *forward[1]; + }; + enum { LastLevel = 11, Sparseness = 3 }; + + QMapData *backward; + QMapData *forward[QMapData::LastLevel + 1]; + QBasicAtomicInt ref; + int topLevel; + int size; + uint randomBits; + uint insertInOrder : 1; + uint sharable : 1; + uint strictAlignment : 1; + uint reserved : 29; + + static QMapData *createData(); // ### Qt5 remove me + static QMapData *createData(int alignment); + void continueFreeData(int offset); + Node *node_create(Node *update[], int offset); // ### Qt5 remove me + Node *node_create(Node *update[], int offset, int alignment); + void node_delete(Node *update[], int offset, Node *node); +#ifdef QT_QMAP_DEBUG + uint adjust_ptr(Node *node); + void dump(); +#endif + + static QMapData shared_null; +}; + + +/* + QMap uses qMapLessThanKey() to compare keys. The default + implementation uses operator<(). For pointer types, + qMapLessThanKey() casts the pointers to integers before it + compares them, because operator<() is undefined on pointers + that come from different memory blocks. (In practice, this + is only a problem when running a program such as + BoundsChecker.) +*/ + +template <class Key> inline bool qMapLessThanKey(const Key &key1, const Key &key2) +{ + return key1 < key2; +} + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +template <class Ptr> inline bool qMapLessThanKey(Ptr *key1, Ptr *key2) +{ + Q_ASSERT(sizeof(quintptr) == sizeof(Ptr *)); + return quintptr(key1) < quintptr(key2); +} + +template <class Ptr> inline bool qMapLessThanKey(const Ptr *key1, const Ptr *key2) +{ + Q_ASSERT(sizeof(quintptr) == sizeof(const Ptr *)); + return quintptr(key1) < quintptr(key2); +} +#endif // QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + +template <class Key, class T> +struct QMapNode { + Key key; + T value; + QMapData::Node *backward; + QMapData::Node *forward[1]; +}; + +template <class Key, class T> +struct QMapPayloadNode +{ + Key key; + T value; + QMapData::Node *backward; +}; + +template <class Key, class T> +class QMap +{ + typedef QMapNode<Key, T> Node; + typedef QMapPayloadNode<Key, T> PayloadNode; + + union { + QMapData *d; + QMapData::Node *e; + }; + + static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); } + static inline int alignment() { +#ifdef Q_ALIGNOF + return int(qMax(sizeof(void*), Q_ALIGNOF(Node))); +#else + return 0; +#endif + } + static inline Node *concrete(QMapData::Node *node) { + return reinterpret_cast<Node *>(reinterpret_cast<char *>(node) - payload()); + } + +public: + inline QMap() : d(&QMapData::shared_null) { d->ref.ref(); } + inline QMap(const QMap<Key, T> &other) : d(other.d) + { d->ref.ref(); if (!d->sharable) detach(); } + inline ~QMap() { if (!d) return; if (!d->ref.deref()) freeData(d); } + + QMap<Key, T> &operator=(const QMap<Key, T> &other); +#ifndef QT_NO_STL + explicit QMap(const typename std::map<Key, T> &other); + std::map<Key, T> toStdMap() const; +#endif + + bool operator==(const QMap<Key, T> &other) const; + inline bool operator!=(const QMap<Key, T> &other) const { return !(*this == other); } + + inline int size() const { return d->size; } + + inline bool isEmpty() const { return d->size == 0; } + + inline void detach() { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; } + + void clear(); + + int remove(const Key &key); + T take(const Key &key); + + bool contains(const Key &key) const; + const Key key(const T &value) const; + const Key key(const T &value, const Key &defaultKey) const; + const T value(const Key &key) const; + const T value(const Key &key, const T &defaultValue) const; + T &operator[](const Key &key); + const T operator[](const Key &key) const; + + QList<Key> uniqueKeys() const; + QList<Key> keys() const; + QList<Key> keys(const T &value) const; + QList<T> values() const; + QList<T> values(const Key &key) const; + int count(const Key &key) const; + + class const_iterator; + + class iterator + { + friend class const_iterator; + QMapData::Node *i; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + // ### Qt 5: get rid of 'operator Node *' + inline operator QMapData::Node *() const { return i; } + inline iterator() : i(0) { } + inline iterator(QMapData::Node *node) : i(node) { } + + inline const Key &key() const { return concrete(i)->key; } + inline T &value() const { return concrete(i)->value; } +#ifdef QT3_SUPPORT + inline QT3_SUPPORT T &data() const { return concrete(i)->value; } +#endif + inline T &operator*() const { return concrete(i)->value; } + inline T *operator->() const { return &concrete(i)->value; } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + + inline iterator &operator++() { + i = i->forward[0]; + return *this; + } + inline iterator operator++(int) { + iterator r = *this; + i = i->forward[0]; + return r; + } + inline iterator &operator--() { + i = i->backward; + return *this; + } + inline iterator operator--(int) { + iterator r = *this; + i = i->backward; + return r; + } + inline iterator operator+(int j) const + { iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; } + inline iterator operator-(int j) const { return operator+(-j); } + inline iterator &operator+=(int j) { return *this = *this + j; } + inline iterator &operator-=(int j) { return *this = *this - j; } + + // ### Qt 5: not sure this is necessary anymore +#ifdef QT_STRICT_ITERATORS + private: +#else + public: +#endif + inline bool operator==(const const_iterator &o) const + { return i == o.i; } + inline bool operator!=(const const_iterator &o) const + { return i != o.i; } + + private: + // ### Qt 5: remove + inline operator bool() const { return false; } + }; + friend class iterator; + + class const_iterator + { + friend class iterator; + QMapData::Node *i; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + // ### Qt 5: get rid of 'operator Node *' + inline operator QMapData::Node *() const { return i; } + inline const_iterator() : i(0) { } + inline const_iterator(QMapData::Node *node) : i(node) { } +#ifdef QT_STRICT_ITERATORS + explicit inline const_iterator(const iterator &o) +#else + inline const_iterator(const iterator &o) +#endif + { i = o.i; } + + inline const Key &key() const { return concrete(i)->key; } + inline const T &value() const { return concrete(i)->value; } +#ifdef QT3_SUPPORT + inline QT3_SUPPORT const T &data() const { return concrete(i)->value; } +#endif + inline const T &operator*() const { return concrete(i)->value; } + inline const T *operator->() const { return &concrete(i)->value; } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + + inline const_iterator &operator++() { + i = i->forward[0]; + return *this; + } + inline const_iterator operator++(int) { + const_iterator r = *this; + i = i->forward[0]; + return r; + } + inline const_iterator &operator--() { + i = i->backward; + return *this; + } + inline const_iterator operator--(int) { + const_iterator r = *this; + i = i->backward; + return r; + } + inline const_iterator operator+(int j) const + { const_iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; } + inline const_iterator operator-(int j) const { return operator+(-j); } + inline const_iterator &operator+=(int j) { return *this = *this + j; } + inline const_iterator &operator-=(int j) { return *this = *this - j; } + + // ### Qt 5: not sure this is necessary anymore +#ifdef QT_STRICT_ITERATORS + private: + inline bool operator==(const iterator &o) { return operator==(const_iterator(o)); } + inline bool operator!=(const iterator &o) { return operator!=(const_iterator(o)); } +#endif + + private: + // ### Qt 5: remove + inline operator bool() const { return false; } + }; + friend class const_iterator; + + // STL style + inline iterator begin() { detach(); return iterator(e->forward[0]); } + inline const_iterator begin() const { return const_iterator(e->forward[0]); } + inline const_iterator constBegin() const { return const_iterator(e->forward[0]); } + inline iterator end() { + detach(); + return iterator(e); + } + inline const_iterator end() const { return const_iterator(e); } + inline const_iterator constEnd() const { return const_iterator(e); } + iterator erase(iterator it); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT iterator remove(iterator it) { return erase(it); } + inline QT3_SUPPORT void erase(const Key &aKey) { remove(aKey); } +#endif + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline int count() const { return d->size; } + iterator find(const Key &key); + const_iterator find(const Key &key) const; + const_iterator constFind(const Key &key) const; + iterator lowerBound(const Key &key); + const_iterator lowerBound(const Key &key) const; + iterator upperBound(const Key &key); + const_iterator upperBound(const Key &key) const; + iterator insert(const Key &key, const T &value); +#ifdef QT3_SUPPORT + QT3_SUPPORT iterator insert(const Key &key, const T &value, bool overwrite); +#endif + iterator insertMulti(const Key &key, const T &value); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT iterator replace(const Key &aKey, const T &aValue) { return insert(aKey, aValue); } +#endif + QMap<Key, T> &unite(const QMap<Key, T> &other); + + // STL compatibility + typedef Key key_type; + typedef T mapped_type; + typedef ptrdiff_t difference_type; + typedef int size_type; + inline bool empty() const { return isEmpty(); } + +#ifdef QT_QMAP_DEBUG + inline void dump() const { d->dump(); } +#endif + +private: + void detach_helper(); + void freeData(QMapData *d); + QMapData::Node *findNode(const Key &key) const; + QMapData::Node *mutableFindNode(QMapData::Node *update[], const Key &key) const; + QMapData::Node *node_create(QMapData *d, QMapData::Node *update[], const Key &key, + const T &value); +}; + +template <class Key, class T> +Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other) +{ + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + freeData(d); + d = other.d; + if (!d->sharable) + detach_helper(); + } + return *this; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE void QMap<Key, T>::clear() +{ + *this = QMap<Key, T>(); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMapData::Node * +QMap<Key, T>::node_create(QMapData *adt, QMapData::Node *aupdate[], const Key &akey, const T &avalue) +{ + QMapData::Node *abstractNode = adt->node_create(aupdate, payload(), alignment()); + QT_TRY { + Node *concreteNode = concrete(abstractNode); + new (&concreteNode->key) Key(akey); + QT_TRY { + new (&concreteNode->value) T(avalue); + } QT_CATCH(...) { + concreteNode->key.~Key(); + QT_RETHROW; + } + } QT_CATCH(...) { + adt->node_delete(aupdate, payload(), abstractNode); + QT_RETHROW; + } + + // clean up the update array for further insertions + /* + for (int i = 0; i <= d->topLevel; ++i) { + if ( aupdate[i]==reinterpret_cast<QMapData::Node *>(adt) || aupdate[i]->forward[i] != abstractNode) + break; + aupdate[i] = abstractNode; + } +*/ + + return abstractNode; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE QMapData::Node *QMap<Key, T>::findNode(const Key &akey) const +{ + QMapData::Node *cur = e; + QMapData::Node *next = e; + + for (int i = d->topLevel; i >= 0; i--) { + while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) + cur = next; + } + + if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { + return next; + } else { + return e; + } +} + +template <class Key, class T> +Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey) const +{ + QMapData::Node *node; + if (d->size == 0 || (node = findNode(akey)) == e) { + return T(); + } else { + return concrete(node)->value; + } +} + +template <class Key, class T> +Q_INLINE_TEMPLATE const T QMap<Key, T>::value(const Key &akey, const T &adefaultValue) const +{ + QMapData::Node *node; + if (d->size == 0 || (node = findNode(akey)) == e) { + return adefaultValue; + } else { + return concrete(node)->value; + } +} + +template <class Key, class T> +Q_INLINE_TEMPLATE const T QMap<Key, T>::operator[](const Key &akey) const +{ + return value(akey); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE T &QMap<Key, T>::operator[](const Key &akey) +{ + detach(); + + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *node = mutableFindNode(update, akey); + if (node == e) + node = node_create(d, update, akey, T()); + return concrete(node)->value; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE int QMap<Key, T>::count(const Key &akey) const +{ + int cnt = 0; + QMapData::Node *node = findNode(akey); + if (node != e) { + do { + ++cnt; + node = node->forward[0]; + } while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key)); + } + return cnt; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE bool QMap<Key, T>::contains(const Key &akey) const +{ + return findNode(akey) != e; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey, + const T &avalue) +{ + detach(); + + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *node = mutableFindNode(update, akey); + if (node == e) { + node = node_create(d, update, akey, avalue); + } else { + concrete(node)->value = avalue; + } + return iterator(node); +} + +#ifdef QT3_SUPPORT +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey, + const T &avalue, + bool aoverwrite) +{ + detach(); + + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *node = mutableFindNode(update, akey); + if (node == e) { + node = node_create(d, update, akey, avalue); + } else { + if (aoverwrite) + concrete(node)->value = avalue; + } + return iterator(node); +} +#endif + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &akey, + const T &avalue) +{ + detach(); + + QMapData::Node *update[QMapData::LastLevel + 1]; + mutableFindNode(update, akey); + return iterator(node_create(d, update, akey, avalue)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::find(const Key &akey) const +{ + return const_iterator(findNode(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &akey) const +{ + return const_iterator(findNode(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::find(const Key &akey) +{ + detach(); + return iterator(findNode(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other) +{ + QMap<Key, T> copy(other); + const_iterator it = copy.constEnd(); + const const_iterator b = copy.constBegin(); + while (it != b) { + --it; + insertMulti(it.key(), it.value()); + } + return *this; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::freeData(QMapData *x) +{ + if (QTypeInfo<Key>::isComplex || QTypeInfo<T>::isComplex) { + QMapData *cur = x; + QMapData *next = cur->forward[0]; + while (next != x) { + cur = next; + next = cur->forward[0]; +#if defined(_MSC_VER) && (_MSC_VER >= 1300) +#pragma warning(disable:4189) +#endif + Node *concreteNode = concrete(reinterpret_cast<QMapData::Node *>(cur)); + concreteNode->key.~Key(); + concreteNode->value.~T(); +#if defined(_MSC_VER) && (_MSC_VER >= 1300) +#pragma warning(default:4189) +#endif + } + } + x->continueFreeData(payload()); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE int QMap<Key, T>::remove(const Key &akey) +{ + detach(); + + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *cur = e; + QMapData::Node *next = e; + int oldSize = d->size; + + for (int i = d->topLevel; i >= 0; i--) { + while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) + cur = next; + update[i] = cur; + } + + if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { + bool deleteNext = true; + do { + cur = next; + next = cur->forward[0]; + deleteNext = (next != e && !qMapLessThanKey<Key>(concrete(cur)->key, concrete(next)->key)); + concrete(cur)->key.~Key(); + concrete(cur)->value.~T(); + d->node_delete(update, payload(), cur); + } while (deleteNext); + } + return oldSize - d->size; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE T QMap<Key, T>::take(const Key &akey) +{ + detach(); + + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *cur = e; + QMapData::Node *next = e; + + for (int i = d->topLevel; i >= 0; i--) { + while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) + cur = next; + update[i] = cur; + } + + if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { + T t = concrete(next)->value; + concrete(next)->key.~Key(); + concrete(next)->value.~T(); + d->node_delete(update, payload(), next); + return t; + } + return T(); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::erase(iterator it) +{ + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *cur = e; + QMapData::Node *next = e; + + if (it == iterator(e)) + return it; + + for (int i = d->topLevel; i >= 0; i--) { + while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, it.key())) + cur = next; + update[i] = cur; + } + + while (next != e) { + cur = next; + next = cur->forward[0]; + if (cur == it) { + concrete(cur)->key.~Key(); + concrete(cur)->value.~T(); + d->node_delete(update, payload(), cur); + return iterator(next); + } + + for (int i = 0; i <= d->topLevel; ++i) { + if (update[i]->forward[i] != cur) + break; + update[i] = cur; + } + } + return end(); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper() +{ + union { QMapData *d; QMapData::Node *e; } x; + x.d = QMapData::createData(alignment()); + if (d->size) { + x.d->insertInOrder = true; + QMapData::Node *update[QMapData::LastLevel + 1]; + QMapData::Node *cur = e->forward[0]; + update[0] = x.e; + while (cur != e) { + QT_TRY { + Node *concreteNode = concrete(cur); + node_create(x.d, update, concreteNode->key, concreteNode->value); + } QT_CATCH(...) { + freeData(x.d); + QT_RETHROW; + } + cur = cur->forward[0]; + } + x.d->insertInOrder = false; + } + if (!d->ref.deref()) + freeData(d); + d = x.d; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QMapData::Node *QMap<Key, T>::mutableFindNode(QMapData::Node *aupdate[], + const Key &akey) const +{ + QMapData::Node *cur = e; + QMapData::Node *next = e; + + for (int i = d->topLevel; i >= 0; i--) { + while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey)) + cur = next; + aupdate[i] = cur; + } + if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) { + return next; + } else { + return e; + } +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::uniqueKeys() const +{ + QList<Key> res; + const_iterator i = begin(); + if (i != end()) { + for (;;) { + const Key &aKey = i.key(); + res.append(aKey); + do { + if (++i == end()) + goto break_out_of_outer_loop; + } while (!(aKey < i.key())); // loop while (key == i.key()) + } + } +break_out_of_outer_loop: + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys() const +{ + QList<Key> res; + const_iterator i = begin(); + while (i != end()) { + res.append(i.key()); + ++i; + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys(const T &avalue) const +{ + QList<Key> res; + const_iterator i = begin(); + while (i != end()) { + if (i.value() == avalue) + res.append(i.key()); + ++i; + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE const Key QMap<Key, T>::key(const T &avalue) const +{ + return key(avalue, Key()); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE const Key QMap<Key, T>::key(const T &avalue, const Key &defaultKey) const +{ + const_iterator i = begin(); + while (i != end()) { + if (i.value() == avalue) + return i.key(); + ++i; + } + + return defaultKey; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values() const +{ + QList<T> res; + const_iterator i = begin(); + while (i != end()) { + res.append(i.value()); + ++i; + } + return res; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values(const Key &akey) const +{ + QList<T> res; + QMapData::Node *node = findNode(akey); + if (node != e) { + do { + res.append(concrete(node)->value); + node = node->forward[0]; + } while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key)); + } + return res; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator +QMap<Key, T>::lowerBound(const Key &akey) const +{ + QMapData::Node *update[QMapData::LastLevel + 1]; + mutableFindNode(update, akey); + return const_iterator(update[0]->forward[0]); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &akey) +{ + detach(); + return static_cast<QMapData::Node *>(const_cast<const QMap *>(this)->lowerBound(akey)); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator +QMap<Key, T>::upperBound(const Key &akey) const +{ + QMapData::Node *update[QMapData::LastLevel + 1]; + mutableFindNode(update, akey); + QMapData::Node *node = update[0]->forward[0]; + while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key)) + node = node->forward[0]; + return const_iterator(node); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &akey) +{ + detach(); + return static_cast<QMapData::Node *>(const_cast<const QMap *>(this)->upperBound(akey)); +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE bool QMap<Key, T>::operator==(const QMap<Key, T> &other) const +{ + if (size() != other.size()) + return false; + if (d == other.d) + return true; + + const_iterator it1 = begin(); + const_iterator it2 = other.begin(); + + while (it1 != end()) { + if (!(it1.value() == it2.value()) || qMapLessThanKey(it1.key(), it2.key()) || qMapLessThanKey(it2.key(), it1.key())) + return false; + ++it2; + ++it1; + } + return true; +} + +#ifndef QT_NO_STL +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE QMap<Key, T>::QMap(const std::map<Key, T> &other) +{ + d = QMapData::createData(alignment()); + d->insertInOrder = true; + typename std::map<Key,T>::const_iterator it = other.end(); + while (it != other.begin()) { + --it; + insert((*it).first, (*it).second); + } + d->insertInOrder = false; +} + +template <class Key, class T> +Q_OUTOFLINE_TEMPLATE std::map<Key, T> QMap<Key, T>::toStdMap() const +{ + std::map<Key, T> map; + const_iterator it = end(); + while (it != begin()) { + --it; + map.insert(std::pair<Key, T>(it.key(), it.value())); + } + return map; +} + +#endif // QT_NO_STL + +template <class Key, class T> +class QMultiMap : public QMap<Key, T> +{ +public: + QMultiMap() {} + QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {} + + inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value) + { return QMap<Key, T>::insert(key, value); } + inline typename QMap<Key, T>::iterator insert(const Key &key, const T &value) + { return QMap<Key, T>::insertMulti(key, value); } + + inline QMultiMap &operator+=(const QMultiMap &other) + { unite(other); return *this; } + inline QMultiMap operator+(const QMultiMap &other) const + { QMultiMap result = *this; result += other; return result; } + +#if !defined(Q_NO_USING_KEYWORD) && !defined(Q_CC_RVCT) + // RVCT compiler doesn't handle using-keyword right when used functions are overloaded in child class + using QMap<Key, T>::contains; + using QMap<Key, T>::remove; + using QMap<Key, T>::count; + using QMap<Key, T>::find; + using QMap<Key, T>::constFind; +#else + inline bool contains(const Key &key) const + { return QMap<Key, T>::contains(key); } + inline int remove(const Key &key) + { return QMap<Key, T>::remove(key); } + inline int count(const Key &key) const + { return QMap<Key, T>::count(key); } + inline int count() const + { return QMap<Key, T>::count(); } + inline typename QMap<Key, T>::iterator find(const Key &key) + { return QMap<Key, T>::find(key); } + inline typename QMap<Key, T>::const_iterator find(const Key &key) const + { return QMap<Key, T>::find(key); } + inline typename QMap<Key, T>::const_iterator constFind(const Key &key) const + { return QMap<Key, T>::constFind(key); } +#endif + + bool contains(const Key &key, const T &value) const; + + int remove(const Key &key, const T &value); + + int count(const Key &key, const T &value) const; + + typename QMap<Key, T>::iterator find(const Key &key, const T &value) { + typename QMap<Key, T>::iterator i(find(key)); + typename QMap<Key, T>::iterator end(this->end()); + while (i != end && !qMapLessThanKey<Key>(key, i.key())) { + if (i.value() == value) + return i; + ++i; + } + return end; + } + typename QMap<Key, T>::const_iterator find(const Key &key, const T &value) const { + typename QMap<Key, T>::const_iterator i(constFind(key)); + typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd()); + while (i != end && !qMapLessThanKey<Key>(key, i.key())) { + if (i.value() == value) + return i; + ++i; + } + return end; + } + typename QMap<Key, T>::const_iterator constFind(const Key &key, const T &value) const + { return find(key, value); } +private: + T &operator[](const Key &key); + const T operator[](const Key &key) const; +}; + +template <class Key, class T> +Q_INLINE_TEMPLATE bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const +{ + return constFind(key, value) != QMap<Key, T>::constEnd(); +} + +template <class Key, class T> +Q_INLINE_TEMPLATE int QMultiMap<Key, T>::remove(const Key &key, const T &value) +{ + int n = 0; + typename QMap<Key, T>::iterator i(find(key)); + typename QMap<Key, T>::iterator end(QMap<Key, T>::end()); + while (i != end && !qMapLessThanKey<Key>(key, i.key())) { + if (i.value() == value) { +#if defined(Q_CC_RVCT) + // RVCT has problems with scoping, apparently. + i = QMap<Key, T>::erase(i); +#else + i = erase(i); +#endif + ++n; + } else { + ++i; + } + } + return n; +} + +template <class Key, class T> +Q_INLINE_TEMPLATE int QMultiMap<Key, T>::count(const Key &key, const T &value) const +{ + int n = 0; + typename QMap<Key, T>::const_iterator i(constFind(key)); + typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd()); + while (i != end && !qMapLessThanKey<Key>(key, i.key())) { + if (i.value() == value) + ++n; + ++i; + } + return n; +} + +Q_DECLARE_ASSOCIATIVE_ITERATOR(Map) +Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Map) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMAP_H diff --git a/qtinterface/qt4/Qt/qmargins.h b/qtinterface/qt4/Qt/qmargins.h new file mode 100644 index 0000000..af1e6da --- /dev/null +++ b/qtinterface/qt4/Qt/qmargins.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMARGINS_H +#define QMARGINS_H + +#include <QtCore/qnamespace.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QMargins +{ +public: + QMargins(); + QMargins(int left, int top, int right, int bottom); + + bool isNull() const; + + int left() const; + int top() const; + int right() const; + int bottom() const; + + void setLeft(int left); + void setTop(int top); + void setRight(int right); + void setBottom(int bottom); + +private: + int m_left; + int m_top; + int m_right; + int m_bottom; + + friend inline bool operator==(const QMargins &, const QMargins &); + friend inline bool operator!=(const QMargins &, const QMargins &); +}; + +Q_DECLARE_TYPEINFO(QMargins, Q_MOVABLE_TYPE); + +/***************************************************************************** + QMargins inline functions + *****************************************************************************/ + +inline QMargins::QMargins() +{ m_top = m_bottom = m_left = m_right = 0; } + +inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) + : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {} + +inline bool QMargins::isNull() const +{ return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; } + +inline int QMargins::left() const +{ return m_left; } + +inline int QMargins::top() const +{ return m_top; } + +inline int QMargins::right() const +{ return m_right; } + +inline int QMargins::bottom() const +{ return m_bottom; } + + +inline void QMargins::setLeft(int aleft) +{ m_left = aleft; } + +inline void QMargins::setTop(int atop) +{ m_top = atop; } + +inline void QMargins::setRight(int aright) +{ m_right = aright; } + +inline void QMargins::setBottom(int abottom) +{ m_bottom = abottom; } + +inline bool operator==(const QMargins &m1, const QMargins &m2) +{ + return + m1.m_left == m2.m_left && + m1.m_top == m2.m_top && + m1.m_right == m2.m_right && + m1.m_bottom == m2.m_bottom; +} + +inline bool operator!=(const QMargins &m1, const QMargins &m2) +{ + return + m1.m_left != m2.m_left || + m1.m_top != m2.m_top || + m1.m_right != m2.m_right || + m1.m_bottom != m2.m_bottom; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMARGINS_H diff --git a/qtinterface/qt4/Qt/qmath.h b/qtinterface/qt4/Qt/qmath.h new file mode 100644 index 0000000..742dc0a --- /dev/null +++ b/qtinterface/qt4/Qt/qmath.h @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMATH_H +#define QMATH_H + +#include <math.h> + +#include <QtCore/qglobal.h> + +#ifdef Q_OS_SYMBIAN +# include <e32math.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#define QT_SINE_TABLE_SIZE 256 + +extern Q_CORE_EXPORT const qreal qt_sine_table[QT_SINE_TABLE_SIZE]; + +inline int qCeil(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return int(ceilf(float(v))); + else +#endif + return int(ceil(v)); +} + +inline int qFloor(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return int(floorf(float(v))); + else +#endif + return int(floor(v)); +} + +inline qreal qFabs(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return fabsf(float(v)); + else +#endif + return fabs(v); +} + +inline qreal qSin(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal sin_v; + Math::Sin(sin_v, static_cast<TReal>(v)); + return static_cast<qreal>(sin_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return sinf(float(v)); + else +# endif + return sin(v); +#endif +} + +inline qreal qCos(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal cos_v; + Math::Cos(cos_v, static_cast<TReal>(v)); + return static_cast<qreal>(cos_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return cosf(float(v)); + else +# endif + return cos(v); +#endif +} + +inline qreal qTan(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal tan_v; + Math::Tan(tan_v, static_cast<TReal>(v)); + return static_cast<qreal>(tan_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return tanf(float(v)); + else +# endif + return tan(v); +#endif +} + +inline qreal qAcos(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal acos_v; + Math::ACos(acos_v, static_cast<TReal>(v)); + return static_cast<qreal>(acos_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return acosf(float(v)); + else +# endif + return acos(v); +#endif +} + +inline qreal qAsin(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal asin_v; + Math::ASin(asin_v, static_cast<TReal>(v)); + return static_cast<qreal>(asin_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return asinf(float(v)); + else +# endif + return asin(v); +#endif +} + +inline qreal qAtan(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal atan_v; + Math::ATan(atan_v, static_cast<TReal>(v)); + return static_cast<qreal>(atan_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atanf(float(v)); + else +# endif + return atan(v); +#endif +} + +inline qreal qAtan2(qreal x, qreal y) +{ +#ifdef Q_OS_SYMBIAN + TReal atan2_v; + Math::ATan(atan2_v, static_cast<TReal>(x), static_cast<TReal>(y)); + return static_cast<qreal>(atan2_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atan2f(float(x), float(y)); + else +# endif + return atan2(x, y); +#endif +} + +inline qreal qSqrt(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal sqrt_v; + Math::Sqrt(sqrt_v, static_cast<TReal>(v)); + return static_cast<qreal>(sqrt_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return sqrtf(float(v)); + else +# endif + return sqrt(v); +#endif +} + +inline qreal qLn(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return logf(float(v)); + else +#endif + return log(v); +} + +inline qreal qExp(qreal v) +{ +#ifdef Q_OS_SYMBIAN + TReal exp_v; + Math::Exp(exp_v, static_cast<TReal>(v)); + return static_cast<qreal>(exp_v); +#else + // only one signature + // exists, exp(double) + return exp(v); +#endif +} + +inline qreal qPow(qreal x, qreal y) +{ +#ifdef Q_OS_SYMBIAN + TReal pow_v; + Math::Pow(pow_v, static_cast<TReal>(x), static_cast<TReal>(y)); + return static_cast<qreal>(pow_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return powf(float(x), float(y)); + else +# endif + return pow(x, y); +#endif +} + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +inline qreal qFastSin(qreal x) +{ + int si = int(x * (0.5 * QT_SINE_TABLE_SIZE / M_PI)); // Would be more accurate with qRound, but slower. + qreal d = x - si * (2.0 * M_PI / QT_SINE_TABLE_SIZE); + int ci = si + QT_SINE_TABLE_SIZE / 4; + si &= QT_SINE_TABLE_SIZE - 1; + ci &= QT_SINE_TABLE_SIZE - 1; + return qt_sine_table[si] + (qt_sine_table[ci] - 0.5 * qt_sine_table[si] * d) * d; +} + +inline qreal qFastCos(qreal x) +{ + int ci = int(x * (0.5 * QT_SINE_TABLE_SIZE / M_PI)); // Would be more accurate with qRound, but slower. + qreal d = x - ci * (2.0 * M_PI / QT_SINE_TABLE_SIZE); + int si = ci + QT_SINE_TABLE_SIZE / 4; + si &= QT_SINE_TABLE_SIZE - 1; + ci &= QT_SINE_TABLE_SIZE - 1; + return qt_sine_table[si] - (qt_sine_table[ci] + 0.5 * qt_sine_table[si] * d) * d; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMATH_H diff --git a/qtinterface/qt4/Qt/qmatrix.h b/qtinterface/qt4/Qt/qmatrix.h new file mode 100644 index 0000000..63a6aa2 --- /dev/null +++ b/qtinterface/qt4/Qt/qmatrix.h @@ -0,0 +1,206 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMATRIX_H +#define QMATRIX_H + +#include <QtGui/qpolygon.h> +#include <QtGui/qregion.h> +#include <QtGui/qwindowdefs.h> +#include <QtCore/qline.h> +#include <QtCore/qpoint.h> +#include <QtCore/qrect.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPainterPath; +class QVariant; + +class Q_GUI_EXPORT QMatrix // 2D transform matrix +{ +public: + inline explicit QMatrix(Qt::Initialization) {} + QMatrix(); + QMatrix(qreal m11, qreal m12, qreal m21, qreal m22, + qreal dx, qreal dy); + QMatrix(const QMatrix &matrix); + + void setMatrix(qreal m11, qreal m12, qreal m21, qreal m22, + qreal dx, qreal dy); + + qreal m11() const { return _m11; } + qreal m12() const { return _m12; } + qreal m21() const { return _m21; } + qreal m22() const { return _m22; } + qreal dx() const { return _dx; } + qreal dy() const { return _dy; } + + void map(int x, int y, int *tx, int *ty) const; + void map(qreal x, qreal y, qreal *tx, qreal *ty) const; + QRect mapRect(const QRect &) const; + QRectF mapRect(const QRectF &) const; + + QPoint map(const QPoint &p) const; + QPointF map(const QPointF&p) const; + QLine map(const QLine &l) const; + QLineF map(const QLineF &l) const; + QPolygonF map(const QPolygonF &a) const; + QPolygon map(const QPolygon &a) const; + QRegion map(const QRegion &r) const; + QPainterPath map(const QPainterPath &p) const; + QPolygon mapToPolygon(const QRect &r) const; + + void reset(); + inline bool isIdentity() const; + + QMatrix &translate(qreal dx, qreal dy); + QMatrix &scale(qreal sx, qreal sy); + QMatrix &shear(qreal sh, qreal sv); + QMatrix &rotate(qreal a); + + bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); } + qreal determinant() const { return _m11*_m22 - _m12*_m21; } +#ifdef QT_DEPRECATED + QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; } +#endif + + QMatrix inverted(bool *invertible = 0) const; + + bool operator==(const QMatrix &) const; + bool operator!=(const QMatrix &) const; + + QMatrix &operator*=(const QMatrix &); + QMatrix operator*(const QMatrix &o) const; + + QMatrix &operator=(const QMatrix &); + + operator QVariant() const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QMatrix invert(bool *invertible=0) const { return inverted(invertible); } + inline QT3_SUPPORT QRect map(const QRect &r) const { return mapRect(r); } + QT3_SUPPORT QRegion mapToRegion(const QRect &r) const; +#endif + +private: + inline QMatrix(bool) + : _m11(1.) + , _m12(0.) + , _m21(0.) + , _m22(1.) + , _dx(0.) + , _dy(0.) {} + inline QMatrix(qreal am11, qreal am12, qreal am21, qreal am22, qreal adx, qreal ady, bool) + : _m11(am11) + , _m12(am12) + , _m21(am21) + , _m22(am22) + , _dx(adx) + , _dy(ady) {} + friend class QTransform; + qreal _m11, _m12; + qreal _m21, _m22; + qreal _dx, _dy; +}; +Q_DECLARE_TYPEINFO(QMatrix, Q_MOVABLE_TYPE); + +// mathematical semantics +Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QMatrix &m) +{ return m.map(p); } +Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QMatrix &m) +{ return m.map(p); } +Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QMatrix &m) +{ return m.map(l); } +Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QMatrix &m) +{ return m.map(l); } +Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QMatrix &m) +{ return m.map(a); } +Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QMatrix &m) +{ return m.map(a); } +Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QMatrix &m) +{ return m.map(r); } +Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m); + +inline bool QMatrix::isIdentity() const +{ + return qFuzzyIsNull(_m11 - 1) && qFuzzyIsNull(_m22 - 1) && qFuzzyIsNull(_m12) + && qFuzzyIsNull(_m21) && qFuzzyIsNull(_dx) && qFuzzyIsNull(_dy); +} + +inline bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2) +{ + return qFuzzyCompare(m1.m11(), m2.m11()) + && qFuzzyCompare(m1.m12(), m2.m12()) + && qFuzzyCompare(m1.m21(), m2.m21()) + && qFuzzyCompare(m1.m22(), m2.m22()) + && qFuzzyCompare(m1.dx(), m2.dx()) + && qFuzzyCompare(m1.dy(), m2.dy()); +} + + +/***************************************************************************** + QMatrix stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &); +#endif + +#ifdef QT3_SUPPORT +QT_BEGIN_INCLUDE_NAMESPACE +#include <QtGui/qwmatrix.h> +QT_END_INCLUDE_NAMESPACE +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMATRIX_H diff --git a/qtinterface/qt4/Qt/qmatrix4x4.h b/qtinterface/qt4/Qt/qmatrix4x4.h new file mode 100644 index 0000000..5552df7 --- /dev/null +++ b/qtinterface/qt4/Qt/qmatrix4x4.h @@ -0,0 +1,1024 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMATRIX4X4_H +#define QMATRIX4X4_H + +#include <QtGui/qvector3d.h> +#include <QtGui/qvector4d.h> +#include <QtGui/qquaternion.h> +#include <QtGui/qgenericmatrix.h> +#include <QtCore/qrect.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MATRIX4X4 + +class QMatrix; +class QTransform; +class QVariant; + +class Q_GUI_EXPORT QMatrix4x4 +{ +public: + inline QMatrix4x4() { setToIdentity(); } + explicit QMatrix4x4(const qreal *values); + inline QMatrix4x4(qreal m11, qreal m12, qreal m13, qreal m14, + qreal m21, qreal m22, qreal m23, qreal m24, + qreal m31, qreal m32, qreal m33, qreal m34, + qreal m41, qreal m42, qreal m43, qreal m44); +#if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) + template <int N, int M> + explicit QMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix); +#endif + QMatrix4x4(const qreal *values, int cols, int rows); + QMatrix4x4(const QTransform& transform); + QMatrix4x4(const QMatrix& matrix); + + inline const qreal& operator()(int row, int column) const; + inline qreal& operator()(int row, int column); + + inline QVector4D column(int index) const; + inline void setColumn(int index, const QVector4D& value); + + inline QVector4D row(int index) const; + inline void setRow(int index, const QVector4D& value); + + inline bool isIdentity() const; + inline void setToIdentity(); + + inline void fill(qreal value); + + qreal determinant() const; + QMatrix4x4 inverted(bool *invertible = 0) const; + QMatrix4x4 transposed() const; + QMatrix3x3 normalMatrix() const; + + inline QMatrix4x4& operator+=(const QMatrix4x4& other); + inline QMatrix4x4& operator-=(const QMatrix4x4& other); + inline QMatrix4x4& operator*=(const QMatrix4x4& other); + inline QMatrix4x4& operator*=(qreal factor); + QMatrix4x4& operator/=(qreal divisor); + inline bool operator==(const QMatrix4x4& other) const; + inline bool operator!=(const QMatrix4x4& other) const; + + friend QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2); + friend QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2); + friend QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2); +#ifndef QT_NO_VECTOR3D + friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector); + friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix); +#endif +#ifndef QT_NO_VECTOR4D + friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix); + friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector); +#endif + friend QPoint operator*(const QPoint& point, const QMatrix4x4& matrix); + friend QPointF operator*(const QPointF& point, const QMatrix4x4& matrix); + friend QMatrix4x4 operator-(const QMatrix4x4& matrix); + friend QPoint operator*(const QMatrix4x4& matrix, const QPoint& point); + friend QPointF operator*(const QMatrix4x4& matrix, const QPointF& point); + friend QMatrix4x4 operator*(qreal factor, const QMatrix4x4& matrix); + friend QMatrix4x4 operator*(const QMatrix4x4& matrix, qreal factor); + friend Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, qreal divisor); + + friend inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2); + +#ifndef QT_NO_VECTOR3D + void scale(const QVector3D& vector); + void translate(const QVector3D& vector); + void rotate(qreal angle, const QVector3D& vector); +#endif + void scale(qreal x, qreal y); + void scale(qreal x, qreal y, qreal z); + void scale(qreal factor); + void translate(qreal x, qreal y); + void translate(qreal x, qreal y, qreal z); + void rotate(qreal angle, qreal x, qreal y, qreal z = 0.0f); +#ifndef QT_NO_QUATERNION + void rotate(const QQuaternion& quaternion); +#endif + + void ortho(const QRect& rect); + void ortho(const QRectF& rect); + void ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); + void frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); + void perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane); +#ifndef QT_NO_VECTOR3D + void lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up); +#endif + void flipCoordinates(); + + void copyDataTo(qreal *values) const; + + QMatrix toAffine() const; + QTransform toTransform() const; + QTransform toTransform(qreal distanceToPlane) const; + + QPoint map(const QPoint& point) const; + QPointF map(const QPointF& point) const; +#ifndef QT_NO_VECTOR3D + QVector3D map(const QVector3D& point) const; + QVector3D mapVector(const QVector3D& vector) const; +#endif +#ifndef QT_NO_VECTOR4D + QVector4D map(const QVector4D& point) const; +#endif + QRect mapRect(const QRect& rect) const; + QRectF mapRect(const QRectF& rect) const; + +#if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) + template <int N, int M> + QGenericMatrix<N, M, qreal> toGenericMatrix() const; +#endif + + inline qreal *data(); + inline const qreal *data() const { return m[0]; } + inline const qreal *constData() const { return m[0]; } + + void optimize(); + + operator QVariant() const; + +#ifndef QT_NO_DEBUG_STREAM + friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m); +#endif + +private: + qreal m[4][4]; // Column-major order to match OpenGL. + int flagBits; // Flag bits from the enum below. + + enum { + Identity = 0x0001, // Identity matrix + General = 0x0002, // General matrix, unknown contents + Translation = 0x0004, // Contains a simple translation + Scale = 0x0008, // Contains a simple scale + Rotation = 0x0010 // Contains a simple rotation + }; + + // Construct without initializing identity matrix. + QMatrix4x4(int) { flagBits = General; } + + QMatrix4x4 orthonormalInverse() const; + + void projectedRotate(qreal angle, qreal x, qreal y, qreal z); + + friend class QGraphicsRotation; +}; + +inline QMatrix4x4::QMatrix4x4 + (qreal m11, qreal m12, qreal m13, qreal m14, + qreal m21, qreal m22, qreal m23, qreal m24, + qreal m31, qreal m32, qreal m33, qreal m34, + qreal m41, qreal m42, qreal m43, qreal m44) +{ + m[0][0] = m11; m[0][1] = m21; m[0][2] = m31; m[0][3] = m41; + m[1][0] = m12; m[1][1] = m22; m[1][2] = m32; m[1][3] = m42; + m[2][0] = m13; m[2][1] = m23; m[2][2] = m33; m[2][3] = m43; + m[3][0] = m14; m[3][1] = m24; m[3][2] = m34; m[3][3] = m44; + flagBits = General; +} + +#if !defined(QT_NO_MEMBER_TEMPLATES) + +template <int N, int M> +Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4 + (const QGenericMatrix<N, M, qreal>& matrix) +{ + const qreal *values = matrix.constData(); + for (int matrixCol = 0; matrixCol < 4; ++matrixCol) { + for (int matrixRow = 0; matrixRow < 4; ++matrixRow) { + if (matrixCol < N && matrixRow < M) + m[matrixCol][matrixRow] = values[matrixCol * M + matrixRow]; + else if (matrixCol == matrixRow) + m[matrixCol][matrixRow] = 1.0f; + else + m[matrixCol][matrixRow] = 0.0f; + } + } + flagBits = General; +} + +template <int N, int M> +QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const +{ + QGenericMatrix<N, M, qreal> result; + qreal *values = result.data(); + for (int matrixCol = 0; matrixCol < N; ++matrixCol) { + for (int matrixRow = 0; matrixRow < M; ++matrixRow) { + if (matrixCol < 4 && matrixRow < 4) + values[matrixCol * M + matrixRow] = m[matrixCol][matrixRow]; + else if (matrixCol == matrixRow) + values[matrixCol * M + matrixRow] = 1.0f; + else + values[matrixCol * M + matrixRow] = 0.0f; + } + } + return result; +} + +#endif + +inline const qreal& QMatrix4x4::operator()(int aRow, int aColumn) const +{ + Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4); + return m[aColumn][aRow]; +} + +inline qreal& QMatrix4x4::operator()(int aRow, int aColumn) +{ + Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4); + flagBits = General; + return m[aColumn][aRow]; +} + +inline QVector4D QMatrix4x4::column(int index) const +{ + Q_ASSERT(index >= 0 && index < 4); + return QVector4D(m[index][0], m[index][1], m[index][2], m[index][3]); +} + +inline void QMatrix4x4::setColumn(int index, const QVector4D& value) +{ + Q_ASSERT(index >= 0 && index < 4); + m[index][0] = value.x(); + m[index][1] = value.y(); + m[index][2] = value.z(); + m[index][3] = value.w(); + flagBits = General; +} + +inline QVector4D QMatrix4x4::row(int index) const +{ + Q_ASSERT(index >= 0 && index < 4); + return QVector4D(m[0][index], m[1][index], m[2][index], m[3][index]); +} + +inline void QMatrix4x4::setRow(int index, const QVector4D& value) +{ + Q_ASSERT(index >= 0 && index < 4); + m[0][index] = value.x(); + m[1][index] = value.y(); + m[2][index] = value.z(); + m[3][index] = value.w(); + flagBits = General; +} + +Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, qreal divisor); + +inline bool QMatrix4x4::isIdentity() const +{ + if (flagBits == Identity) + return true; + if (m[0][0] != 1.0f || m[0][1] != 0.0f || m[0][2] != 0.0f) + return false; + if (m[0][3] != 0.0f || m[1][0] != 0.0f || m[1][1] != 1.0f) + return false; + if (m[1][2] != 0.0f || m[1][3] != 0.0f || m[2][0] != 0.0f) + return false; + if (m[2][1] != 0.0f || m[2][2] != 1.0f || m[2][3] != 0.0f) + return false; + if (m[3][0] != 0.0f || m[3][1] != 0.0f || m[3][2] != 0.0f) + return false; + return (m[3][3] == 1.0f); +} + +inline void QMatrix4x4::setToIdentity() +{ + m[0][0] = 1.0f; + m[0][1] = 0.0f; + m[0][2] = 0.0f; + m[0][3] = 0.0f; + m[1][0] = 0.0f; + m[1][1] = 1.0f; + m[1][2] = 0.0f; + m[1][3] = 0.0f; + m[2][0] = 0.0f; + m[2][1] = 0.0f; + m[2][2] = 1.0f; + m[2][3] = 0.0f; + m[3][0] = 0.0f; + m[3][1] = 0.0f; + m[3][2] = 0.0f; + m[3][3] = 1.0f; + flagBits = Identity; +} + +inline void QMatrix4x4::fill(qreal value) +{ + m[0][0] = value; + m[0][1] = value; + m[0][2] = value; + m[0][3] = value; + m[1][0] = value; + m[1][1] = value; + m[1][2] = value; + m[1][3] = value; + m[2][0] = value; + m[2][1] = value; + m[2][2] = value; + m[2][3] = value; + m[3][0] = value; + m[3][1] = value; + m[3][2] = value; + m[3][3] = value; + flagBits = General; +} + +inline QMatrix4x4& QMatrix4x4::operator+=(const QMatrix4x4& other) +{ + m[0][0] += other.m[0][0]; + m[0][1] += other.m[0][1]; + m[0][2] += other.m[0][2]; + m[0][3] += other.m[0][3]; + m[1][0] += other.m[1][0]; + m[1][1] += other.m[1][1]; + m[1][2] += other.m[1][2]; + m[1][3] += other.m[1][3]; + m[2][0] += other.m[2][0]; + m[2][1] += other.m[2][1]; + m[2][2] += other.m[2][2]; + m[2][3] += other.m[2][3]; + m[3][0] += other.m[3][0]; + m[3][1] += other.m[3][1]; + m[3][2] += other.m[3][2]; + m[3][3] += other.m[3][3]; + flagBits = General; + return *this; +} + +inline QMatrix4x4& QMatrix4x4::operator-=(const QMatrix4x4& other) +{ + m[0][0] -= other.m[0][0]; + m[0][1] -= other.m[0][1]; + m[0][2] -= other.m[0][2]; + m[0][3] -= other.m[0][3]; + m[1][0] -= other.m[1][0]; + m[1][1] -= other.m[1][1]; + m[1][2] -= other.m[1][2]; + m[1][3] -= other.m[1][3]; + m[2][0] -= other.m[2][0]; + m[2][1] -= other.m[2][1]; + m[2][2] -= other.m[2][2]; + m[2][3] -= other.m[2][3]; + m[3][0] -= other.m[3][0]; + m[3][1] -= other.m[3][1]; + m[3][2] -= other.m[3][2]; + m[3][3] -= other.m[3][3]; + flagBits = General; + return *this; +} + +inline QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& other) +{ + if (flagBits == Identity) { + *this = other; + return *this; + } else if (other.flagBits == Identity) { + return *this; + } else { + *this = *this * other; + return *this; + } +} + +inline QMatrix4x4& QMatrix4x4::operator*=(qreal factor) +{ + m[0][0] *= factor; + m[0][1] *= factor; + m[0][2] *= factor; + m[0][3] *= factor; + m[1][0] *= factor; + m[1][1] *= factor; + m[1][2] *= factor; + m[1][3] *= factor; + m[2][0] *= factor; + m[2][1] *= factor; + m[2][2] *= factor; + m[2][3] *= factor; + m[3][0] *= factor; + m[3][1] *= factor; + m[3][2] *= factor; + m[3][3] *= factor; + flagBits = General; + return *this; +} + +inline bool QMatrix4x4::operator==(const QMatrix4x4& other) const +{ + return m[0][0] == other.m[0][0] && + m[0][1] == other.m[0][1] && + m[0][2] == other.m[0][2] && + m[0][3] == other.m[0][3] && + m[1][0] == other.m[1][0] && + m[1][1] == other.m[1][1] && + m[1][2] == other.m[1][2] && + m[1][3] == other.m[1][3] && + m[2][0] == other.m[2][0] && + m[2][1] == other.m[2][1] && + m[2][2] == other.m[2][2] && + m[2][3] == other.m[2][3] && + m[3][0] == other.m[3][0] && + m[3][1] == other.m[3][1] && + m[3][2] == other.m[3][2] && + m[3][3] == other.m[3][3]; +} + +inline bool QMatrix4x4::operator!=(const QMatrix4x4& other) const +{ + return m[0][0] != other.m[0][0] || + m[0][1] != other.m[0][1] || + m[0][2] != other.m[0][2] || + m[0][3] != other.m[0][3] || + m[1][0] != other.m[1][0] || + m[1][1] != other.m[1][1] || + m[1][2] != other.m[1][2] || + m[1][3] != other.m[1][3] || + m[2][0] != other.m[2][0] || + m[2][1] != other.m[2][1] || + m[2][2] != other.m[2][2] || + m[2][3] != other.m[2][3] || + m[3][0] != other.m[3][0] || + m[3][1] != other.m[3][1] || + m[3][2] != other.m[3][2] || + m[3][3] != other.m[3][3]; +} + +inline QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2) +{ + QMatrix4x4 m(1); + m.m[0][0] = m1.m[0][0] + m2.m[0][0]; + m.m[0][1] = m1.m[0][1] + m2.m[0][1]; + m.m[0][2] = m1.m[0][2] + m2.m[0][2]; + m.m[0][3] = m1.m[0][3] + m2.m[0][3]; + m.m[1][0] = m1.m[1][0] + m2.m[1][0]; + m.m[1][1] = m1.m[1][1] + m2.m[1][1]; + m.m[1][2] = m1.m[1][2] + m2.m[1][2]; + m.m[1][3] = m1.m[1][3] + m2.m[1][3]; + m.m[2][0] = m1.m[2][0] + m2.m[2][0]; + m.m[2][1] = m1.m[2][1] + m2.m[2][1]; + m.m[2][2] = m1.m[2][2] + m2.m[2][2]; + m.m[2][3] = m1.m[2][3] + m2.m[2][3]; + m.m[3][0] = m1.m[3][0] + m2.m[3][0]; + m.m[3][1] = m1.m[3][1] + m2.m[3][1]; + m.m[3][2] = m1.m[3][2] + m2.m[3][2]; + m.m[3][3] = m1.m[3][3] + m2.m[3][3]; + return m; +} + +inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2) +{ + QMatrix4x4 m(1); + m.m[0][0] = m1.m[0][0] - m2.m[0][0]; + m.m[0][1] = m1.m[0][1] - m2.m[0][1]; + m.m[0][2] = m1.m[0][2] - m2.m[0][2]; + m.m[0][3] = m1.m[0][3] - m2.m[0][3]; + m.m[1][0] = m1.m[1][0] - m2.m[1][0]; + m.m[1][1] = m1.m[1][1] - m2.m[1][1]; + m.m[1][2] = m1.m[1][2] - m2.m[1][2]; + m.m[1][3] = m1.m[1][3] - m2.m[1][3]; + m.m[2][0] = m1.m[2][0] - m2.m[2][0]; + m.m[2][1] = m1.m[2][1] - m2.m[2][1]; + m.m[2][2] = m1.m[2][2] - m2.m[2][2]; + m.m[2][3] = m1.m[2][3] - m2.m[2][3]; + m.m[3][0] = m1.m[3][0] - m2.m[3][0]; + m.m[3][1] = m1.m[3][1] - m2.m[3][1]; + m.m[3][2] = m1.m[3][2] - m2.m[3][2]; + m.m[3][3] = m1.m[3][3] - m2.m[3][3]; + return m; +} + +inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2) +{ + if (m1.flagBits == QMatrix4x4::Identity) + return m2; + else if (m2.flagBits == QMatrix4x4::Identity) + return m1; + + QMatrix4x4 m(1); + m.m[0][0] = m1.m[0][0] * m2.m[0][0] + + m1.m[1][0] * m2.m[0][1] + + m1.m[2][0] * m2.m[0][2] + + m1.m[3][0] * m2.m[0][3]; + m.m[0][1] = m1.m[0][1] * m2.m[0][0] + + m1.m[1][1] * m2.m[0][1] + + m1.m[2][1] * m2.m[0][2] + + m1.m[3][1] * m2.m[0][3]; + m.m[0][2] = m1.m[0][2] * m2.m[0][0] + + m1.m[1][2] * m2.m[0][1] + + m1.m[2][2] * m2.m[0][2] + + m1.m[3][2] * m2.m[0][3]; + m.m[0][3] = m1.m[0][3] * m2.m[0][0] + + m1.m[1][3] * m2.m[0][1] + + m1.m[2][3] * m2.m[0][2] + + m1.m[3][3] * m2.m[0][3]; + m.m[1][0] = m1.m[0][0] * m2.m[1][0] + + m1.m[1][0] * m2.m[1][1] + + m1.m[2][0] * m2.m[1][2] + + m1.m[3][0] * m2.m[1][3]; + m.m[1][1] = m1.m[0][1] * m2.m[1][0] + + m1.m[1][1] * m2.m[1][1] + + m1.m[2][1] * m2.m[1][2] + + m1.m[3][1] * m2.m[1][3]; + m.m[1][2] = m1.m[0][2] * m2.m[1][0] + + m1.m[1][2] * m2.m[1][1] + + m1.m[2][2] * m2.m[1][2] + + m1.m[3][2] * m2.m[1][3]; + m.m[1][3] = m1.m[0][3] * m2.m[1][0] + + m1.m[1][3] * m2.m[1][1] + + m1.m[2][3] * m2.m[1][2] + + m1.m[3][3] * m2.m[1][3]; + m.m[2][0] = m1.m[0][0] * m2.m[2][0] + + m1.m[1][0] * m2.m[2][1] + + m1.m[2][0] * m2.m[2][2] + + m1.m[3][0] * m2.m[2][3]; + m.m[2][1] = m1.m[0][1] * m2.m[2][0] + + m1.m[1][1] * m2.m[2][1] + + m1.m[2][1] * m2.m[2][2] + + m1.m[3][1] * m2.m[2][3]; + m.m[2][2] = m1.m[0][2] * m2.m[2][0] + + m1.m[1][2] * m2.m[2][1] + + m1.m[2][2] * m2.m[2][2] + + m1.m[3][2] * m2.m[2][3]; + m.m[2][3] = m1.m[0][3] * m2.m[2][0] + + m1.m[1][3] * m2.m[2][1] + + m1.m[2][3] * m2.m[2][2] + + m1.m[3][3] * m2.m[2][3]; + m.m[3][0] = m1.m[0][0] * m2.m[3][0] + + m1.m[1][0] * m2.m[3][1] + + m1.m[2][0] * m2.m[3][2] + + m1.m[3][0] * m2.m[3][3]; + m.m[3][1] = m1.m[0][1] * m2.m[3][0] + + m1.m[1][1] * m2.m[3][1] + + m1.m[2][1] * m2.m[3][2] + + m1.m[3][1] * m2.m[3][3]; + m.m[3][2] = m1.m[0][2] * m2.m[3][0] + + m1.m[1][2] * m2.m[3][1] + + m1.m[2][2] * m2.m[3][2] + + m1.m[3][2] * m2.m[3][3]; + m.m[3][3] = m1.m[0][3] * m2.m[3][0] + + m1.m[1][3] * m2.m[3][1] + + m1.m[2][3] * m2.m[3][2] + + m1.m[3][3] * m2.m[3][3]; + return m; +} + +#ifndef QT_NO_VECTOR3D + +inline QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix) +{ + qreal x, y, z, w; + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[0][1] + + vector.z() * matrix.m[0][2] + + matrix.m[0][3]; + y = vector.x() * matrix.m[1][0] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[1][2] + + matrix.m[1][3]; + z = vector.x() * matrix.m[2][0] + + vector.y() * matrix.m[2][1] + + vector.z() * matrix.m[2][2] + + matrix.m[2][3]; + w = vector.x() * matrix.m[3][0] + + vector.y() * matrix.m[3][1] + + vector.z() * matrix.m[3][2] + + matrix.m[3][3]; + if (w == 1.0f) + return QVector3D(x, y, z); + else + return QVector3D(x / w, y / w, z / w); +} + +inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector) +{ + qreal x, y, z, w; + if (matrix.flagBits == QMatrix4x4::Identity) { + return vector; + } else if (matrix.flagBits == QMatrix4x4::Translation) { + return QVector3D(vector.x() + matrix.m[3][0], + vector.y() + matrix.m[3][1], + vector.z() + matrix.m[3][2]); + } else if (matrix.flagBits == + (QMatrix4x4::Translation | QMatrix4x4::Scale)) { + return QVector3D(vector.x() * matrix.m[0][0] + matrix.m[3][0], + vector.y() * matrix.m[1][1] + matrix.m[3][1], + vector.z() * matrix.m[2][2] + matrix.m[3][2]); + } else if (matrix.flagBits == QMatrix4x4::Scale) { + return QVector3D(vector.x() * matrix.m[0][0], + vector.y() * matrix.m[1][1], + vector.z() * matrix.m[2][2]); + } else { + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[1][0] + + vector.z() * matrix.m[2][0] + + matrix.m[3][0]; + y = vector.x() * matrix.m[0][1] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[2][1] + + matrix.m[3][1]; + z = vector.x() * matrix.m[0][2] + + vector.y() * matrix.m[1][2] + + vector.z() * matrix.m[2][2] + + matrix.m[3][2]; + w = vector.x() * matrix.m[0][3] + + vector.y() * matrix.m[1][3] + + vector.z() * matrix.m[2][3] + + matrix.m[3][3]; + if (w == 1.0f) + return QVector3D(x, y, z); + else + return QVector3D(x / w, y / w, z / w); + } +} + +#endif + +#ifndef QT_NO_VECTOR4D + +inline QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix) +{ + qreal x, y, z, w; + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[0][1] + + vector.z() * matrix.m[0][2] + + vector.w() * matrix.m[0][3]; + y = vector.x() * matrix.m[1][0] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[1][2] + + vector.w() * matrix.m[1][3]; + z = vector.x() * matrix.m[2][0] + + vector.y() * matrix.m[2][1] + + vector.z() * matrix.m[2][2] + + vector.w() * matrix.m[2][3]; + w = vector.x() * matrix.m[3][0] + + vector.y() * matrix.m[3][1] + + vector.z() * matrix.m[3][2] + + vector.w() * matrix.m[3][3]; + return QVector4D(x, y, z, w); +} + +inline QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector) +{ + qreal x, y, z, w; + x = vector.x() * matrix.m[0][0] + + vector.y() * matrix.m[1][0] + + vector.z() * matrix.m[2][0] + + vector.w() * matrix.m[3][0]; + y = vector.x() * matrix.m[0][1] + + vector.y() * matrix.m[1][1] + + vector.z() * matrix.m[2][1] + + vector.w() * matrix.m[3][1]; + z = vector.x() * matrix.m[0][2] + + vector.y() * matrix.m[1][2] + + vector.z() * matrix.m[2][2] + + vector.w() * matrix.m[3][2]; + w = vector.x() * matrix.m[0][3] + + vector.y() * matrix.m[1][3] + + vector.z() * matrix.m[2][3] + + vector.w() * matrix.m[3][3]; + return QVector4D(x, y, z, w); +} + +#endif + +inline QPoint operator*(const QPoint& point, const QMatrix4x4& matrix) +{ + qreal xin, yin; + qreal x, y, w; + xin = point.x(); + yin = point.y(); + x = xin * matrix.m[0][0] + + yin * matrix.m[0][1] + + matrix.m[0][3]; + y = xin * matrix.m[1][0] + + yin * matrix.m[1][1] + + matrix.m[1][3]; + w = xin * matrix.m[3][0] + + yin * matrix.m[3][1] + + matrix.m[3][3]; + if (w == 1.0f) + return QPoint(qRound(x), qRound(y)); + else + return QPoint(qRound(x / w), qRound(y / w)); +} + +inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix) +{ + qreal xin, yin; + qreal x, y, w; + xin = point.x(); + yin = point.y(); + x = xin * matrix.m[0][0] + + yin * matrix.m[0][1] + + matrix.m[0][3]; + y = xin * matrix.m[1][0] + + yin * matrix.m[1][1] + + matrix.m[1][3]; + w = xin * matrix.m[3][0] + + yin * matrix.m[3][1] + + matrix.m[3][3]; + if (w == 1.0f) { + return QPointF(qreal(x), qreal(y)); + } else { + return QPointF(qreal(x / w), qreal(y / w)); + } +} + +inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point) +{ + qreal xin, yin; + qreal x, y, w; + xin = point.x(); + yin = point.y(); + if (matrix.flagBits == QMatrix4x4::Identity) { + return point; + } else if (matrix.flagBits == QMatrix4x4::Translation) { + return QPoint(qRound(xin + matrix.m[3][0]), + qRound(yin + matrix.m[3][1])); + } else if (matrix.flagBits == + (QMatrix4x4::Translation | QMatrix4x4::Scale)) { + return QPoint(qRound(xin * matrix.m[0][0] + matrix.m[3][0]), + qRound(yin * matrix.m[1][1] + matrix.m[3][1])); + } else if (matrix.flagBits == QMatrix4x4::Scale) { + return QPoint(qRound(xin * matrix.m[0][0]), + qRound(yin * matrix.m[1][1])); + } else { + x = xin * matrix.m[0][0] + + yin * matrix.m[1][0] + + matrix.m[3][0]; + y = xin * matrix.m[0][1] + + yin * matrix.m[1][1] + + matrix.m[3][1]; + w = xin * matrix.m[0][3] + + yin * matrix.m[1][3] + + matrix.m[3][3]; + if (w == 1.0f) + return QPoint(qRound(x), qRound(y)); + else + return QPoint(qRound(x / w), qRound(y / w)); + } +} + +inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point) +{ + qreal xin, yin; + qreal x, y, w; + xin = point.x(); + yin = point.y(); + if (matrix.flagBits == QMatrix4x4::Identity) { + return point; + } else if (matrix.flagBits == QMatrix4x4::Translation) { + return QPointF(xin + matrix.m[3][0], + yin + matrix.m[3][1]); + } else if (matrix.flagBits == + (QMatrix4x4::Translation | QMatrix4x4::Scale)) { + return QPointF(xin * matrix.m[0][0] + matrix.m[3][0], + yin * matrix.m[1][1] + matrix.m[3][1]); + } else if (matrix.flagBits == QMatrix4x4::Scale) { + return QPointF(xin * matrix.m[0][0], + yin * matrix.m[1][1]); + } else { + x = xin * matrix.m[0][0] + + yin * matrix.m[1][0] + + matrix.m[3][0]; + y = xin * matrix.m[0][1] + + yin * matrix.m[1][1] + + matrix.m[3][1]; + w = xin * matrix.m[0][3] + + yin * matrix.m[1][3] + + matrix.m[3][3]; + if (w == 1.0f) { + return QPointF(qreal(x), qreal(y)); + } else { + return QPointF(qreal(x / w), qreal(y / w)); + } + } +} + +inline QMatrix4x4 operator-(const QMatrix4x4& matrix) +{ + QMatrix4x4 m(1); + m.m[0][0] = -matrix.m[0][0]; + m.m[0][1] = -matrix.m[0][1]; + m.m[0][2] = -matrix.m[0][2]; + m.m[0][3] = -matrix.m[0][3]; + m.m[1][0] = -matrix.m[1][0]; + m.m[1][1] = -matrix.m[1][1]; + m.m[1][2] = -matrix.m[1][2]; + m.m[1][3] = -matrix.m[1][3]; + m.m[2][0] = -matrix.m[2][0]; + m.m[2][1] = -matrix.m[2][1]; + m.m[2][2] = -matrix.m[2][2]; + m.m[2][3] = -matrix.m[2][3]; + m.m[3][0] = -matrix.m[3][0]; + m.m[3][1] = -matrix.m[3][1]; + m.m[3][2] = -matrix.m[3][2]; + m.m[3][3] = -matrix.m[3][3]; + return m; +} + +inline QMatrix4x4 operator*(qreal factor, const QMatrix4x4& matrix) +{ + QMatrix4x4 m(1); + m.m[0][0] = matrix.m[0][0] * factor; + m.m[0][1] = matrix.m[0][1] * factor; + m.m[0][2] = matrix.m[0][2] * factor; + m.m[0][3] = matrix.m[0][3] * factor; + m.m[1][0] = matrix.m[1][0] * factor; + m.m[1][1] = matrix.m[1][1] * factor; + m.m[1][2] = matrix.m[1][2] * factor; + m.m[1][3] = matrix.m[1][3] * factor; + m.m[2][0] = matrix.m[2][0] * factor; + m.m[2][1] = matrix.m[2][1] * factor; + m.m[2][2] = matrix.m[2][2] * factor; + m.m[2][3] = matrix.m[2][3] * factor; + m.m[3][0] = matrix.m[3][0] * factor; + m.m[3][1] = matrix.m[3][1] * factor; + m.m[3][2] = matrix.m[3][2] * factor; + m.m[3][3] = matrix.m[3][3] * factor; + return m; +} + +inline QMatrix4x4 operator*(const QMatrix4x4& matrix, qreal factor) +{ + QMatrix4x4 m(1); + m.m[0][0] = matrix.m[0][0] * factor; + m.m[0][1] = matrix.m[0][1] * factor; + m.m[0][2] = matrix.m[0][2] * factor; + m.m[0][3] = matrix.m[0][3] * factor; + m.m[1][0] = matrix.m[1][0] * factor; + m.m[1][1] = matrix.m[1][1] * factor; + m.m[1][2] = matrix.m[1][2] * factor; + m.m[1][3] = matrix.m[1][3] * factor; + m.m[2][0] = matrix.m[2][0] * factor; + m.m[2][1] = matrix.m[2][1] * factor; + m.m[2][2] = matrix.m[2][2] * factor; + m.m[2][3] = matrix.m[2][3] * factor; + m.m[3][0] = matrix.m[3][0] * factor; + m.m[3][1] = matrix.m[3][1] * factor; + m.m[3][2] = matrix.m[3][2] * factor; + m.m[3][3] = matrix.m[3][3] * factor; + return m; +} + +inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2) +{ + return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) && + qFuzzyCompare(m1.m[0][1], m2.m[0][1]) && + qFuzzyCompare(m1.m[0][2], m2.m[0][2]) && + qFuzzyCompare(m1.m[0][3], m2.m[0][3]) && + qFuzzyCompare(m1.m[1][0], m2.m[1][0]) && + qFuzzyCompare(m1.m[1][1], m2.m[1][1]) && + qFuzzyCompare(m1.m[1][2], m2.m[1][2]) && + qFuzzyCompare(m1.m[1][3], m2.m[1][3]) && + qFuzzyCompare(m1.m[2][0], m2.m[2][0]) && + qFuzzyCompare(m1.m[2][1], m2.m[2][1]) && + qFuzzyCompare(m1.m[2][2], m2.m[2][2]) && + qFuzzyCompare(m1.m[2][3], m2.m[2][3]) && + qFuzzyCompare(m1.m[3][0], m2.m[3][0]) && + qFuzzyCompare(m1.m[3][1], m2.m[3][1]) && + qFuzzyCompare(m1.m[3][2], m2.m[3][2]) && + qFuzzyCompare(m1.m[3][3], m2.m[3][3]); +} + +inline QPoint QMatrix4x4::map(const QPoint& point) const +{ + return *this * point; +} + +inline QPointF QMatrix4x4::map(const QPointF& point) const +{ + return *this * point; +} + +#ifndef QT_NO_VECTOR3D + +inline QVector3D QMatrix4x4::map(const QVector3D& point) const +{ + return *this * point; +} + +inline QVector3D QMatrix4x4::mapVector(const QVector3D& vector) const +{ + if (flagBits == Identity || flagBits == Translation) { + return vector; + } else if (flagBits == Scale || flagBits == (Translation | Scale)) { + return QVector3D(vector.x() * m[0][0], + vector.y() * m[1][1], + vector.z() * m[2][2]); + } else { + return QVector3D(vector.x() * m[0][0] + + vector.y() * m[1][0] + + vector.z() * m[2][0], + vector.x() * m[0][1] + + vector.y() * m[1][1] + + vector.z() * m[2][1], + vector.x() * m[0][2] + + vector.y() * m[1][2] + + vector.z() * m[2][2]); + } +} + +#endif + +#ifndef QT_NO_VECTOR4D + +inline QVector4D QMatrix4x4::map(const QVector4D& point) const +{ + return *this * point; +} + +#endif + +inline qreal *QMatrix4x4::data() +{ + // We have to assume that the caller will modify the matrix elements, + // so we flip it over to "General" mode. + flagBits = General; + return m[0]; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m); +#endif + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix4x4 &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix4x4 &); +#endif + +template <int N, int M> +QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal>& matrix) +{ + return QMatrix4x4(matrix.constData(), N, M); +} + +template <int N, int M> +QGenericMatrix<N, M, qreal> qGenericMatrixFromMatrix4x4(const QMatrix4x4& matrix) +{ + QGenericMatrix<N, M, qreal> result; + const qreal *m = matrix.constData(); + qreal *values = result.data(); + for (int col = 0; col < N; ++col) { + for (int row = 0; row < M; ++row) { + if (col < 4 && row < 4) + values[col * M + row] = m[col * 4 + row]; + else if (col == row) + values[col * M + row] = 1.0f; + else + values[col * M + row] = 0.0f; + } + } + return result; +} + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qmdiarea.h b/qtinterface/qt4/Qt/qmdiarea.h new file mode 100644 index 0000000..894fa55 --- /dev/null +++ b/qtinterface/qt4/Qt/qmdiarea.h @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMDIAREA_H +#define QMDIAREA_H + +#include <QtGui/qabstractscrollarea.h> +#include <QtGui/qtabwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MDIAREA + +class QMdiSubWindow; + +class QMdiAreaPrivate; +class Q_GUI_EXPORT QMdiArea : public QAbstractScrollArea +{ + Q_OBJECT + Q_ENUMS(ViewMode) + Q_PROPERTY(QBrush background READ background WRITE setBackground) + Q_PROPERTY(WindowOrder activationOrder READ activationOrder WRITE setActivationOrder) + Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) +#ifndef QT_NO_TABBAR + Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode) +#endif +#ifndef QT_NO_TABWIDGET + Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape) + Q_PROPERTY(QTabWidget::TabPosition tabPosition READ tabPosition WRITE setTabPosition) +#endif + Q_ENUMS(WindowOrder) +public: + enum AreaOption { + DontMaximizeSubWindowOnActivation = 0x1 + }; + Q_DECLARE_FLAGS(AreaOptions, AreaOption) + + enum WindowOrder { + CreationOrder, + StackingOrder, + ActivationHistoryOrder + }; + + enum ViewMode { + SubWindowView, + TabbedView + }; + + QMdiArea(QWidget *parent = 0); + ~QMdiArea(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + QMdiSubWindow *currentSubWindow() const; + QMdiSubWindow *activeSubWindow() const; + QList<QMdiSubWindow *> subWindowList(WindowOrder order = CreationOrder) const; + + QMdiSubWindow *addSubWindow(QWidget *widget, Qt::WindowFlags flags = 0); + void removeSubWindow(QWidget *widget); + + QBrush background() const; + void setBackground(const QBrush &background); + + WindowOrder activationOrder() const; + void setActivationOrder(WindowOrder order); + + void setOption(AreaOption option, bool on = true); + bool testOption(AreaOption opton) const; + + void setViewMode(ViewMode mode); + ViewMode viewMode() const; + +#ifndef QT_NO_TABBAR + bool documentMode() const; + void setDocumentMode(bool enabled); +#endif +#ifndef QT_NO_TABWIDGET + void setTabShape(QTabWidget::TabShape shape); + QTabWidget::TabShape tabShape() const; + + void setTabPosition(QTabWidget::TabPosition position); + QTabWidget::TabPosition tabPosition() const; +#endif + +Q_SIGNALS: + void subWindowActivated(QMdiSubWindow *); + +public Q_SLOTS: + void setActiveSubWindow(QMdiSubWindow *window); + void tileSubWindows(); + void cascadeSubWindows(); + void closeActiveSubWindow(); + void closeAllSubWindows(); + void activateNextSubWindow(); + void activatePreviousSubWindow(); + +protected Q_SLOTS: + void setupViewport(QWidget *viewport); + +protected: + bool event(QEvent *event); + bool eventFilter(QObject *object, QEvent *event); + void paintEvent(QPaintEvent *paintEvent); + void childEvent(QChildEvent *childEvent); + void resizeEvent(QResizeEvent *resizeEvent); + void timerEvent(QTimerEvent *timerEvent); + void showEvent(QShowEvent *showEvent); + bool viewportEvent(QEvent *event); + void scrollContentsBy(int dx, int dy); + +private: + Q_DISABLE_COPY(QMdiArea) + Q_DECLARE_PRIVATE(QMdiArea) + Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows()) + Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates)) + Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int index)) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiArea::AreaOptions) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_MDIAREA +#endif // QMDIAREA_H diff --git a/qtinterface/qt4/Qt/qmdisubwindow.h b/qtinterface/qt4/Qt/qmdisubwindow.h new file mode 100644 index 0000000..ea95692 --- /dev/null +++ b/qtinterface/qt4/Qt/qmdisubwindow.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMDISUBWINDOW_H +#define QMDISUBWINDOW_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MDIAREA + +class QMenu; +class QMdiArea; + +namespace QMdi { class ControlContainer; } +class QMdiSubWindowPrivate; +class Q_GUI_EXPORT QMdiSubWindow : public QWidget +{ + Q_OBJECT + Q_PROPERTY(int keyboardSingleStep READ keyboardSingleStep WRITE setKeyboardSingleStep) + Q_PROPERTY(int keyboardPageStep READ keyboardPageStep WRITE setKeyboardPageStep) +public: + enum SubWindowOption { + AllowOutsideAreaHorizontally = 0x1, // internal + AllowOutsideAreaVertically = 0x2, // internal + RubberBandResize = 0x4, + RubberBandMove = 0x8 + }; + Q_DECLARE_FLAGS(SubWindowOptions, SubWindowOption) + + QMdiSubWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QMdiSubWindow(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setWidget(QWidget *widget); + QWidget *widget() const; + + QWidget *maximizedButtonsWidget() const; // internal + QWidget *maximizedSystemMenuIconWidget() const; // internal + + bool isShaded() const; + + void setOption(SubWindowOption option, bool on = true); + bool testOption(SubWindowOption) const; + + void setKeyboardSingleStep(int step); + int keyboardSingleStep() const; + + void setKeyboardPageStep(int step); + int keyboardPageStep() const; + +#ifndef QT_NO_MENU + void setSystemMenu(QMenu *systemMenu); + QMenu *systemMenu() const; +#endif + + QMdiArea *mdiArea() const; + +Q_SIGNALS: + void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState); + void aboutToActivate(); + +public Q_SLOTS: +#ifndef QT_NO_MENU + void showSystemMenu(); +#endif + void showShaded(); + +protected: + bool eventFilter(QObject *object, QEvent *event); + bool event(QEvent *event); + void showEvent(QShowEvent *showEvent); + void hideEvent(QHideEvent *hideEvent); + void changeEvent(QEvent *changeEvent); + void closeEvent(QCloseEvent *closeEvent); + void leaveEvent(QEvent *leaveEvent); + void resizeEvent(QResizeEvent *resizeEvent); + void timerEvent(QTimerEvent *timerEvent); + void moveEvent(QMoveEvent *moveEvent); + void paintEvent(QPaintEvent *paintEvent); + void mousePressEvent(QMouseEvent *mouseEvent); + void mouseDoubleClickEvent(QMouseEvent *mouseEvent); + void mouseReleaseEvent(QMouseEvent *mouseEvent); + void mouseMoveEvent(QMouseEvent *mouseEvent); + void keyPressEvent(QKeyEvent *keyEvent); +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *contextMenuEvent); +#endif + void focusInEvent(QFocusEvent *focusInEvent); + void focusOutEvent(QFocusEvent *focusOutEvent); + void childEvent(QChildEvent *childEvent); + +private: + Q_DISABLE_COPY(QMdiSubWindow) + Q_DECLARE_PRIVATE(QMdiSubWindow) + Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint()) + Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode()) + Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *)) + friend class QMdiAreaPrivate; +#ifndef QT_NO_TABBAR + friend class QMdiAreaTabBar; +#endif + friend class QMdi::ControlContainer; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_MDIAREA + +#endif // QMDISUBWINDOW_H diff --git a/qtinterface/qt4/Qt/qmenu.h b/qtinterface/qt4/Qt/qmenu.h new file mode 100644 index 0000000..237efa1 --- /dev/null +++ b/qtinterface/qt4/Qt/qmenu.h @@ -0,0 +1,427 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMENU_H +#define QMENU_H + +#include <QtGui/qwidget.h> +#include <QtCore/qstring.h> +#include <QtGui/qicon.h> +#include <QtGui/qaction.h> + +#ifdef QT3_SUPPORT +#include <QtGui/qpixmap.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MENU + +class QMenuPrivate; +class QStyleOptionMenuItem; +#ifdef QT3_SUPPORT +class QMenuItem; +#endif + +class Q_GUI_EXPORT QMenu : public QWidget +{ +private: + Q_OBJECT + Q_DECLARE_PRIVATE(QMenu) + + Q_PROPERTY(bool tearOffEnabled READ isTearOffEnabled WRITE setTearOffEnabled) + Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon) + Q_PROPERTY(bool separatorsCollapsible READ separatorsCollapsible WRITE setSeparatorsCollapsible) + +public: + explicit QMenu(QWidget *parent = 0); + explicit QMenu(const QString &title, QWidget *parent = 0); + ~QMenu(); + +#ifdef Q_NO_USING_KEYWORD + inline void addAction(QAction *action) { QWidget::addAction(action); } +#else + using QWidget::addAction; +#endif + QAction *addAction(const QString &text); + QAction *addAction(const QIcon &icon, const QString &text); + QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); + QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); + + QAction *addMenu(QMenu *menu); + QMenu *addMenu(const QString &title); + QMenu *addMenu(const QIcon &icon, const QString &title); + + QAction *addSeparator(); + + QAction *insertMenu(QAction *before, QMenu *menu); + QAction *insertSeparator(QAction *before); + + bool isEmpty() const; + void clear(); + + void setTearOffEnabled(bool); + bool isTearOffEnabled() const; + + bool isTearOffMenuVisible() const; + void hideTearOffMenu(); + + void setDefaultAction(QAction *); + QAction *defaultAction() const; + + void setActiveAction(QAction *act); + QAction *activeAction() const; + + void popup(const QPoint &pos, QAction *at=0); + QAction *exec(); + QAction *exec(const QPoint &pos, QAction *at=0); + + // ### Qt 5: merge + static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at=0); + static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at, QWidget *parent); + + QSize sizeHint() const; + + QRect actionGeometry(QAction *) const; + QAction *actionAt(const QPoint &) const; + + QAction *menuAction() const; + + QString title() const; + void setTitle(const QString &title); + + QIcon icon() const; + void setIcon(const QIcon &icon); + + void setNoReplayFor(QWidget *widget); +#ifdef Q_WS_MAC + OSMenuRef macMenu(OSMenuRef merge=0); +#endif + +#ifdef Q_WS_WINCE + HMENU wceMenu(bool create = false); +#endif + + bool separatorsCollapsible() const; + void setSeparatorsCollapsible(bool collapse); + +Q_SIGNALS: + void aboutToShow(); + void aboutToHide(); + void triggered(QAction *action); + void hovered(QAction *action); + +protected: + int columnCount() const; + + void changeEvent(QEvent *); + void keyPressEvent(QKeyEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void wheelEvent(QWheelEvent *); + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + void hideEvent(QHideEvent *); + void paintEvent(QPaintEvent *); + void actionEvent(QActionEvent *); + void timerEvent(QTimerEvent *); + bool event(QEvent *); + bool focusNextPrevChild(bool next); + void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + +#ifdef Q_WS_WINCE + QAction* wceCommands(uint command); +#endif + +private Q_SLOTS: + void internalSetSloppyAction(); + void internalDelayedPopup(); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) + Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) + Q_PRIVATE_SLOT(d_func(), void _q_overrideMenuActionDestroyed()) + +#ifdef QT3_SUPPORT +public: + //menudata + inline QT3_SUPPORT uint count() const { return actions().count(); } + inline QT3_SUPPORT int insertItem(const QString &text, const QObject *receiver, const char* member, + const QKeySequence& shortcut = 0, int id = -1, int index = -1) { + return insertAny(0, &text, receiver, member, &shortcut, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, + const QObject *receiver, const char* member, + const QKeySequence& shortcut = 0, int id = -1, int index = -1) { + return insertAny(&icon, &text, receiver, member, &shortcut, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, + const QKeySequence& shortcut = 0, int id = -1, int index = -1) { + QIcon icon(pixmap); + return insertAny(&icon, 0, receiver, member, &shortcut, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QString &text, int id=-1, int index=-1) { + return insertAny(0, &text, 0, 0, 0, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, int id=-1, int index=-1) { + return insertAny(&icon, &text, 0, 0, 0, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QString &text, QMenu *popup, int id=-1, int index=-1) { + return insertAny(0, &text, 0, 0, 0, popup, id, index); + } + inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id=-1, int index=-1) { + return insertAny(&icon, &text, 0, 0, 0, popup, id, index); + } + inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, int id=-1, int index=-1) { + QIcon icon(pixmap); + return insertAny(&icon, 0, 0, 0, 0, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, QMenu *popup, int id=-1, int index=-1) { + QIcon icon(pixmap); + return insertAny(&icon, 0, 0, 0, 0, popup, id, index); + } + QT3_SUPPORT int insertItem(QMenuItem *item, int id=-1, int index=-1); + QT3_SUPPORT int insertSeparator(int index=-1); + inline QT3_SUPPORT void removeItem(int id) { + if(QAction *act = findActionForId(id)) + removeAction(act); } + inline QT3_SUPPORT void removeItemAt(int index) { + if(QAction *act = actions().value(index)) + removeAction(act); } +#ifndef QT_NO_SHORTCUT + inline QT3_SUPPORT QKeySequence accel(int id) const { + if(QAction *act = findActionForId(id)) + return act->shortcut(); + return QKeySequence(); } + inline QT3_SUPPORT void setAccel(const QKeySequence& key, int id) { + if(QAction *act = findActionForId(id)) + act->setShortcut(key); + } +#endif + inline QT3_SUPPORT QIcon iconSet(int id) const { + if(QAction *act = findActionForId(id)) + return act->icon(); + return QIcon(); } + inline QT3_SUPPORT QString text(int id) const { + if(QAction *act = findActionForId(id)) + return act->text(); + return QString(); } + inline QT3_SUPPORT QPixmap pixmap(int id) const { + if(QAction *act = findActionForId(id)) + return act->icon().pixmap(QSize(22, 22)); + return QPixmap(); } + inline QT3_SUPPORT void setWhatsThis(int id, const QString &w) { + if(QAction *act = findActionForId(id)) + act->setWhatsThis(w); } + inline QT3_SUPPORT QString whatsThis(int id) const { + if(QAction *act = findActionForId(id)) + return act->whatsThis(); + return QString(); } + + inline QT3_SUPPORT void changeItem(int id, const QString &text) { + if(QAction *act = findActionForId(id)) + act->setText(text); } + inline QT3_SUPPORT void changeItem(int id, const QPixmap &pixmap) { + if(QAction *act = findActionForId(id)) + act->setIcon(QIcon(pixmap)); } + inline QT3_SUPPORT void changeItem(int id, const QIcon &icon, const QString &text) { + if(QAction *act = findActionForId(id)) { + act->setIcon(icon); + act->setText(text); + } + } + inline QT3_SUPPORT void setActiveItem(int id) { + setActiveAction(findActionForId(id)); + } + inline QT3_SUPPORT bool isItemActive(int id) const { + return findActionForId(id) == activeAction(); + } + inline QT3_SUPPORT bool isItemEnabled(int id) const { + if(QAction *act = findActionForId(id)) + return act->isEnabled(); + return false; } + inline QT3_SUPPORT void setItemEnabled(int id, bool enable) { + if(QAction *act = findActionForId(id)) + act->setEnabled(enable); + } + inline QT3_SUPPORT bool isItemChecked(int id) const { + if(QAction *act = findActionForId(id)) + return act->isChecked(); + return false; + } + inline QT3_SUPPORT void setItemChecked(int id, bool check) { + if(QAction *act = findActionForId(id)) { + act->setCheckable(true); + act->setChecked(check); + } + } + inline QT3_SUPPORT bool isItemVisible(int id) const { + if(QAction *act = findActionForId(id)) + return act->isVisible(); + return false; + } + inline QT3_SUPPORT void setItemVisible(int id, bool visible) { + if(QAction *act = findActionForId(id)) + act->setVisible(visible); + } + inline QT3_SUPPORT QRect itemGeometry(int index) { + if(QAction *act = actions().value(index)) + return actionGeometry(act); + return QRect(); + } + inline QT3_SUPPORT QFont itemFont(int id) const { + if(QAction *act = findActionForId(id)) + return act->font(); + return QFont(); + } + inline QT3_SUPPORT void setItemFont(int id, const QFont &font) { + if(QAction *act = findActionForId(id)) + act->setFont(font); + } + inline QT3_SUPPORT int indexOf(int id) const { + return actions().indexOf(findActionForId(id)); + } + inline QT3_SUPPORT int idAt(int index) const { + return findIdForAction(actions().value(index)); + } + QT3_SUPPORT void setId (int index, int id); + inline QT3_SUPPORT void activateItemAt(int index) { + if(QAction *ret = actions().value(index)) + ret->activate(QAction::Trigger); + } + inline QT3_SUPPORT bool connectItem(int id, const QObject *receiver, const char* member) { + if(QAction *act = findActionForId(id)) { + QObject::connect(act, SIGNAL(activated(int)), receiver, member); + return true; + } + return false; + } + inline QT3_SUPPORT bool disconnectItem(int id,const QObject *receiver, const char* member) { + if(QAction *act = findActionForId(id)) { + QObject::disconnect(act, SIGNAL(triggered()), receiver, member); + return true; + } + return false; + } + inline QT3_SUPPORT QMenuItem *findItem(int id) const { + return reinterpret_cast<QMenuItem*>(findActionForId(id)); + } + + inline QT3_SUPPORT void setCheckable(bool){} + inline QT3_SUPPORT bool isCheckable() const {return true;} + + QT3_SUPPORT QMenuItem *findPopup( QMenu *popup, int *index ); + + QT3_SUPPORT bool setItemParameter(int id, int param); + QT3_SUPPORT int itemParameter(int id) const; + + //frame + QT3_SUPPORT int frameWidth() const; + + //popupmenu + inline QT3_SUPPORT void popup(const QPoint & pos, int indexAtPoint) { popup(pos, actions().value(indexAtPoint)); } + inline QT3_SUPPORT int insertTearOffHandle(int = 0, int = 0) { + setTearOffEnabled(true); + return -1; + } + +protected: + inline QT3_SUPPORT int itemAtPos(const QPoint &p, bool ignoreSeparator = true) { + QAction *ret = actionAt(p); + if(ignoreSeparator && ret && ret->isSeparator()) + return -1; + return findIdForAction(ret); + } + inline QT3_SUPPORT int columns() const { return columnCount(); } + inline QT3_SUPPORT int itemHeight(int index) { + return actionGeometry(actions().value(index)).height(); + } + inline QT3_SUPPORT int itemHeight(QMenuItem *mi) { + return actionGeometry(reinterpret_cast<QAction *>(mi)).height(); + } + +Q_SIGNALS: + QT_MOC_COMPAT void activated(int itemId); + QT_MOC_COMPAT void highlighted(int itemId); + +private: + int insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, + const QKeySequence *shorcut, const QMenu *popup, int id, int index); + QAction *findActionForId(int id) const; + int findIdForAction(QAction*) const; +#endif + +protected: + QMenu(QMenuPrivate &dd, QWidget* parent = 0); + +private: + Q_DISABLE_COPY(QMenu) + + friend class QMenuBar; + friend class QMenuBarPrivate; + friend class QTornOffMenu; + friend class Q3PopupMenu; + friend class QComboBox; + friend class QAction; + friend class QToolButtonPrivate; + +#ifdef Q_WS_MAC + friend void qt_mac_trayicon_activate_action(QMenu *, QAction *action); + friend bool qt_mac_watchingAboutToShow(QMenu *); + friend OSStatus qt_mac_menu_event(EventHandlerCallRef, EventRef, void *); + friend bool qt_mac_activate_action(OSMenuRef, uint, QAction::ActionEvent, bool); + friend void qt_mac_emit_menuSignals(QMenu *, bool); +#endif +}; + +#endif // QT_NO_MENU + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMENU_H diff --git a/qtinterface/qt4/Qt/qmenubar.h b/qtinterface/qt4/Qt/qmenubar.h new file mode 100644 index 0000000..1e15a6c --- /dev/null +++ b/qtinterface/qt4/Qt/qmenubar.h @@ -0,0 +1,367 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMENUBAR_H +#define QMENUBAR_H + +#include <QtGui/qmenu.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MENUBAR + +class QMenuBarPrivate; +class QStyleOptionMenuItem; +class QWindowsStyle; +#ifdef QT3_SUPPORT +class QMenuItem; +#endif + +class Q_GUI_EXPORT QMenuBar : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(bool defaultUp READ isDefaultUp WRITE setDefaultUp) + Q_PROPERTY(bool nativeMenuBar READ isNativeMenuBar WRITE setNativeMenuBar) + +public: + explicit QMenuBar(QWidget *parent = 0); + ~QMenuBar(); + +#ifdef Q_NO_USING_KEYWORD + void addAction(QAction *action) { QWidget::addAction(action); } +#else + using QWidget::addAction; +#endif + QAction *addAction(const QString &text); + QAction *addAction(const QString &text, const QObject *receiver, const char* member); + + QAction *addMenu(QMenu *menu); + QMenu *addMenu(const QString &title); + QMenu *addMenu(const QIcon &icon, const QString &title); + + + QAction *addSeparator(); + QAction *insertSeparator(QAction *before); + + QAction *insertMenu(QAction *before, QMenu *menu); + + void clear(); + + QAction *activeAction() const; + void setActiveAction(QAction *action); + + void setDefaultUp(bool); + bool isDefaultUp() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + int heightForWidth(int) const; + + QRect actionGeometry(QAction *) const; + QAction *actionAt(const QPoint &) const; + + void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner); + QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; + +#ifdef Q_WS_MAC + OSMenuRef macMenu(); + static bool macUpdateMenuBar(); +#endif + +#ifdef Q_WS_WINCE + void setDefaultAction(QAction *); + QAction *defaultAction() const; + + static void wceCommands(uint command, HWND controlHandle); + static void wceRefresh(); +#endif + + bool isNativeMenuBar() const; + void setNativeMenuBar(bool nativeMenuBar); + +public Q_SLOTS: + virtual void setVisible(bool visible); + +Q_SIGNALS: + void triggered(QAction *action); + void hovered(QAction *action); + +protected: + void changeEvent(QEvent *); + void keyPressEvent(QKeyEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void leaveEvent(QEvent *); + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + void actionEvent(QActionEvent *); + void focusOutEvent(QFocusEvent *); + void focusInEvent(QFocusEvent *); + void timerEvent(QTimerEvent *); + bool eventFilter(QObject *, QEvent *); + bool event(QEvent *); + void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QMenuBar(QWidget *parent, const char *name); + inline QT3_SUPPORT uint count() const { return actions().count(); } + inline QT3_SUPPORT int insertItem(const QString &text, const QObject *receiver, const char* member, + const QKeySequence& shortcut = 0, int id = -1, int index = -1) { + return insertAny(0, &text, receiver, member, &shortcut, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, + const QObject *receiver, const char* member, + const QKeySequence& shortcut = 0, int id = -1, int index = -1) { + return insertAny(&icon, &text, receiver, member, &shortcut, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, + const QKeySequence& shortcut = 0, int id = -1, int index = -1) { + QIcon icon(pixmap); + return insertAny(&icon, 0, receiver, member, &shortcut, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QString &text, int id=-1, int index=-1) { + return insertAny(0, &text, 0, 0, 0, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, int id=-1, int index=-1) { + return insertAny(&icon, &text, 0, 0, 0, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QString &text, QMenu *popup, int id=-1, int index=-1) { + return insertAny(0, &text, 0, 0, 0, popup, id, index); + } + inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id=-1, int index=-1) { + return insertAny(&icon, &text, 0, 0, 0, popup, id, index); + } + inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, int id=-1, int index=-1) { + QIcon icon(pixmap); + return insertAny(&icon, 0, 0, 0, 0, 0, id, index); + } + inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, QMenu *popup, int id=-1, int index=-1) { + QIcon icon(pixmap); + return insertAny(&icon, 0, 0, 0, 0, popup, id, index); + } + QT3_SUPPORT int insertSeparator(int index=-1); + inline QT3_SUPPORT void removeItem(int id) { + if(QAction *act = findActionForId(id)) + removeAction(act); } + inline QT3_SUPPORT void removeItemAt(int index) { + if(QAction *act = actions().value(index)) + removeAction(act); } +#ifndef QT_NO_SHORTCUT + inline QT3_SUPPORT QKeySequence accel(int id) const { + if(QAction *act = findActionForId(id)) + return act->shortcut(); + return QKeySequence(); } + inline QT3_SUPPORT void setAccel(const QKeySequence& key, int id) { + if(QAction *act = findActionForId(id)) + act->setShortcut(key); + } +#endif + inline QT3_SUPPORT QIcon iconSet(int id) const { + if(QAction *act = findActionForId(id)) + return act->icon(); + return QIcon(); } + inline QT3_SUPPORT QString text(int id) const { + if(QAction *act = findActionForId(id)) + return act->text(); + return QString(); } + inline QT3_SUPPORT QPixmap pixmap(int id) const { + if(QAction *act = findActionForId(id)) + return act->icon().pixmap(QSize(22,22)); + return QPixmap(); } + inline QT3_SUPPORT void setWhatsThis(int id, const QString &w) { + if(QAction *act = findActionForId(id)) + act->setWhatsThis(w); } + inline QT3_SUPPORT QString whatsThis(int id) const { + if(QAction *act = findActionForId(id)) + return act->whatsThis(); + return QString(); } + + inline QT3_SUPPORT void changeItem(int id, const QString &text) { + if(QAction *act = findActionForId(id)) + act->setText(text); } + inline QT3_SUPPORT void changeItem(int id, const QPixmap &pixmap) { + if(QAction *act = findActionForId(id)) + act->setIcon(QIcon(pixmap)); } + inline QT3_SUPPORT void changeItem(int id, const QIcon &icon, const QString &text) { + if(QAction *act = findActionForId(id)) { + act->setIcon(icon); + act->setText(text); + } + } + inline QT3_SUPPORT bool isItemActive(int id) const { return findActionForId(id) == activeAction(); } + inline QT3_SUPPORT bool isItemEnabled(int id) const { + if(QAction *act = findActionForId(id)) + return act->isEnabled(); + return false; } + inline QT3_SUPPORT void setItemEnabled(int id, bool enable) { + if(QAction *act = findActionForId(id)) + act->setEnabled(enable); } + inline QT3_SUPPORT bool isItemChecked(int id) const { + if(QAction *act = findActionForId(id)) + return act->isChecked(); + return false; } + inline QT3_SUPPORT void setItemChecked(int id, bool check) { + if(QAction *act = findActionForId(id)) + act->setChecked(check); } + inline QT3_SUPPORT bool isItemVisible(int id) const { + if(QAction *act = findActionForId(id)) + return act->isVisible(); + return false; } + inline QT3_SUPPORT void setItemVisible(int id, bool visible) { + if(QAction *act = findActionForId(id)) + act->setVisible(visible); } + inline QT3_SUPPORT int indexOf(int id) const { return actions().indexOf(findActionForId(id)); } + inline QT3_SUPPORT int idAt(int index) const { + return index >= 0 && index < actions().size() + ? findIdForAction(actions().at(index)) + : -1; + } + inline QT3_SUPPORT void activateItemAt(int index) { + if(QAction *ret = actions().value(index)) + setActiveAction(ret); + } + inline QT3_SUPPORT bool connectItem(int id, const QObject *receiver, const char* member) { + if(QAction *act = findActionForId(id)) { + QObject::connect(act, SIGNAL(triggered()), receiver, member); + return true; + } + return false; + } + inline QT3_SUPPORT bool disconnectItem(int id,const QObject *receiver, const char* member) { + if(QAction *act = findActionForId(id)) { + QObject::disconnect(act, SIGNAL(triggered()), receiver, member); + return true; + } + return false; + } + inline QT3_SUPPORT QMenuItem *findItem(int id) const { + return (QMenuItem*)findActionForId(id); + } + QT3_SUPPORT bool setItemParameter(int id, int param); + QT3_SUPPORT int itemParameter(int id) const; + + //frame + QT3_SUPPORT int frameWidth() const; + + QT3_SUPPORT void setFrameRect(QRect) {} + QT3_SUPPORT QRect frameRect() const { return QRect(); } + enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel, + HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel, + PopupPanel, LineEditPanel, TabWidgetPanel, MShape }; + QT3_SUPPORT void setFrameShadow(DummyFrame) {} + QT3_SUPPORT DummyFrame frameShadow() const { return Plain; } + QT3_SUPPORT void setFrameShape(DummyFrame) {} + QT3_SUPPORT DummyFrame frameShape() const { return NoFrame; } + QT3_SUPPORT void setFrameStyle(int) {} + QT3_SUPPORT int frameStyle() const { return 0; } + QT3_SUPPORT void setLineWidth(int) {} + QT3_SUPPORT int lineWidth() const { return 0; } + QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + QT3_SUPPORT int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } + QT3_SUPPORT void setMidLineWidth(int) {} + QT3_SUPPORT int midLineWidth() const { return 0; } + + //menubar + enum Separator { Never=0, InWindowsStyle=1 }; + inline QT3_SUPPORT Separator separator() const { return InWindowsStyle; } + inline QT3_SUPPORT void setSeparator(Separator) { } + + QT3_SUPPORT void setAutoGeometry(bool); + QT3_SUPPORT bool autoGeometry() const; + +Q_SIGNALS: + QT_MOC_COMPAT void activated(int itemId); + QT_MOC_COMPAT void highlighted(int itemId); + +protected: + inline QT3_SUPPORT QRect itemRect(int index) { + if(QAction *act = actions().value(index)) + return actionGeometry(act); + return QRect(); + } + inline QT3_SUPPORT int itemAtPos(const QPoint &p) { + return findIdForAction(actionAt(p)); + } +private: + QAction *findActionForId(int id) const; + int insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, + const QKeySequence *shorcut, const QMenu *popup, int id, int index); + int findIdForAction(QAction*) const; +#endif + +private: + Q_DECLARE_PRIVATE(QMenuBar) + Q_DISABLE_COPY(QMenuBar) + Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) + Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) + Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateLayout()) + +#ifdef Q_WS_WINCE + Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction()) +#endif + + friend class QMenu; + friend class QMenuPrivate; + friend class QWindowsStyle; + +#ifdef Q_WS_MAC + friend class QApplicationPrivate; + friend class QWidgetPrivate; + friend bool qt_mac_activate_action(MenuRef, uint, QAction::ActionEvent, bool); +#endif +}; + +#endif // QT_NO_MENUBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMENUBAR_H diff --git a/qtinterface/qt4/Qt/qmenudata.h b/qtinterface/qt4/Qt/qmenudata.h new file mode 100644 index 0000000..6ca3db7 --- /dev/null +++ b/qtinterface/qt4/Qt/qmenudata.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMENUDATA_H +#define QMENUDATA_H + +#include <QtCore/qglobal.h> + +#ifdef QT3_SUPPORT +#include <QtGui/qaction.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QMenuItem : public QAction +{ + Q_OBJECT + +public: + QMenuItem(); + + QT3_SUPPORT int id() const; + QT3_SUPPORT int signalValue() const; +private: + friend class QMenu; + friend class QMenuBar; + void setId(int); + void setSignalValue(int); + + Q_DISABLE_COPY(QMenuItem) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + +#endif // QMENUDATA_H diff --git a/qtinterface/qt4/Qt/qmessagebox.h b/qtinterface/qt4/Qt/qmessagebox.h new file mode 100644 index 0000000..d3617b7 --- /dev/null +++ b/qtinterface/qt4/Qt/qmessagebox.h @@ -0,0 +1,365 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMESSAGEBOX_H +#define QMESSAGEBOX_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MESSAGEBOX + +class QLabel; +class QMessageBoxPrivate; +class QAbstractButton; + +class Q_GUI_EXPORT QMessageBox : public QDialog +{ + Q_OBJECT + Q_ENUMS(Icon) + Q_FLAGS(StandardButtons) + Q_PROPERTY(QString text READ text WRITE setText) + // ### Qt 5: Rename 'icon' 'standardIcon' and 'iconPixmap' 'icon' (and use QIcon?) + Q_PROPERTY(Icon icon READ icon WRITE setIcon) + Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap) + Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat) + Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons) +#ifndef QT_NO_TEXTEDIT + Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText) +#endif + Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText) + +public: + enum Icon { + NoIcon = 0, + Information = 1, + Warning = 2, + Critical = 3, + Question = 4 + }; + + enum ButtonRole { + // keep this in sync with QDialogButtonBox::ButtonRole + InvalidRole = -1, + AcceptRole, + RejectRole, + DestructiveRole, + ActionRole, + HelpRole, + YesRole, + NoRole, + ResetRole, + ApplyRole, + + NRoles + }; + + enum StandardButton { + // keep this in sync with QDialogButtonBox::StandardButton + NoButton = 0x00000000, + Ok = 0x00000400, + Save = 0x00000800, + SaveAll = 0x00001000, + Open = 0x00002000, + Yes = 0x00004000, + YesToAll = 0x00008000, + No = 0x00010000, + NoToAll = 0x00020000, + Abort = 0x00040000, + Retry = 0x00080000, + Ignore = 0x00100000, + Close = 0x00200000, + Cancel = 0x00400000, + Discard = 0x00800000, + Help = 0x01000000, + Apply = 0x02000000, + Reset = 0x04000000, + RestoreDefaults = 0x08000000, + + FirstButton = Ok, // internal + LastButton = RestoreDefaults, // internal + + YesAll = YesToAll, // obsolete + NoAll = NoToAll, // obsolete + + Default = 0x00000100, // obsolete + Escape = 0x00000200, // obsolete + FlagMask = 0x00000300, // obsolete + ButtonMask = ~FlagMask // obsolete + }; + typedef StandardButton Button; // obsolete + + Q_DECLARE_FLAGS(StandardButtons, StandardButton) + + explicit QMessageBox(QWidget *parent = 0); + QMessageBox(Icon icon, const QString &title, const QString &text, + StandardButtons buttons = NoButton, QWidget *parent = 0, + Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); + ~QMessageBox(); + + void addButton(QAbstractButton *button, ButtonRole role); + QPushButton *addButton(const QString &text, ButtonRole role); + QPushButton *addButton(StandardButton button); + void removeButton(QAbstractButton *button); + +#ifdef Q_WS_WINCE + void setVisible(bool visible); +#endif + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + + QList<QAbstractButton *> buttons() const; + ButtonRole buttonRole(QAbstractButton *button) const; + + void setStandardButtons(StandardButtons buttons); + StandardButtons standardButtons() const; + StandardButton standardButton(QAbstractButton *button) const; + QAbstractButton *button(StandardButton which) const; + + QPushButton *defaultButton() const; + void setDefaultButton(QPushButton *button); + void setDefaultButton(StandardButton button); + + QAbstractButton *escapeButton() const; + void setEscapeButton(QAbstractButton *button); + void setEscapeButton(StandardButton button); + + QAbstractButton *clickedButton() const; + + QString text() const; + void setText(const QString &text); + + Icon icon() const; + void setIcon(Icon); + + QPixmap iconPixmap() const; + void setIconPixmap(const QPixmap &pixmap); + + Qt::TextFormat textFormat() const; + void setTextFormat(Qt::TextFormat format); + + static StandardButton information(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = Ok, + StandardButton defaultButton = NoButton); + // ### Qt 5: Replace Ok with Yes|No in question() function. + // Also consider if Ok == Yes and Cancel == No. + static StandardButton question(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = Ok, + StandardButton defaultButton = NoButton); + static StandardButton warning(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = Ok, + StandardButton defaultButton = NoButton); + static StandardButton critical(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = Ok, + StandardButton defaultButton = NoButton); + static void about(QWidget *parent, const QString &title, const QString &text); + static void aboutQt(QWidget *parent, const QString &title = QString()); + + QSize sizeHint() const; + + // the following functions are obsolete: + + QMessageBox(const QString &title, const QString &text, Icon icon, + int button0, int button1, int button2, + QWidget *parent = 0, + Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); + + static int information(QWidget *parent, const QString &title, + const QString& text, + int button0, int button1 = 0, int button2 = 0); + static int information(QWidget *parent, const QString &title, + const QString& text, + const QString& button0Text, + const QString& button1Text = QString(), + const QString& button2Text = QString(), + int defaultButtonNumber = 0, + int escapeButtonNumber = -1); + inline static StandardButton information(QWidget *parent, const QString &title, + const QString& text, + StandardButton button0, StandardButton button1 = NoButton) + { return information(parent, title, text, StandardButtons(button0), button1); } + + static int question(QWidget *parent, const QString &title, + const QString& text, + int button0, int button1 = 0, int button2 = 0); + static int question(QWidget *parent, const QString &title, + const QString& text, + const QString& button0Text, + const QString& button1Text = QString(), + const QString& button2Text = QString(), + int defaultButtonNumber = 0, + int escapeButtonNumber = -1); + inline static int question(QWidget *parent, const QString &title, + const QString& text, + StandardButton button0, StandardButton button1) + { return question(parent, title, text, StandardButtons(button0), button1); } + + static int warning(QWidget *parent, const QString &title, + const QString& text, + int button0, int button1, int button2 = 0); + static int warning(QWidget *parent, const QString &title, + const QString& text, + const QString& button0Text, + const QString& button1Text = QString(), + const QString& button2Text = QString(), + int defaultButtonNumber = 0, + int escapeButtonNumber = -1); + inline static int warning(QWidget *parent, const QString &title, + const QString& text, + StandardButton button0, StandardButton button1) + { return warning(parent, title, text, StandardButtons(button0), button1); } + + static int critical(QWidget *parent, const QString &title, + const QString& text, + int button0, int button1, int button2 = 0); + static int critical(QWidget *parent, const QString &title, + const QString& text, + const QString& button0Text, + const QString& button1Text = QString(), + const QString& button2Text = QString(), + int defaultButtonNumber = 0, + int escapeButtonNumber = -1); + inline static int critical(QWidget *parent, const QString &title, + const QString& text, + StandardButton button0, StandardButton button1) + { return critical(parent, title, text, StandardButtons(button0), button1); } + + QString buttonText(int button) const; + void setButtonText(int button, const QString &text); + + QString informativeText() const; + void setInformativeText(const QString &text); + +#ifndef QT_NO_TEXTEDIT + QString detailedText() const; + void setDetailedText(const QString &text); +#endif + + void setWindowTitle(const QString &title); + void setWindowModality(Qt::WindowModality windowModality); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QMessageBox(const QString &title, const QString &text, Icon icon, + int button0, int button1, int button2, + QWidget *parent, const char *name, bool modal, + Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); + QT3_SUPPORT_CONSTRUCTOR QMessageBox(QWidget *parent, const char *name); + + static QT3_SUPPORT QPixmap standardIcon(Icon icon, Qt::GUIStyle); + static QT3_SUPPORT int message(const QString &title, + const QString& text, + const QString& buttonText=QString(), + QWidget *parent = 0, const char * = 0) { + return QMessageBox::information(parent, title, text, + buttonText.isEmpty() ? tr("OK") : buttonText) == 0; + } + static QT3_SUPPORT bool query(const QString &title, + const QString& text, + const QString& yesButtonText = QString(), + const QString& noButtonText = QString(), + QWidget *parent = 0, const char * = 0) { + return QMessageBox::information(parent, title, text, + yesButtonText.isEmpty() ? tr("OK") : yesButtonText, + noButtonText) == 0; + } +#endif + + static QPixmap standardIcon(Icon icon); + +Q_SIGNALS: + void buttonClicked(QAbstractButton *button); + +#ifdef qdoc +public Q_SLOTS: + int exec(); +#endif + +protected: + bool event(QEvent *e); + void resizeEvent(QResizeEvent *event); + void showEvent(QShowEvent *event); + void closeEvent(QCloseEvent *event); + void keyPressEvent(QKeyEvent *event); + void changeEvent(QEvent *event); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *)) + + Q_DISABLE_COPY(QMessageBox) + Q_DECLARE_PRIVATE(QMessageBox) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QMessageBox::StandardButtons) + +#define QT_REQUIRE_VERSION(argc, argv, str) { QString s = QString::fromLatin1(str);\ +QString sq = QString::fromLatin1(qVersion()); \ +if ((sq.section(QChar::fromLatin1('.'),0,0).toInt()<<16)+\ +(sq.section(QChar::fromLatin1('.'),1,1).toInt()<<8)+\ +sq.section(QChar::fromLatin1('.'),2,2).toInt()<(s.section(QChar::fromLatin1('.'),0,0).toInt()<<16)+\ +(s.section(QChar::fromLatin1('.'),1,1).toInt()<<8)+\ +s.section(QChar::fromLatin1('.'),2,2).toInt()) { \ +if (!qApp){ \ + new QApplication(argc,argv); \ +} \ +QString s = QApplication::tr("Executable '%1' requires Qt "\ + "%2, found Qt %3.").arg(qAppName()).arg(QString::fromLatin1(\ +str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\ +"Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal(s.toLatin1().data()); }} + +#endif // QT_NO_MESSAGEBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMESSAGEBOX_H diff --git a/qtinterface/qt4/Qt/qmetaobject.h b/qtinterface/qt4/Qt/qmetaobject.h new file mode 100644 index 0000000..ff404ca --- /dev/null +++ b/qtinterface/qt4/Qt/qmetaobject.h @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMETAOBJECT_H +#define QMETAOBJECT_H + +#include <QtCore/qobjectdefs.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <typename T> class QList; + +class Q_CORE_EXPORT QMetaMethod +{ +public: + inline QMetaMethod() : mobj(0),handle(0) {} + + const char *signature() const; + const char *typeName() const; + QList<QByteArray> parameterTypes() const; + QList<QByteArray> parameterNames() const; + const char *tag() const; + enum Access { Private, Protected, Public }; + Access access() const; + enum MethodType { Method, Signal, Slot, Constructor }; + MethodType methodType() const; + enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 }; + int attributes() const; + int methodIndex() const; + + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + + bool invoke(QObject *object, + Qt::ConnectionType connectionType, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; + inline bool invoke(QObject *object, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, Qt::AutoConnection, returnValue, + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + inline bool invoke(QObject *object, + Qt::ConnectionType connectionType, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, connectionType, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + inline bool invoke(QObject *object, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, Qt::AutoConnection, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + +private: + const QMetaObject *mobj; + uint handle; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE); + +class Q_CORE_EXPORT QMetaEnum +{ +public: + inline QMetaEnum() : mobj(0),handle(0) {} + + const char *name() const; + bool isFlag() const; + + int keyCount() const; + const char *key(int index) const; + int value(int index) const; + + const char *scope() const; + + int keyToValue(const char *key) const; + const char* valueToKey(int value) const; + int keysToValue(const char * keys) const; + QByteArray valueToKeys(int value) const; + + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + + inline bool isValid() const { return name() != 0; } +private: + const QMetaObject *mobj; + uint handle; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE); + +class Q_CORE_EXPORT QMetaProperty +{ +public: + QMetaProperty(); + + const char *name() const; + const char *typeName() const; + QVariant::Type type() const; + int userType() const; + int propertyIndex() const; + + bool isReadable() const; + bool isWritable() const; + bool isResettable() const; + bool isDesignable(const QObject *obj = 0) const; + bool isScriptable(const QObject *obj = 0) const; + bool isStored(const QObject *obj = 0) const; + bool isEditable(const QObject *obj = 0) const; + bool isUser(const QObject *obj = 0) const; + bool isConstant() const; + bool isFinal() const; + + bool isFlagType() const; + bool isEnumType() const; + QMetaEnum enumerator() const; + + bool hasNotifySignal() const; + QMetaMethod notifySignal() const; + int notifySignalIndex() const; + + QVariant read(const QObject *obj) const; + bool write(QObject *obj, const QVariant &value) const; + bool reset(QObject *obj) const; + + bool hasStdCppSet() const; + inline bool isValid() const { return isReadable(); } + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + +private: + const QMetaObject *mobj; + uint handle; + int idx; + QMetaEnum menum; + friend struct QMetaObject; +}; + +class Q_CORE_EXPORT QMetaClassInfo +{ +public: + inline QMetaClassInfo() : mobj(0),handle(0) {} + const char *name() const; + const char *value() const; + inline const QMetaObject *enclosingMetaObject() const { return mobj; } +private: + const QMetaObject *mobj; + uint handle; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMETAOBJECT_H diff --git a/qtinterface/qt4/Qt/qmetatype.h b/qtinterface/qt4/Qt/qmetatype.h new file mode 100644 index 0000000..f298994 --- /dev/null +++ b/qtinterface/qt4/Qt/qmetatype.h @@ -0,0 +1,372 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMETATYPE_H +#define QMETATYPE_H + +#include <QtCore/qglobal.h> +#include <QtCore/qatomic.h> + +#ifndef QT_NO_DATASTREAM +#include <QtCore/qdatastream.h> +#endif + +#ifdef Bool +#error qmetatype.h must be included before any header file that defines Bool +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QMetaType { +public: + enum Type { + // these are merged with QVariant + Void = 0, Bool = 1, Int = 2, UInt = 3, LongLong = 4, ULongLong = 5, + Double = 6, QChar = 7, QVariantMap = 8, QVariantList = 9, + QString = 10, QStringList = 11, QByteArray = 12, + QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17, + QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22, + QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27, + QVariantHash = 28, LastCoreType = 28 /* QVariantHash */, + + FirstGuiType = 63 /* QColorGroup */, +#ifdef QT3_SUPPORT + QColorGroup = 63, +#endif + QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68, + QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73, + QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77, + QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81, + QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85, + QQuaternion = 86, + LastGuiType = 86 /* QQuaternion */, + + FirstCoreExtType = 128 /* VoidStar */, + VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, + UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, + LastCoreExtType = 137 /* QWidgetStar */, + +// This logic must match the one in qglobal.h +#if defined(QT_COORD_TYPE) + QReal = 0, +#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) + QReal = Float, +#else + QReal = Double, +#endif + + User = 256 + }; + + typedef void (*Destructor)(void *); + typedef void *(*Constructor)(const void *); + +#ifndef QT_NO_DATASTREAM + typedef void (*SaveOperator)(QDataStream &, const void *); + typedef void (*LoadOperator)(QDataStream &, void *); + static void registerStreamOperators(const char *typeName, SaveOperator saveOp, + LoadOperator loadOp); +#endif + static int registerType(const char *typeName, Destructor destructor, + Constructor constructor); + static int type(const char *typeName); + static const char *typeName(int type); + static bool isRegistered(int type); + static void *construct(int type, const void *copy = 0); + static void destroy(int type, void *data); + static void unregisterType(const char *typeName); + +#ifndef QT_NO_DATASTREAM + static bool save(QDataStream &stream, int type, const void *data); + static bool load(QDataStream &stream, int type, void *data); +#endif +}; + +template <typename T> +void qMetaTypeDeleteHelper(T *t) +{ + delete t; +} + +template <typename T> +void *qMetaTypeConstructHelper(const T *t) +{ + if (!t) + return new T; + return new T(*static_cast<const T*>(t)); +} + +#ifndef QT_NO_DATASTREAM +template <typename T> +void qMetaTypeSaveHelper(QDataStream &stream, const T *t) +{ + stream << *t; +} + +template <typename T> +void qMetaTypeLoadHelper(QDataStream &stream, T *t) +{ + stream >> *t; +} +#endif // QT_NO_DATASTREAM + +template <typename T> +int qRegisterMetaType(const char *typeName +#ifndef qdoc + , T * /* dummy */ = 0 +#endif +) +{ + typedef void*(*ConstructPtr)(const T*); + ConstructPtr cptr = qMetaTypeConstructHelper<T>; + typedef void(*DeletePtr)(T*); + DeletePtr dptr = qMetaTypeDeleteHelper<T>; + + return QMetaType::registerType(typeName, reinterpret_cast<QMetaType::Destructor>(dptr), + reinterpret_cast<QMetaType::Constructor>(cptr)); +} + +#ifndef QT_NO_DATASTREAM +template <typename T> +void qRegisterMetaTypeStreamOperators(const char *typeName +#ifndef qdoc + , T * /* dummy */ = 0 +#endif +) +{ + typedef void(*SavePtr)(QDataStream &, const T *); + typedef void(*LoadPtr)(QDataStream &, T *); + SavePtr sptr = qMetaTypeSaveHelper<T>; + LoadPtr lptr = qMetaTypeLoadHelper<T>; + + qRegisterMetaType<T>(typeName); + QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(sptr), + reinterpret_cast<QMetaType::LoadOperator>(lptr)); +} +#endif // QT_NO_DATASTREAM + +template <typename T> +struct QMetaTypeId +{ + enum { Defined = 0 }; +}; + +template <typename T> +struct QMetaTypeId2 +{ + enum { Defined = QMetaTypeId<T>::Defined }; + static inline int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); } +}; + +template <typename T> +inline int qMetaTypeId( +#ifndef qdoc + T * /* dummy */ = 0 +#endif +) +{ + return QMetaTypeId2<T>::qt_metatype_id(); +} + +template <typename T> +inline int qRegisterMetaType( +#if !defined(qdoc) && !defined(Q_CC_SUN) + T * dummy = 0 +#endif +) +{ +#ifdef Q_CC_SUN + return qMetaTypeId(static_cast<T *>(0)); +#else + return qMetaTypeId(dummy); +#endif +} + +#define Q_DECLARE_METATYPE(TYPE) \ + QT_BEGIN_NAMESPACE \ + template <> \ + struct QMetaTypeId< TYPE > \ + { \ + enum { Defined = 1 }; \ + static int qt_metatype_id() \ + { \ + static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + if (!metatype_id) \ + metatype_id = qRegisterMetaType< TYPE >(#TYPE); \ + return metatype_id; \ + } \ + }; \ + QT_END_NAMESPACE + +#define Q_DECLARE_BUILTIN_METATYPE(TYPE, NAME) \ + QT_BEGIN_NAMESPACE \ + template<> struct QMetaTypeId2<TYPE> \ + { \ + enum { Defined = 1, MetaType = QMetaType::NAME }; \ + static inline int qt_metatype_id() { return QMetaType::NAME; } \ + }; \ + QT_END_NAMESPACE + +class QString; +class QByteArray; +class QChar; +class QStringList; +class QBitArray; +class QDate; +class QTime; +class QDateTime; +class QUrl; +class QLocale; +class QRect; +class QRectF; +class QSize; +class QSizeF; +class QLine; +class QLineF; +class QPoint; +class QPointF; +#ifndef QT_NO_REGEXP +class QRegExp; +#endif +class QWidget; +class QObject; + +#ifdef QT3_SUPPORT +class QColorGroup; +#endif +class QFont; +class QPixmap; +class QBrush; +class QColor; +class QPalette; +class QIcon; +class QImage; +class QPolygon; +class QRegion; +class QBitmap; +class QCursor; +class QSizePolicy; +class QKeySequence; +class QPen; +class QTextLength; +class QTextFormat; +class QMatrix; +class QTransform; +class QMatrix4x4; +class QVector2D; +class QVector3D; +class QVector4D; +class QQuaternion; + +QT_END_NAMESPACE + +Q_DECLARE_BUILTIN_METATYPE(QString, QString) +Q_DECLARE_BUILTIN_METATYPE(int, Int) +Q_DECLARE_BUILTIN_METATYPE(uint, UInt) +Q_DECLARE_BUILTIN_METATYPE(bool, Bool) +Q_DECLARE_BUILTIN_METATYPE(double, Double) +Q_DECLARE_BUILTIN_METATYPE(QByteArray, QByteArray) +Q_DECLARE_BUILTIN_METATYPE(QChar, QChar) +Q_DECLARE_BUILTIN_METATYPE(long, Long) +Q_DECLARE_BUILTIN_METATYPE(short, Short) +Q_DECLARE_BUILTIN_METATYPE(char, Char) +Q_DECLARE_BUILTIN_METATYPE(ulong, ULong) +Q_DECLARE_BUILTIN_METATYPE(ushort, UShort) +Q_DECLARE_BUILTIN_METATYPE(uchar, UChar) +Q_DECLARE_BUILTIN_METATYPE(float, Float) +Q_DECLARE_BUILTIN_METATYPE(QObject *, QObjectStar) +Q_DECLARE_BUILTIN_METATYPE(QWidget *, QWidgetStar) +Q_DECLARE_BUILTIN_METATYPE(void *, VoidStar) +Q_DECLARE_BUILTIN_METATYPE(qlonglong, LongLong) +Q_DECLARE_BUILTIN_METATYPE(qulonglong, ULongLong) +Q_DECLARE_BUILTIN_METATYPE(QStringList, QStringList) +Q_DECLARE_BUILTIN_METATYPE(QBitArray, QBitArray) +Q_DECLARE_BUILTIN_METATYPE(QDate, QDate) +Q_DECLARE_BUILTIN_METATYPE(QTime, QTime) +Q_DECLARE_BUILTIN_METATYPE(QDateTime, QDateTime) +Q_DECLARE_BUILTIN_METATYPE(QUrl, QUrl) +Q_DECLARE_BUILTIN_METATYPE(QLocale, QLocale) +Q_DECLARE_BUILTIN_METATYPE(QRect, QRect) +Q_DECLARE_BUILTIN_METATYPE(QRectF, QRectF) +Q_DECLARE_BUILTIN_METATYPE(QSize, QSize) +Q_DECLARE_BUILTIN_METATYPE(QSizeF, QSizeF) +Q_DECLARE_BUILTIN_METATYPE(QLine, QLine) +Q_DECLARE_BUILTIN_METATYPE(QLineF, QLineF) +Q_DECLARE_BUILTIN_METATYPE(QPoint, QPoint) +Q_DECLARE_BUILTIN_METATYPE(QPointF, QPointF) +#ifndef QT_NO_REGEXP +Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp) +#endif + +#ifdef QT3_SUPPORT +Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup) +#endif +Q_DECLARE_BUILTIN_METATYPE(QFont, QFont) +Q_DECLARE_BUILTIN_METATYPE(QPixmap, QPixmap) +Q_DECLARE_BUILTIN_METATYPE(QBrush, QBrush) +Q_DECLARE_BUILTIN_METATYPE(QColor, QColor) +Q_DECLARE_BUILTIN_METATYPE(QPalette, QPalette) +Q_DECLARE_BUILTIN_METATYPE(QIcon, QIcon) +Q_DECLARE_BUILTIN_METATYPE(QImage, QImage) +Q_DECLARE_BUILTIN_METATYPE(QPolygon, QPolygon) +Q_DECLARE_BUILTIN_METATYPE(QRegion, QRegion) +Q_DECLARE_BUILTIN_METATYPE(QBitmap, QBitmap) +Q_DECLARE_BUILTIN_METATYPE(QCursor, QCursor) +Q_DECLARE_BUILTIN_METATYPE(QSizePolicy, QSizePolicy) +Q_DECLARE_BUILTIN_METATYPE(QKeySequence, QKeySequence) +Q_DECLARE_BUILTIN_METATYPE(QPen, QPen) +Q_DECLARE_BUILTIN_METATYPE(QTextLength, QTextLength) +Q_DECLARE_BUILTIN_METATYPE(QTextFormat, QTextFormat) +Q_DECLARE_BUILTIN_METATYPE(QMatrix, QMatrix) +Q_DECLARE_BUILTIN_METATYPE(QTransform, QTransform) +Q_DECLARE_BUILTIN_METATYPE(QMatrix4x4, QMatrix4x4) +Q_DECLARE_BUILTIN_METATYPE(QVector2D, QVector2D) +Q_DECLARE_BUILTIN_METATYPE(QVector3D, QVector3D) +Q_DECLARE_BUILTIN_METATYPE(QVector4D, QVector4D) +Q_DECLARE_BUILTIN_METATYPE(QQuaternion, QQuaternion) + +QT_END_HEADER + +#endif // QMETATYPE_H diff --git a/qtinterface/qt4/Qt/qmime.h b/qtinterface/qt4/Qt/qmime.h new file mode 100644 index 0000000..c79b2dd --- /dev/null +++ b/qtinterface/qt4/Qt/qmime.h @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMIME_H +#define QMIME_H + +#include <QtCore/qmimedata.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QMimeSource +{ +public: + virtual ~QMimeSource(); + virtual const char* format(int n = 0) const = 0; + virtual bool provides(const char*) const; + virtual QByteArray encodedData(const char*) const = 0; +}; + + +#if defined(Q_WS_WIN) + +QT_BEGIN_INCLUDE_NAMESPACE +typedef struct tagFORMATETC FORMATETC; +typedef struct tagSTGMEDIUM STGMEDIUM; +struct IDataObject; + +#include <QtCore/qvariant.h> +QT_END_INCLUDE_NAMESPACE + +/* + Encapsulation of conversion between MIME and Windows CLIPFORMAT. + Not need on X11, as the underlying protocol uses the MIME standard + directly. +*/ + +class Q_GUI_EXPORT QWindowsMime +{ +public: + QWindowsMime(); + virtual ~QWindowsMime(); + + // for converting from Qt + virtual bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const = 0; + virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const = 0; + virtual QVector<FORMATETC> formatsForMime(const QString &mimeType, const QMimeData *mimeData) const = 0; + + // for converting to Qt + virtual bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const = 0; + virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const = 0; + virtual QString mimeForFormat(const FORMATETC &formatetc) const = 0; + + static int registerMimeType(const QString &mime); + +private: + friend class QClipboardWatcher; + friend class QDragManager; + friend class QDropData; + friend class QOleDataObject; + + static QWindowsMime *converterToMime(const QString &mimeType, IDataObject *pDataObj); + static QStringList allMimesForFormats(IDataObject *pDataObj); + static QWindowsMime *converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData); + static QVector<FORMATETC> allFormatsForMime(const QMimeData *mimeData); +}; + +#endif +#if defined(Q_WS_MAC) + +/* + Encapsulation of conversion between MIME and Mac flavor. + Not needed on X11, as the underlying protocol uses the MIME standard + directly. +*/ + +class Q_GUI_EXPORT QMacMime { //Obsolete + char type; +public: + enum QMacMimeType { MIME_DND=0x01, MIME_CLIP=0x02, MIME_QT_CONVERTOR=0x04, MIME_ALL=MIME_DND|MIME_CLIP }; + explicit QMacMime(char) { } + virtual ~QMacMime() { } + + static void initialize() { } + + static QList<QMacMime*> all(QMacMimeType) { return QList<QMacMime*>(); } + static QMacMime *convertor(QMacMimeType, const QString &, int) { return 0; } + static QString flavorToMime(QMacMimeType, int) { return QString(); } + + virtual QString convertorName()=0; + virtual int countFlavors()=0; + virtual int flavor(int index)=0; + virtual bool canConvert(const QString &mime, int flav)=0; + virtual QString mimeFor(int flav)=0; + virtual int flavorFor(const QString &mime)=0; + virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, int flav)=0; + virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, int flav)=0; +}; + +class Q_GUI_EXPORT QMacPasteboardMime { + char type; +public: + enum QMacPasteboardMimeType { MIME_DND=0x01, + MIME_CLIP=0x02, + MIME_QT_CONVERTOR=0x04, + MIME_QT3_CONVERTOR=0x08, + MIME_ALL=MIME_DND|MIME_CLIP + }; + explicit QMacPasteboardMime(char); + virtual ~QMacPasteboardMime(); + + static void initialize(); + + static QList<QMacPasteboardMime*> all(uchar); + static QMacPasteboardMime *convertor(uchar, const QString &mime, QString flav); + static QString flavorToMime(uchar, QString flav); + + virtual QString convertorName() = 0; + + virtual bool canConvert(const QString &mime, QString flav) = 0; + virtual QString mimeFor(QString flav) = 0; + virtual QString flavorFor(const QString &mime) = 0; + virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav) = 0; + virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav) = 0; +}; + +// ### Qt 5: Add const QStringList& QMacPasteboardMime::supportedFlavours() +Q_GUI_EXPORT void qRegisterDraggedTypes(const QStringList &types); +#endif // Q_WS_MAC + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMIME_H diff --git a/qtinterface/qt4/Qt/qmimedata.h b/qtinterface/qt4/Qt/qmimedata.h new file mode 100644 index 0000000..cd5c437 --- /dev/null +++ b/qtinterface/qt4/Qt/qmimedata.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMIMEDATA_H +#define QMIMEDATA_H + +#include <QtCore/qvariant.h> +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QUrl; +class QMimeDataPrivate; + +class Q_CORE_EXPORT QMimeData : public QObject +{ + Q_OBJECT +public: + QMimeData(); + ~QMimeData(); + + QList<QUrl> urls() const; + void setUrls(const QList<QUrl> &urls); + bool hasUrls() const; + + QString text() const; + void setText(const QString &text); + bool hasText() const; + + QString html() const; + void setHtml(const QString &html); + bool hasHtml() const; + + QVariant imageData() const; + void setImageData(const QVariant &image); + bool hasImage() const; + + QVariant colorData() const; + void setColorData(const QVariant &color); + bool hasColor() const; + + QByteArray data(const QString &mimetype) const; + void setData(const QString &mimetype, const QByteArray &data); + void removeFormat(const QString &mimetype); + + virtual bool hasFormat(const QString &mimetype) const; + virtual QStringList formats() const; + + void clear(); +protected: + virtual QVariant retrieveData(const QString &mimetype, + QVariant::Type preferredType) const; +private: + Q_DISABLE_COPY(QMimeData) + Q_DECLARE_PRIVATE(QMimeData) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMIMEDATA_H diff --git a/qtinterface/qt4/Qt/qmotifstyle.h b/qtinterface/qt4/Qt/qmotifstyle.h new file mode 100644 index 0000000..7d2b070 --- /dev/null +++ b/qtinterface/qt4/Qt/qmotifstyle.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOTIFSTYLE_H +#define QMOTIFSTYLE_H + +#include <QtGui/qcommonstyle.h> +#include <QtCore/qpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_MOTIF) + +class QPalette; +class QFocusFrame; + +class QMotifStylePrivate; +class Q_GUI_EXPORT QMotifStyle : public QCommonStyle +{ + Q_OBJECT +public: + explicit QMotifStyle(bool useHighlightCols=false); + virtual ~QMotifStyle(); + + void setUseHighlightColors(bool); + bool useHighlightColors() const; + + void polish(QPalette&); + void polish(QWidget*); + void unpolish(QWidget*); + void polish(QApplication*); + void unpolish(QApplication*); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + + void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, + const QWidget *w = 0) const; + + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget = 0) const; + + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, + const QWidget *widget = 0) const; + + QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, + const QSize &contentsSize, const QWidget *widget = 0) const; + + QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + + int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + bool event(QEvent *); + QPalette standardPalette() const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; + +protected: + QPointer<QFocusFrame> focus; + QMotifStyle(QMotifStylePrivate &dd, bool useHighlightCols = false); + void timerEvent(QTimerEvent *event); + bool eventFilter(QObject *o, QEvent *e); + +private: + Q_DECLARE_PRIVATE(QMotifStyle) + Q_DISABLE_COPY(QMotifStyle) + + bool highlightCols; +}; + +#endif // QT_NO_STYLE_MOTIF + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOTIFSTYLE_H diff --git a/qtinterface/qt4/Qt/qmouse_qws.h b/qtinterface/qt4/Qt/qmouse_qws.h new file mode 100644 index 0000000..5878b6d --- /dev/null +++ b/qtinterface/qt4/Qt/qmouse_qws.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSE_QWS_H +#define QMOUSE_QWS_H + +#include <QtCore/qobject.h> +#include <QtGui/qpolygon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWSMouseHandlerPrivate; +class QScreen; + +class Q_GUI_EXPORT QWSPointerCalibrationData +{ +public: + enum Location { TopLeft = 0, BottomLeft = 1, BottomRight = 2, TopRight = 3, + Center = 4, LastLocation = Center }; + QPoint devPoints[5]; + QPoint screenPoints[5]; +}; + +class Q_GUI_EXPORT QWSMouseHandler +{ +public: + explicit QWSMouseHandler(const QString &driver = QString(), + const QString &device = QString()); + virtual ~QWSMouseHandler(); + + virtual void clearCalibration() {} + virtual void calibrate(const QWSPointerCalibrationData *) {} + virtual void getCalibration(QWSPointerCalibrationData *) const {} + + virtual void resume() = 0; + virtual void suspend() = 0; + + void limitToScreen(QPoint &pt); + void mouseChanged(const QPoint& pos, int bstate, int wheel = 0); + const QPoint &pos() const { return mousePos; } + + void setScreen(const QScreen *screen); + +protected: + QPoint &mousePos; + QWSMouseHandlerPrivate *d_ptr; +}; + + +class Q_GUI_EXPORT QWSCalibratedMouseHandler : public QWSMouseHandler +{ +public: + explicit QWSCalibratedMouseHandler(const QString &driver = QString(), + const QString &device = QString()); + + virtual void clearCalibration(); + virtual void calibrate(const QWSPointerCalibrationData *); + virtual void getCalibration(QWSPointerCalibrationData *) const; + +protected: + bool sendFiltered(const QPoint &, int button); + QPoint transform(const QPoint &); + + void readCalibration(); + void writeCalibration(); + void setFilterSize(int); + +private: + int a, b, c; + int d, e, f; + int s; + QPolygon samples; + int currSample; + int numSamples; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSE_QWS_H diff --git a/qtinterface/qt4/Qt/qmousedriverfactory_qws.h b/qtinterface/qt4/Qt/qmousedriverfactory_qws.h new file mode 100644 index 0000000..de52830 --- /dev/null +++ b/qtinterface/qt4/Qt/qmousedriverfactory_qws.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSEDRIVERFACTORY_QWS_H +#define QMOUSEDRIVERFACTORY_QWS_H + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QString; +class QWSMouseHandler; + +class Q_GUI_EXPORT QMouseDriverFactory +{ +public: + static QStringList keys(); + static QWSMouseHandler *create(const QString&, const QString &); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEDRIVERFACTORY_QWS_H diff --git a/qtinterface/qt4/Qt/qmousedriverplugin_qws.h b/qtinterface/qt4/Qt/qmousedriverplugin_qws.h new file mode 100644 index 0000000..c3794bf --- /dev/null +++ b/qtinterface/qt4/Qt/qmousedriverplugin_qws.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSEDRIVERPLUGIN_QWS_H +#define QMOUSEDRIVERPLUGIN_QWS_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LIBRARY + +class QWSMouseHandler; + +struct Q_GUI_EXPORT QWSMouseHandlerFactoryInterface : public QFactoryInterface +{ + virtual QWSMouseHandler* create(const QString &name, const QString &device) = 0; +}; + +#define QWSMouseHandlerFactoryInterface_iid "com.trolltech.Qt.QWSMouseHandlerFactoryInterface" +Q_DECLARE_INTERFACE(QWSMouseHandlerFactoryInterface, QWSMouseHandlerFactoryInterface_iid) + +class Q_GUI_EXPORT QMouseDriverPlugin : public QObject, public QWSMouseHandlerFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QWSMouseHandlerFactoryInterface:QFactoryInterface) +public: + explicit QMouseDriverPlugin(QObject *parent = 0); + ~QMouseDriverPlugin(); + + virtual QStringList keys() const = 0; + virtual QWSMouseHandler* create(const QString& driver, const QString &device) = 0; +}; + +#endif // QT_NO_LIBRARY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEDRIVERPLUGIN_QWS_H diff --git a/qtinterface/qt4/Qt/qmouseeventtransition.h b/qtinterface/qt4/Qt/qmouseeventtransition.h new file mode 100644 index 0000000..1c264ad --- /dev/null +++ b/qtinterface/qt4/Qt/qmouseeventtransition.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSEEVENTTRANSITION_H +#define QMOUSEEVENTTRANSITION_H + +#include <QtCore/qeventtransition.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_STATEMACHINE + +class QMouseEventTransitionPrivate; +class QPainterPath; +class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition +{ + Q_OBJECT + Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) +public: + QMouseEventTransition(QState *sourceState = 0); + QMouseEventTransition(QObject *object, QEvent::Type type, + Qt::MouseButton button, QState *sourceState = 0); + ~QMouseEventTransition(); + + Qt::MouseButton button() const; + void setButton(Qt::MouseButton button); + + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); + + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); + +protected: + void onTransition(QEvent *event); + bool eventTest(QEvent *event); + +private: + Q_DISABLE_COPY(QMouseEventTransition) + Q_DECLARE_PRIVATE(QMouseEventTransition) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qmouselinuxinput_qws.h b/qtinterface/qt4/Qt/qmouselinuxinput_qws.h new file mode 100644 index 0000000..c469262 --- /dev/null +++ b/qtinterface/qt4/Qt/qmouselinuxinput_qws.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSELINUXINPUT_QWS_H +#define QMOUSELINUXINPUT_QWS_H + +#include <QtGui/QWSCalibratedMouseHandler> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_MOUSE_LINUXINPUT + +class QWSLinuxInputMousePrivate; + +class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler +{ +public: + QWSLinuxInputMouseHandler(const QString &); + ~QWSLinuxInputMouseHandler(); + + void suspend(); + void resume(); + +private: + QWSLinuxInputMousePrivate *d; + + friend class QWSLinuxInputMousePrivate; +}; + +#endif // QT_NO_QWS_MOUSE_LINUXINPUT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSELINUXINPUT_QWS_H diff --git a/qtinterface/qt4/Qt/qmouselinuxtp_qws.h b/qtinterface/qt4/Qt/qmouselinuxtp_qws.h new file mode 100644 index 0000000..54ebbcb --- /dev/null +++ b/qtinterface/qt4/Qt/qmouselinuxtp_qws.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSELINUXTP_QWS_H +#define QMOUSELINUXTP_QWS_H + +#include <QtGui/qmouse_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_MOUSE_LINUXTP + +class QWSLinuxTPMouseHandlerPrivate; + +class QWSLinuxTPMouseHandler : public QWSCalibratedMouseHandler +{ + friend class QWSLinuxTPMouseHandlerPrivate; +public: + explicit QWSLinuxTPMouseHandler(const QString & = QString(), + const QString & = QString()); + ~QWSLinuxTPMouseHandler(); + + void suspend(); + void resume(); +protected: + QWSLinuxTPMouseHandlerPrivate *d; +}; + +#endif // QT_NO_QWS_MOUSE_LINUXTP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSELINUXTP_QWS_H diff --git a/qtinterface/qt4/Qt/qmousepc_qws.h b/qtinterface/qt4/Qt/qmousepc_qws.h new file mode 100644 index 0000000..08d2948 --- /dev/null +++ b/qtinterface/qt4/Qt/qmousepc_qws.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSEPC_QWS_H +#define QMOUSEPC_QWS_H + +#include <QtGui/qmouse_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_MOUSE_PC + +class QWSPcMouseHandlerPrivate; + +class QWSPcMouseHandler : public QWSMouseHandler +{ +public: + explicit QWSPcMouseHandler(const QString & = QString(), + const QString & = QString()); + ~QWSPcMouseHandler(); + + void suspend(); + void resume(); +protected: + QWSPcMouseHandlerPrivate *d; +}; + +#endif // QT_NO_QWS_MOUSE_PC + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEPC_QWS_H diff --git a/qtinterface/qt4/Qt/qmouseqnx_qws.h b/qtinterface/qt4/Qt/qmouseqnx_qws.h new file mode 100644 index 0000000..bb1c949 --- /dev/null +++ b/qtinterface/qt4/Qt/qmouseqnx_qws.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSE_QNX_H +#define QMOUSE_QNX_H + +#include <QtCore/qobject.h> +#include <QtGui/qmouse_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QSocketNotifier; + +class Q_GUI_EXPORT QQnxMouseHandler : public QObject, public QWSMouseHandler +{ + Q_OBJECT +public: + explicit QQnxMouseHandler(const QString &driver = QString(), + const QString &device = QString()); + ~QQnxMouseHandler(); + + void resume(); + void suspend(); + +private Q_SLOTS: + void socketActivated(); + +private: + QSocketNotifier *mouseNotifier; + int mouseFD; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSE_QWS_H diff --git a/qtinterface/qt4/Qt/qmousetslib_qws.h b/qtinterface/qt4/Qt/qmousetslib_qws.h new file mode 100644 index 0000000..8dbcc6d --- /dev/null +++ b/qtinterface/qt4/Qt/qmousetslib_qws.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSETSLIB_QWS_H +#define QMOUSETSLIB_QWS_H + +#include <QtGui/qmouse_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_QWS_MOUSE_TSLIB) || defined(QT_PLUGIN) + +class QWSTslibMouseHandlerPrivate; + +class QWSTslibMouseHandler : public QWSCalibratedMouseHandler +{ +public: + explicit QWSTslibMouseHandler(const QString &driver = QString(), + const QString &device = QString()); + ~QWSTslibMouseHandler(); + + void suspend(); + void resume(); + + void calibrate(const QWSPointerCalibrationData *data); + void clearCalibration(); + +protected: + friend class QWSTslibMouseHandlerPrivate; + QWSTslibMouseHandlerPrivate *d; +}; + + +#endif // QT_NO_QWS_MOUSE_TSLIB +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QMOUSETSLIB_QWS_H diff --git a/qtinterface/qt4/Qt/qmousevfb_qws.h b/qtinterface/qt4/Qt/qmousevfb_qws.h new file mode 100644 index 0000000..deb8691 --- /dev/null +++ b/qtinterface/qt4/Qt/qmousevfb_qws.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOUSEVFB_QWS_H +#define QMOUSEVFB_QWS_H + +#include <QtGui/qmouse_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_MOUSE_QVFB + +class QSocketNotifier; + +class QVFbMouseHandler : public QObject, public QWSMouseHandler { + Q_OBJECT +public: + QVFbMouseHandler(const QString &driver = QString(), + const QString &device = QString()); + ~QVFbMouseHandler(); + + void resume(); + void suspend(); + +private: + int mouseFD; + int mouseIdx; + enum {mouseBufSize = 128}; + uchar mouseBuf[mouseBufSize]; + QSocketNotifier *mouseNotifier; + +private Q_SLOTS: + void readMouseData(); +}; +#endif // QT_NO_QWS_MOUSE_QVFB + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEVFB_QWS_H diff --git a/qtinterface/qt4/Qt/qmovie.h b/qtinterface/qt4/Qt/qmovie.h new file mode 100644 index 0000000..e6a4297 --- /dev/null +++ b/qtinterface/qt4/Qt/qmovie.h @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMOVIE_H +#define QMOVIE_H + +#include <QtCore/qobject.h> + +#ifndef QT_NO_MOVIE + +#include <QtCore/qbytearray.h> +#include <QtCore/qlist.h> +#include <QtCore/qobject.h> +#include <QtGui/qimagereader.h> + +#ifdef QT3_SUPPORT +#include <QtGui/qimage.h> +#include <QtGui/qpixmap.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QByteArray; +class QColor; +class QIODevice; +class QImage; +class QPixmap; +class QRect; +class QSize; + +class QMoviePrivate; +class Q_GUI_EXPORT QMovie : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QMovie) + Q_ENUMS(MovieState CacheMode) + Q_PROPERTY(int speed READ speed WRITE setSpeed) + Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) +public: + enum MovieState { + NotRunning, + Paused, + Running + }; + enum CacheMode { + CacheNone, + CacheAll + }; + + QMovie(QObject *parent = 0); + explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0); + explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = 0); + ~QMovie(); + + static QList<QByteArray> supportedFormats(); + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setFileName(const QString &fileName); + QString fileName() const; + + void setFormat(const QByteArray &format); + QByteArray format() const; + + void setBackgroundColor(const QColor &color); + QColor backgroundColor() const; + + MovieState state() const; + + QRect frameRect() const; + QImage currentImage() const; + QPixmap currentPixmap() const; + + bool isValid() const; + + bool jumpToFrame(int frameNumber); + int loopCount() const; + int frameCount() const; + int nextFrameDelay() const; + int currentFrameNumber() const; + + int speed() const; + + QSize scaledSize(); + void setScaledSize(const QSize &size); + + CacheMode cacheMode() const; + void setCacheMode(CacheMode mode); + + CacheMode cacheMode(); // ### Qt 5: remove me + +Q_SIGNALS: + void started(); + void resized(const QSize &size); + void updated(const QRect &rect); + void stateChanged(QMovie::MovieState state); + void error(QImageReader::ImageReaderError error); + void finished(); + void frameChanged(int frameNumber); + +public Q_SLOTS: + void start(); + bool jumpToNextFrame(); + void setPaused(bool paused); + void stop(); + void setSpeed(int percentSpeed); + +private: + Q_DISABLE_COPY(QMovie) + Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame()) + +#ifdef QT3_SUPPORT +public: + inline QT3_SUPPORT bool isNull() const { return isValid(); } + inline QT3_SUPPORT int frameNumber() const { return currentFrameNumber(); } + inline QT3_SUPPORT bool running() const { return state() == Running; } + inline QT3_SUPPORT bool paused() const { return state() == Paused; } + inline QT3_SUPPORT bool finished() const { return state() == NotRunning; } + inline QT3_SUPPORT void restart() { stop(); start(); } + inline QT3_SUPPORT QImage frameImage() const { return currentImage(); } + inline QT3_SUPPORT QPixmap framePixmap() const { return currentPixmap(); } + inline QT3_SUPPORT void step() { jumpToNextFrame(); } + inline QT3_SUPPORT void pause() { setPaused(true); } + inline QT3_SUPPORT void unpause() { setPaused(false); } +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_MOVIE + +#endif // QMOVIE_H diff --git a/qtinterface/qt4/Qt/qmutex.h b/qtinterface/qt4/Qt/qmutex.h new file mode 100644 index 0000000..8b5663f --- /dev/null +++ b/qtinterface/qt4/Qt/qmutex.h @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMUTEX_H +#define QMUTEX_H + +#include <QtCore/qglobal.h> +#include <new> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_THREAD + +class QMutexPrivate; + +class Q_CORE_EXPORT QMutex +{ + friend class QWaitCondition; + friend class QWaitConditionPrivate; + +public: + enum RecursionMode { NonRecursive, Recursive }; + + explicit QMutex(RecursionMode mode = NonRecursive); + ~QMutex(); + + void lock(); + bool tryLock(); + bool tryLock(int timeout); + void unlock(); + +#if defined(QT3_SUPPORT) + inline QT3_SUPPORT bool locked() + { + if (!tryLock()) + return true; + unlock(); + return false; + } + inline QT3_SUPPORT_CONSTRUCTOR QMutex(bool recursive) + { + new (this) QMutex(recursive ? Recursive : NonRecursive); + } +#endif + +private: + Q_DISABLE_COPY(QMutex) + + QMutexPrivate *d; +}; + +class Q_CORE_EXPORT QMutexLocker +{ +public: + inline explicit QMutexLocker(QMutex *m) + : mtx(m) + { + Q_ASSERT_X((val & quintptr(1u)) == quintptr(0), + "QMutexLocker", "QMutex pointer is misaligned"); + relock(); + } + inline ~QMutexLocker() { unlock(); } + + inline void unlock() + { + if (mtx) { + if ((val & quintptr(1u)) == quintptr(1u)) { + val &= ~quintptr(1u); + mtx->unlock(); + } + } + } + + inline void relock() + { + if (mtx) { + if ((val & quintptr(1u)) == quintptr(0u)) { + mtx->lock(); + val |= quintptr(1u); + } + } + } + +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4312 ) // ignoring the warning from /Wp64 +#endif + + inline QMutex *mutex() const + { + return reinterpret_cast<QMutex *>(val & ~quintptr(1u)); + } + +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif + +private: + Q_DISABLE_COPY(QMutexLocker) + + union { + QMutex *mtx; + quintptr val; + }; +}; + +#else // QT_NO_THREAD + + +class Q_CORE_EXPORT QMutex +{ +public: + enum RecursionMode { NonRecursive, Recursive }; + + inline explicit QMutex(RecursionMode mode = NonRecursive) { Q_UNUSED(mode); } + inline ~QMutex() {} + + static inline void lock() {} + static inline bool tryLock() { return true; } + static inline bool tryLock(int timeout) { Q_UNUSED(timeout); return true; } + static void unlock() {} + +#if defined(QT3_SUPPORT) + static inline QT3_SUPPORT bool locked() { return false; } +#endif + +private: + Q_DISABLE_COPY(QMutex) +}; + +class Q_CORE_EXPORT QMutexLocker +{ +public: + inline explicit QMutexLocker(QMutex *) {} + inline ~QMutexLocker() {} + + static inline void unlock() {} + static void relock() {} + static inline QMutex *mutex() { return 0; } + +private: + Q_DISABLE_COPY(QMutexLocker) +}; + +#endif // QT_NO_THREAD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMUTEX_H diff --git a/qtinterface/qt4/Qt/qnamespace.h b/qtinterface/qt4/Qt/qnamespace.h new file mode 100644 index 0000000..c26ecb7 --- /dev/null +++ b/qtinterface/qt4/Qt/qnamespace.h @@ -0,0 +1,1830 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNAMESPACE_H +#define QNAMESPACE_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef Q_MOC_RUN +namespace +#else +class Q_CORE_EXPORT +#endif +Qt { + +#if defined(Q_MOC_RUN) + Q_OBJECT +#endif + +#if (defined(Q_MOC_RUN) || defined(QT_JAMBI_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) + Q_ENUMS(FillRule MaskMode BGMode ClipOperation SizeMode) + Q_ENUMS(BackgroundMode) // Qt3 + Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation DropAction) + Q_FLAGS(Alignment Orientations DropActions) + Q_FLAGS(DockWidgetAreas ToolBarAreas) + Q_ENUMS(DockWidgetArea ToolBarArea) + Q_ENUMS(TextFormat) + Q_ENUMS(TextElideMode) + Q_ENUMS(DateFormat TimeSpec DayOfWeek) + Q_ENUMS(CursorShape GlobalColor) + Q_ENUMS(AspectRatioMode TransformationMode) + Q_FLAGS(ImageConversionFlags) + Q_ENUMS(Key ShortcutContext) + Q_ENUMS(TextInteractionFlag) + Q_FLAGS(TextInteractionFlags) + Q_ENUMS(ItemSelectionMode) + Q_FLAGS(ItemFlags) + Q_ENUMS(CheckState) + Q_ENUMS(SortOrder CaseSensitivity) + Q_FLAGS(MatchFlags) + Q_FLAGS(KeyboardModifiers MouseButtons) + Q_ENUMS(WindowType WindowState WindowModality WidgetAttribute ApplicationAttribute) + Q_ENUMS(InputMethodHint) + Q_FLAGS(WindowFlags WindowStates InputMethodHints) + Q_ENUMS(ConnectionType) +#endif // (defined(Q_MOC_RUN) || defined(QT_JAMBI_RUN)) + +#if defined(Q_MOC_RUN) +public: +#endif + + enum GlobalColor { + color0, + color1, + black, + white, + darkGray, + gray, + lightGray, + red, + green, + blue, + cyan, + magenta, + yellow, + darkRed, + darkGreen, + darkBlue, + darkCyan, + darkMagenta, + darkYellow, + transparent + }; + + enum KeyboardModifier { + NoModifier = 0x00000000, + ShiftModifier = 0x02000000, + ControlModifier = 0x04000000, + AltModifier = 0x08000000, + MetaModifier = 0x10000000, + KeypadModifier = 0x20000000, + GroupSwitchModifier = 0x40000000, + // Do not extend the mask to include 0x01000000 + KeyboardModifierMask = 0xfe000000 + }; + Q_DECLARE_FLAGS(KeyboardModifiers, KeyboardModifier) + + //shorter names for shortcuts + enum Modifier { + META = Qt::MetaModifier, + SHIFT = Qt::ShiftModifier, + CTRL = Qt::ControlModifier, + ALT = Qt::AltModifier, + MODIFIER_MASK = KeyboardModifierMask, + UNICODE_ACCEL = 0x00000000 + }; + + enum MouseButton { + NoButton = 0x00000000, + LeftButton = 0x00000001, + RightButton = 0x00000002, + MidButton = 0x00000004, + XButton1 = 0x00000008, + XButton2 = 0x00000010, + MouseButtonMask = 0x000000ff + }; + Q_DECLARE_FLAGS(MouseButtons, MouseButton) + +#ifdef QT3_SUPPORT + enum ButtonState_enum { + ShiftButton = Qt::ShiftModifier, + ControlButton = Qt::ControlModifier, + AltButton = Qt::AltModifier, + MetaButton = Qt::MetaModifier, + Keypad = Qt::KeypadModifier, + KeyButtonMask = Qt::KeyboardModifierMask + }; + typedef int ButtonState; +#endif + + enum Orientation { + Horizontal = 0x1, + Vertical = 0x2 + }; + + Q_DECLARE_FLAGS(Orientations, Orientation) + + enum FocusPolicy { + NoFocus = 0, + TabFocus = 0x1, + ClickFocus = 0x2, + StrongFocus = TabFocus | ClickFocus | 0x8, + WheelFocus = StrongFocus | 0x4 + }; + + enum SortOrder { + AscendingOrder, + DescendingOrder +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + ,Ascending = AscendingOrder, + Descending = DescendingOrder +#endif + }; + + enum TileRule { + StretchTile, + RepeatTile, + RoundTile + }; + + // Text formatting flags for QPainter::drawText and QLabel. + // The following two enums can be combined to one integer which + // is passed as 'flags' to drawText and qt_format_text. + + enum AlignmentFlag { + AlignLeft = 0x0001, + AlignLeading = AlignLeft, + AlignRight = 0x0002, + AlignTrailing = AlignRight, + AlignHCenter = 0x0004, + AlignJustify = 0x0008, + AlignAbsolute = 0x0010, + AlignHorizontal_Mask = AlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute, + + AlignTop = 0x0020, + AlignBottom = 0x0040, + AlignVCenter = 0x0080, + AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter, + + AlignCenter = AlignVCenter | AlignHCenter +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , AlignAuto = AlignLeft +#endif + }; + + Q_DECLARE_FLAGS(Alignment, AlignmentFlag) + + enum TextFlag { + TextSingleLine = 0x0100, + TextDontClip = 0x0200, + TextExpandTabs = 0x0400, + TextShowMnemonic = 0x0800, + TextWordWrap = 0x1000, + TextWrapAnywhere = 0x2000, + TextDontPrint = 0x4000, + TextIncludeTrailingSpaces = 0x08000000, + TextHideMnemonic = 0x8000, + TextJustificationForced = 0x10000, + TextForceLeftToRight = 0x20000, + TextForceRightToLeft = 0x40000, + TextLongestVariant = 0x80000 + +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + ,SingleLine = TextSingleLine, + DontClip = TextDontClip, + ExpandTabs = TextExpandTabs, + ShowPrefix = TextShowMnemonic, + WordBreak = TextWordWrap, + BreakAnywhere = TextWrapAnywhere, + DontPrint = TextDontPrint, + IncludeTrailingSpaces = TextIncludeTrailingSpaces, + NoAccel = TextHideMnemonic +#endif + }; +#ifdef QT3_SUPPORT + typedef TextFlag TextFlags; +#endif + + enum TextElideMode { + ElideLeft, + ElideRight, + ElideMiddle, + ElideNone + }; + + enum WindowType { + Widget = 0x00000000, + Window = 0x00000001, + Dialog = 0x00000002 | Window, + Sheet = 0x00000004 | Window, + Drawer = 0x00000006 | Window, + Popup = 0x00000008 | Window, + Tool = 0x0000000a | Window, + ToolTip = 0x0000000c | Window, + SplashScreen = 0x0000000e | Window, + Desktop = 0x00000010 | Window, + SubWindow = 0x00000012, + + WindowType_Mask = 0x000000ff, + MSWindowsFixedSizeDialogHint = 0x00000100, + MSWindowsOwnDC = 0x00000200, + X11BypassWindowManagerHint = 0x00000400, + FramelessWindowHint = 0x00000800, + WindowTitleHint = 0x00001000, + WindowSystemMenuHint = 0x00002000, + WindowMinimizeButtonHint = 0x00004000, + WindowMaximizeButtonHint = 0x00008000, + WindowMinMaxButtonsHint = WindowMinimizeButtonHint | WindowMaximizeButtonHint, + WindowContextHelpButtonHint = 0x00010000, + WindowShadeButtonHint = 0x00020000, + WindowStaysOnTopHint = 0x00040000, + // reserved for Qt3Support: + // WMouseNoMask = 0x00080000, + // WDestructiveClose = 0x00100000, + // WStaticContents = 0x00200000, + // WGroupLeader = 0x00400000, + // WShowModal = 0x00800000, + // WNoMousePropagation = 0x01000000, + CustomizeWindowHint = 0x02000000, + WindowStaysOnBottomHint = 0x04000000, + WindowCloseButtonHint = 0x08000000, + MacWindowToolBarButtonHint = 0x10000000, + BypassGraphicsProxyWidget = 0x20000000, + WindowOkButtonHint = 0x00080000, + WindowCancelButtonHint = 0x00100000 + +#ifdef QT3_SUPPORT + , + WMouseNoMask = 0x00080000, + WDestructiveClose = 0x00100000, + WStaticContents = 0x00200000, + WGroupLeader = 0x00400000, + WShowModal = 0x00800000, + WNoMousePropagation = 0x01000000, + + WType_TopLevel = Window, + WType_Dialog = Dialog, + WType_Popup = Popup, + WType_Desktop = Desktop, + WType_Mask = WindowType_Mask, + + WStyle_Customize = 0, + WStyle_NormalBorder = 0, + WStyle_DialogBorder = MSWindowsFixedSizeDialogHint, + WStyle_NoBorder = FramelessWindowHint, + WStyle_Title = WindowTitleHint, + WStyle_SysMenu = WindowSystemMenuHint, + WStyle_Minimize = WindowMinimizeButtonHint, + WStyle_Maximize = WindowMaximizeButtonHint, + WStyle_MinMax = WStyle_Minimize | WStyle_Maximize, + WStyle_Tool = Tool, + WStyle_StaysOnTop = WindowStaysOnTopHint, + WStyle_ContextHelp = WindowContextHelpButtonHint, + + // misc flags + WPaintDesktop = 0, + WPaintClever = 0, + + WX11BypassWM = X11BypassWindowManagerHint, + WWinOwnDC = MSWindowsOwnDC, + WMacSheet = Sheet, + WMacDrawer = Drawer, + + WStyle_Splash = SplashScreen, + + WNoAutoErase = 0, + WRepaintNoErase = 0, + WNorthWestGravity = WStaticContents, + WType_Modal = Dialog | WShowModal, + WStyle_Dialog = Dialog, + WStyle_NoBorderEx = FramelessWindowHint, + WResizeNoErase = 0, + WMacNoSheet = 0 +#endif + + }; + + Q_DECLARE_FLAGS(WindowFlags, WindowType) + + enum WindowState { + WindowNoState = 0x00000000, + WindowMinimized = 0x00000001, + WindowMaximized = 0x00000002, + WindowFullScreen = 0x00000004, + WindowActive = 0x00000008 + }; + + Q_DECLARE_FLAGS(WindowStates, WindowState) + + enum WidgetAttribute { + WA_Disabled = 0, + WA_UnderMouse = 1, + WA_MouseTracking = 2, + WA_ContentsPropagated = 3, // ## deprecated + WA_OpaquePaintEvent = 4, + WA_NoBackground = WA_OpaquePaintEvent, // ## deprecated + WA_StaticContents = 5, + WA_LaidOut = 7, + WA_PaintOnScreen = 8, + WA_NoSystemBackground = 9, + WA_UpdatesDisabled = 10, + WA_Mapped = 11, + WA_MacNoClickThrough = 12, // Mac only + WA_PaintOutsidePaintEvent = 13, + WA_InputMethodEnabled = 14, + WA_WState_Visible = 15, + WA_WState_Hidden = 16, + + WA_ForceDisabled = 32, + WA_KeyCompression = 33, + WA_PendingMoveEvent = 34, + WA_PendingResizeEvent = 35, + WA_SetPalette = 36, + WA_SetFont = 37, + WA_SetCursor = 38, + WA_NoChildEventsFromChildren = 39, + WA_WindowModified = 41, + WA_Resized = 42, + WA_Moved = 43, + WA_PendingUpdate = 44, + WA_InvalidSize = 45, + WA_MacBrushedMetal = 46, // Mac only + WA_MacMetalStyle = WA_MacBrushedMetal, // obsolete + WA_CustomWhatsThis = 47, + WA_LayoutOnEntireRect = 48, + WA_OutsideWSRange = 49, + WA_GrabbedShortcut = 50, + WA_TransparentForMouseEvents = 51, + WA_PaintUnclipped = 52, + WA_SetWindowIcon = 53, + WA_NoMouseReplay = 54, + WA_DeleteOnClose = 55, + WA_RightToLeft = 56, + WA_SetLayoutDirection = 57, + WA_NoChildEventsForParent = 58, + WA_ForceUpdatesDisabled = 59, + + WA_WState_Created = 60, + WA_WState_CompressKeys = 61, + WA_WState_InPaintEvent = 62, + WA_WState_Reparented = 63, + WA_WState_ConfigPending = 64, + WA_WState_Polished = 66, + WA_WState_DND = 67, // ## deprecated + WA_WState_OwnSizePolicy = 68, + WA_WState_ExplicitShowHide = 69, + + WA_ShowModal = 70, // ## deprecated + WA_MouseNoMask = 71, + WA_GroupLeader = 72, // ## deprecated + WA_NoMousePropagation = 73, // ## for now, might go away. + WA_Hover = 74, + WA_InputMethodTransparent = 75, // Don't reset IM when user clicks on this (for virtual keyboards on embedded) + WA_QuitOnClose = 76, + + WA_KeyboardFocusChange = 77, + + WA_AcceptDrops = 78, + WA_DropSiteRegistered = 79, // internal + WA_ForceAcceptDrops = WA_DropSiteRegistered, // ## deprecated + + WA_WindowPropagation = 80, + + WA_NoX11EventCompression = 81, + WA_TintedBackground = 82, + WA_X11OpenGLOverlay = 83, + WA_AlwaysShowToolTips = 84, + WA_MacOpaqueSizeGrip = 85, + WA_SetStyle = 86, + + WA_SetLocale = 87, + WA_MacShowFocusRect = 88, + + WA_MacNormalSize = 89, // Mac only + WA_MacSmallSize = 90, // Mac only + WA_MacMiniSize = 91, // Mac only + + WA_LayoutUsesWidgetRect = 92, + WA_StyledBackground = 93, // internal + WA_MSWindowsUseDirect3D = 94, // Win only + WA_CanHostQMdiSubWindowTitleBar = 95, // Internal + + WA_MacAlwaysShowToolWindow = 96, // Mac only + + WA_StyleSheet = 97, // internal + + WA_ShowWithoutActivating = 98, + + WA_X11BypassTransientForHint = 99, + + WA_NativeWindow = 100, + WA_DontCreateNativeAncestors = 101, + + WA_MacVariableSize = 102, // Mac only + + WA_DontShowOnScreen = 103, + + // window types from http://standards.freedesktop.org/wm-spec/ + WA_X11NetWmWindowTypeDesktop = 104, + WA_X11NetWmWindowTypeDock = 105, + WA_X11NetWmWindowTypeToolBar = 106, + WA_X11NetWmWindowTypeMenu = 107, + WA_X11NetWmWindowTypeUtility = 108, + WA_X11NetWmWindowTypeSplash = 109, + WA_X11NetWmWindowTypeDialog = 110, + WA_X11NetWmWindowTypeDropDownMenu = 111, + WA_X11NetWmWindowTypePopupMenu = 112, + WA_X11NetWmWindowTypeToolTip = 113, + WA_X11NetWmWindowTypeNotification = 114, + WA_X11NetWmWindowTypeCombo = 115, + WA_X11NetWmWindowTypeDND = 116, + + WA_MacFrameworkScaled = 117, + + WA_SetWindowModality = 118, + WA_WState_WindowOpacitySet = 119, // internal + WA_TranslucentBackground = 120, + + WA_AcceptTouchEvents = 121, + WA_WState_AcceptedTouchBeginEvent = 122, + WA_TouchPadAcceptSingleTouchEvents = 123, + + WA_MergeSoftkeys = 124, + WA_MergeSoftkeysRecursively = 125, + + // Add new attributes before this line + WA_AttributeCount + }; + + enum ApplicationAttribute + { + AA_ImmediateWidgetCreation = 0, + AA_MSWindowsUseDirect3DByDefault = 1, // Win only + AA_DontShowIconsInMenus = 2, + AA_NativeWindows = 3, + AA_DontCreateNativeWidgetSiblings = 4, + AA_MacPluginApplication = 5, + AA_DontUseNativeMenuBar = 6, + AA_MacDontSwapCtrlAndMeta = 7, + AA_S60DontConstructApplicationPanes = 8, + + // Add new attributes before this line + AA_AttributeCount + }; + + + // Image conversion flags. The unusual ordering is caused by + // compatibility and default requirements. + + enum ImageConversionFlag { + ColorMode_Mask = 0x00000003, + AutoColor = 0x00000000, + ColorOnly = 0x00000003, + MonoOnly = 0x00000002, + // Reserved = 0x00000001, + + AlphaDither_Mask = 0x0000000c, + ThresholdAlphaDither = 0x00000000, + OrderedAlphaDither = 0x00000004, + DiffuseAlphaDither = 0x00000008, + NoAlpha = 0x0000000c, // Not supported + + Dither_Mask = 0x00000030, + DiffuseDither = 0x00000000, + OrderedDither = 0x00000010, + ThresholdDither = 0x00000020, + // ReservedDither = 0x00000030, + + DitherMode_Mask = 0x000000c0, + AutoDither = 0x00000000, + PreferDither = 0x00000040, + AvoidDither = 0x00000080, + + NoOpaqueDetection = 0x00000100 + }; + Q_DECLARE_FLAGS(ImageConversionFlags, ImageConversionFlag) + + enum BGMode { + TransparentMode, + OpaqueMode + }; + +#ifdef QT3_SUPPORT + enum PaintUnit { // paint unit + PixelUnit, + LoMetricUnit, // obsolete + HiMetricUnit, // obsolete + LoEnglishUnit, // obsolete + HiEnglishUnit, // obsolete + TwipsUnit // obsolete + }; + + enum GUIStyle { + MacStyle, + WindowsStyle, + Win3Style, + PMStyle, + MotifStyle + }; +#endif + + enum Key { + Key_Escape = 0x01000000, // misc keys + Key_Tab = 0x01000001, + Key_Backtab = 0x01000002, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_BackTab = Key_Backtab, +#endif + Key_Backspace = 0x01000003, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_BackSpace = Key_Backspace, +#endif + Key_Return = 0x01000004, + Key_Enter = 0x01000005, + Key_Insert = 0x01000006, + Key_Delete = 0x01000007, + Key_Pause = 0x01000008, + Key_Print = 0x01000009, + Key_SysReq = 0x0100000a, + Key_Clear = 0x0100000b, + Key_Home = 0x01000010, // cursor movement + Key_End = 0x01000011, + Key_Left = 0x01000012, + Key_Up = 0x01000013, + Key_Right = 0x01000014, + Key_Down = 0x01000015, + Key_PageUp = 0x01000016, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_Prior = Key_PageUp, +#endif + Key_PageDown = 0x01000017, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_Next = Key_PageDown, +#endif + Key_Shift = 0x01000020, // modifiers + Key_Control = 0x01000021, + Key_Meta = 0x01000022, + Key_Alt = 0x01000023, + Key_CapsLock = 0x01000024, + Key_NumLock = 0x01000025, + Key_ScrollLock = 0x01000026, + Key_F1 = 0x01000030, // function keys + Key_F2 = 0x01000031, + Key_F3 = 0x01000032, + Key_F4 = 0x01000033, + Key_F5 = 0x01000034, + Key_F6 = 0x01000035, + Key_F7 = 0x01000036, + Key_F8 = 0x01000037, + Key_F9 = 0x01000038, + Key_F10 = 0x01000039, + Key_F11 = 0x0100003a, + Key_F12 = 0x0100003b, + Key_F13 = 0x0100003c, + Key_F14 = 0x0100003d, + Key_F15 = 0x0100003e, + Key_F16 = 0x0100003f, + Key_F17 = 0x01000040, + Key_F18 = 0x01000041, + Key_F19 = 0x01000042, + Key_F20 = 0x01000043, + Key_F21 = 0x01000044, + Key_F22 = 0x01000045, + Key_F23 = 0x01000046, + Key_F24 = 0x01000047, + Key_F25 = 0x01000048, // F25 .. F35 only on X11 + Key_F26 = 0x01000049, + Key_F27 = 0x0100004a, + Key_F28 = 0x0100004b, + Key_F29 = 0x0100004c, + Key_F30 = 0x0100004d, + Key_F31 = 0x0100004e, + Key_F32 = 0x0100004f, + Key_F33 = 0x01000050, + Key_F34 = 0x01000051, + Key_F35 = 0x01000052, + Key_Super_L = 0x01000053, // extra keys + Key_Super_R = 0x01000054, + Key_Menu = 0x01000055, + Key_Hyper_L = 0x01000056, + Key_Hyper_R = 0x01000057, + Key_Help = 0x01000058, + Key_Direction_L = 0x01000059, + Key_Direction_R = 0x01000060, + Key_Space = 0x20, // 7 bit printable ASCII + Key_Any = Key_Space, + Key_Exclam = 0x21, + Key_QuoteDbl = 0x22, + Key_NumberSign = 0x23, + Key_Dollar = 0x24, + Key_Percent = 0x25, + Key_Ampersand = 0x26, + Key_Apostrophe = 0x27, + Key_ParenLeft = 0x28, + Key_ParenRight = 0x29, + Key_Asterisk = 0x2a, + Key_Plus = 0x2b, + Key_Comma = 0x2c, + Key_Minus = 0x2d, + Key_Period = 0x2e, + Key_Slash = 0x2f, + Key_0 = 0x30, + Key_1 = 0x31, + Key_2 = 0x32, + Key_3 = 0x33, + Key_4 = 0x34, + Key_5 = 0x35, + Key_6 = 0x36, + Key_7 = 0x37, + Key_8 = 0x38, + Key_9 = 0x39, + Key_Colon = 0x3a, + Key_Semicolon = 0x3b, + Key_Less = 0x3c, + Key_Equal = 0x3d, + Key_Greater = 0x3e, + Key_Question = 0x3f, + Key_At = 0x40, + Key_A = 0x41, + Key_B = 0x42, + Key_C = 0x43, + Key_D = 0x44, + Key_E = 0x45, + Key_F = 0x46, + Key_G = 0x47, + Key_H = 0x48, + Key_I = 0x49, + Key_J = 0x4a, + Key_K = 0x4b, + Key_L = 0x4c, + Key_M = 0x4d, + Key_N = 0x4e, + Key_O = 0x4f, + Key_P = 0x50, + Key_Q = 0x51, + Key_R = 0x52, + Key_S = 0x53, + Key_T = 0x54, + Key_U = 0x55, + Key_V = 0x56, + Key_W = 0x57, + Key_X = 0x58, + Key_Y = 0x59, + Key_Z = 0x5a, + Key_BracketLeft = 0x5b, + Key_Backslash = 0x5c, + Key_BracketRight = 0x5d, + Key_AsciiCircum = 0x5e, + Key_Underscore = 0x5f, + Key_QuoteLeft = 0x60, + Key_BraceLeft = 0x7b, + Key_Bar = 0x7c, + Key_BraceRight = 0x7d, + Key_AsciiTilde = 0x7e, + + Key_nobreakspace = 0x0a0, + Key_exclamdown = 0x0a1, + Key_cent = 0x0a2, + Key_sterling = 0x0a3, + Key_currency = 0x0a4, + Key_yen = 0x0a5, + Key_brokenbar = 0x0a6, + Key_section = 0x0a7, + Key_diaeresis = 0x0a8, + Key_copyright = 0x0a9, + Key_ordfeminine = 0x0aa, + Key_guillemotleft = 0x0ab, // left angle quotation mark + Key_notsign = 0x0ac, + Key_hyphen = 0x0ad, + Key_registered = 0x0ae, + Key_macron = 0x0af, + Key_degree = 0x0b0, + Key_plusminus = 0x0b1, + Key_twosuperior = 0x0b2, + Key_threesuperior = 0x0b3, + Key_acute = 0x0b4, + Key_mu = 0x0b5, + Key_paragraph = 0x0b6, + Key_periodcentered = 0x0b7, + Key_cedilla = 0x0b8, + Key_onesuperior = 0x0b9, + Key_masculine = 0x0ba, + Key_guillemotright = 0x0bb, // right angle quotation mark + Key_onequarter = 0x0bc, + Key_onehalf = 0x0bd, + Key_threequarters = 0x0be, + Key_questiondown = 0x0bf, + Key_Agrave = 0x0c0, + Key_Aacute = 0x0c1, + Key_Acircumflex = 0x0c2, + Key_Atilde = 0x0c3, + Key_Adiaeresis = 0x0c4, + Key_Aring = 0x0c5, + Key_AE = 0x0c6, + Key_Ccedilla = 0x0c7, + Key_Egrave = 0x0c8, + Key_Eacute = 0x0c9, + Key_Ecircumflex = 0x0ca, + Key_Ediaeresis = 0x0cb, + Key_Igrave = 0x0cc, + Key_Iacute = 0x0cd, + Key_Icircumflex = 0x0ce, + Key_Idiaeresis = 0x0cf, + Key_ETH = 0x0d0, + Key_Ntilde = 0x0d1, + Key_Ograve = 0x0d2, + Key_Oacute = 0x0d3, + Key_Ocircumflex = 0x0d4, + Key_Otilde = 0x0d5, + Key_Odiaeresis = 0x0d6, + Key_multiply = 0x0d7, + Key_Ooblique = 0x0d8, + Key_Ugrave = 0x0d9, + Key_Uacute = 0x0da, + Key_Ucircumflex = 0x0db, + Key_Udiaeresis = 0x0dc, + Key_Yacute = 0x0dd, + Key_THORN = 0x0de, + Key_ssharp = 0x0df, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_agrave = Key_Agrave, + Key_aacute = Key_Aacute, + Key_acircumflex = Key_Acircumflex, + Key_atilde = Key_Atilde, + Key_adiaeresis = Key_Adiaeresis, + Key_aring = Key_Aring, + Key_ae = Key_AE, + Key_ccedilla = Key_Ccedilla, + Key_egrave = Key_Egrave, + Key_eacute = Key_Eacute, + Key_ecircumflex = Key_Ecircumflex, + Key_ediaeresis = Key_Ediaeresis, + Key_igrave = Key_Igrave, + Key_iacute = Key_Iacute, + Key_icircumflex = Key_Icircumflex, + Key_idiaeresis = Key_Idiaeresis, + Key_eth = Key_ETH, + Key_ntilde = Key_Ntilde, + Key_ograve = Key_Ograve, + Key_oacute = Key_Oacute, + Key_ocircumflex = Key_Ocircumflex, + Key_otilde = Key_Otilde, + Key_odiaeresis = Key_Odiaeresis, +#endif + Key_division = 0x0f7, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_oslash = Key_Ooblique, + Key_ugrave = Key_Ugrave, + Key_uacute = Key_Uacute, + Key_ucircumflex = Key_Ucircumflex, + Key_udiaeresis = Key_Udiaeresis, + Key_yacute = Key_Yacute, + Key_thorn = Key_THORN, +#endif + Key_ydiaeresis = 0x0ff, + + // International input method support (X keycode - 0xEE00, the + // definition follows Qt/Embedded 2.3.7) Only interesting if + // you are writing your own input method + + // International & multi-key character composition + Key_AltGr = 0x01001103, + Key_Multi_key = 0x01001120, // Multi-key character compose + Key_Codeinput = 0x01001137, + Key_SingleCandidate = 0x0100113c, + Key_MultipleCandidate = 0x0100113d, + Key_PreviousCandidate = 0x0100113e, + + // Misc Functions + Key_Mode_switch = 0x0100117e, // Character set switch + //Key_script_switch = 0x0100117e, // Alias for mode_switch + + // Japanese keyboard support + Key_Kanji = 0x01001121, // Kanji, Kanji convert + Key_Muhenkan = 0x01001122, // Cancel Conversion + //Key_Henkan_Mode = 0x01001123, // Start/Stop Conversion + Key_Henkan = 0x01001123, // Alias for Henkan_Mode + Key_Romaji = 0x01001124, // to Romaji + Key_Hiragana = 0x01001125, // to Hiragana + Key_Katakana = 0x01001126, // to Katakana + Key_Hiragana_Katakana = 0x01001127, // Hiragana/Katakana toggle + Key_Zenkaku = 0x01001128, // to Zenkaku + Key_Hankaku = 0x01001129, // to Hankaku + Key_Zenkaku_Hankaku = 0x0100112a, // Zenkaku/Hankaku toggle + Key_Touroku = 0x0100112b, // Add to Dictionary + Key_Massyo = 0x0100112c, // Delete from Dictionary + Key_Kana_Lock = 0x0100112d, // Kana Lock + Key_Kana_Shift = 0x0100112e, // Kana Shift + Key_Eisu_Shift = 0x0100112f, // Alphanumeric Shift + Key_Eisu_toggle = 0x01001130, // Alphanumeric toggle + //Key_Kanji_Bangou = 0x01001137, // Codeinput + //Key_Zen_Koho = 0x0100113d, // Multiple/All Candidate(s) + //Key_Mae_Koho = 0x0100113e, // Previous Candidate + + // Korean keyboard support + // + // In fact, many Korean users need only 2 keys, Key_Hangul and + // Key_Hangul_Hanja. But rest of the keys are good for future. + + Key_Hangul = 0x01001131, // Hangul start/stop(toggle) + Key_Hangul_Start = 0x01001132, // Hangul start + Key_Hangul_End = 0x01001133, // Hangul end, English start + Key_Hangul_Hanja = 0x01001134, // Start Hangul->Hanja Conversion + Key_Hangul_Jamo = 0x01001135, // Hangul Jamo mode + Key_Hangul_Romaja = 0x01001136, // Hangul Romaja mode + //Key_Hangul_Codeinput = 0x01001137, // Hangul code input mode + Key_Hangul_Jeonja = 0x01001138, // Jeonja mode + Key_Hangul_Banja = 0x01001139, // Banja mode + Key_Hangul_PreHanja = 0x0100113a, // Pre Hanja conversion + Key_Hangul_PostHanja = 0x0100113b, // Post Hanja conversion + //Key_Hangul_SingleCandidate = 0x0100113c, // Single candidate + //Key_Hangul_MultipleCandidate = 0x0100113d, // Multiple candidate + //Key_Hangul_PreviousCandidate = 0x0100113e, // Previous candidate + Key_Hangul_Special = 0x0100113f, // Special symbols + //Key_Hangul_switch = 0x0100117e, // Alias for mode_switch + + // dead keys (X keycode - 0xED00 to avoid the conflict) + Key_Dead_Grave = 0x01001250, + Key_Dead_Acute = 0x01001251, + Key_Dead_Circumflex = 0x01001252, + Key_Dead_Tilde = 0x01001253, + Key_Dead_Macron = 0x01001254, + Key_Dead_Breve = 0x01001255, + Key_Dead_Abovedot = 0x01001256, + Key_Dead_Diaeresis = 0x01001257, + Key_Dead_Abovering = 0x01001258, + Key_Dead_Doubleacute = 0x01001259, + Key_Dead_Caron = 0x0100125a, + Key_Dead_Cedilla = 0x0100125b, + Key_Dead_Ogonek = 0x0100125c, + Key_Dead_Iota = 0x0100125d, + Key_Dead_Voiced_Sound = 0x0100125e, + Key_Dead_Semivoiced_Sound = 0x0100125f, + Key_Dead_Belowdot = 0x01001260, + Key_Dead_Hook = 0x01001261, + Key_Dead_Horn = 0x01001262, + + // multimedia/internet keys - ignored by default - see QKeyEvent c'tor + Key_Back = 0x01000061, + Key_Forward = 0x01000062, + Key_Stop = 0x01000063, + Key_Refresh = 0x01000064, + Key_VolumeDown = 0x01000070, + Key_VolumeMute = 0x01000071, + Key_VolumeUp = 0x01000072, + Key_BassBoost = 0x01000073, + Key_BassUp = 0x01000074, + Key_BassDown = 0x01000075, + Key_TrebleUp = 0x01000076, + Key_TrebleDown = 0x01000077, + Key_MediaPlay = 0x01000080, + Key_MediaStop = 0x01000081, + Key_MediaPrevious = 0x01000082, +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + Key_MediaPrev = Key_MediaPrevious, +#endif + Key_MediaNext = 0x01000083, + Key_MediaRecord = 0x01000084, + Key_HomePage = 0x01000090, + Key_Favorites = 0x01000091, + Key_Search = 0x01000092, + Key_Standby = 0x01000093, + Key_OpenUrl = 0x01000094, + Key_LaunchMail = 0x010000a0, + Key_LaunchMedia = 0x010000a1, + Key_Launch0 = 0x010000a2, + Key_Launch1 = 0x010000a3, + Key_Launch2 = 0x010000a4, + Key_Launch3 = 0x010000a5, + Key_Launch4 = 0x010000a6, + Key_Launch5 = 0x010000a7, + Key_Launch6 = 0x010000a8, + Key_Launch7 = 0x010000a9, + Key_Launch8 = 0x010000aa, + Key_Launch9 = 0x010000ab, + Key_LaunchA = 0x010000ac, + Key_LaunchB = 0x010000ad, + Key_LaunchC = 0x010000ae, + Key_LaunchD = 0x010000af, + Key_LaunchE = 0x010000b0, + Key_LaunchF = 0x010000b1, + Key_MonBrightnessUp = 0x010000b2, + Key_MonBrightnessDown = 0x010000b3, + Key_KeyboardLightOnOff = 0x010000b4, + Key_KeyboardBrightnessUp = 0x010000b5, + Key_KeyboardBrightnessDown = 0x010000b6, + Key_PowerOff = 0x010000b7, + Key_WakeUp = 0x010000b8, + Key_Eject = 0x010000b9, + Key_ScreenSaver = 0x010000ba, + Key_WWW = 0x010000bb, + Key_Memo = 0x010000bc, + Key_LightBulb = 0x010000bd, + Key_Shop = 0x010000be, + Key_History = 0x010000bf, + Key_AddFavorite = 0x010000c0, + Key_HotLinks = 0x010000c1, + Key_BrightnessAdjust = 0x010000c2, + Key_Finance = 0x010000c3, + Key_Community = 0x010000c4, + Key_AudioRewind = 0x010000c5, + Key_BackForward = 0x010000c6, + Key_ApplicationLeft = 0x010000c7, + Key_ApplicationRight = 0x010000c8, + Key_Book = 0x010000c9, + Key_CD = 0x010000ca, + Key_Calculator = 0x010000cb, + Key_ToDoList = 0x010000cc, + Key_ClearGrab = 0x010000cd, + Key_Close = 0x010000ce, + Key_Copy = 0x010000cf, + Key_Cut = 0x010000d0, + Key_Display = 0x010000d1, + Key_DOS = 0x010000d2, + Key_Documents = 0x010000d3, + Key_Excel = 0x010000d4, + Key_Explorer = 0x010000d5, + Key_Game = 0x010000d6, + Key_Go = 0x010000d7, + Key_iTouch = 0x010000d8, + Key_LogOff = 0x010000d9, + Key_Market = 0x010000da, + Key_Meeting = 0x010000db, + Key_MenuKB = 0x010000dc, + Key_MenuPB = 0x010000dd, + Key_MySites = 0x010000de, + Key_News = 0x010000df, + Key_OfficeHome = 0x010000e0, + Key_Option = 0x010000e1, + Key_Paste = 0x010000e2, + Key_Phone = 0x010000e3, + Key_Calendar = 0x010000e4, + Key_Reply = 0x010000e5, + Key_Reload = 0x010000e6, + Key_RotateWindows = 0x010000e7, + Key_RotationPB = 0x010000e8, + Key_RotationKB = 0x010000e9, + Key_Save = 0x010000ea, + Key_Send = 0x010000eb, + Key_Spell = 0x010000ec, + Key_SplitScreen = 0x010000ed, + Key_Support = 0x010000ee, + Key_TaskPane = 0x010000ef, + Key_Terminal = 0x010000f0, + Key_Tools = 0x010000f1, + Key_Travel = 0x010000f2, + Key_Video = 0x010000f3, + Key_Word = 0x010000f4, + Key_Xfer = 0x010000f5, + Key_ZoomIn = 0x010000f6, + Key_ZoomOut = 0x010000f7, + Key_Away = 0x010000f8, + Key_Messenger = 0x010000f9, + Key_WebCam = 0x010000fa, + Key_MailForward = 0x010000fb, + Key_Pictures = 0x010000fc, + Key_Music = 0x010000fd, + Key_Battery = 0x010000fe, + Key_Bluetooth = 0x010000ff, + Key_WLAN = 0x01000100, + Key_UWB = 0x01000101, + Key_AudioForward = 0x01000102, + Key_AudioRepeat = 0x01000103, + Key_AudioRandomPlay = 0x01000104, + Key_Subtitle = 0x01000105, + Key_AudioCycleTrack = 0x01000106, + Key_Time = 0x01000107, + Key_Hibernate = 0x01000108, + Key_View = 0x01000109, + Key_TopMenu = 0x0100010a, + Key_PowerDown = 0x0100010b, + Key_Suspend = 0x0100010c, + Key_ContrastAdjust = 0x0100010d, + + Key_MediaLast = 0x0100ffff, + + // Keypad navigation keys + Key_Select = 0x01010000, + Key_Yes = 0x01010001, + Key_No = 0x01010002, + + // Newer misc keys + Key_Cancel = 0x01020001, + Key_Printer = 0x01020002, + Key_Execute = 0x01020003, + Key_Sleep = 0x01020004, + Key_Play = 0x01020005, // Not the same as Key_MediaPlay + Key_Zoom = 0x01020006, + //Key_Jisho = 0x01020007, // IME: Dictionary key + //Key_Oyayubi_Left = 0x01020008, // IME: Left Oyayubi key + //Key_Oyayubi_Right = 0x01020009, // IME: Right Oyayubi key + + // Device keys + Key_Context1 = 0x01100000, + Key_Context2 = 0x01100001, + Key_Context3 = 0x01100002, + Key_Context4 = 0x01100003, + Key_Call = 0x01100004, + Key_Hangup = 0x01100005, + Key_Flip = 0x01100006, + + Key_unknown = 0x01ffffff + }; + + enum ArrowType { + NoArrow, + UpArrow, + DownArrow, + LeftArrow, + RightArrow + }; + + enum PenStyle { // pen style + NoPen, + SolidLine, + DashLine, + DotLine, + DashDotLine, + DashDotDotLine, + CustomDashLine +#ifndef Q_MOC_RUN + , MPenStyle = 0x0f +#endif + }; + + enum PenCapStyle { // line endcap style + FlatCap = 0x00, + SquareCap = 0x10, + RoundCap = 0x20, + MPenCapStyle = 0x30 + }; + + enum PenJoinStyle { // line join style + MiterJoin = 0x00, + BevelJoin = 0x40, + RoundJoin = 0x80, + SvgMiterJoin = 0x100, + MPenJoinStyle = 0x1c0 + }; + + enum BrushStyle { // brush style + NoBrush, + SolidPattern, + Dense1Pattern, + Dense2Pattern, + Dense3Pattern, + Dense4Pattern, + Dense5Pattern, + Dense6Pattern, + Dense7Pattern, + HorPattern, + VerPattern, + CrossPattern, + BDiagPattern, + FDiagPattern, + DiagCrossPattern, + LinearGradientPattern, + RadialGradientPattern, + ConicalGradientPattern, + TexturePattern = 24 +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , CustomPattern = TexturePattern +#endif + }; + + enum SizeMode { + AbsoluteSize, + RelativeSize + }; + +#if defined(QT3_SUPPORT) +#if defined(Q_OS_MAC) +#ifndef qdoc + typedef int MacintoshVersion; + + enum +#else + enum MacintoshVersion +#endif + { + //Unknown + MV_Unknown = 0x0000, + + //Version numbers + MV_9 = QSysInfo::MV_9, + MV_10_DOT_0 = QSysInfo::MV_10_0, + MV_10_DOT_1 = QSysInfo::MV_10_1, + MV_10_DOT_2 = QSysInfo::MV_10_2, + MV_10_DOT_3 = QSysInfo::MV_10_3, + MV_10_DOT_4 = QSysInfo::MV_10_4, + + //Code names + MV_CHEETAH = QSysInfo::MV_CHEETAH, + MV_PUMA = QSysInfo::MV_PUMA, + MV_JAGUAR = QSysInfo::MV_JAGUAR, + MV_PANTHER = QSysInfo::MV_PANTHER, + MV_TIGER = QSysInfo::MV_TIGER + }; +#endif // Q_OS_MAC + +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) +#ifndef qdoc + typedef int WindowsVersion; + + enum +#else + enum WindowsVersion +#endif + { + WV_32s = QSysInfo::WV_32s, + WV_95 = QSysInfo::WV_95, + WV_98 = QSysInfo::WV_98, + WV_Me = QSysInfo::WV_Me, + WV_DOS_based= QSysInfo::WV_DOS_based, + + WV_NT = QSysInfo::WV_NT, + WV_2000 = QSysInfo::WV_2000, + WV_XP = QSysInfo::WV_XP, + WV_2003 = QSysInfo::WV_2003, + WV_NT_based = QSysInfo::WV_NT_based, + + WV_CE = QSysInfo::WV_CE, + WV_CENET = QSysInfo::WV_CENET, + WV_CE_5 = QSysInfo::WV_CE_5, + WV_CE_6 = QSysInfo::WV_CE_6, + WV_CE_based = QSysInfo::WV_CE_based + }; +#endif // Q_OS_WIN +#endif // QT3_SUPPORT + + enum UIEffect { + UI_General, + UI_AnimateMenu, + UI_FadeMenu, + UI_AnimateCombo, + UI_AnimateTooltip, + UI_FadeTooltip, + UI_AnimateToolBox + }; + + enum CursorShape { + ArrowCursor, + UpArrowCursor, + CrossCursor, + WaitCursor, + IBeamCursor, + SizeVerCursor, + SizeHorCursor, + SizeBDiagCursor, + SizeFDiagCursor, + SizeAllCursor, + BlankCursor, + SplitVCursor, + SplitHCursor, + PointingHandCursor, + ForbiddenCursor, + WhatsThisCursor, + BusyCursor, + OpenHandCursor, + ClosedHandCursor, + LastCursor = ClosedHandCursor, + BitmapCursor = 24, + CustomCursor = 25 + +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , + arrowCursor = ArrowCursor, + upArrowCursor = UpArrowCursor, + crossCursor = CrossCursor, + waitCursor = WaitCursor, + ibeamCursor = IBeamCursor, + sizeVerCursor = SizeVerCursor, + sizeHorCursor = SizeHorCursor, + sizeBDiagCursor = SizeBDiagCursor, + sizeFDiagCursor = SizeFDiagCursor, + sizeAllCursor = SizeAllCursor, + blankCursor = BlankCursor, + splitVCursor = SplitVCursor, + splitHCursor = SplitHCursor, + pointingHandCursor = PointingHandCursor, + forbiddenCursor = ForbiddenCursor, + whatsThisCursor = WhatsThisCursor +#endif + }; + + enum TextFormat { + PlainText, + RichText, + AutoText, + LogText + }; + + enum AspectRatioMode { + IgnoreAspectRatio, + KeepAspectRatio, + KeepAspectRatioByExpanding +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , ScaleFree = IgnoreAspectRatio, + ScaleMin = KeepAspectRatio, + ScaleMax = KeepAspectRatioByExpanding +#endif + }; +#ifdef QT3_SUPPORT + typedef AspectRatioMode ScaleMode; +#endif + + // This is for Q3TextEdit only, actually. + enum AnchorAttribute { + AnchorName, + AnchorHref + }; + + enum DockWidgetArea { + LeftDockWidgetArea = 0x1, + RightDockWidgetArea = 0x2, + TopDockWidgetArea = 0x4, + BottomDockWidgetArea = 0x8, + + DockWidgetArea_Mask = 0xf, + AllDockWidgetAreas = DockWidgetArea_Mask, + NoDockWidgetArea = 0 + }; + enum DockWidgetAreaSizes { + NDockWidgetAreas = 4 + }; + + Q_DECLARE_FLAGS(DockWidgetAreas, DockWidgetArea) + + enum ToolBarArea { + LeftToolBarArea = 0x1, + RightToolBarArea = 0x2, + TopToolBarArea = 0x4, + BottomToolBarArea = 0x8, + + ToolBarArea_Mask = 0xf, + AllToolBarAreas = ToolBarArea_Mask, + NoToolBarArea = 0 + }; + + enum ToolBarAreaSizes { + NToolBarAreas = 4 + }; + + Q_DECLARE_FLAGS(ToolBarAreas, ToolBarArea) + +#ifdef QT3_SUPPORT + enum Dock { + DockUnmanaged, + DockTornOff, + DockTop, + DockBottom, + DockRight, + DockLeft, + DockMinimized + , + Unmanaged = DockUnmanaged, + TornOff = DockTornOff, + Top = DockTop, + Bottom = DockBottom, + Right = DockRight, + Left = DockLeft, + Minimized = DockMinimized + }; + // compatibility + typedef Dock ToolBarDock; +#endif + + enum DateFormat { + TextDate, // default Qt + ISODate, // ISO 8601 + SystemLocaleDate, // deprecated + LocalDate = SystemLocaleDate, // deprecated + LocaleDate, // deprecated + SystemLocaleShortDate, + SystemLocaleLongDate, + DefaultLocaleShortDate, + DefaultLocaleLongDate + }; + + enum TimeSpec { + LocalTime, + UTC, + OffsetFromUTC + }; + + enum DayOfWeek { + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, + Sunday = 7 + }; + + enum ScrollBarPolicy { + ScrollBarAsNeeded, + ScrollBarAlwaysOff, + ScrollBarAlwaysOn + }; + +#ifdef QT3_SUPPORT + enum BackgroundMode { + FixedColor, + FixedPixmap, + NoBackground, + PaletteForeground, + PaletteButton, + PaletteLight, + PaletteMidlight, + PaletteDark, + PaletteMid, + PaletteText, + PaletteBrightText, + PaletteBase, + PaletteBackground, + PaletteShadow, + PaletteHighlight, + PaletteHighlightedText, + PaletteButtonText, + PaletteLink, + PaletteLinkVisited, + X11ParentRelative + }; +#endif + + enum CaseSensitivity { + CaseInsensitive, + CaseSensitive + }; + + enum Corner { + TopLeftCorner = 0x00000, + TopRightCorner = 0x00001, + BottomLeftCorner = 0x00002, + BottomRightCorner = 0x00003 +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + ,TopLeft = TopLeftCorner, + TopRight = TopRightCorner, + BottomLeft = BottomLeftCorner, + BottomRight = BottomRightCorner +#endif + }; + + enum ConnectionType { + AutoConnection, + DirectConnection, + QueuedConnection, + AutoCompatConnection, + BlockingQueuedConnection, + UniqueConnection = 0x80 + }; + + enum ShortcutContext { + WidgetShortcut, + WindowShortcut, + ApplicationShortcut, + WidgetWithChildrenShortcut + }; + + enum FillRule { + OddEvenFill, + WindingFill + }; + + enum MaskMode { + MaskInColor, + MaskOutColor + }; + + enum ClipOperation { + NoClip, + ReplaceClip, + IntersectClip, + UniteClip + }; + + // Shape = 0x1, BoundingRect = 0x2 + enum ItemSelectionMode { + ContainsItemShape = 0x0, + IntersectsItemShape = 0x1, + ContainsItemBoundingRect = 0x2, + IntersectsItemBoundingRect = 0x3 + }; + + enum TransformationMode { + FastTransformation, + SmoothTransformation + }; + + enum Axis { + XAxis, + YAxis, + ZAxis + }; + + enum FocusReason { + MouseFocusReason, + TabFocusReason, + BacktabFocusReason, + ActiveWindowFocusReason, + PopupFocusReason, + ShortcutFocusReason, + MenuBarFocusReason, + OtherFocusReason, + NoFocusReason + }; + + enum ContextMenuPolicy { + NoContextMenu, + DefaultContextMenu, + ActionsContextMenu, + CustomContextMenu, + PreventContextMenu + }; + + enum InputMethodQuery { + ImMicroFocus, + ImFont, + ImCursorPosition, + ImSurroundingText, + ImCurrentSelection, + ImMaximumTextLength, + ImAnchorPosition + }; + + enum InputMethodHint { + ImhNone = 0x0, + ImhHiddenText = 0x1, + ImhNoAutoUppercase = 0x2, + ImhPreferNumbers = 0x4, + ImhPreferUppercase = 0x8, + ImhPreferLowercase = 0x10, + ImhNoPredictiveText = 0x20, + + ImhDigitsOnly = 0x10000, + ImhFormattedNumbersOnly = 0x20000, + ImhUppercaseOnly = 0x40000, + ImhLowercaseOnly = 0x80000, + ImhDialableCharactersOnly = 0x100000, + ImhEmailCharactersOnly = 0x200000, + ImhUrlCharactersOnly = 0x400000, + + ImhExclusiveInputMask = 0xffff0000 + }; + Q_DECLARE_FLAGS(InputMethodHints, InputMethodHint) + + enum ToolButtonStyle { + ToolButtonIconOnly, + ToolButtonTextOnly, + ToolButtonTextBesideIcon, + ToolButtonTextUnderIcon, + ToolButtonFollowStyle + }; + + enum LayoutDirection { + LeftToRight, + RightToLeft + }; + + enum AnchorPoint { + AnchorLeft = 0, + AnchorHorizontalCenter, + AnchorRight, + AnchorTop, + AnchorVerticalCenter, + AnchorBottom + }; + + + + enum DropAction { + CopyAction = 0x1, + MoveAction = 0x2, + LinkAction = 0x4, + ActionMask = 0xff, + TargetMoveAction = 0x8002, + IgnoreAction = 0x0 + }; + Q_DECLARE_FLAGS(DropActions, DropAction) + + enum CheckState { + Unchecked, + PartiallyChecked, + Checked + }; + + enum ItemDataRole { + DisplayRole = 0, + DecorationRole = 1, + EditRole = 2, + ToolTipRole = 3, + StatusTipRole = 4, + WhatsThisRole = 5, + // Metadata + FontRole = 6, + TextAlignmentRole = 7, + BackgroundColorRole = 8, + BackgroundRole = 8, + TextColorRole = 9, + ForegroundRole = 9, + CheckStateRole = 10, + // Accessibility + AccessibleTextRole = 11, + AccessibleDescriptionRole = 12, + // More general purpose + SizeHintRole = 13, + // Internal UiLib roles. Start worrying when public roles go that high. + DisplayPropertyRole = 27, + DecorationPropertyRole = 28, + ToolTipPropertyRole = 29, + StatusTipPropertyRole = 30, + WhatsThisPropertyRole = 31, + // Reserved + UserRole = 32 + }; + + enum ItemFlag { + NoItemFlags = 0, + ItemIsSelectable = 1, + ItemIsEditable = 2, + ItemIsDragEnabled = 4, + ItemIsDropEnabled = 8, + ItemIsUserCheckable = 16, + ItemIsEnabled = 32, + ItemIsTristate = 64 + }; + Q_DECLARE_FLAGS(ItemFlags, ItemFlag) + + enum MatchFlag { + MatchExactly = 0, + MatchContains = 1, + MatchStartsWith = 2, + MatchEndsWith = 3, + MatchRegExp = 4, + MatchWildcard = 5, + MatchFixedString = 8, + MatchCaseSensitive = 16, + MatchWrap = 32, + MatchRecursive = 64 + }; + Q_DECLARE_FLAGS(MatchFlags, MatchFlag) + +#if defined(Q_WS_MAC) + typedef void * HANDLE; +#elif defined(Q_WS_WIN) + typedef void *HANDLE; +#elif defined(Q_WS_X11) + typedef unsigned long HANDLE; +#elif defined(Q_WS_QWS) + typedef void * HANDLE; +#elif defined(Q_OS_SYMBIAN) + typedef unsigned long int HANDLE; // equivalent to TUint32 +#endif + typedef WindowFlags WFlags; + + enum WindowModality { + NonModal, + WindowModal, + ApplicationModal + }; + + enum TextInteractionFlag { + NoTextInteraction = 0, + TextSelectableByMouse = 1, + TextSelectableByKeyboard = 2, + LinksAccessibleByMouse = 4, + LinksAccessibleByKeyboard = 8, + TextEditable = 16, + + TextEditorInteraction = TextSelectableByMouse | TextSelectableByKeyboard | TextEditable, + TextBrowserInteraction = TextSelectableByMouse | LinksAccessibleByMouse | LinksAccessibleByKeyboard + }; + Q_DECLARE_FLAGS(TextInteractionFlags, TextInteractionFlag) + + enum EventPriority { + HighEventPriority = 1, + NormalEventPriority = 0, + LowEventPriority = -1 + }; + + enum SizeHint { + MinimumSize, + PreferredSize, + MaximumSize, + MinimumDescent, + NSizeHints + }; + + enum WindowFrameSection { + NoSection, + LeftSection, // For resize + TopLeftSection, + TopSection, + TopRightSection, + RightSection, + BottomRightSection, + BottomSection, + BottomLeftSection, + TitleBarArea // For move + }; + + enum Initialization { + Uninitialized + }; + + enum CoordinateSystem { + DeviceCoordinates, + LogicalCoordinates + }; + + enum TouchPointState { + TouchPointPressed = 0x01, + TouchPointMoved = 0x02, + TouchPointStationary = 0x04, + TouchPointReleased = 0x08, + TouchPointStateMask = 0x0f, + + TouchPointPrimary = 0x10 + }; + Q_DECLARE_FLAGS(TouchPointStates, TouchPointState) + + enum GestureState + { + NoGesture, + GestureStarted = 1, + GestureUpdated = 2, + GestureFinished = 3, + GestureCanceled = 4 + }; + + enum GestureType + { + TapGesture = 1, + TapAndHoldGesture = 2, + PanGesture = 3, + PinchGesture = 4, + SwipeGesture = 5, + + CustomGesture = 0x0100, + + LastGestureType = ~0u + }; + + enum GestureFlag + { + DontStartGestureOnChildren = 0x01, + ReceivePartialGestures = 0x02 + }; + Q_DECLARE_FLAGS(GestureFlags, GestureFlag) + + enum NavigationMode + { + NavigationModeNone, + NavigationModeKeypadTabOrder, + NavigationModeKeypadDirectional, + NavigationModeCursorAuto, + NavigationModeCursorForceVisible + }; +} +#ifdef Q_MOC_RUN + ; +#endif + +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MouseButtons) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::Orientations) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::KeyboardModifiers) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::WindowFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::Alignment) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::ImageConversionFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::DockWidgetAreas) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::ToolBarAreas) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::WindowStates) +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::InputMethodHints) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureFlags) + +typedef bool (*qInternalCallback)(void **); + +class Q_CORE_EXPORT QInternal { +public: + enum PaintDeviceFlags { + UnknownDevice = 0x00, + Widget = 0x01, + Pixmap = 0x02, + Image = 0x03, + Printer = 0x04, + Picture = 0x05, + Pbuffer = 0x06, // GL pbuffer + FramebufferObject = 0x07, // GL framebuffer object + CustomRaster = 0x08, + MacQuartz = 0x09, + PaintBuffer = 0x0a, + OpenGL = 0x0b + }; + enum RelayoutType { + RelayoutNormal, + RelayoutDragging, + RelayoutDropped + }; + + + enum Callback { + ConnectCallback, + DisconnectCallback, + AdoptCurrentThread, + EventNotifyCallback, + LastCallback + }; + + enum InternalFunction { + CreateThreadForAdoption, + RefAdoptedThread, + DerefAdoptedThread, + SetCurrentThreadToMainThread, + SetQObjectSender, + GetQObjectSender, + ResetQObjectSender, + LastInternalFunction + }; + + enum DockPosition { + LeftDock, + RightDock, + TopDock, + BottomDock, + DockCount + }; + + static bool registerCallback(Callback, qInternalCallback); + static bool unregisterCallback(Callback, qInternalCallback); + + static bool activateCallbacks(Callback, void **); + static bool callFunction(InternalFunction func, void **); +}; + +#ifdef QT3_SUPPORT +typedef qint32 QCOORD; // coordinate type +enum { + QCOORD_MAX = 2147483647, + QCOORD_MIN = -QCOORD_MAX - 1 +}; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QNAMESPACE_H diff --git a/qtinterface/qt4/Qt/qnetworkaccessmanager.h b/qtinterface/qt4/Qt/qnetworkaccessmanager.h new file mode 100644 index 0000000..d6fc30b --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkaccessmanager.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKACCESSMANAGER_H +#define QNETWORKACCESSMANAGER_H + +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QIODevice; +class QAbstractNetworkCache; +class QAuthenticator; +class QByteArray; +template<typename T> class QList; +class QNetworkCookie; +class QNetworkCookieJar; +class QNetworkRequest; +class QNetworkReply; +class QNetworkProxy; +class QNetworkProxyFactory; +class QSslError; + +class QNetworkReplyImplPrivate; +class QNetworkAccessManagerPrivate; +class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject +{ + Q_OBJECT +public: + enum Operation { + HeadOperation = 1, + GetOperation, + PutOperation, + PostOperation, + DeleteOperation, + + UnknownOperation = 0 + }; + + explicit QNetworkAccessManager(QObject *parent = 0); + ~QNetworkAccessManager(); + +#ifndef QT_NO_NETWORKPROXY + QNetworkProxy proxy() const; + void setProxy(const QNetworkProxy &proxy); + QNetworkProxyFactory *proxyFactory() const; + void setProxyFactory(QNetworkProxyFactory *factory); +#endif + + QAbstractNetworkCache *cache() const; + void setCache(QAbstractNetworkCache *cache); + + QNetworkCookieJar *cookieJar() const; + void setCookieJar(QNetworkCookieJar *cookieJar); + + QNetworkReply *head(const QNetworkRequest &request); + QNetworkReply *get(const QNetworkRequest &request); + QNetworkReply *post(const QNetworkRequest &request, QIODevice *data); + QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data); + QNetworkReply *put(const QNetworkRequest &request, QIODevice *data); + QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data); + QNetworkReply *deleteResource(const QNetworkRequest &request); + +Q_SIGNALS: +#ifndef QT_NO_NETWORKPROXY + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); +#endif + void authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator); + void finished(QNetworkReply *reply); +#ifndef QT_NO_OPENSSL + void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); +#endif + +protected: + virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, + QIODevice *outgoingData = 0); + +private: + friend class QNetworkReplyImplPrivate; + Q_DECLARE_PRIVATE(QNetworkAccessManager) + Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>)) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qnetworkcookie.h b/qtinterface/qt4/Qt/qnetworkcookie.h new file mode 100644 index 0000000..efacb75 --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkcookie.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKCOOKIE_H +#define QNETWORKCOOKIE_H + +#include <QtCore/QSharedDataPointer> +#include <QtCore/QList> +#include <QtCore/QMetaType> +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QByteArray; +class QDateTime; +class QString; +class QUrl; + +class QNetworkCookiePrivate; +class Q_NETWORK_EXPORT QNetworkCookie +{ +public: + enum RawForm { + NameAndValueOnly, + Full + }; + + QNetworkCookie(const QByteArray &name = QByteArray(), const QByteArray &value = QByteArray()); + QNetworkCookie(const QNetworkCookie &other); + ~QNetworkCookie(); + QNetworkCookie &operator=(const QNetworkCookie &other); + bool operator==(const QNetworkCookie &other) const; + inline bool operator!=(const QNetworkCookie &other) const + { return !(*this == other); } + + bool isSecure() const; + void setSecure(bool enable); + bool isHttpOnly() const; + void setHttpOnly(bool enable); + + bool isSessionCookie() const; + QDateTime expirationDate() const; + void setExpirationDate(const QDateTime &date); + + QString domain() const; + void setDomain(const QString &domain); + + QString path() const; + void setPath(const QString &path); + + QByteArray name() const; + void setName(const QByteArray &cookieName); + + QByteArray value() const; + void setValue(const QByteArray &value); + + QByteArray toRawForm(RawForm form = Full) const; + + static QList<QNetworkCookie> parseCookies(const QByteArray &cookieString); + +private: + QSharedDataPointer<QNetworkCookiePrivate> d; + friend class QNetworkCookiePrivate; +}; +Q_DECLARE_TYPEINFO(QNetworkCookie, Q_MOVABLE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &); +#endif + +QT_END_NAMESPACE + +// ### Qt5 remove this include +#include "qnetworkcookiejar.h" + +Q_DECLARE_METATYPE(QNetworkCookie) +Q_DECLARE_METATYPE(QList<QNetworkCookie>) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qnetworkcookiejar.h b/qtinterface/qt4/Qt/qnetworkcookiejar.h new file mode 100644 index 0000000..34db8db --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkcookiejar.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKCOOKIEJAR_H +#define QNETWORKCOOKIEJAR_H + +#include <QtCore/QObject> +#include <QtCore/QUrl> + +// ### Qt5 remove this include +#include "qnetworkcookie.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QNetworkCookieJarPrivate; +class Q_NETWORK_EXPORT QNetworkCookieJar: public QObject +{ + Q_OBJECT +public: + QNetworkCookieJar(QObject *parent = 0); + virtual ~QNetworkCookieJar(); + + virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const; + virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url); + +protected: + QList<QNetworkCookie> allCookies() const; + void setAllCookies(const QList<QNetworkCookie> &cookieList); + +private: + Q_DECLARE_PRIVATE(QNetworkCookieJar) + Q_DISABLE_COPY(QNetworkCookieJar) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qnetworkdiskcache.h b/qtinterface/qt4/Qt/qnetworkdiskcache.h new file mode 100644 index 0000000..8a63ed1 --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkdiskcache.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKDISKCACHE_H +#define QNETWORKDISKCACHE_H + +#include <QtNetwork/qabstractnetworkcache.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_NETWORKDISKCACHE + +class QNetworkDiskCachePrivate; +class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache +{ + Q_OBJECT + +public: + explicit QNetworkDiskCache(QObject *parent = 0); + ~QNetworkDiskCache(); + + QString cacheDirectory() const; + void setCacheDirectory(const QString &cacheDir); + + qint64 maximumCacheSize() const; + void setMaximumCacheSize(qint64 size); + + qint64 cacheSize() const; + QNetworkCacheMetaData metaData(const QUrl &url); + void updateMetaData(const QNetworkCacheMetaData &metaData); + QIODevice *data(const QUrl &url); + bool remove(const QUrl &url); + QIODevice *prepare(const QNetworkCacheMetaData &metaData); + void insert(QIODevice *device); + + QNetworkCacheMetaData fileMetaData(const QString &fileName) const; + +public Q_SLOTS: + void clear(); + +protected: + virtual qint64 expire(); + +private: + Q_DECLARE_PRIVATE(QNetworkDiskCache) + Q_DISABLE_COPY(QNetworkDiskCache) +}; + +#endif // QT_NO_NETWORKDISKCACHE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QNETWORKDISKCACHE_H diff --git a/qtinterface/qt4/Qt/qnetworkinterface.h b/qtinterface/qt4/Qt/qnetworkinterface.h new file mode 100644 index 0000000..95580c1 --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkinterface.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKINTERFACE_H +#define QNETWORKINTERFACE_H + +#include <QtCore/qshareddata.h> +#include <QtCore/qscopedpointer.h> +#include <QtNetwork/qhostaddress.h> + +#ifndef QT_NO_NETWORKINTERFACE + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +template<typename T> class QList; + +class QNetworkAddressEntryPrivate; +class Q_NETWORK_EXPORT QNetworkAddressEntry +{ +public: + QNetworkAddressEntry(); + QNetworkAddressEntry(const QNetworkAddressEntry &other); + QNetworkAddressEntry &operator=(const QNetworkAddressEntry &other); + ~QNetworkAddressEntry(); + bool operator==(const QNetworkAddressEntry &other) const; + inline bool operator!=(const QNetworkAddressEntry &other) const + { return !(*this == other); } + + QHostAddress ip() const; + void setIp(const QHostAddress &newIp); + + QHostAddress netmask() const; + void setNetmask(const QHostAddress &newNetmask); + int prefixLength() const; + void setPrefixLength(int length); + + QHostAddress broadcast() const; + void setBroadcast(const QHostAddress &newBroadcast); + +private: + QScopedPointer<QNetworkAddressEntryPrivate> d; +}; + +class QNetworkInterfacePrivate; +class Q_NETWORK_EXPORT QNetworkInterface +{ +public: + enum InterfaceFlag { + IsUp = 0x1, + IsRunning = 0x2, + CanBroadcast = 0x4, + IsLoopBack = 0x8, + IsPointToPoint = 0x10, + CanMulticast = 0x20 + }; + Q_DECLARE_FLAGS(InterfaceFlags, InterfaceFlag) + + QNetworkInterface(); + QNetworkInterface(const QNetworkInterface &other); + QNetworkInterface &operator=(const QNetworkInterface &other); + ~QNetworkInterface(); + + bool isValid() const; + + int index() const; + QString name() const; + QString humanReadableName() const; + InterfaceFlags flags() const; + QString hardwareAddress() const; + QList<QNetworkAddressEntry> addressEntries() const; + + static QNetworkInterface interfaceFromName(const QString &name); + static QNetworkInterface interfaceFromIndex(int index); + static QList<QNetworkInterface> allInterfaces(); + static QList<QHostAddress> allAddresses(); + +private: + friend class QNetworkInterfacePrivate; + QSharedDataPointer<QNetworkInterfacePrivate> d; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkInterface::InterfaceFlags) + +#ifndef QT_NO_DEBUG_STREAM +Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_NETWORKINTERFACE + +#endif diff --git a/qtinterface/qt4/Qt/qnetworkproxy.h b/qtinterface/qt4/Qt/qnetworkproxy.h new file mode 100644 index 0000000..864e7ab --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkproxy.h @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKPROXY_H +#define QNETWORKPROXY_H + +#include <QtNetwork/qhostaddress.h> +#include <QtCore/qshareddata.h> + +#ifndef QT_NO_NETWORKPROXY + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QUrl; + +class QNetworkProxyQueryPrivate; +class Q_NETWORK_EXPORT QNetworkProxyQuery +{ +public: + enum QueryType { + TcpSocket, + UdpSocket, + TcpServer = 100, + UrlRequest + }; + + QNetworkProxyQuery(); + QNetworkProxyQuery(const QUrl &requestUrl, QueryType queryType = UrlRequest); + QNetworkProxyQuery(const QString &hostname, int port, const QString &protocolTag = QString(), + QueryType queryType = TcpSocket); + QNetworkProxyQuery(quint16 bindPort, const QString &protocolTag = QString(), + QueryType queryType = TcpServer); + QNetworkProxyQuery(const QNetworkProxyQuery &other); + ~QNetworkProxyQuery(); + QNetworkProxyQuery &operator=(const QNetworkProxyQuery &other); + bool operator==(const QNetworkProxyQuery &other) const; + inline bool operator!=(const QNetworkProxyQuery &other) const + { return !(*this == other); } + + QueryType queryType() const; + void setQueryType(QueryType type); + + int peerPort() const; + void setPeerPort(int port); + + QString peerHostName() const; + void setPeerHostName(const QString &hostname); + + int localPort() const; + void setLocalPort(int port); + + QString protocolTag() const; + void setProtocolTag(const QString &protocolTag); + + QUrl url() const; + void setUrl(const QUrl &url); + +private: + QSharedDataPointer<QNetworkProxyQueryPrivate> d; +}; +Q_DECLARE_TYPEINFO(QNetworkProxyQuery, Q_MOVABLE_TYPE); + +class QNetworkProxyPrivate; + +class Q_NETWORK_EXPORT QNetworkProxy +{ +public: + enum ProxyType { + DefaultProxy, + Socks5Proxy, + NoProxy, + HttpProxy, + HttpCachingProxy, + FtpCachingProxy + }; + + enum Capability { + TunnelingCapability = 0x0001, + ListeningCapability = 0x0002, + UdpTunnelingCapability = 0x0004, + CachingCapability = 0x0008, + HostNameLookupCapability = 0x0010 + }; + Q_DECLARE_FLAGS(Capabilities, Capability) + + QNetworkProxy(); + QNetworkProxy(ProxyType type, const QString &hostName = QString(), quint16 port = 0, + const QString &user = QString(), const QString &password = QString()); + QNetworkProxy(const QNetworkProxy &other); + QNetworkProxy &operator=(const QNetworkProxy &other); + ~QNetworkProxy(); + bool operator==(const QNetworkProxy &other) const; + inline bool operator!=(const QNetworkProxy &other) const + { return !(*this == other); } + + void setType(QNetworkProxy::ProxyType type); + QNetworkProxy::ProxyType type() const; + + void setCapabilities(Capabilities capab); + Capabilities capabilities() const; + bool isCachingProxy() const; + bool isTransparentProxy() const; + + void setUser(const QString &userName); + QString user() const; + + void setPassword(const QString &password); + QString password() const; + + void setHostName(const QString &hostName); + QString hostName() const; + + void setPort(quint16 port); + quint16 port() const; + + static void setApplicationProxy(const QNetworkProxy &proxy); + static QNetworkProxy applicationProxy(); + +private: + QSharedDataPointer<QNetworkProxyPrivate> d; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkProxy::Capabilities) + +class Q_NETWORK_EXPORT QNetworkProxyFactory +{ +public: + QNetworkProxyFactory(); + virtual ~QNetworkProxyFactory(); + + virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0; + + static void setUseSystemConfiguration(bool enable); + static void setApplicationProxyFactory(QNetworkProxyFactory *factory); + static QList<QNetworkProxy> proxyForQuery(const QNetworkProxyQuery &query); + static QList<QNetworkProxy> systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery()); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_NETWORKPROXY + +#endif // QHOSTINFO_H diff --git a/qtinterface/qt4/Qt/qnetworkreply.h b/qtinterface/qt4/Qt/qnetworkreply.h new file mode 100644 index 0000000..f1aa624 --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkreply.h @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKREPLY_H +#define QNETWORKREPLY_H + +#include <QtCore/QIODevice> +#include <QtCore/QString> +#include <QtCore/QVariant> + +#include <QtNetwork/QNetworkRequest> +#include <QtNetwork/QNetworkAccessManager> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QUrl; +class QVariant; +class QAuthenticator; +class QSslConfiguration; +class QSslError; + +class QNetworkReplyPrivate; +class Q_NETWORK_EXPORT QNetworkReply: public QIODevice +{ + Q_OBJECT + Q_ENUMS(NetworkError) +public: + enum NetworkError { + NoError = 0, + + // network layer errors [relating to the destination server] (1-99): + ConnectionRefusedError = 1, + RemoteHostClosedError, + HostNotFoundError, + TimeoutError, + OperationCanceledError, + SslHandshakeFailedError, + UnknownNetworkError = 99, + + // proxy errors (101-199): + ProxyConnectionRefusedError = 101, + ProxyConnectionClosedError, + ProxyNotFoundError, + ProxyTimeoutError, + ProxyAuthenticationRequiredError, + UnknownProxyError = 199, + + // content errors (201-299): + ContentAccessDenied = 201, + ContentOperationNotPermittedError, + ContentNotFoundError, + AuthenticationRequiredError, + ContentReSendError, + UnknownContentError = 299, + + // protocol errors + ProtocolUnknownError = 301, + ProtocolInvalidOperationError, + ProtocolFailure = 399 + }; + + ~QNetworkReply(); + virtual void abort() = 0; + + // reimplemented from QIODevice + virtual void close(); + virtual bool isSequential() const; + + // like QAbstractSocket: + qint64 readBufferSize() const; + virtual void setReadBufferSize(qint64 size); + + QNetworkAccessManager *manager() const; + QNetworkAccessManager::Operation operation() const; + QNetworkRequest request() const; + NetworkError error() const; + bool isFinished() const; + bool isRunning() const; + QUrl url() const; + + // "cooked" headers + QVariant header(QNetworkRequest::KnownHeaders header) const; + + // raw headers: + bool hasRawHeader(const QByteArray &headerName) const; + QList<QByteArray> rawHeaderList() const; + QByteArray rawHeader(const QByteArray &headerName) const; + + // attributes + QVariant attribute(QNetworkRequest::Attribute code) const; + +#ifndef QT_NO_OPENSSL + QSslConfiguration sslConfiguration() const; + void setSslConfiguration(const QSslConfiguration &configuration); + void ignoreSslErrors(const QList<QSslError> &errors); +#endif + +public Q_SLOTS: + virtual void ignoreSslErrors(); + +Q_SIGNALS: + void metaDataChanged(); + void finished(); + void error(QNetworkReply::NetworkError); +#ifndef QT_NO_OPENSSL + void sslErrors(const QList<QSslError> &errors); +#endif + + void uploadProgress(qint64 bytesSent, qint64 bytesTotal); + void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); + +protected: + QNetworkReply(QObject *parent = 0); + QNetworkReply(QNetworkReplyPrivate &dd, QObject *parent); + virtual qint64 writeData(const char *data, qint64 len); + + void setOperation(QNetworkAccessManager::Operation operation); + void setRequest(const QNetworkRequest &request); + void setError(NetworkError errorCode, const QString &errorString); + void setUrl(const QUrl &url); + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + void setRawHeader(const QByteArray &headerName, const QByteArray &value); + void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); + +private: + Q_DECLARE_PRIVATE(QNetworkReply) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qnetworkrequest.h b/qtinterface/qt4/Qt/qnetworkrequest.h new file mode 100644 index 0000000..4aa8eda --- /dev/null +++ b/qtinterface/qt4/Qt/qnetworkrequest.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKREQUEST_H +#define QNETWORKREQUEST_H + +#include <QtCore/QSharedDataPointer> +#include <QtCore/QString> +#include <QtCore/QUrl> +#include <QtCore/QVariant> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QSslConfiguration; + +class QNetworkRequestPrivate; +class Q_NETWORK_EXPORT QNetworkRequest +{ +public: + enum KnownHeaders { + ContentTypeHeader, + ContentLengthHeader, + LocationHeader, + LastModifiedHeader, + CookieHeader, + SetCookieHeader + }; + enum Attribute { + HttpStatusCodeAttribute, + HttpReasonPhraseAttribute, + RedirectionTargetAttribute, + ConnectionEncryptedAttribute, + CacheLoadControlAttribute, + CacheSaveControlAttribute, + SourceIsFromCacheAttribute, + DoNotBufferUploadDataAttribute, + HttpPipeliningAllowedAttribute, + HttpPipeliningWasUsedAttribute, + + User = 1000, + UserMax = 32767 + }; + enum CacheLoadControl { + AlwaysNetwork, + PreferNetwork, + PreferCache, + AlwaysCache + }; + + explicit QNetworkRequest(const QUrl &url = QUrl()); + QNetworkRequest(const QNetworkRequest &other); + ~QNetworkRequest(); + QNetworkRequest &operator=(const QNetworkRequest &other); + + bool operator==(const QNetworkRequest &other) const; + inline bool operator!=(const QNetworkRequest &other) const + { return !operator==(other); } + + QUrl url() const; + void setUrl(const QUrl &url); + + // "cooked" headers + QVariant header(KnownHeaders header) const; + void setHeader(KnownHeaders header, const QVariant &value); + + // raw headers: + bool hasRawHeader(const QByteArray &headerName) const; + QList<QByteArray> rawHeaderList() const; + QByteArray rawHeader(const QByteArray &headerName) const; + void setRawHeader(const QByteArray &headerName, const QByteArray &value); + + // attributes + QVariant attribute(Attribute code, const QVariant &defaultValue = QVariant()) const; + void setAttribute(Attribute code, const QVariant &value); + +#ifndef QT_NO_OPENSSL + QSslConfiguration sslConfiguration() const; + void setSslConfiguration(const QSslConfiguration &configuration); +#endif + + void setOriginatingObject(QObject *object); + QObject *originatingObject() const; + +private: + QSharedDataPointer<QNetworkRequestPrivate> d; + friend class QNetworkRequestPrivate; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QNetworkRequest) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qnumeric.h b/qtinterface/qt4/Qt/qnumeric.h new file mode 100644 index 0000000..380b9d6 --- /dev/null +++ b/qtinterface/qt4/Qt/qnumeric.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNUMERIC_H +#define QNUMERIC_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +Q_CORE_EXPORT bool qIsInf(double d); +Q_CORE_EXPORT bool qIsNaN(double d); +Q_CORE_EXPORT bool qIsFinite(double d); +Q_CORE_EXPORT bool qIsInf(float f); +Q_CORE_EXPORT bool qIsNaN(float f); +Q_CORE_EXPORT bool qIsFinite(float f); +Q_CORE_EXPORT double qSNaN(); +Q_CORE_EXPORT double qQNaN(); +Q_CORE_EXPORT double qInf(); + +#define Q_INFINITY (QT_PREPEND_NAMESPACE(qInf)()) +#define Q_SNAN (QT_PREPEND_NAMESPACE(qSNaN)()) +#define Q_QNAN (QT_PREPEND_NAMESPACE(qQNaN)()) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QNUMERIC_H diff --git a/qtinterface/qt4/Qt/qobject.h b/qtinterface/qt4/Qt/qobject.h new file mode 100644 index 0000000..c3e94ed --- /dev/null +++ b/qtinterface/qt4/Qt/qobject.h @@ -0,0 +1,497 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOBJECT_H +#define QOBJECT_H + +#ifndef QT_NO_QOBJECT + +#include <QtCore/qobjectdefs.h> +#include <QtCore/qstring.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qlist.h> +#ifdef QT_INCLUDE_COMPAT +#include <QtCore/qcoreevent.h> +#endif +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QEvent; +class QTimerEvent; +class QChildEvent; +struct QMetaObject; +class QVariant; +class QObjectPrivate; +class QObject; +class QThread; +class QWidget; +#ifndef QT_NO_REGEXP +class QRegExp; +#endif +#ifndef QT_NO_USERDATA +class QObjectUserData; +#endif + +typedef QList<QObject*> QObjectList; + +#if defined Q_CC_MSVC && _MSC_VER < 1300 +template<typename T> inline T qFindChild(const QObject *o, const QString &name = QString(), T = 0); +template<typename T> inline QList<T> qFindChildren(const QObject *o, const QString &name = QString(), T = 0); +# ifndef QT_NO_REGEXP +template<typename T> inline QList<T> qFindChildren(const QObject *o, const QRegExp &re, T = 0); +# endif +#else +template<typename T> inline T qFindChild(const QObject *, const QString & = QString()); +template<typename T> inline QList<T> qFindChildren(const QObject *, const QString & = QString()); +# ifndef QT_NO_REGEXP +template<typename T> inline QList<T> qFindChildren(const QObject *, const QRegExp &); +# endif +#endif + +class +#if defined(__INTEL_COMPILER) && defined(Q_OS_WIN) +Q_CORE_EXPORT +#endif +QObjectData { +public: + virtual ~QObjectData() = 0; + QObject *q_ptr; + QObject *parent; + QObjectList children; + + uint isWidget : 1; + uint pendTimer : 1; + uint blockSig : 1; + uint wasDeleted : 1; + uint ownObjectName : 1; + uint sendChildEvents : 1; + uint receiveChildEvents : 1; + uint inEventHandler : 1; + uint inThreadChangeEvent : 1; + uint hasGuards : 1; //true iff there is one or more QPointer attached to this object + uint unused : 22; + int postedEvents; + QMetaObject *metaObject; // assert dynamic +}; + + +class Q_CORE_EXPORT QObject +{ + Q_OBJECT + Q_PROPERTY(QString objectName READ objectName WRITE setObjectName) + Q_DECLARE_PRIVATE(QObject) + +public: + Q_INVOKABLE explicit QObject(QObject *parent=0); + virtual ~QObject(); + + virtual bool event(QEvent *); + virtual bool eventFilter(QObject *, QEvent *); + +#ifdef qdoc + static QString tr(const char *sourceText, const char *comment = 0, int n = -1); + static QString trUtf8(const char *sourceText, const char *comment = 0, int n = -1); + virtual const QMetaObject *metaObject() const; + static const QMetaObject staticMetaObject; +#endif +#ifdef QT_NO_TRANSLATION + static QString tr(const char *sourceText, const char *, int) + { return QString::fromLatin1(sourceText); } + static QString tr(const char *sourceText, const char * = 0) + { return QString::fromLatin1(sourceText); } +#ifndef QT_NO_TEXTCODEC + static QString trUtf8(const char *sourceText, const char *, int) + { return QString::fromUtf8(sourceText); } + static QString trUtf8(const char *sourceText, const char * = 0) + { return QString::fromUtf8(sourceText); } +#endif +#endif //QT_NO_TRANSLATION + + QString objectName() const; + void setObjectName(const QString &name); + + inline bool isWidgetType() const { return d_ptr->isWidget; } + + inline bool signalsBlocked() const { return d_ptr->blockSig; } + bool blockSignals(bool b); + + QThread *thread() const; + void moveToThread(QThread *thread); + + int startTimer(int interval); + void killTimer(int id); + +#ifndef QT_NO_MEMBER_TEMPLATES + template<typename T> + inline T findChild(const QString &aName = QString()) const + { return qFindChild<T>(this, aName); } + + template<typename T> + inline QList<T> findChildren(const QString &aName = QString()) const + { return qFindChildren<T>(this, aName); } + +#ifndef QT_NO_REGEXP + template<typename T> + inline QList<T> findChildren(const QRegExp &re) const + { return qFindChildren<T>(this, re); } +#endif +#endif + +#ifdef QT3_SUPPORT + QT3_SUPPORT QObject *child(const char *objName, const char *inheritsClass = 0, + bool recursiveSearch = true) const; + QT3_SUPPORT QObjectList queryList(const char *inheritsClass = 0, + const char *objName = 0, + bool regexpMatch = true, + bool recursiveSearch = true) const; +#endif + inline const QObjectList &children() const { return d_ptr->children; } + + void setParent(QObject *); + void installEventFilter(QObject *); + void removeEventFilter(QObject *); + + + static bool connect(const QObject *sender, const char *signal, + const QObject *receiver, const char *member, Qt::ConnectionType = +#ifdef qdoc + Qt::AutoConnection +#else +#ifdef QT3_SUPPORT + Qt::AutoCompatConnection +#else + Qt::AutoConnection +#endif +#endif + ); + inline bool connect(const QObject *sender, const char *signal, + const char *member, Qt::ConnectionType type = +#ifdef qdoc + Qt::AutoConnection +#else +#ifdef QT3_SUPPORT + Qt::AutoCompatConnection +#else + Qt::AutoConnection +#endif +#endif + ) const; + + static bool disconnect(const QObject *sender, const char *signal, + const QObject *receiver, const char *member); + inline bool disconnect(const char *signal = 0, + const QObject *receiver = 0, const char *member = 0) + { return disconnect(this, signal, receiver, member); } + inline bool disconnect(const QObject *receiver, const char *member = 0) + { return disconnect(this, 0, receiver, member); } + + void dumpObjectTree(); + void dumpObjectInfo(); + +#ifndef QT_NO_PROPERTIES + bool setProperty(const char *name, const QVariant &value); + QVariant property(const char *name) const; + QList<QByteArray> dynamicPropertyNames() const; +#endif // QT_NO_PROPERTIES + +#ifndef QT_NO_USERDATA + static uint registerUserData(); + void setUserData(uint id, QObjectUserData* data); + QObjectUserData* userData(uint id) const; +#endif // QT_NO_USERDATA + +Q_SIGNALS: + void destroyed(QObject * = 0); + +public: + inline QObject *parent() const { return d_ptr->parent; } + + inline bool inherits(const char *classname) const + { return const_cast<QObject *>(this)->qt_metacast(classname) != 0; } + +public Q_SLOTS: + void deleteLater(); + +protected: + QObject *sender() const; + int receivers(const char* signal) const; + + virtual void timerEvent(QTimerEvent *); + virtual void childEvent(QChildEvent *); + virtual void customEvent(QEvent *); + + virtual void connectNotify(const char *signal); + virtual void disconnectNotify(const char *signal); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QObject(QObject *parent, const char *name); + inline QT3_SUPPORT void insertChild(QObject *o) + { if (o) o->setParent(this); } + inline QT3_SUPPORT void removeChild(QObject *o) + { if (o) o->setParent(0); } + inline QT3_SUPPORT bool isA(const char *classname) const + { return qstrcmp(classname, metaObject()->className()) == 0; } + inline QT3_SUPPORT const char *className() const { return metaObject()->className(); } + inline QT3_SUPPORT const char *name() const { return objectName().latin1_helper(); } + inline QT3_SUPPORT const char *name(const char *defaultName) const + { QString s = objectName(); return s.isEmpty()?defaultName:s.latin1_helper(); } + inline QT3_SUPPORT void setName(const char *aName) { setObjectName(QLatin1String(aName)); } +protected: + inline QT3_SUPPORT bool checkConnectArgs(const char *signal, + const QObject *, + const char *member) + { return QMetaObject::checkConnectArgs(signal, member); } + static inline QT3_SUPPORT QByteArray normalizeSignalSlot(const char *signalSlot) + { return QMetaObject::normalizedSignature(signalSlot); } +#endif + +protected: + QObject(QObjectPrivate &dd, QObject *parent = 0); + +protected: + QScopedPointer<QObjectData> d_ptr; + + static const QMetaObject staticQtMetaObject; + + friend struct QMetaObject; + friend class QApplication; + friend class QApplicationPrivate; + friend class QCoreApplication; + friend class QCoreApplicationPrivate; + friend class QWidget; + friend class QThreadData; + +private: + Q_DISABLE_COPY(QObject) + Q_PRIVATE_SLOT(d_func(), void _q_reregisterTimers(void *)) +}; + +inline bool QObject::connect(const QObject *asender, const char *asignal, + const char *amember, Qt::ConnectionType atype) const +{ return connect(asender, asignal, this, amember, atype); } + +#ifndef QT_NO_USERDATA +class Q_CORE_EXPORT QObjectUserData { +public: + virtual ~QObjectUserData(); +}; +#endif + +Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, + const QMetaObject &mo, QList<void *> *list); +Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo); + +#if defined Q_CC_MSVC && _MSC_VER < 1300 + +template<typename T> +inline T qFindChild(const QObject *o, const QString &name, T) +{ return static_cast<T>(qt_qFindChild_helper(o, name, ((T)0)->staticMetaObject)); } + +template<typename T> +inline QList<T> qFindChildren(const QObject *o, const QString &name, T) +{ + QList<T> list; + union { + QList<T> *typedList; + QList<void *> *voidList; + } u; + u.typedList = &list; + qt_qFindChildren_helper(o, name, 0, ((T)0)->staticMetaObject, u.voidList); + return list; +} + +template<typename T> +inline T qFindChild(const QObject *o, const QString &name) +{ return qFindChild<T>(o, name, T(0)); } + +template<typename T> +inline T qFindChild(const QObject *o) +{ return qFindChild<T>(o, QString(), T(0)); } + +template<typename T> +inline QList<T> qFindChildren(const QObject *o, const QString &name) +{ return qFindChildren<T>(o, name, T(0)); } + +template<typename T> +inline QList<T> qFindChildren(const QObject *o) +{ return qFindChildren<T>(o, QString(), T(0)); } + +#ifndef QT_NO_REGEXP +template<typename T> +inline QList<T> qFindChildren(const QObject *o, const QRegExp &re, T) +{ + QList<T> list; + union { + QList<T> *typedList; + QList<void *> *voidList; + } u; + u.typedList = &list; + qt_qFindChildren_helper(o, 0, &re, ((T)0)->staticMetaObject, u.voidList); + return list; +} + +template<typename T> +inline QList<T> qFindChildren(const QObject *o, const QRegExp &re) +{ return qFindChildren<T>(o, re, T(0)); } + +#endif + +#ifdef Q_MOC_RUN +# define Q_DECLARE_INTERFACE(IFace, IId) Q_DECLARE_INTERFACE(IFace, IId) +#endif // Q_MOC_RUN + + +template <class T> inline const char * qobject_interface_iid() +{ return 0; } + +template <class T> inline T qobject_cast_helper(QObject *object, T) +{ return static_cast<T>(((T)0)->staticMetaObject.cast(object)); } + +template <class T> inline T qobject_cast_helper(const QObject *object, T) +{ return static_cast<T>(const_cast<const QObject *>(((T)0)->staticMetaObject.cast(const_cast<QObject *>(object)))); } + +template <class T> +inline T qobject_cast(QObject *object) +{ return qobject_cast_helper<T>(object, T(0)); } + +template <class T> +inline T qobject_cast(const QObject *object) +{ return qobject_cast_helper<T>(object, T(0)); } + +#ifndef Q_MOC_RUN +# define Q_DECLARE_INTERFACE(IFace, IId) \ + template <> inline const char *qobject_interface_iid<IFace *>() \ + { return IId; } \ + template <> inline IFace *qobject_cast_helper<IFace *>(QObject *object, IFace *) \ + { return (IFace *)(object ? object->qt_metacast(IId) : 0); } \ + template <> inline IFace *qobject_cast_helper<IFace *>(const QObject *object, IFace *) \ + { return (IFace *)(object ? const_cast<QObject *>(object)->qt_metacast(IId) : 0); } +#endif // Q_MOC_RUN + +#else + +template<typename T> +inline T qFindChild(const QObject *o, const QString &name) +{ return static_cast<T>(qt_qFindChild_helper(o, name, reinterpret_cast<T>(0)->staticMetaObject)); } + +template<typename T> +inline QList<T> qFindChildren(const QObject *o, const QString &name) +{ + QList<T> list; + union { + QList<T> *typedList; + QList<void *> *voidList; + } u; + u.typedList = &list; + qt_qFindChildren_helper(o, name, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList); + return list; +} + +#ifndef QT_NO_REGEXP +template<typename T> +inline QList<T> qFindChildren(const QObject *o, const QRegExp &re) +{ + QList<T> list; + union { + QList<T> *typedList; + QList<void *> *voidList; + } u; + u.typedList = &list; + qt_qFindChildren_helper(o, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList); + return list; +} +#endif + +template <class T> +inline T qobject_cast(QObject *object) +{ +#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) + reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(object)); +#endif + return static_cast<T>(reinterpret_cast<T>(0)->staticMetaObject.cast(object)); +} + +template <class T> +inline T qobject_cast(const QObject *object) +{ + // this will cause a compilation error if T is not const + register T ptr = static_cast<T>(object); + Q_UNUSED(ptr); + +#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) + reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(const_cast<QObject *>(object))); +#endif + return static_cast<T>(const_cast<QObject *>(reinterpret_cast<T>(0)->staticMetaObject.cast(const_cast<QObject *>(object)))); +} + + +template <class T> inline const char * qobject_interface_iid() +{ return 0; } + +#ifndef Q_MOC_RUN +# define Q_DECLARE_INTERFACE(IFace, IId) \ + template <> inline const char *qobject_interface_iid<IFace *>() \ + { return IId; } \ + template <> inline IFace *qobject_cast<IFace *>(QObject *object) \ + { return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : 0)); } \ + template <> inline IFace *qobject_cast<IFace *>(const QObject *object) \ + { return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : 0)); } +#endif // Q_MOC_RUN + +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + +#endif // QOBJECT_H diff --git a/qtinterface/qt4/Qt/qobjectcleanuphandler.h b/qtinterface/qt4/Qt/qobjectcleanuphandler.h new file mode 100644 index 0000000..31a3eb0 --- /dev/null +++ b/qtinterface/qt4/Qt/qobjectcleanuphandler.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOBJECTCLEANUPHANDLER_H +#define QOBJECTCLEANUPHANDLER_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QObjectCleanupHandler : public QObject +{ + Q_OBJECT + +public: + QObjectCleanupHandler(); + ~QObjectCleanupHandler(); + + QObject* add(QObject* object); + void remove(QObject *object); + bool isEmpty() const; + void clear(); + +private: + // ### move into d pointer + QObjectList cleanupObjects; + +private Q_SLOTS: + void objectDestroyed(QObject *); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QOBJECTCLEANUPHANDLER_H diff --git a/qtinterface/qt4/Qt/qobjectdefs.h b/qtinterface/qt4/Qt/qobjectdefs.h new file mode 100644 index 0000000..a6cf2e4 --- /dev/null +++ b/qtinterface/qt4/Qt/qobjectdefs.h @@ -0,0 +1,484 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOBJECTDEFS_H +#define QOBJECTDEFS_H + +#include <QtCore/qnamespace.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QByteArray; + +class QString; + +#ifndef Q_MOC_OUTPUT_REVISION +#define Q_MOC_OUTPUT_REVISION 62 +#endif + +// The following macros are our "extensions" to C++ +// They are used, strictly speaking, only by the moc. + +#ifndef Q_MOC_RUN +# if defined(QT_NO_KEYWORDS) +# define QT_NO_EMIT +# else +# define slots +# define signals protected +# endif +# define Q_SLOTS +# define Q_SIGNALS protected +# define Q_PRIVATE_SLOT(d, signature) +# define Q_EMIT +#ifndef QT_NO_EMIT +# define emit +#endif +#define Q_CLASSINFO(name, value) +#define Q_INTERFACES(x) +#define Q_PROPERTY(text) +#define Q_OVERRIDE(text) +#define Q_ENUMS(x) +#define Q_FLAGS(x) +#ifdef QT3_SUPPORT +# define Q_SETS(x) +#endif +#define Q_SCRIPTABLE +#define Q_INVOKABLE +#define Q_SIGNAL +#define Q_SLOT + +#ifndef QT_NO_TRANSLATION +# ifndef QT_NO_TEXTCODEC +// full set of tr functions +// ### Qt 5: merge overloads +# define QT_TR_FUNCTIONS \ + static inline QString tr(const char *s, const char *c = 0) \ + { return staticMetaObject.tr(s, c); } \ + static inline QString trUtf8(const char *s, const char *c = 0) \ + { return staticMetaObject.trUtf8(s, c); } \ + static inline QString tr(const char *s, const char *c, int n) \ + { return staticMetaObject.tr(s, c, n); } \ + static inline QString trUtf8(const char *s, const char *c, int n) \ + { return staticMetaObject.trUtf8(s, c, n); } +# else +// no QTextCodec, no utf8 +// ### Qt 5: merge overloads +# define QT_TR_FUNCTIONS \ + static inline QString tr(const char *s, const char *c = 0) \ + { return staticMetaObject.tr(s, c); } \ + static inline QString tr(const char *s, const char *c, int n) \ + { return staticMetaObject.tr(s, c, n); } +# endif +#else +// inherit the ones from QObject +# define QT_TR_FUNCTIONS +#endif + +#if defined(QT_NO_MEMBER_TEMPLATES) || defined(QT_NO_QOBJECT_CHECK) +/* tmake ignore Q_OBJECT */ +#define Q_OBJECT_CHECK +#else + +/* This is a compile time check that ensures that any class cast with qobject_cast + actually contains a Q_OBJECT macro. Note: qobject_cast will fail if a QObject + subclass doesn't contain Q_OBJECT. + + In qt_check_for_QOBJECT_macro, we call a dummy templated function with two + parameters, the first being "this" and the other the target of the qobject + cast. If the types are not identical, we know that a Q_OBJECT macro is missing. + + If you get a compiler error here, make sure that the class you are casting + to contains a Q_OBJECT macro. +*/ + +/* tmake ignore Q_OBJECT */ +#define Q_OBJECT_CHECK \ + template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const \ + { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } + +template <typename T> +inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; } + +template <typename T1, typename T2> +inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} +#endif // QT_NO_MEMBER_TEMPLATES + +#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 \ + virtual int qt_metacall(QMetaObject::Call, int, void **); \ +private: +/* tmake ignore Q_OBJECT */ +#define Q_OBJECT_FAKE Q_OBJECT +/* tmake ignore Q_GADGET */ +#define Q_GADGET \ +public: \ + static const QMetaObject staticMetaObject; \ + Q_OBJECT_GETSTATICMETAOBJECT \ +private: +#else // Q_MOC_RUN +#define slots slots +#define signals signals +#define Q_SLOTS Q_SLOTS +#define Q_SIGNALS Q_SIGNALS +#define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value) +#define Q_INTERFACES(x) Q_INTERFACES(x) +#define Q_PROPERTY(text) Q_PROPERTY(text) +#define Q_OVERRIDE(text) Q_OVERRIDE(text) +#define Q_ENUMS(x) Q_ENUMS(x) +#define Q_FLAGS(x) Q_FLAGS(x) +#ifdef QT3_SUPPORT +# define Q_SETS(x) Q_SETS(x) +#endif + /* tmake ignore Q_OBJECT */ +#define Q_OBJECT Q_OBJECT + /* tmake ignore Q_OBJECT */ +#define Q_OBJECT_FAKE Q_OBJECT_FAKE + /* tmake ignore Q_GADGET */ +#define Q_GADGET Q_GADGET +#define Q_SCRIPTABLE Q_SCRIPTABLE +#define Q_INVOKABLE Q_INVOKABLE +#define Q_SIGNAL Q_SIGNAL +#define Q_SLOT Q_SLOT +#endif //Q_MOC_RUN + +// macro for onaming members +#ifdef METHOD +#undef METHOD +#endif +#ifdef SLOT +#undef SLOT +#endif +#ifdef SIGNAL +#undef SIGNAL +#endif + +Q_CORE_EXPORT const char *qFlagLocation(const char *method); + +#define QTOSTRING_HELPER(s) #s +#define QTOSTRING(s) QTOSTRING_HELPER(s) +#ifndef QT_NO_DEBUG +# define QLOCATION "\0"__FILE__":"QTOSTRING(__LINE__) +# define METHOD(a) qFlagLocation("0"#a QLOCATION) +# define SLOT(a) qFlagLocation("1"#a QLOCATION) +# define SIGNAL(a) qFlagLocation("2"#a QLOCATION) +#else +# define METHOD(a) "0"#a +# define SLOT(a) "1"#a +# define SIGNAL(a) "2"#a +#endif + +#ifdef QT3_SUPPORT +#define METHOD_CODE 0 // member type codes +#define SLOT_CODE 1 +#define SIGNAL_CODE 2 +#endif + +#define QMETHOD_CODE 0 // member type codes +#define QSLOT_CODE 1 +#define QSIGNAL_CODE 2 + +#define Q_ARG(type, data) QArgument<type >(#type, data) +#define Q_RETURN_ARG(type, data) QReturnArgument<type >(#type, data) + +class QObject; +class QMetaMethod; +class QMetaEnum; +class QMetaProperty; +class QMetaClassInfo; + + +class Q_CORE_EXPORT QGenericArgument +{ +public: + inline QGenericArgument(const char *aName = 0, const void *aData = 0) + : _data(aData), _name(aName) {} + inline void *data() const { return const_cast<void *>(_data); } + inline const char *name() const { return _name; } + +private: + const void *_data; + const char *_name; +}; + +class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument +{ +public: + inline QGenericReturnArgument(const char *aName = 0, void *aData = 0) + : QGenericArgument(aName, aData) + {} +}; + +template <class T> +class QArgument: public QGenericArgument +{ +public: + inline QArgument(const char *aName, const T &aData) + : QGenericArgument(aName, static_cast<const void *>(&aData)) + {} +}; + + +template <typename T> +class QReturnArgument: public QGenericReturnArgument +{ +public: + inline QReturnArgument(const char *aName, T &aData) + : QGenericReturnArgument(aName, static_cast<void *>(&aData)) + {} +}; + +struct Q_CORE_EXPORT QMetaObject +{ + const char *className() const; + const QMetaObject *superClass() const; + + QObject *cast(QObject *obj) const; + +#ifndef QT_NO_TRANSLATION + // ### Qt 4: Merge overloads + QString tr(const char *s, const char *c) const; + QString trUtf8(const char *s, const char *c) const; + QString tr(const char *s, const char *c, int n) const; + QString trUtf8(const char *s, const char *c, int n) const; +#endif // QT_NO_TRANSLATION + + int methodOffset() const; + int enumeratorOffset() const; + int propertyOffset() const; + int classInfoOffset() const; + + int constructorCount() const; + int methodCount() const; + int enumeratorCount() const; + int propertyCount() const; + int classInfoCount() const; + + int indexOfConstructor(const char *constructor) const; + int indexOfMethod(const char *method) const; + int indexOfSignal(const char *signal) const; + int indexOfSlot(const char *slot) const; + int indexOfEnumerator(const char *name) const; + int indexOfProperty(const char *name) const; + int indexOfClassInfo(const char *name) const; + + QMetaMethod constructor(int index) const; + QMetaMethod method(int index) const; + QMetaEnum enumerator(int index) const; + QMetaProperty property(int index) const; + QMetaClassInfo classInfo(int index) const; + QMetaProperty userProperty() const; + + static bool checkConnectArgs(const char *signal, const char *method); + static QByteArray normalizedSignature(const char *method); + static QByteArray normalizedType(const char *type); + + // internal index-based connect + static bool connect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + int type = 0, int *types = 0); + // internal index-based disconnect + static bool disconnect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index); + static bool disconnectOne(const QObject *sender, int signal_index, + const QObject *receiver, int method_index); + // internal slot-name based connect + static void connectSlotsByName(QObject *o); + + // internal index-based signal activation + static void activate(QObject *sender, int signal_index, void **argv); //obsolete + static void activate(QObject *sender, int from_signal_index, int to_signal_index, void **argv); //obsolete + static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv); + static void activate(QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv); //obsolete + + // 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, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()); + + static inline bool invokeMethod(QObject *obj, const char *member, + QGenericReturnArgument ret, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3, + val4, val5, val6, val7, val8, val9); + } + + static inline bool invokeMethod(QObject *obj, const char *member, + Qt::ConnectionType type, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2, + val3, val4, val5, val6, val7, val8, val9); + } + + static inline bool invokeMethod(QObject *obj, const char *member, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0, + val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + + QObject *newInstance(QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; + + enum Call { + InvokeMetaMethod, + ReadProperty, + WriteProperty, + ResetProperty, + QueryPropertyDesignable, + QueryPropertyScriptable, + QueryPropertyStored, + QueryPropertyEditable, + QueryPropertyUser, + CreateInstance + }; + + int static_metacall(Call, int, void **) const; + static int metacall(QObject *, Call, int, void **); + +#ifdef QT3_SUPPORT + QT3_SUPPORT const char *superClassName() const; +#endif + + struct { // private data + const QMetaObject *superdata; + const char *stringdata; + const uint *data; + const void *extradata; + } d; + +}; + +typedef const QMetaObject& (*QMetaObjectAccessor)(); + +struct QMetaObjectExtraData +{ +#ifdef Q_NO_DATA_RELOCATION + const QMetaObjectAccessor *objects; +#else + const QMetaObject **objects; +#endif + int (*static_metacall)(QMetaObject::Call, int, void **); +}; + +inline const char *QMetaObject::className() const +{ return d.stringdata; } + +inline const QMetaObject *QMetaObject::superClass() const +{ return d.superdata; } + +#ifdef QT3_SUPPORT +inline const char *QMetaObject::superClassName() const +{ return d.superdata ? d.superdata->className() : 0; } +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QOBJECTDEFS_H diff --git a/qtinterface/qt4/Qt/qpagesetupdialog.h b/qtinterface/qt4/Qt/qpagesetupdialog.h new file mode 100644 index 0000000..9db7e13 --- /dev/null +++ b/qtinterface/qt4/Qt/qpagesetupdialog.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAGESETUPDIALOG_H +#define QPAGESETUPDIALOG_H + +#include <QtGui/qabstractpagesetupdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTDIALOG + +class QPageSetupDialogPrivate; + +class Q_GUI_EXPORT QPageSetupDialog : public QAbstractPageSetupDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPageSetupDialog) + Q_ENUMS(PageSetupDialogOption) + Q_PROPERTY(PageSetupDialogOptions options READ options WRITE setOptions) + +public: + enum PageSetupDialogOption { + None = 0x00000000, // internal + DontUseSheet = 0x00000001, + OwnsPrinter = 0x80000000 // internal + }; + + Q_DECLARE_FLAGS(PageSetupDialogOptions, PageSetupDialogOption) + + explicit QPageSetupDialog(QPrinter *printer, QWidget *parent = 0); + explicit QPageSetupDialog(QWidget *parent = 0); + + // obsolete + void addEnabledOption(PageSetupDialogOption option); + void setEnabledOptions(PageSetupDialogOptions options); + PageSetupDialogOptions enabledOptions() const; + bool isOptionEnabled(PageSetupDialogOption option) const; + + void setOption(PageSetupDialogOption option, bool on = true); + bool testOption(PageSetupDialogOption option) const; + void setOptions(PageSetupDialogOptions options); + PageSetupDialogOptions options() const; + +#if defined(Q_WS_MAC) || defined(Q_OS_WIN) + virtual void setVisible(bool visible); +#endif + virtual int exec(); + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + +#ifdef qdoc + QPrinter *printer(); +#endif +}; + +#endif // QT_NO_PRINTDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAGESETUPDIALOG_H diff --git a/qtinterface/qt4/Qt/qpaintdevice.h b/qtinterface/qt4/Qt/qpaintdevice.h new file mode 100644 index 0000000..ce0ceba --- /dev/null +++ b/qtinterface/qt4/Qt/qpaintdevice.h @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAINTDEVICE_H +#define QPAINTDEVICE_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qrect.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if defined(Q_WS_QWS) +class QWSDisplay; +#endif + +class QPaintEngine; + +class Q_GUI_EXPORT QPaintDevice // device for QPainter +{ +public: + enum PaintDeviceMetric { + PdmWidth = 1, + PdmHeight, + PdmWidthMM, + PdmHeightMM, + PdmNumColors, + PdmDepth, + PdmDpiX, + PdmDpiY, + PdmPhysicalDpiX, + PdmPhysicalDpiY + }; + + virtual ~QPaintDevice(); + + virtual int devType() const; + bool paintingActive() const; + virtual QPaintEngine *paintEngine() const = 0; + +#if defined(Q_WS_QWS) + static QWSDisplay *qwsDisplay(); +#endif + +#ifdef Q_WS_WIN + virtual HDC getDC() const; + virtual void releaseDC(HDC hdc) const; +#endif + + int width() const { return metric(PdmWidth); } + int height() const { return metric(PdmHeight); } + int widthMM() const { return metric(PdmWidthMM); } + int heightMM() const { return metric(PdmHeightMM); } + int logicalDpiX() const { return metric(PdmDpiX); } + int logicalDpiY() const { return metric(PdmDpiY); } + int physicalDpiX() const { return metric(PdmPhysicalDpiX); } + int physicalDpiY() const { return metric(PdmPhysicalDpiY); } +#ifdef QT_DEPRECATED + QT_DEPRECATED int numColors() const { return metric(PdmNumColors); } +#endif + int colorCount() const { return metric(PdmNumColors); } + int depth() const { return metric(PdmDepth); } + +protected: + QPaintDevice(); + virtual int metric(PaintDeviceMetric metric) const; + + ushort painters; // refcount + +private: + Q_DISABLE_COPY(QPaintDevice) + +#if defined(Q_WS_X11) && defined(QT3_SUPPORT) +public: + QT3_SUPPORT Display *x11Display() const; + QT3_SUPPORT int x11Screen() const; + QT3_SUPPORT int x11Depth() const; + QT3_SUPPORT int x11Cells() const; + QT3_SUPPORT Qt::HANDLE x11Colormap() const; + QT3_SUPPORT bool x11DefaultColormap() const; + QT3_SUPPORT void *x11Visual() const; + QT3_SUPPORT bool x11DefaultVisual() const; + + static QT3_SUPPORT Display *x11AppDisplay(); + static QT3_SUPPORT int x11AppScreen(); + static QT3_SUPPORT int x11AppDepth(int screen = -1); + static QT3_SUPPORT int x11AppCells(int screen = -1); + static QT3_SUPPORT Qt::HANDLE x11AppRootWindow(int screen = -1); + static QT3_SUPPORT Qt::HANDLE x11AppColormap(int screen = -1); + static QT3_SUPPORT void *x11AppVisual(int screen = -1); + static QT3_SUPPORT bool x11AppDefaultColormap(int screen =-1); + static QT3_SUPPORT bool x11AppDefaultVisual(int screen =-1); + static QT3_SUPPORT int x11AppDpiX(int screen = -1); + static QT3_SUPPORT int x11AppDpiY(int screen = -1); + static QT3_SUPPORT void x11SetAppDpiX(int, int); + static QT3_SUPPORT void x11SetAppDpiY(int, int); +#endif + + friend class QPainter; + friend class QFontEngineMac; + friend class QX11PaintEngine; + friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric); +}; + +#ifdef QT3_SUPPORT +QT3_SUPPORT Q_GUI_EXPORT +void bitBlt(QPaintDevice *dst, int dx, int dy, + const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1, + bool ignoreMask=false); + +QT3_SUPPORT Q_GUI_EXPORT +void bitBlt(QPaintDevice *dst, int dx, int dy, + const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1, + int conversion_flags=0); + +QT3_SUPPORT Q_GUI_EXPORT +void bitBlt(QPaintDevice *dst, const QPoint &dp, + const QPaintDevice *src, const QRect &sr=QRect(0,0,-1,-1), + bool ignoreMask=false); +#endif + +/***************************************************************************** + Inline functions + *****************************************************************************/ + +inline int QPaintDevice::devType() const +{ return QInternal::UnknownDevice; } + +inline bool QPaintDevice::paintingActive() const +{ return painters != 0; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAINTDEVICE_H diff --git a/qtinterface/qt4/Qt/qpaintengine.h b/qtinterface/qt4/Qt/qpaintengine.h new file mode 100644 index 0000000..1089cce --- /dev/null +++ b/qtinterface/qt4/Qt/qpaintengine.h @@ -0,0 +1,364 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAINTENGINE_H +#define QPAINTENGINE_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qobjectdefs.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qpainter.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFontEngine; +class QLineF; +class QPaintDevice; +class QPaintEnginePrivate; +class QPainterPath; +class QPointF; +class QPolygonF; +class QRectF; +struct QGlyphLayout; +class QTextItemInt; +class QPaintEngineState; + +class Q_GUI_EXPORT QTextItem { +public: + enum RenderFlag { + RightToLeft = 0x1, + Overline = 0x10, + Underline = 0x20, + StrikeOut = 0x40, + + Dummy = 0xffffffff + }; + Q_DECLARE_FLAGS(RenderFlags, RenderFlag) + qreal descent() const; + qreal ascent() const; + qreal width() const; + + RenderFlags renderFlags() const; + QString text() const; + QFont font() const; +}; +Q_DECLARE_TYPEINFO(QTextItem, Q_PRIMITIVE_TYPE); + + +class Q_GUI_EXPORT QPaintEngine +{ + Q_DECLARE_PRIVATE(QPaintEngine) +public: + enum PaintEngineFeature { + PrimitiveTransform = 0x00000001, // Can transform primitives brushes + PatternTransform = 0x00000002, // Can transform pattern brushes + PixmapTransform = 0x00000004, // Can transform pixmaps + PatternBrush = 0x00000008, // Can fill with pixmaps and standard patterns + LinearGradientFill = 0x00000010, // Can fill gradient areas + RadialGradientFill = 0x00000020, // Can render radial gradients + ConicalGradientFill = 0x00000040, // Can render conical gradients + AlphaBlend = 0x00000080, // Can do source over alpha blend + PorterDuff = 0x00000100, // Can do general porter duff compositions + PainterPaths = 0x00000200, // Can fill, outline and clip paths + Antialiasing = 0x00000400, // Can antialias lines + BrushStroke = 0x00000800, // Can render brush based pens + ConstantOpacity = 0x00001000, // Can render at constant opacity + MaskedBrush = 0x00002000, // Can fill with textures that has an alpha channel or mask + PerspectiveTransform = 0x00004000, // Can do perspective transformations + BlendModes = 0x00008000, // Can do extended Porter&Duff composition + ObjectBoundingModeGradients = 0x00010000, // Can do object bounding mode gradients + RasterOpModes = 0x00020000, // Can do logical raster operations + PaintOutsidePaintEvent = 0x20000000, // Engine is capable of painting outside paint events + /* 0x10000000, // Used for emulating + QGradient::StretchToDevice, + defined in qpainter.cpp + + 0x40000000, // Used internally for emulating opaque backgrounds + */ + + AllFeatures = 0xffffffff // For convenience + }; + Q_DECLARE_FLAGS(PaintEngineFeatures, PaintEngineFeature) + + enum DirtyFlag { + DirtyPen = 0x0001, + DirtyBrush = 0x0002, + DirtyBrushOrigin = 0x0004, + DirtyFont = 0x0008, + DirtyBackground = 0x0010, + DirtyBackgroundMode = 0x0020, + DirtyTransform = 0x0040, + DirtyClipRegion = 0x0080, + DirtyClipPath = 0x0100, + DirtyHints = 0x0200, + DirtyCompositionMode = 0x0400, + DirtyClipEnabled = 0x0800, + DirtyOpacity = 0x1000, + + AllDirty = 0xffff + }; + Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag) + + enum PolygonDrawMode { + OddEvenMode, + WindingMode, + ConvexMode, + PolylineMode + }; + + explicit QPaintEngine(PaintEngineFeatures features=0); + virtual ~QPaintEngine(); + + bool isActive() const { return active; } + void setActive(bool newState) { active = newState; } + + virtual bool begin(QPaintDevice *pdev) = 0; + virtual bool end() = 0; + + virtual void updateState(const QPaintEngineState &state) = 0; + + virtual void drawRects(const QRect *rects, int rectCount); + virtual void drawRects(const QRectF *rects, int rectCount); + + virtual void drawLines(const QLine *lines, int lineCount); + virtual void drawLines(const QLineF *lines, int lineCount); + + virtual void drawEllipse(const QRectF &r); + virtual void drawEllipse(const QRect &r); + + virtual void drawPath(const QPainterPath &path); + + virtual void drawPoints(const QPointF *points, int pointCount); + virtual void drawPoints(const QPoint *points, int pointCount); + + virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); + virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); + + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) = 0; + virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); + virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); + + void setPaintDevice(QPaintDevice *device); + QPaintDevice *paintDevice() const; + + void setSystemClip(const QRegion &baseClip); + QRegion systemClip() const; + + void setSystemRect(const QRect &rect); + QRect systemRect() const; + +#ifdef Q_WS_WIN + virtual HDC getDC() const; + virtual void releaseDC(HDC hdc) const; +#endif + + virtual QPoint coordinateOffset() const; + + enum Type { + X11, + Windows, + QuickDraw, CoreGraphics, MacPrinter, + QWindowSystem, + PostScript, + OpenGL, + Picture, + SVG, + Raster, + Direct3D, + Pdf, + OpenVG, + OpenGL2, + PaintBuffer, + + User = 50, // first user type id + MaxUser = 100 // last user type id + }; + virtual Type type() const = 0; + + inline void fix_neg_rect(int *x, int *y, int *w, int *h); + + inline bool testDirty(DirtyFlags df); + inline void setDirty(DirtyFlags df); + inline void clearDirty(DirtyFlags df); + + bool hasFeature(PaintEngineFeatures feature) const { return (gccaps & feature) != 0; } + + QPainter *painter() const; + + void syncState(); + inline bool isExtended() const { return extended; } + +protected: + QPaintEngine(QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0); + + QPaintEngineState *state; + PaintEngineFeatures gccaps; + + uint active : 1; + uint selfDestruct : 1; + uint extended : 1; + + QScopedPointer<QPaintEnginePrivate> d_ptr; + +private: + void setAutoDestruct(bool autoDestr) { selfDestruct = autoDestr; } + bool autoDestruct() const { return selfDestruct; } + Q_DISABLE_COPY(QPaintEngine) + + friend class QPainterReplayer; + friend class QFontEngineBox; + friend class QFontEngineMac; + friend class QFontEngineWin; +#ifndef QT_NO_FREETYPE + friend class QFontEngineFT; +#endif +#ifndef QT_NO_QWS_QPF + friend class QFontEngineQPF1; +#endif +#ifndef QT_NO_QWS_QPF2 + friend class QFontEngineQPF; +#endif + friend class QPSPrintEngine; + friend class QMacPrintEngine; + friend class QMacPrintEnginePrivate; +#ifdef Q_WS_QWS + friend class QtopiaPrintEngine; + friend class QtopiaPrintEnginePrivate; + friend class QProxyFontEngine; +#endif + friend class QPainter; + friend class QPainterPrivate; + friend class QWidget; + friend class QWidgetPrivate; + friend class QWin32PaintEngine; + friend class QWin32PaintEnginePrivate; + friend class QMacCGContext; + friend class QPreviewPaintEngine; + friend class QX11GLPixmapData; +}; + + +class Q_GUI_EXPORT QPaintEngineState +{ +public: + QPaintEngine::DirtyFlags state() const { return dirtyFlags; } + + QPen pen() const; + QBrush brush() const; + QPointF brushOrigin() const; + QBrush backgroundBrush() const; + Qt::BGMode backgroundMode() const; + QFont font() const; + QMatrix matrix() const; + QTransform transform() const; + + Qt::ClipOperation clipOperation() const; + QRegion clipRegion() const; + QPainterPath clipPath() const; + bool isClipEnabled() const; + + QPainter::RenderHints renderHints() const; + QPainter::CompositionMode compositionMode() const; + qreal opacity() const; + + QPainter *painter() const; + + bool brushNeedsResolving() const; + bool penNeedsResolving() const; + +protected: + friend class QPaintEngine; + friend class QRasterPaintEngine; + friend class QWidget; + friend class QPainter; + friend class QPainterPrivate; + friend class QMacPrintEnginePrivate; + + QPaintEngine::DirtyFlags dirtyFlags; +}; + +// +// inline functions +// + +inline void QPaintEngine::fix_neg_rect(int *x, int *y, int *w, int *h) +{ + if (*w < 0) { + *w = -*w; + *x -= *w - 1; + } + if (*h < 0) { + *h = -*h; + *y -= *h - 1; + } +} + +inline bool QPaintEngine::testDirty(DirtyFlags df) { + Q_ASSERT(state); + return ((state->dirtyFlags & df) != 0); +} + +inline void QPaintEngine::setDirty(DirtyFlags df) { + Q_ASSERT(state); + state->dirtyFlags |= df; +} + +inline void QPaintEngine::clearDirty(DirtyFlags df) +{ + Q_ASSERT(state); + state->dirtyFlags &= ~static_cast<uint>(df); +} + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextItem::RenderFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QPaintEngine::PaintEngineFeatures) +Q_DECLARE_OPERATORS_FOR_FLAGS(QPaintEngine::DirtyFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAINTENGINE_H diff --git a/qtinterface/qt4/Qt/qpainter.h b/qtinterface/qt4/Qt/qpainter.h new file mode 100644 index 0000000..817a93f --- /dev/null +++ b/qtinterface/qt4/Qt/qpainter.h @@ -0,0 +1,960 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAINTER_H +#define QPAINTER_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qrect.h> +#include <QtCore/qpoint.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qpixmap.h> +#include <QtGui/qimage.h> +#include <QtGui/qtextoption.h> +#include <QtGui/qdrawutil.h> + +#ifndef QT_INCLUDE_COMPAT +#include <QtGui/qpolygon.h> +#include <QtGui/qpen.h> +#include <QtGui/qbrush.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qtransform.h> +#include <QtGui/qfontinfo.h> +#include <QtGui/qfontmetrics.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QBrush; +class QFontInfo; +class QFontMetrics; +class QPaintDevice; +class QPainterPath; +class QPainterPrivate; +class QPen; +class QPolygon; +class QTextItem; +class QMatrix; +class QTransform; + +class QPainterPrivateDeleter; + +class Q_GUI_EXPORT QPainter +{ + Q_DECLARE_PRIVATE(QPainter) + Q_GADGET + Q_FLAGS(RenderHint RenderHints) + +public: + enum RenderHint { + Antialiasing = 0x01, + TextAntialiasing = 0x02, + SmoothPixmapTransform = 0x04, + HighQualityAntialiasing = 0x08, + NonCosmeticDefaultPen = 0x10 + }; + + Q_DECLARE_FLAGS(RenderHints, RenderHint) + + QPainter(); + explicit QPainter(QPaintDevice *); + ~QPainter(); + + QPaintDevice *device() const; + + bool begin(QPaintDevice *); + bool end(); + bool isActive() const; + + void initFrom(const QWidget *widget); + + enum CompositionMode { + CompositionMode_SourceOver, + CompositionMode_DestinationOver, + CompositionMode_Clear, + CompositionMode_Source, + CompositionMode_Destination, + CompositionMode_SourceIn, + CompositionMode_DestinationIn, + CompositionMode_SourceOut, + CompositionMode_DestinationOut, + CompositionMode_SourceAtop, + CompositionMode_DestinationAtop, + CompositionMode_Xor, + + //svg 1.2 blend modes + CompositionMode_Plus, + CompositionMode_Multiply, + CompositionMode_Screen, + CompositionMode_Overlay, + CompositionMode_Darken, + CompositionMode_Lighten, + CompositionMode_ColorDodge, + CompositionMode_ColorBurn, + CompositionMode_HardLight, + CompositionMode_SoftLight, + CompositionMode_Difference, + CompositionMode_Exclusion, + + // ROPs + RasterOp_SourceOrDestination, + RasterOp_SourceAndDestination, + RasterOp_SourceXorDestination, + RasterOp_NotSourceAndNotDestination, + RasterOp_NotSourceOrNotDestination, + RasterOp_NotSourceXorDestination, + RasterOp_NotSource, + RasterOp_NotSourceAndDestination, + RasterOp_SourceAndNotDestination + }; + void setCompositionMode(CompositionMode mode); + CompositionMode compositionMode() const; + + const QFont &font() const; + void setFont(const QFont &f); + + QFontMetrics fontMetrics() const; + QFontInfo fontInfo() const; + + void setPen(const QColor &color); + void setPen(const QPen &pen); + void setPen(Qt::PenStyle style); + const QPen &pen() const; + + void setBrush(const QBrush &brush); + void setBrush(Qt::BrushStyle style); + const QBrush &brush() const; + + // attributes/modes + void setBackgroundMode(Qt::BGMode mode); + Qt::BGMode backgroundMode() const; + + QPoint brushOrigin() const; + inline void setBrushOrigin(int x, int y); + inline void setBrushOrigin(const QPoint &); + void setBrushOrigin(const QPointF &); + + void setBackground(const QBrush &bg); + const QBrush &background() const; + + qreal opacity() const; + void setOpacity(qreal opacity); + + // Clip functions + QRegion clipRegion() const; + QPainterPath clipPath() const; + + void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip); + void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip); + inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip); + + void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip); + + void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip); + + void setClipping(bool enable); + bool hasClipping() const; + + void save(); + void restore(); + + // XForm functions + void setMatrix(const QMatrix &matrix, bool combine = false); + const QMatrix &matrix() const; + const QMatrix &deviceMatrix() const; + void resetMatrix(); + + void setTransform(const QTransform &transform, bool combine = false); + const QTransform &transform() const; + const QTransform &deviceTransform() const; + void resetTransform(); + + void setWorldMatrix(const QMatrix &matrix, bool combine = false); + const QMatrix &worldMatrix() const; + + void setWorldTransform(const QTransform &matrix, bool combine = false); + const QTransform &worldTransform() const; + + QMatrix combinedMatrix() const; + QTransform combinedTransform() const; + + void setMatrixEnabled(bool enabled); + bool matrixEnabled() const; + + void setWorldMatrixEnabled(bool enabled); + bool worldMatrixEnabled() const; + + void scale(qreal sx, qreal sy); + void shear(qreal sh, qreal sv); + void rotate(qreal a); + + void translate(const QPointF &offset); + inline void translate(const QPoint &offset); + inline void translate(qreal dx, qreal dy); + + QRect window() const; + void setWindow(const QRect &window); + inline void setWindow(int x, int y, int w, int h); + + QRect viewport() const; + void setViewport(const QRect &viewport); + inline void setViewport(int x, int y, int w, int h); + + void setViewTransformEnabled(bool enable); + bool viewTransformEnabled() const; + + // drawing functions + void strokePath(const QPainterPath &path, const QPen &pen); + void fillPath(const QPainterPath &path, const QBrush &brush); + void drawPath(const QPainterPath &path); + + inline void drawPoint(const QPointF &pt); + inline void drawPoint(const QPoint &p); + inline void drawPoint(int x, int y); + + void drawPoints(const QPointF *points, int pointCount); + inline void drawPoints(const QPolygonF &points); + void drawPoints(const QPoint *points, int pointCount); + inline void drawPoints(const QPolygon &points); + + inline void drawLine(const QLineF &line); + inline void drawLine(const QLine &line); + inline void drawLine(int x1, int y1, int x2, int y2); + inline void drawLine(const QPoint &p1, const QPoint &p2); + inline void drawLine(const QPointF &p1, const QPointF &p2); + + void drawLines(const QLineF *lines, int lineCount); + inline void drawLines(const QVector<QLineF> &lines); + void drawLines(const QPointF *pointPairs, int lineCount); + inline void drawLines(const QVector<QPointF> &pointPairs); + void drawLines(const QLine *lines, int lineCount); + inline void drawLines(const QVector<QLine> &lines); + void drawLines(const QPoint *pointPairs, int lineCount); + inline void drawLines(const QVector<QPoint> &pointPairs); + + inline void drawRect(const QRectF &rect); + inline void drawRect(int x1, int y1, int w, int h); + inline void drawRect(const QRect &rect); + + void drawRects(const QRectF *rects, int rectCount); + inline void drawRects(const QVector<QRectF> &rectangles); + void drawRects(const QRect *rects, int rectCount); + inline void drawRects(const QVector<QRect> &rectangles); + + void drawEllipse(const QRectF &r); + void drawEllipse(const QRect &r); + inline void drawEllipse(int x, int y, int w, int h); + + inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry); + inline void drawEllipse(const QPoint ¢er, int rx, int ry); + + void drawPolyline(const QPointF *points, int pointCount); + inline void drawPolyline(const QPolygonF &polyline); + void drawPolyline(const QPoint *points, int pointCount); + inline void drawPolyline(const QPolygon &polygon); + + void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill); + inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill); + void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill); + inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill); + + void drawConvexPolygon(const QPointF *points, int pointCount); + inline void drawConvexPolygon(const QPolygonF &polygon); + void drawConvexPolygon(const QPoint *points, int pointCount); + inline void drawConvexPolygon(const QPolygon &polygon); + + void drawArc(const QRectF &rect, int a, int alen); + inline void drawArc(const QRect &, int a, int alen); + inline void drawArc(int x, int y, int w, int h, int a, int alen); + + void drawPie(const QRectF &rect, int a, int alen); + inline void drawPie(int x, int y, int w, int h, int a, int alen); + inline void drawPie(const QRect &, int a, int alen); + + void drawChord(const QRectF &rect, int a, int alen); + inline void drawChord(int x, int y, int w, int h, int a, int alen); + inline void drawChord(const QRect &, int a, int alen); + + void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, + Qt::SizeMode mode = Qt::AbsoluteSize); + inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, + Qt::SizeMode mode = Qt::AbsoluteSize); + inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, + Qt::SizeMode mode = Qt::AbsoluteSize); + + void drawRoundRect(const QRectF &r, int xround = 25, int yround = 25); + inline void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25); + inline void drawRoundRect(const QRect &r, int xround = 25, int yround = 25); + + void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF()); + inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0); + inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint()); +#ifndef QT_NO_PICTURE + void drawPicture(const QPointF &p, const QPicture &picture); + inline void drawPicture(int x, int y, const QPicture &picture); + inline void drawPicture(const QPoint &p, const QPicture &picture); +#endif + + void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect); + inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect); + inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm, + int sx, int sy, int sw, int sh); + inline void drawPixmap(int x, int y, const QPixmap &pm, + int sx, int sy, int sw, int sh); + inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr); + inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr); + void drawPixmap(const QPointF &p, const QPixmap &pm); + inline void drawPixmap(const QPoint &p, const QPixmap &pm); + inline void drawPixmap(int x, int y, const QPixmap &pm); + inline void drawPixmap(const QRect &r, const QPixmap &pm); + inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); + + void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, + Qt::ImageConversionFlags flags = Qt::AutoColor); + inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, + Qt::ImageConversionFlags flags = Qt::AutoColor); + inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); + inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); + inline void drawImage(const QRectF &r, const QImage &image); + inline void drawImage(const QRect &r, const QImage &image); + void drawImage(const QPointF &p, const QImage &image); + inline void drawImage(const QPoint &p, const QImage &image); + inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0, + int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor); + + void setLayoutDirection(Qt::LayoutDirection direction); + Qt::LayoutDirection layoutDirection() const; + + void drawText(const QPointF &p, const QString &s); + inline void drawText(const QPoint &p, const QString &s); + inline void drawText(int x, int y, const QString &s); + + void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding); + + void drawText(const QRectF &r, int flags, const QString &text, QRectF *br=0); + void drawText(const QRect &r, int flags, const QString &text, QRect *br=0); + inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br=0); + + void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption()); + + QRectF boundingRect(const QRectF &rect, int flags, const QString &text); + QRect boundingRect(const QRect &rect, int flags, const QString &text); + inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text); + + QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption()); + + void drawTextItem(const QPointF &p, const QTextItem &ti); + inline void drawTextItem(int x, int y, const QTextItem &ti); + inline void drawTextItem(const QPoint &p, const QTextItem &ti); + + void fillRect(const QRectF &, const QBrush &); + inline void fillRect(int x, int y, int w, int h, const QBrush &); + void fillRect(const QRect &, const QBrush &); + + void fillRect(const QRectF &, const QColor &color); + inline void fillRect(int x, int y, int w, int h, const QColor &color); + void fillRect(const QRect &, const QColor &color); + + inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c); + inline void fillRect(const QRect &r, Qt::GlobalColor c); + inline void fillRect(const QRectF &r, Qt::GlobalColor c); + + inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style); + inline void fillRect(const QRect &r, Qt::BrushStyle style); + inline void fillRect(const QRectF &r, Qt::BrushStyle style); + + void eraseRect(const QRectF &); + inline void eraseRect(int x, int y, int w, int h); + inline void eraseRect(const QRect &); + + void setRenderHint(RenderHint hint, bool on = true); + void setRenderHints(RenderHints hints, bool on = true); + RenderHints renderHints() const; + inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; } + + QPaintEngine *paintEngine() const; + + static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement, + const QPoint& offset = QPoint()); + static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0); + static void restoreRedirected(const QPaintDevice *device); + + void beginNativePainting(); + void endNativePainting(); + +#ifdef QT3_SUPPORT + + inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); } + inline QT3_SUPPORT const QColor &backgroundColor() const { return background().color(); } + + inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int pos, int len) + { drawText(x, y, s.mid(pos, len)); } + inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int pos, int len) + { drawText(p, s.mid(pos, len)); } + inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int len) + { drawText(x, y, s.left(len)); } + inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int len) + { drawText(p, s.left(len)); } + inline QT3_SUPPORT void drawText(const QRect &r, int flags, const QString &str, int len, QRect *br=0) + { drawText(r, flags, str.left(len), br); } + inline QT3_SUPPORT void drawText(int x, int y, int w, int h, int flags, const QString &text, int len, QRect *br=0) + { drawText(QRect(x, y, w, h), flags, text.left(len), br); } + inline QT3_SUPPORT QRect boundingRect(const QRect &rect, int flags, const QString &text, int len) + { return boundingRect(rect, flags, text.left(len)); } + inline QT3_SUPPORT QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, int len) + { return boundingRect(QRect(x, y, w, h), flags, text.left(len)); } + + inline QT3_SUPPORT bool begin(QPaintDevice *pdev, const QWidget *init) + { bool ret = begin(pdev); initFrom(init); return ret; } + QT3_SUPPORT void drawPoints(const QPolygon &pa, int index, int npoints = -1) + { drawPoints(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } + + QT3_SUPPORT void drawCubicBezier(const QPolygon &pa, int index = 0); + + QT3_SUPPORT void drawLineSegments(const QPolygon &points, int index = 0, int nlines = -1); + + inline QT3_SUPPORT void drawPolyline(const QPolygon &pa, int index, int npoints = -1) + { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } + + inline QT3_SUPPORT void drawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1) + { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints, + winding ? Qt::WindingFill : Qt::OddEvenFill); } + + inline QT3_SUPPORT void drawPolygon(const QPolygonF &polygon, bool winding, int index = 0, + int npoints = -1) + { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints, + winding ? Qt::WindingFill : Qt::OddEvenFill); } + + inline QT3_SUPPORT void drawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1) + { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); } + inline QT3_SUPPORT void drawConvexPolygon(const QPolygon &pa, int index, int npoints = -1) + { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } + + static inline QT3_SUPPORT void redirect(QPaintDevice *pdev, QPaintDevice *replacement) + { setRedirected(pdev, replacement); } + static inline QT3_SUPPORT QPaintDevice *redirect(QPaintDevice *pdev) + { return const_cast<QPaintDevice*>(redirected(pdev)); } + + inline QT3_SUPPORT void setWorldXForm(bool enabled) { setMatrixEnabled(enabled); } + inline QT3_SUPPORT bool hasWorldXForm() const { return matrixEnabled(); } + inline QT3_SUPPORT void resetXForm() { resetTransform(); } + + inline QT3_SUPPORT void setViewXForm(bool enabled) { setViewTransformEnabled(enabled); } + inline QT3_SUPPORT bool hasViewXForm() const { return viewTransformEnabled(); } + + QT3_SUPPORT void map(int x, int y, int *rx, int *ry) const; + QT3_SUPPORT QPoint xForm(const QPoint &) const; // map virtual -> deviceb + QT3_SUPPORT QRect xForm(const QRect &) const; + QT3_SUPPORT QPolygon xForm(const QPolygon &) const; + QT3_SUPPORT QPolygon xForm(const QPolygon &, int index, int npoints) const; + QT3_SUPPORT QPoint xFormDev(const QPoint &) const; // map device -> virtual + QT3_SUPPORT QRect xFormDev(const QRect &) const; + QT3_SUPPORT QPolygon xFormDev(const QPolygon &) const; + QT3_SUPPORT QPolygon xFormDev(const QPolygon &, int index, int npoints) const; + QT3_SUPPORT qreal translationX() const; + QT3_SUPPORT qreal translationY() const; +#endif + +private: + Q_DISABLE_COPY(QPainter) + friend class Q3Painter; + + QScopedPointer<QPainterPrivate> d_ptr; + + friend class QFontEngine; + friend class QFontEngineBox; + friend class QFontEngineFT; + friend class QFontEngineMac; + friend class QFontEngineWin; + friend class QFontEngineXLFD; + friend class QWSManager; + friend class QPaintEngine; + friend class QPaintEngineExPrivate; + friend class QOpenGLPaintEngine; + friend class QX11PaintEngine; + friend class QX11PaintEnginePrivate; + friend class QWin32PaintEngine; + friend class QWin32PaintEnginePrivate; + friend class QRasterPaintEngine; + friend class QAlphaPaintEngine; + friend class QPreviewPaintEngine; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints) + +// +// functions +// +inline void QPainter::drawLine(const QLineF &l) +{ + drawLines(&l, 1); +} + +inline void QPainter::drawLine(const QLine &line) +{ + drawLines(&line, 1); +} + +inline void QPainter::drawLine(int x1, int y1, int x2, int y2) +{ + QLine l(x1, y1, x2, y2); + drawLines(&l, 1); +} + +inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2) +{ + QLine l(p1, p2); + drawLines(&l, 1); +} + +inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2) +{ + drawLine(QLineF(p1, p2)); +} + +inline void QPainter::drawLines(const QVector<QLineF> &lines) +{ + drawLines(lines.constData(), lines.size()); +} + +inline void QPainter::drawLines(const QVector<QLine> &lines) +{ + drawLines(lines.constData(), lines.size()); +} + +inline void QPainter::drawLines(const QVector<QPointF> &pointPairs) +{ + drawLines(pointPairs.constData(), pointPairs.size() / 2); +} + +inline void QPainter::drawLines(const QVector<QPoint> &pointPairs) +{ + drawLines(pointPairs.constData(), pointPairs.size() / 2); +} + +inline void QPainter::drawPolyline(const QPolygonF &polyline) +{ + drawPolyline(polyline.constData(), polyline.size()); +} + +inline void QPainter::drawPolyline(const QPolygon &polyline) +{ + drawPolyline(polyline.constData(), polyline.size()); +} + +inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule) +{ + drawPolygon(polygon.constData(), polygon.size(), fillRule); +} + +inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule) +{ + drawPolygon(polygon.constData(), polygon.size(), fillRule); +} + +inline void QPainter::drawConvexPolygon(const QPolygonF &poly) +{ + drawConvexPolygon(poly.constData(), poly.size()); +} + +inline void QPainter::drawConvexPolygon(const QPolygon &poly) +{ + drawConvexPolygon(poly.constData(), poly.size()); +} + +inline void QPainter::drawRect(const QRectF &rect) +{ + drawRects(&rect, 1); +} + +inline void QPainter::drawRect(int x, int y, int w, int h) +{ + QRect r(x, y, w, h); + drawRects(&r, 1); +} + +inline void QPainter::drawRect(const QRect &r) +{ + drawRects(&r, 1); +} + +inline void QPainter::drawRects(const QVector<QRectF> &rects) +{ + drawRects(rects.constData(), rects.size()); +} + +inline void QPainter::drawRects(const QVector<QRect> &rects) +{ + drawRects(rects.constData(), rects.size()); +} + +inline void QPainter::drawPoint(const QPointF &p) +{ + drawPoints(&p, 1); +} + +inline void QPainter::drawPoint(int x, int y) +{ + QPoint p(x, y); + drawPoints(&p, 1); +} + +inline void QPainter::drawPoint(const QPoint &p) +{ + drawPoints(&p, 1); +} + +inline void QPainter::drawPoints(const QPolygonF &points) +{ + drawPoints(points.constData(), points.size()); +} + +inline void QPainter::drawPoints(const QPolygon &points) +{ + drawPoints(points.constData(), points.size()); +} + +inline void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd) +{ + drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd); +} + +inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd) +{ + drawRoundRect(QRectF(rect), xRnd, yRnd); +} + +inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, + Qt::SizeMode mode) +{ + drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode); +} + +inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, + Qt::SizeMode mode) +{ + drawRoundedRect(QRectF(rect), xRadius, yRadius, mode); +} + +inline void QPainter::drawEllipse(int x, int y, int w, int h) +{ + drawEllipse(QRect(x, y, w, h)); +} + +inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry) +{ + drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); +} + +inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry) +{ + drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); +} + +inline void QPainter::drawArc(const QRect &r, int a, int alen) +{ + drawArc(QRectF(r), a, alen); +} + +inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen) +{ + drawArc(QRectF(x, y, w, h), a, alen); +} + +inline void QPainter::drawPie(const QRect &rect, int a, int alen) +{ + drawPie(QRectF(rect), a, alen); +} + +inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen) +{ + drawPie(QRectF(x, y, w, h), a, alen); +} + +inline void QPainter::drawChord(const QRect &rect, int a, int alen) +{ + drawChord(QRectF(rect), a, alen); +} + +inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen) +{ + drawChord(QRectF(x, y, w, h), a, alen); +} + +inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op) +{ + setClipRect(QRect(x, y, w, h), op); +} + +inline void QPainter::eraseRect(const QRect &rect) +{ + eraseRect(QRectF(rect)); +} + +inline void QPainter::eraseRect(int x, int y, int w, int h) +{ + eraseRect(QRectF(x, y, w, h)); +} + +inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b) +{ + fillRect(QRect(x, y, w, h), b); +} + +inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b) +{ + fillRect(QRect(x, y, w, h), b); +} + +inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c) +{ + fillRect(QRect(x, y, w, h), QColor(c)); +} + +inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c) +{ + fillRect(r, QColor(c)); +} + +inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c) +{ + fillRect(r, QColor(c)); +} + +inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style) +{ + fillRect(QRectF(x, y, w, h), QBrush(style)); +} + +inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style) +{ + fillRect(QRectF(r), QBrush(style)); +} + +inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style) +{ + fillRect(r, QBrush(style)); +} + + +inline void QPainter::setBrushOrigin(int x, int y) +{ + setBrushOrigin(QPoint(x, y)); +} + +inline void QPainter::setBrushOrigin(const QPoint &p) +{ + setBrushOrigin(QPointF(p)); +} + +inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset) +{ + drawTiledPixmap(QRectF(rect), pm, QPointF(offset)); +} + +inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy) +{ + drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy)); +} + +inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect) +{ + drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect)); +} + +inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm) +{ + drawPixmap(QPointF(p), pm); +} + +inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm) +{ + drawPixmap(QRectF(r), pm, QRectF()); +} + +inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm) +{ + drawPixmap(QPointF(x, y), pm); +} + +inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm) +{ + drawPixmap(QRectF(x, y, w, h), pm, QRectF()); +} + +inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm, + int sx, int sy, int sw, int sh) +{ + drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); +} + +inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm, + int sx, int sy, int sw, int sh) +{ + drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh)); +} + +inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr) +{ + drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr); +} + +inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr) +{ + drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr); +} + +inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti) +{ + drawTextItem(QPointF(x, y), ti); +} + +inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, + Qt::ImageConversionFlags flags) +{ + drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags); +} + +inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr, + Qt::ImageConversionFlags flags) +{ + drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags); +} + +inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr, + Qt::ImageConversionFlags flags) +{ + drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags); +} + + +inline void QPainter::drawImage(const QRectF &r, const QImage &image) +{ + drawImage(r, image, QRect(0, 0, image.width(), image.height())); +} + +inline void QPainter::drawImage(const QRect &r, const QImage &image) +{ + drawImage(r, image, QRectF(0, 0, image.width(), image.height())); +} + +inline void QPainter::drawImage(const QPoint &p, const QImage &image) +{ + drawImage(QPointF(p), image); +} + +inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh, + Qt::ImageConversionFlags flags) +{ + if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor) + drawImage(QPointF(x, y), image); + else + drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags); +} + +inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti) +{ + drawTextItem(QPointF(p), ti); +} + +inline void QPainter::drawText(const QPoint &p, const QString &s) +{ + drawText(QPointF(p), s); +} + +inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br) +{ + drawText(QRect(x, y, w, h), flags, str, br); +} + +inline void QPainter::drawText(int x, int y, const QString &s) +{ + drawText(QPointF(x, y), s); +} + +inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text) +{ + return boundingRect(QRect(x, y, w, h), flags, text); +} + +inline void QPainter::translate(qreal dx, qreal dy) +{ + translate(QPointF(dx, dy)); +} + +inline void QPainter::translate(const QPoint &offset) +{ + translate(offset.x(), offset.y()); +} + +inline void QPainter::setViewport(int x, int y, int w, int h) +{ + setViewport(QRect(x, y, w, h)); +} + +inline void QPainter::setWindow(int x, int y, int w, int h) +{ + setWindow(QRect(x, y, w, h)); +} + +#ifndef QT_NO_PICTURE +inline void QPainter::drawPicture(int x, int y, const QPicture &p) +{ + drawPicture(QPoint(x, y), p); +} + +inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p) +{ + drawPicture(QPointF(pt), p); +} +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAINTER_H diff --git a/qtinterface/qt4/Qt/qpainterpath.h b/qtinterface/qt4/Qt/qpainterpath.h new file mode 100644 index 0000000..9206a19 --- /dev/null +++ b/qtinterface/qt4/Qt/qpainterpath.h @@ -0,0 +1,428 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAINTERPATH_H +#define QPAINTERPATH_H + +#include <QtGui/qmatrix.h> +#include <QtCore/qglobal.h> +#include <QtCore/qrect.h> +#include <QtCore/qline.h> +#include <QtCore/qvector.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QFont; +class QPainterPathPrivate; +struct QPainterPathPrivateDeleter; +class QPainterPathData; +class QPainterPathStrokerPrivate; +class QPolygonF; +class QRegion; +class QVectorPath; + +class Q_GUI_EXPORT QPainterPath +{ +public: + enum ElementType { + MoveToElement, + LineToElement, + CurveToElement, + CurveToDataElement + }; + + class Element { + public: + qreal x; + qreal y; + ElementType type; + + bool isMoveTo() const { return type == MoveToElement; } + bool isLineTo() const { return type == LineToElement; } + bool isCurveTo() const { return type == CurveToElement; } + + operator QPointF () const { return QPointF(x, y); } + + bool operator==(const Element &e) const { return qFuzzyCompare(x, e.x) + && qFuzzyCompare(y, e.y) && type == e.type; } + inline bool operator!=(const Element &e) const { return !operator==(e); } + }; + + QPainterPath(); + explicit QPainterPath(const QPointF &startPoint); + QPainterPath(const QPainterPath &other); + QPainterPath &operator=(const QPainterPath &other); + ~QPainterPath(); + + void closeSubpath(); + + void moveTo(const QPointF &p); + inline void moveTo(qreal x, qreal y); + + void lineTo(const QPointF &p); + inline void lineTo(qreal x, qreal y); + + void arcMoveTo(const QRectF &rect, qreal angle); + inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle); + + void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength); + inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength); + + void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt); + inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, + qreal endPtx, qreal endPty); + void quadTo(const QPointF &ctrlPt, const QPointF &endPt); + inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty); + + QPointF currentPosition() const; + + void addRect(const QRectF &rect); + inline void addRect(qreal x, qreal y, qreal w, qreal h); + void addEllipse(const QRectF &rect); + inline void addEllipse(qreal x, qreal y, qreal w, qreal h); + inline void addEllipse(const QPointF ¢er, qreal rx, qreal ry); + void addPolygon(const QPolygonF &polygon); + void addText(const QPointF &point, const QFont &f, const QString &text); + inline void addText(qreal x, qreal y, const QFont &f, const QString &text); + void addPath(const QPainterPath &path); + void addRegion(const QRegion ®ion); + + void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, + Qt::SizeMode mode = Qt::AbsoluteSize); + inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h, + qreal xRadius, qreal yRadius, + Qt::SizeMode mode = Qt::AbsoluteSize); + + void addRoundRect(const QRectF &rect, int xRnd, int yRnd); + inline void addRoundRect(qreal x, qreal y, qreal w, qreal h, + int xRnd, int yRnd); + inline void addRoundRect(const QRectF &rect, int roundness); + inline void addRoundRect(qreal x, qreal y, qreal w, qreal h, + int roundness); + + void connectPath(const QPainterPath &path); + + bool contains(const QPointF &pt) const; + bool contains(const QRectF &rect) const; + bool intersects(const QRectF &rect) const; + + void translate(qreal dx, qreal dy); + inline void translate(const QPointF &offset); + + QPainterPath translated(qreal dx, qreal dy) const; + inline QPainterPath translated(const QPointF &offset) const; + + QRectF boundingRect() const; + QRectF controlPointRect() const; + + Qt::FillRule fillRule() const; + void setFillRule(Qt::FillRule fillRule); + + inline bool isEmpty() const; + + QPainterPath toReversed() const; + QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const; + QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const; + QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const; + QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const; + QList<QPolygonF> toFillPolygons(const QTransform &matrix) const; + QPolygonF toFillPolygon(const QTransform &matrix) const; + + inline int elementCount() const; + inline const QPainterPath::Element &elementAt(int i) const; + inline void setElementPositionAt(int i, qreal x, qreal y); + + qreal length() const; + qreal percentAtLength(qreal t) const; + QPointF pointAtPercent(qreal t) const; + qreal angleAtPercent(qreal t) const; + qreal slopeAtPercent(qreal t) const; + + bool intersects(const QPainterPath &p) const; + bool contains(const QPainterPath &p) const; + QPainterPath united(const QPainterPath &r) const; + QPainterPath intersected(const QPainterPath &r) const; + QPainterPath subtracted(const QPainterPath &r) const; + QPainterPath subtractedInverted(const QPainterPath &r) const; + + QPainterPath simplified() const; + + bool operator==(const QPainterPath &other) const; + bool operator!=(const QPainterPath &other) const; + + QPainterPath operator&(const QPainterPath &other) const; + QPainterPath operator|(const QPainterPath &other) const; + QPainterPath operator+(const QPainterPath &other) const; + QPainterPath operator-(const QPainterPath &other) const; + QPainterPath &operator&=(const QPainterPath &other); + QPainterPath &operator|=(const QPainterPath &other); + QPainterPath &operator+=(const QPainterPath &other); + QPainterPath &operator-=(const QPainterPath &other); + +private: + QScopedPointer<QPainterPathPrivate, QPainterPathPrivateDeleter> d_ptr; + + inline void ensureData() { if (!d_ptr) ensureData_helper(); } + void ensureData_helper(); + inline void detach(); + void detach_helper(); + void setDirty(bool); + void computeBoundingRect() const; + void computeControlPointRect() const; + + QPainterPathData *d_func() const { return reinterpret_cast<QPainterPathData *>(d_ptr.data()); } + + friend class QPainterPathData; + friend class QPainterPathStroker; + friend class QPainterPathStrokerPrivate; + friend class QMatrix; + friend class QTransform; + friend class QVectorPath; + friend Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &); + +#ifndef QT_NO_DATASTREAM + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); +#endif +}; + +class QPainterPathPrivate +{ +public: + friend class QPainterPath; + friend class QPainterPathData; + friend class QPainterPathStroker; + friend class QPainterPathStrokerPrivate; + friend class QMatrix; + friend class QTransform; + friend class QVectorPath; + friend struct QPainterPathPrivateDeleter; +#ifndef QT_NO_DATASTREAM + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); +#endif +private: + QAtomicInt ref; + QVector<QPainterPath::Element> elements; +}; + +Q_DECLARE_TYPEINFO(QPainterPath::Element, Q_PRIMITIVE_TYPE); + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); +#endif + +class Q_GUI_EXPORT QPainterPathStroker +{ + Q_DECLARE_PRIVATE(QPainterPathStroker) +public: + QPainterPathStroker(); + ~QPainterPathStroker(); + + void setWidth(qreal width); + qreal width() const; + + void setCapStyle(Qt::PenCapStyle style); + Qt::PenCapStyle capStyle() const; + + void setJoinStyle(Qt::PenJoinStyle style); + Qt::PenJoinStyle joinStyle() const; + + void setMiterLimit(qreal length); + qreal miterLimit() const; + + void setCurveThreshold(qreal threshold); + qreal curveThreshold() const; + + void setDashPattern(Qt::PenStyle); + void setDashPattern(const QVector<qreal> &dashPattern); + QVector<qreal> dashPattern() const; + + void setDashOffset(qreal offset); + qreal dashOffset() const; + + QPainterPath createStroke(const QPainterPath &path) const; + +private: + friend class QX11PaintEngine; + + QScopedPointer<QPainterPathStrokerPrivate> d_ptr; +}; + +inline void QPainterPath::moveTo(qreal x, qreal y) +{ + moveTo(QPointF(x, y)); +} + +inline void QPainterPath::lineTo(qreal x, qreal y) +{ + lineTo(QPointF(x, y)); +} + +inline void QPainterPath::arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength) +{ + arcTo(QRectF(x, y, w, h), startAngle, arcLength); +} + +inline void QPainterPath::arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle) +{ + arcMoveTo(QRectF(x, y, w, h), angle); +} + +inline void QPainterPath::cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, + qreal endPtx, qreal endPty) +{ + cubicTo(QPointF(ctrlPt1x, ctrlPt1y), QPointF(ctrlPt2x, ctrlPt2y), + QPointF(endPtx, endPty)); +} + +inline void QPainterPath::quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty) +{ + quadTo(QPointF(ctrlPtx, ctrlPty), QPointF(endPtx, endPty)); +} + +inline void QPainterPath::addEllipse(qreal x, qreal y, qreal w, qreal h) +{ + addEllipse(QRectF(x, y, w, h)); +} + +inline void QPainterPath::addEllipse(const QPointF ¢er, qreal rx, qreal ry) +{ + addEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); +} + +inline void QPainterPath::addRect(qreal x, qreal y, qreal w, qreal h) +{ + addRect(QRectF(x, y, w, h)); +} + +inline void QPainterPath::addRoundedRect(qreal x, qreal y, qreal w, qreal h, + qreal xRadius, qreal yRadius, + Qt::SizeMode mode) +{ + addRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode); +} + +inline void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h, + int xRnd, int yRnd) +{ + addRoundRect(QRectF(x, y, w, h), xRnd, yRnd); +} + +inline void QPainterPath::addRoundRect(const QRectF &rect, + int roundness) +{ + int xRnd = roundness; + int yRnd = roundness; + if (rect.width() > rect.height()) + xRnd = int(roundness * rect.height()/rect.width()); + else + yRnd = int(roundness * rect.width()/rect.height()); + addRoundRect(rect, xRnd, yRnd); +} + +inline void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h, + int roundness) +{ + addRoundRect(QRectF(x, y, w, h), roundness); +} + +inline void QPainterPath::addText(qreal x, qreal y, const QFont &f, const QString &text) +{ + addText(QPointF(x, y), f, text); +} + +inline void QPainterPath::translate(const QPointF &offset) +{ translate(offset.x(), offset.y()); } + +inline QPainterPath QPainterPath::translated(const QPointF &offset) const +{ return translated(offset.x(), offset.y()); } + +inline bool QPainterPath::isEmpty() const +{ + return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement); +} + +inline int QPainterPath::elementCount() const +{ + return d_ptr ? d_ptr->elements.size() : 0; +} + +inline const QPainterPath::Element &QPainterPath::elementAt(int i) const +{ + Q_ASSERT(d_ptr); + Q_ASSERT(i >= 0 && i < elementCount()); + return d_ptr->elements.at(i); +} + +inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y) +{ + Q_ASSERT(d_ptr); + Q_ASSERT(i >= 0 && i < elementCount()); + detach(); + QPainterPath::Element &e = d_ptr->elements[i]; + e.x = x; + e.y = y; +} + + +inline void QPainterPath::detach() +{ + if (d_ptr->ref != 1) + detach_helper(); + setDirty(true); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QPainterPath &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAINTERPATH_H diff --git a/qtinterface/qt4/Qt/qpair.h b/qtinterface/qt4/Qt/qpair.h new file mode 100644 index 0000000..a62a686 --- /dev/null +++ b/qtinterface/qt4/Qt/qpair.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAIR_H +#define QPAIR_H + +#include <QtCore/qdatastream.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class T1, class T2> +struct QPair +{ + typedef T1 first_type; + typedef T2 second_type; + + QPair() : first(T1()), second(T2()) {} + QPair(const T1 &t1, const T2 &t2) : first(t1), second(t2) {} + + QPair<T1, T2> &operator=(const QPair<T1, T2> &other) + { first = other.first; second = other.second; return *this; } + + T1 first; + T2 second; +}; + +template <class T1, class T2> +Q_INLINE_TEMPLATE bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) +{ return p1.first == p2.first && p1.second == p2.second; } + +template <class T1, class T2> +Q_INLINE_TEMPLATE bool operator!=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) +{ return !(p1 == p2); } + +template <class T1, class T2> +Q_INLINE_TEMPLATE bool operator<(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) +{ + return p1.first < p2.first || (!(p2.first < p1.first) && p1.second < p2.second); +} + +template <class T1, class T2> +Q_INLINE_TEMPLATE bool operator>(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) +{ + return p2 < p1; +} + +template <class T1, class T2> +Q_INLINE_TEMPLATE bool operator<=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) +{ + return !(p2 < p1); +} + +template <class T1, class T2> +Q_INLINE_TEMPLATE bool operator>=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) +{ + return !(p1 < p2); +} + +template <class T1, class T2> +Q_OUTOFLINE_TEMPLATE QPair<T1, T2> qMakePair(const T1 &x, const T2 &y) +{ + return QPair<T1, T2>(x, y); +} + +#ifndef QT_NO_DATASTREAM +template <class T1, class T2> +inline QDataStream& operator>>(QDataStream& s, QPair<T1, T2>& p) +{ + s >> p.first >> p.second; + return s; +} + +template <class T1, class T2> +inline QDataStream& operator<<(QDataStream& s, const QPair<T1, T2>& p) +{ + s << p.first << p.second; + return s; +} +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAIR_H diff --git a/qtinterface/qt4/Qt/qpalette.h b/qtinterface/qt4/Qt/qpalette.h new file mode 100644 index 0000000..94f8f47 --- /dev/null +++ b/qtinterface/qt4/Qt/qpalette.h @@ -0,0 +1,262 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPALETTE_H +#define QPALETTE_H + +#include <QtGui/qwindowdefs.h> +#include <QtGui/qcolor.h> +#include <QtGui/qbrush.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifdef QT3_SUPPORT +class QColorGroup; +#endif +class QPalettePrivate; +class QVariant; + +class Q_GUI_EXPORT QPalette +{ + Q_GADGET + Q_ENUMS(ColorGroup ColorRole) +public: + QPalette(); + QPalette(const QColor &button); + QPalette(Qt::GlobalColor button); + QPalette(const QColor &button, const QColor &window); + QPalette(const QBrush &windowText, const QBrush &button, const QBrush &light, + const QBrush &dark, const QBrush &mid, const QBrush &text, + const QBrush &bright_text, const QBrush &base, const QBrush &window); + QPalette(const QColor &windowText, const QColor &window, const QColor &light, + const QColor &dark, const QColor &mid, const QColor &text, const QColor &base); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QPalette(const QColorGroup &active, const QColorGroup &disabled, const QColorGroup &inactive); +#endif + QPalette(const QPalette &palette); + ~QPalette(); + QPalette &operator=(const QPalette &palette); + operator QVariant() const; + + // Do not change the order, the serialization format depends on it + enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active }; + enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid, + Text, BrightText, ButtonText, Base, Window, Shadow, + Highlight, HighlightedText, + Link, LinkVisited, // ### Qt 5: remove + AlternateBase, + NoRole, // ### Qt 5: value should be 0 or -1 + ToolTipBase, ToolTipText, + NColorRoles = ToolTipText + 1, + Foreground = WindowText, Background = Window // ### Qt 5: remove + }; + + inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(current_group); } + inline void setCurrentColorGroup(ColorGroup cg) { current_group = cg; } + + inline const QColor &color(ColorGroup cg, ColorRole cr) const + { return brush(cg, cr).color(); } + const QBrush &brush(ColorGroup cg, ColorRole cr) const; + inline void setColor(ColorGroup cg, ColorRole cr, const QColor &color); + inline void setColor(ColorRole cr, const QColor &color); + inline void setBrush(ColorRole cr, const QBrush &brush); + bool isBrushSet(ColorGroup cg, ColorRole cr) const; + void setBrush(ColorGroup cg, ColorRole cr, const QBrush &brush); + void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button, + const QBrush &light, const QBrush &dark, const QBrush &mid, + const QBrush &text, const QBrush &bright_text, const QBrush &base, + const QBrush &window); + bool isEqual(ColorGroup cr1, ColorGroup cr2) const; + + inline const QColor &color(ColorRole cr) const { return color(Current, cr); } + inline const QBrush &brush(ColorRole cr) const { return brush(Current, cr); } + inline const QBrush &foreground() const { return brush(WindowText); } + inline const QBrush &windowText() const { return brush(WindowText); } + inline const QBrush &button() const { return brush(Button); } + inline const QBrush &light() const { return brush(Light); } + inline const QBrush &dark() const { return brush(Dark); } + inline const QBrush &mid() const { return brush(Mid); } + inline const QBrush &text() const { return brush(Text); } + inline const QBrush &base() const { return brush(Base); } + inline const QBrush &alternateBase() const { return brush(AlternateBase); } + inline const QBrush &toolTipBase() const { return brush(ToolTipBase); } + inline const QBrush &toolTipText() const { return brush(ToolTipText); } + inline const QBrush &background() const { return brush(Window); } + inline const QBrush &window() const { return brush(Window); } + inline const QBrush &midlight() const { return brush(Midlight); } + inline const QBrush &brightText() const { return brush(BrightText); } + inline const QBrush &buttonText() const { return brush(ButtonText); } + inline const QBrush &shadow() const { return brush(Shadow); } + inline const QBrush &highlight() const { return brush(Highlight); } + inline const QBrush &highlightedText() const { return brush(HighlightedText); } + inline const QBrush &link() const { return brush(Link); } + inline const QBrush &linkVisited() const { return brush(LinkVisited); } + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QPalette copy() const { QPalette p = *this; p.detach(); return p; } + QT3_SUPPORT QColorGroup normal() const; + inline QT3_SUPPORT void setNormal(const QColorGroup &cg) { setColorGroup(Active, cg); } + + QT3_SUPPORT QColorGroup active() const; + QT3_SUPPORT QColorGroup disabled() const; + QT3_SUPPORT QColorGroup inactive() const; + inline QT3_SUPPORT void setActive(const QColorGroup &cg) { setColorGroup(Active, cg); } + inline QT3_SUPPORT void setDisabled(const QColorGroup &cg) { setColorGroup(Disabled, cg); } + inline QT3_SUPPORT void setInactive(const QColorGroup &cg) { setColorGroup(Inactive, cg); } +#endif + + bool operator==(const QPalette &p) const; + inline bool operator!=(const QPalette &p) const { return !(operator==(p)); } + bool isCopyOf(const QPalette &p) const; + + int serialNumber() const; + qint64 cacheKey() const; + + QPalette resolve(const QPalette &) const; + inline uint resolve() const { return resolve_mask; } + inline void resolve(uint mask) { resolve_mask = mask; } + +private: + void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button, + const QBrush &light, const QBrush &dark, const QBrush &mid, + const QBrush &text, const QBrush &bright_text, + const QBrush &base, const QBrush &alternate_base, + const QBrush &window, const QBrush &midlight, + const QBrush &button_text, const QBrush &shadow, + const QBrush &highlight, const QBrush &highlighted_text, + const QBrush &link, const QBrush &link_visited); + void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button, + const QBrush &light, const QBrush &dark, const QBrush &mid, + const QBrush &text, const QBrush &bright_text, + const QBrush &base, const QBrush &alternate_base, + const QBrush &window, const QBrush &midlight, + const QBrush &button_text, const QBrush &shadow, + const QBrush &highlight, const QBrush &highlighted_text, + const QBrush &link, const QBrush &link_visited, + const QBrush &toolTipBase, const QBrush &toolTipText); +#ifdef QT3_SUPPORT + friend class QColorGroup; + void setColorGroup(ColorGroup, const QColorGroup &); + QColorGroup createColorGroup(ColorGroup) const; +#endif + void init(); + void detach(); + + QPalettePrivate *d; + uint current_group : 4; + uint resolve_mask : 28; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const QPalette &p); +}; + +inline void QPalette::setColor(ColorGroup acg, ColorRole acr, + const QColor &acolor) +{ setBrush(acg, acr, QBrush(acolor)); } +inline void QPalette::setColor(ColorRole acr, const QColor &acolor) +{ setColor(All, acr, acolor); } +inline void QPalette::setBrush(ColorRole acr, const QBrush &abrush) +{ setBrush(All, acr, abrush); } + +#ifdef QT3_SUPPORT +class Q_GUI_EXPORT QColorGroup : public QPalette +{ +public: + inline QColorGroup() : QPalette() {} + inline QColorGroup(const QBrush &foreground, const QBrush &button, const QBrush &light, + const QBrush &dark, const QBrush &mid, const QBrush &text, + const QBrush &bright_text, const QBrush &base, const QBrush &background) + : QPalette(foreground, button, light, dark, mid, text, bright_text, base, background) + {} + inline QColorGroup(const QColor &foreground, const QColor &background, const QColor &light, + const QColor &dark, const QColor &mid, const QColor &text, const QColor &base) + : QPalette(foreground, background, light, dark, mid, text, base) {} + inline QColorGroup(const QColorGroup &cg) : QPalette(cg) {} + inline QColorGroup(const QPalette &pal) : QPalette(pal) {} + bool operator==(const QColorGroup &other) const; + inline bool operator!=(const QColorGroup &other) const { return !(operator==(other)); } + operator QVariant() const; + + inline QT3_SUPPORT const QColor &foreground() const { return color(WindowText); } + inline QT3_SUPPORT const QColor &button() const { return color(Button); } + inline QT3_SUPPORT const QColor &light() const { return color(Light); } + inline QT3_SUPPORT const QColor &dark() const { return color(Dark); } + inline QT3_SUPPORT const QColor &mid() const { return color(Mid); } + inline QT3_SUPPORT const QColor &text() const { return color(Text); } + inline QT3_SUPPORT const QColor &base() const { return color(Base); } + inline QT3_SUPPORT const QColor &background() const { return color(Window); } + inline QT3_SUPPORT const QColor &midlight() const { return color(Midlight); } + inline QT3_SUPPORT const QColor &brightText() const { return color(BrightText); } + inline QT3_SUPPORT const QColor &buttonText() const { return color(ButtonText); } + inline QT3_SUPPORT const QColor &shadow() const { return color(Shadow); } + inline QT3_SUPPORT const QColor &highlight() const { return color(Highlight); } + inline QT3_SUPPORT const QColor &highlightedText() const { return color(HighlightedText); } + inline QT3_SUPPORT const QColor &link() const { return color(Link); } + inline QT3_SUPPORT const QColor &linkVisited() const { return color(LinkVisited); } +}; + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QT3_SUPPORT QDataStream &operator<<(QDataStream &ds, const QColorGroup &cg); +Q_GUI_EXPORT QT3_SUPPORT QDataStream &operator>>(QDataStream &ds, QColorGroup &cg); +#endif + +inline QColorGroup QPalette::inactive() const { return createColorGroup(Inactive); } +inline QColorGroup QPalette::disabled() const { return createColorGroup(Disabled); } +inline QColorGroup QPalette::active() const { return createColorGroup(Active); } +inline QColorGroup QPalette::normal() const { return createColorGroup(Active); } + +#endif + +/***************************************************************************** + QPalette stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &ds, const QPalette &p); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &ds, QPalette &p); +#endif // QT_NO_DATASTREAM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPALETTE_H diff --git a/qtinterface/qt4/Qt/qparallelanimationgroup.h b/qtinterface/qt4/Qt/qparallelanimationgroup.h new file mode 100644 index 0000000..921ecd5 --- /dev/null +++ b/qtinterface/qt4/Qt/qparallelanimationgroup.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPARALLELANIMATIONGROUP_H +#define QPARALLELANIMATIONGROUP_H + +#include <QtCore/qanimationgroup.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QParallelAnimationGroupPrivate; +class Q_CORE_EXPORT QParallelAnimationGroup : public QAnimationGroup +{ + Q_OBJECT + +public: + QParallelAnimationGroup(QObject *parent = 0); + ~QParallelAnimationGroup(); + + int duration() const; + +protected: + QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent); + bool event(QEvent *event); + + void updateCurrentTime(int currentTime); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + void updateDirection(QAbstractAnimation::Direction direction); + +private: + Q_DISABLE_COPY(QParallelAnimationGroup) + Q_DECLARE_PRIVATE(QParallelAnimationGroup) + Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished()) +}; + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPARALLELANIMATIONGROUP diff --git a/qtinterface/qt4/Qt/qpauseanimation.h b/qtinterface/qt4/Qt/qpauseanimation.h new file mode 100644 index 0000000..696e198 --- /dev/null +++ b/qtinterface/qt4/Qt/qpauseanimation.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPAUSEANIMATION_P_H +#define QPAUSEANIMATION_P_H + +#include <QtCore/qanimationgroup.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QPauseAnimationPrivate; + +class Q_CORE_EXPORT QPauseAnimation : public QAbstractAnimation +{ + Q_OBJECT + Q_PROPERTY(int duration READ duration WRITE setDuration) +public: + QPauseAnimation(QObject *parent = 0); + QPauseAnimation(int msecs, QObject *parent = 0); + ~QPauseAnimation(); + + int duration() const; + void setDuration(int msecs); + +protected: + bool event(QEvent *e); + void updateCurrentTime(int); + +private: + Q_DISABLE_COPY(QPauseAnimation) + Q_DECLARE_PRIVATE(QPauseAnimation) +}; + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPAUSEANIMATION_P_H diff --git a/qtinterface/qt4/Qt/qpen.h b/qtinterface/qt4/Qt/qpen.h new file mode 100644 index 0000000..639d136 --- /dev/null +++ b/qtinterface/qt4/Qt/qpen.h @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPEN_H +#define QPEN_H + +#include <QtGui/qcolor.h> +#include <QtGui/qbrush.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QVariant; +class QPenPrivate; +class QBrush; +class QPen; + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); +#endif + +class Q_GUI_EXPORT QPen +{ +public: + QPen(); + QPen(Qt::PenStyle); + QPen(const QColor &color); + QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine, + Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin); + QPen(const QPen &pen); + + ~QPen(); + + QPen &operator=(const QPen &pen); + + Qt::PenStyle style() const; + void setStyle(Qt::PenStyle); + + QVector<qreal> dashPattern() const; + void setDashPattern(const QVector<qreal> &pattern); + + qreal dashOffset() const; + void setDashOffset(qreal doffset); + + qreal miterLimit() const; + void setMiterLimit(qreal limit); + + qreal widthF() const; + void setWidthF(qreal width); + + int width() const; + void setWidth(int width); + + QColor color() const; + void setColor(const QColor &color); + + QBrush brush() const; + void setBrush(const QBrush &brush); + + bool isSolid() const; + + Qt::PenCapStyle capStyle() const; + void setCapStyle(Qt::PenCapStyle pcs); + + Qt::PenJoinStyle joinStyle() const; + void setJoinStyle(Qt::PenJoinStyle pcs); + + bool isCosmetic() const; + void setCosmetic(bool cosmetic); + + bool operator==(const QPen &p) const; + inline bool operator!=(const QPen &p) const { return !(operator==(p)); } + operator QVariant() const; + + bool isDetached(); +private: + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); + + void detach(); + class QPenPrivate *d; + +public: + typedef QPenPrivate * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; +Q_DECLARE_TYPEINFO(QPen, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QPen) + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPEN_H diff --git a/qtinterface/qt4/Qt/qpicture.h b/qtinterface/qt4/Qt/qpicture.h new file mode 100644 index 0000000..9369794 --- /dev/null +++ b/qtinterface/qt4/Qt/qpicture.h @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPICTURE_H +#define QPICTURE_H + +#include <QtCore/qstringlist.h> +#include <QtCore/qsharedpointer.h> +#include <QtGui/qpaintdevice.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PICTURE + +class QPicturePrivate; +class Q_GUI_EXPORT QPicture : public QPaintDevice +{ + Q_DECLARE_PRIVATE(QPicture) +public: + explicit QPicture(int formatVersion = -1); + QPicture(const QPicture &); + ~QPicture(); + + bool isNull() const; + + int devType() const; + uint size() const; + const char* data() const; + virtual void setData(const char* data, uint size); + + bool play(QPainter *p); + + bool load(QIODevice *dev, const char *format = 0); + bool load(const QString &fileName, const char *format = 0); + bool save(QIODevice *dev, const char *format = 0); + bool save(const QString &fileName, const char *format = 0); + + QRect boundingRect() const; + void setBoundingRect(const QRect &r); + + QPicture& operator=(const QPicture &p); + void detach(); + bool isDetached() const; + + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p); + + static const char* pictureFormat(const QString &fileName); + static QList<QByteArray> inputFormats(); + static QList<QByteArray> outputFormats(); + static QStringList inputFormatList(); + static QStringList outputFormatList(); + + QPaintEngine *paintEngine() const; + +protected: + QPicture(QPicturePrivate &data); + + int metric(PaintDeviceMetric m) const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QPicture copy() const { QPicture p(*this); p.detach(); return p; } +#endif + +private: + bool exec(QPainter *p, QDataStream &ds, int i); + void detach_helper(); + + QExplicitlySharedDataPointer<QPicturePrivate> d_ptr; + friend class QPicturePaintEngine; + friend class Q3Picture; + friend class QAlphaPaintEngine; + friend class QPreviewPaintEngine; + +public: + typedef QExplicitlySharedDataPointer<QPicturePrivate> DataPtr; + inline DataPtr &data_ptr() { return d_ptr; } +}; + +Q_DECLARE_SHARED(QPicture) + + +#ifndef QT_NO_PICTUREIO +class QIODevice; +class QPictureIO; +typedef void (*picture_io_handler)(QPictureIO *); // picture IO handler + +struct QPictureIOData; + +class Q_GUI_EXPORT QPictureIO +{ +public: + QPictureIO(); + QPictureIO(QIODevice *ioDevice, const char *format); + QPictureIO(const QString &fileName, const char *format); + ~QPictureIO(); + + const QPicture &picture() const; + int status() const; + const char *format() const; + QIODevice *ioDevice() const; + QString fileName() const; + int quality() const; + QString description() const; + const char *parameters() const; + float gamma() const; + + void setPicture(const QPicture &); + void setStatus(int); + void setFormat(const char *); + void setIODevice(QIODevice *); + void setFileName(const QString &); + void setQuality(int); + void setDescription(const QString &); + void setParameters(const char *); + void setGamma(float); + + bool read(); + bool write(); + + static QByteArray pictureFormat(const QString &fileName); + static QByteArray pictureFormat(QIODevice *); + static QList<QByteArray> inputFormats(); + static QList<QByteArray> outputFormats(); + + static void defineIOHandler(const char *format, + const char *header, + const char *flags, + picture_io_handler read_picture, + picture_io_handler write_picture); + +private: + Q_DISABLE_COPY(QPictureIO) + + void init(); + + QPictureIOData *d; +}; + +#endif //QT_NO_PICTUREIO + + +/***************************************************************************** + QPicture stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &); +#endif + +#endif // QT_NO_PICTURE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPICTURE_H diff --git a/qtinterface/qt4/Qt/qpictureformatplugin.h b/qtinterface/qt4/Qt/qpictureformatplugin.h new file mode 100644 index 0000000..250c01e --- /dev/null +++ b/qtinterface/qt4/Qt/qpictureformatplugin.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPICTUREFORMATPLUGIN_H +#define QPICTUREFORMATPLUGIN_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_PICTURE) + +class QPicture; +class QImage; +class QString; +class QStringList; + +struct Q_GUI_EXPORT QPictureFormatInterface : public QFactoryInterface +{ + virtual bool loadPicture(const QString &format, const QString &filename, QPicture *) = 0; + virtual bool savePicture(const QString &format, const QString &filename, const QPicture &) = 0; + + virtual bool installIOHandler(const QString &) = 0; +}; + +#define QPictureFormatInterface_iid "com.trolltech.Qt.QPictureFormatInterface" +Q_DECLARE_INTERFACE(QPictureFormatInterface, QPictureFormatInterface_iid) + + +class Q_GUI_EXPORT QPictureFormatPlugin : public QObject, public QPictureFormatInterface +{ + Q_OBJECT + Q_INTERFACES(QPictureFormatInterface:QFactoryInterface) +public: + explicit QPictureFormatPlugin(QObject *parent = 0); + ~QPictureFormatPlugin(); + + virtual QStringList keys() const = 0; + virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic); + virtual bool savePicture(const QString &format, const QString &filename, const QPicture &pic); + virtual bool installIOHandler(const QString &format) = 0; + +}; + +#endif // QT_NO_LIBRARY || QT_NO_PICTURE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPICTUREFORMATPLUGIN_H diff --git a/qtinterface/qt4/Qt/qpixmap.h b/qtinterface/qt4/Qt/qpixmap.h new file mode 100644 index 0000000..1695976 --- /dev/null +++ b/qtinterface/qt4/Qt/qpixmap.h @@ -0,0 +1,329 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPIXMAP_H +#define QPIXMAP_H + +#include <QtGui/qpaintdevice.h> +#include <QtGui/qcolor.h> +#include <QtCore/qnamespace.h> +#include <QtCore/qstring.h> // char*->QString conversion +#include <QtCore/qsharedpointer.h> +#include <QtGui/qimage.h> +#include <QtGui/qtransform.h> + +QT_BEGIN_HEADER + +#if defined(Q_OS_SYMBIAN) +class CFbsBitmap; +class RSgImage; +#endif + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QImageWriter; +class QColor; +class QVariant; +class QX11Info; +class QPixmapData; + +class Q_GUI_EXPORT QPixmap : public QPaintDevice +{ +public: + QPixmap(); + explicit QPixmap(QPixmapData *data); + QPixmap(int w, int h); + QPixmap(const QSize &); + QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); +#ifndef QT_NO_IMAGEFORMAT_XPM + QPixmap(const char * const xpm[]); +#endif + QPixmap(const QPixmap &); + ~QPixmap(); + + QPixmap &operator=(const QPixmap &); + operator QVariant() const; + + bool isNull() const; // ### Qt 5: make inline + int devType() const; + + int width() const; // ### Qt 5: make inline + int height() const; // ### Qt 5: make inline + QSize size() const; + QRect rect() const; + int depth() const; + + static int defaultDepth(); + + void fill(const QColor &fillColor = Qt::white); + void fill(const QWidget *widget, const QPoint &ofs); + inline void fill(const QWidget *widget, int xofs, int yofs) { fill(widget, QPoint(xofs, yofs)); } + + QBitmap mask() const; + void setMask(const QBitmap &); + + QPixmap alphaChannel() const; + void setAlphaChannel(const QPixmap &); + + bool hasAlpha() const; + bool hasAlphaChannel() const; + +#ifndef QT_NO_IMAGE_HEURISTIC_MASK + QBitmap createHeuristicMask(bool clipTight = true) const; +#endif + QBitmap createMaskFromColor(const QColor &maskColor) const; // ### Qt 5: remove + QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) const; + + static QPixmap grabWindow(WId, int x=0, int y=0, int w=-1, int h=-1); + static QPixmap grabWidget(QWidget *widget, const QRect &rect); + static inline QPixmap grabWidget(QWidget *widget, int x=0, int y=0, int w=-1, int h=-1) + { return grabWidget(widget, QRect(x, y, w, h)); } + + + inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const + { return scaled(QSize(w, h), aspectMode, mode); } + QPixmap scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QMatrix trueMatrix(const QMatrix &m, int w, int h); + QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QTransform trueMatrix(const QTransform &m, int w, int h); + + QImage toImage() const; + static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + + bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + inline bool loadFromData(const QByteArray &data, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool save(const QString& fileName, const char* format = 0, int quality = -1) const; + bool save(QIODevice* device, const char* format = 0, int quality = -1) const; + +#if defined(Q_WS_WIN) + enum HBitmapFormat { + NoAlpha, + PremultipliedAlpha, + Alpha + }; + + HBITMAP toWinHBITMAP(HBitmapFormat format = NoAlpha) const; + HICON toWinHICON() const; + + static QPixmap fromWinHBITMAP(HBITMAP hbitmap, HBitmapFormat format = NoAlpha); + static QPixmap fromWinHICON(HICON hicon); +#endif + +#if defined(Q_WS_MAC) + CGImageRef toMacCGImageRef() const; + static QPixmap fromMacCGImageRef(CGImageRef image); +#endif + +#if defined(Q_OS_SYMBIAN) + CFbsBitmap *toSymbianCFbsBitmap() const; + static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap); + RSgImage* toSymbianRSgImage() const; + static QPixmap fromSymbianRSgImage(RSgImage *sgImage); +#endif + + inline QPixmap copy(int x, int y, int width, int height) const; + QPixmap copy(const QRect &rect = QRect()) const; + + inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = 0); + void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0); + + int serialNumber() const; + qint64 cacheKey() const; + + bool isDetached() const; + void detach(); + + bool isQBitmap() const; + +#if defined(Q_WS_QWS) + const uchar *qwsBits() const; + int qwsBytesPerLine() const; + QRgb *clut() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numCols() const; +#endif + int colorCount() const; +#elif defined(Q_WS_MAC) + Qt::HANDLE macQDHandle() const; + Qt::HANDLE macQDAlphaHandle() const; + Qt::HANDLE macCGHandle() const; +#elif defined(Q_WS_X11) + enum ShareMode { ImplicitlyShared, ExplicitlyShared }; + + static QPixmap fromX11Pixmap(Qt::HANDLE pixmap, ShareMode mode = ImplicitlyShared); + static int x11SetDefaultScreen(int screen); + void x11SetScreen(int screen); + const QX11Info &x11Info() const; + Qt::HANDLE x11PictureHandle() const; +#endif + +#if defined(Q_WS_X11) || defined(Q_WS_QWS) + Qt::HANDLE handle() const; +#endif + + QPaintEngine *paintEngine() const; + + inline bool operator!() const { return isNull(); } + +protected: + int metric(PaintDeviceMetric) const; + +#ifdef QT3_SUPPORT +public: + enum ColorMode { Auto, Color, Mono }; + QT3_SUPPORT_CONSTRUCTOR QPixmap(const QString& fileName, const char *format, ColorMode mode); + QT3_SUPPORT bool load(const QString& fileName, const char *format, ColorMode mode); + QT3_SUPPORT bool loadFromData(const uchar *buf, uint len, const char* format, ColorMode mode); + QT3_SUPPORT_CONSTRUCTOR QPixmap(const QImage& image); + QT3_SUPPORT QPixmap &operator=(const QImage &); + inline QT3_SUPPORT QImage convertToImage() const { return toImage(); } + QT3_SUPPORT bool convertFromImage(const QImage &, ColorMode mode); + QT3_SUPPORT bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor) + { (*this) = fromImage(img, flags); return !isNull(); } + inline QT3_SUPPORT operator QImage() const { return toImage(); } + inline QT3_SUPPORT QPixmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } + inline QT3_SUPPORT bool selfMask() const { return false; } +private: + void resize_helper(const QSize &s); +public: + inline QT3_SUPPORT void resize(const QSize &s) { resize_helper(s); } + inline QT3_SUPPORT void resize(int width, int height) { resize_helper(QSize(width, height)); } +#endif + +private: + QExplicitlySharedDataPointer<QPixmapData> data; + + bool doImageIO(QImageWriter *io, int quality) const; + + // ### Qt5: remove the following three lines + enum Type { PixmapType, BitmapType }; // must match QPixmapData::PixelType + QPixmap(const QSize &s, Type); + void init(int, int, Type = PixmapType); + + QPixmap(const QSize &s, int type); + void init(int, int, int); + void deref(); +#if defined(Q_WS_WIN) + void initAlphaPixmap(uchar *bytes, int length, struct tagBITMAPINFO *bmi); +#endif + Q_DUMMY_COMPARISON_OPERATOR(QPixmap) +#ifdef Q_WS_MAC + friend CGContextRef qt_mac_cg_context(const QPaintDevice*); + friend CGImageRef qt_mac_create_imagemask(const QPixmap&, const QRectF&); + friend IconRef qt_mac_create_iconref(const QPixmap&); + friend quint32 *qt_mac_pixmap_get_base(const QPixmap*); + friend int qt_mac_pixmap_get_bytes_per_line(const QPixmap*); +#endif + friend class QPixmapData; + friend class QX11PixmapData; + friend class QMacPixmapData; + friend class QS60PixmapData; + friend class QBitmap; + friend class QPaintDevice; + friend class QPainter; + friend class QGLWidget; + friend class QX11PaintEngine; + friend class QCoreGraphicsPaintEngine; + friend class QWidgetPrivate; + friend class QRasterPaintEngine; + friend class QRasterBuffer; + friend class QPixmapCacheEntry; +#if !defined(QT_NO_DATASTREAM) + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); +#endif + friend Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap); + +public: + QPixmapData* pixmapData() const; + +public: + typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr; + inline DataPtr &data_ptr() { return data; } +}; + +Q_DECLARE_SHARED(QPixmap) + +inline QPixmap QPixmap::copy(int ax, int ay, int awidth, int aheight) const +{ + return copy(QRect(ax, ay, awidth, aheight)); +} + +inline void QPixmap::scroll(int dx, int dy, int ax, int ay, int awidth, int aheight, QRegion *exposed) +{ + scroll(dx, dy, QRect(ax, ay, awidth, aheight), exposed); +} + +inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format, + Qt::ImageConversionFlags flags) +{ + return loadFromData(reinterpret_cast<const uchar *>(buf.constData()), buf.size(), format, flags); +} + +/***************************************************************************** + QPixmap stream functions +*****************************************************************************/ + +#if !defined(QT_NO_DATASTREAM) +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); +#endif + +/***************************************************************************** + QPixmap (and QImage) helper functions +*****************************************************************************/ +#ifdef QT3_SUPPORT +QT3_SUPPORT Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, const QPixmap *src, + int sx=0, int sy=0, int sw=-1, int sh=-1); +#endif // QT3_SUPPORT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPIXMAP_H diff --git a/qtinterface/qt4/Qt/qpixmapcache.h b/qtinterface/qt4/Qt/qpixmapcache.h new file mode 100644 index 0000000..e1d2282 --- /dev/null +++ b/qtinterface/qt4/Qt/qpixmapcache.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPIXMAPCACHE_H +#define QPIXMAPCACHE_H + +#include <QtGui/qpixmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QPixmapCache +{ +public: + class KeyData; + class Q_GUI_EXPORT Key + { + public: + Key(); + Key(const Key &other); + ~Key(); + bool operator ==(const Key &key) const; + inline bool operator !=(const Key &key) const + { return !operator==(key); } + Key &operator =(const Key &other); + + private: + KeyData *d; + friend class QPMCache; + friend class QPixmapCache; + }; + + static int cacheLimit(); + static void setCacheLimit(int); + static QPixmap *find(const QString &key); + static bool find(const QString &key, QPixmap &pixmap); + static bool find(const QString &key, QPixmap *pixmap); + static bool find(const Key &key, QPixmap *pixmap); + static bool insert(const QString &key, const QPixmap &pixmap); + static Key insert(const QPixmap &pixmap); + static bool replace(const Key &key, const QPixmap &pixmap); + static void remove(const QString &key); + static void remove(const Key &key); + static void clear(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPIXMAPCACHE_H diff --git a/qtinterface/qt4/Qt/qplaintextedit.h b/qtinterface/qt4/Qt/qplaintextedit.h new file mode 100644 index 0000000..f894c31 --- /dev/null +++ b/qtinterface/qt4/Qt/qplaintextedit.h @@ -0,0 +1,327 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLAINTEXTEDIT_H +#define QPLAINTEXTEDIT_H + +#include <QtGui/qtextedit.h> + +#include <QtGui/qabstractscrollarea.h> +#include <QtGui/qtextdocument.h> +#include <QtGui/qtextoption.h> +#include <QtGui/qtextcursor.h> +#include <QtGui/qtextformat.h> +#include <QtGui/qabstracttextdocumentlayout.h> + +#ifndef QT_NO_TEXTEDIT + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyleSheet; +class QTextDocument; +class QMenu; +class QPlainTextEditPrivate; +class QMimeData; + + +class Q_GUI_EXPORT QPlainTextEdit : public QAbstractScrollArea +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPlainTextEdit) + Q_ENUMS(LineWrapMode) + Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) + Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) + Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) + Q_PROPERTY(LineWrapMode lineWrapMode READ lineWrapMode WRITE setLineWrapMode) + QDOC_PROPERTY(QTextOption::WrapMode wordWrapMode READ wordWrapMode WRITE setWordWrapMode) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText NOTIFY textChanged USER true) + Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) + Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth) + Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) + Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) + Q_PROPERTY(int blockCount READ blockCount) + Q_PROPERTY(int maximumBlockCount READ maximumBlockCount WRITE setMaximumBlockCount) + Q_PROPERTY(bool backgroundVisible READ backgroundVisible WRITE setBackgroundVisible) + Q_PROPERTY(bool centerOnScroll READ centerOnScroll WRITE setCenterOnScroll) +public: + enum LineWrapMode { + NoWrap, + WidgetWidth + }; + + explicit QPlainTextEdit(QWidget *parent = 0); + explicit QPlainTextEdit(const QString &text, QWidget *parent = 0); + virtual ~QPlainTextEdit(); + + void setDocument(QTextDocument *document); + QTextDocument *document() const; + + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + + bool isReadOnly() const; + void setReadOnly(bool ro); + + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + + void mergeCurrentCharFormat(const QTextCharFormat &modifier); + void setCurrentCharFormat(const QTextCharFormat &format); + QTextCharFormat currentCharFormat() const; + + bool tabChangesFocus() const; + void setTabChangesFocus(bool b); + + inline void setDocumentTitle(const QString &title) + { document()->setMetaInformation(QTextDocument::DocumentTitle, title); } + inline QString documentTitle() const + { return document()->metaInformation(QTextDocument::DocumentTitle); } + + inline bool isUndoRedoEnabled() const + { return document()->isUndoRedoEnabled(); } + inline void setUndoRedoEnabled(bool enable) + { document()->setUndoRedoEnabled(enable); } + + inline void setMaximumBlockCount(int maximum) + { document()->setMaximumBlockCount(maximum); } + inline int maximumBlockCount() const + { return document()->maximumBlockCount(); } + + + LineWrapMode lineWrapMode() const; + void setLineWrapMode(LineWrapMode mode); + + QTextOption::WrapMode wordWrapMode() const; + void setWordWrapMode(QTextOption::WrapMode policy); + + void setBackgroundVisible(bool visible); + bool backgroundVisible() const; + + void setCenterOnScroll(bool enabled); + bool centerOnScroll() const; + + bool find(const QString &exp, QTextDocument::FindFlags options = 0); + + inline QString toPlainText() const + { return document()->toPlainText(); } + + void ensureCursorVisible(); + + virtual QVariant loadResource(int type, const QUrl &name); +#ifndef QT_NO_CONTEXTMENU + QMenu *createStandardContextMenu(); +#endif + + QTextCursor cursorForPosition(const QPoint &pos) const; + QRect cursorRect(const QTextCursor &cursor) const; + QRect cursorRect() const; + + bool overwriteMode() const; + void setOverwriteMode(bool overwrite); + + int tabStopWidth() const; + void setTabStopWidth(int width); + + int cursorWidth() const; + void setCursorWidth(int width); + + void setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections); + QList<QTextEdit::ExtraSelection> extraSelections() const; + + void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + + bool canPaste() const; + +#ifndef QT_NO_PRINTER + void print(QPrinter *printer) const; +#endif + + int blockCount() const; + +public Q_SLOTS: + + void setPlainText(const QString &text); + +#ifndef QT_NO_CLIPBOARD + void cut(); + void copy(); + void paste(); +#endif + + void undo(); + void redo(); + + void clear(); + void selectAll(); + + void insertPlainText(const QString &text); + + void appendPlainText(const QString &text); + void appendHtml(const QString &html); + + void centerCursor(); + +Q_SIGNALS: + void textChanged(); + void undoAvailable(bool b); + void redoAvailable(bool b); + void copyAvailable(bool b); + void selectionChanged(); + void cursorPositionChanged(); + + void updateRequest(const QRect &rect, int dy); + void blockCountChanged(int newBlockCount); + void modificationChanged(bool); + +protected: + virtual bool event(QEvent *e); + virtual void timerEvent(QTimerEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void paintEvent(QPaintEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual bool focusNextPrevChild(bool next); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QContextMenuEvent *e); +#endif +#ifndef QT_NO_DRAGANDDROP + virtual void dragEnterEvent(QDragEnterEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dropEvent(QDropEvent *e); +#endif + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void showEvent(QShowEvent *); + virtual void changeEvent(QEvent *e); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *e); +#endif + + virtual QMimeData *createMimeDataFromSelection() const; + virtual bool canInsertFromMimeData(const QMimeData *source) const; + virtual void insertFromMimeData(const QMimeData *source); + + virtual void inputMethodEvent(QInputMethodEvent *); + QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + + QPlainTextEdit(QPlainTextEditPrivate &dd, QWidget *parent); + + virtual void scrollContentsBy(int dx, int dy); + + QTextBlock firstVisibleBlock() const; + QPointF contentOffset() const; + QRectF blockBoundingRect(const QTextBlock &block) const; + QRectF blockBoundingGeometry(const QTextBlock &block) const; + QAbstractTextDocumentLayout::PaintContext getPaintContext() const; + + +private: + Q_DISABLE_COPY(QPlainTextEdit) + Q_PRIVATE_SLOT(d_func(), void _q_repaintContents(const QRectF &r)) + Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) + Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int)) + Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged()) + + friend class QPlainTextEditControl; +}; + + +class QPlainTextDocumentLayoutPrivate; +class Q_GUI_EXPORT QPlainTextDocumentLayout : public QAbstractTextDocumentLayout +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPlainTextDocumentLayout) + Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) + +public: + QPlainTextDocumentLayout(QTextDocument *document); + ~QPlainTextDocumentLayout(); + + void draw(QPainter *, const PaintContext &); + int hitTest(const QPointF &, Qt::HitTestAccuracy ) const; + + int pageCount() const; + QSizeF documentSize() const; + + QRectF frameBoundingRect(QTextFrame *) const; + QRectF blockBoundingRect(const QTextBlock &block) const; + + void ensureBlockLayout(const QTextBlock &block) const; + + void setCursorWidth(int width); + int cursorWidth() const; + + void requestUpdate(); + +protected: + void documentChanged(int from, int /*charsRemoved*/, int charsAdded); + + +private: + void setTextWidth(qreal newWidth); + qreal textWidth() const; + void layoutBlock(const QTextBlock &block); + qreal blockWidth(const QTextBlock &block); + + QPlainTextDocumentLayoutPrivate *priv() const; + + friend class QPlainTextEdit; + friend class QPlainTextEditPrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QT_NO_TEXTEDIT + +#endif // QPLAINTEXTEDIT_H diff --git a/qtinterface/qt4/Qt/qplastiquestyle.h b/qtinterface/qt4/Qt/qplastiquestyle.h new file mode 100644 index 0000000..25e1dc7 --- /dev/null +++ b/qtinterface/qt4/Qt/qplastiquestyle.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLASTIQUESTYLE_H +#define QPLASTIQUESTYLE_H + +#include <QtGui/qwindowsstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_PLASTIQUE) + +class QPlastiqueStylePrivate; +class Q_GUI_EXPORT QPlastiqueStyle : public QWindowsStyle +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPlastiqueStyle) +public: + QPlastiqueStyle(); + ~QPlastiqueStyle(); + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, + QPainter *painter, const QWidget *widget) const; + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget) const; + + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, + const QPoint &pos, const QWidget *widget = 0) const; + + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + + void polish(QWidget *widget); + void polish(QApplication *app); + void polish(QPalette &pal); + void unpolish(QWidget *widget); + void unpolish(QApplication *app); + + QPalette standardPalette() const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; + int layoutSpacingImplementation(QSizePolicy::ControlType control1, + QSizePolicy::ControlType control2, + Qt::Orientation orientation, + const QStyleOption *option = 0, + const QWidget *widget = 0) const; + +protected: + bool eventFilter(QObject *watched, QEvent *event); + void timerEvent(QTimerEvent *event); + +private: + Q_DISABLE_COPY(QPlastiqueStyle) + void *reserved; +}; + +#endif // QT_NO_STYLE_PLASTIQUE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLASTIQUESTYLE_H diff --git a/qtinterface/qt4/Qt/qplugin.h b/qtinterface/qt4/Qt/qplugin.h new file mode 100644 index 0000000..36e4a7b --- /dev/null +++ b/qtinterface/qt4/Qt/qplugin.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLUGIN_H +#define QPLUGIN_H + +#include <QtCore/qobject.h> +#include <QtCore/qpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef Q_EXTERN_C +# ifdef __cplusplus +# define Q_EXTERN_C extern "C" +# else +# define Q_EXTERN_C extern +# endif +#endif + +typedef QObject *(*QtPluginInstanceFunction)(); + +void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function); + +#define Q_IMPORT_PLUGIN(PLUGIN) \ + extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \ + class Static##PLUGIN##PluginInstance{ \ + public: \ + Static##PLUGIN##PluginInstance() { \ + qRegisterStaticPluginInstanceFunction(qt_plugin_instance_##PLUGIN); \ + } \ + }; \ + static Static##PLUGIN##PluginInstance static##PLUGIN##Instance; + +#define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ + { \ + static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \ + if (!_instance) \ + _instance = new IMPLEMENTATION; \ + return _instance; \ + } + +# define Q_EXPORT_PLUGIN(PLUGIN) \ + Q_EXPORT_PLUGIN2(PLUGIN, PLUGIN) + +# define Q_EXPORT_STATIC_PLUGIN(PLUGIN) \ + Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGIN) + +#if defined(QT_STATICPLUGIN) + +# define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \ + QT_PREPEND_NAMESPACE(QObject) \ + *qt_plugin_instance_##PLUGIN() \ + Q_PLUGIN_INSTANCE(PLUGINCLASS) + +# define Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGINCLASS) \ + Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) + +#else +// NOTE: if you change pattern, you MUST change the pattern in +// qlibrary.cpp as well. changing the pattern will break all +// backwards compatibility as well (no old plugins will be loaded). +# ifdef QPLUGIN_DEBUG_STR +# undef QPLUGIN_DEBUG_STR +# endif +# ifdef QT_NO_DEBUG +# define QPLUGIN_DEBUG_STR "false" +# else +# define QPLUGIN_DEBUG_STR "true" +# endif +# define Q_PLUGIN_VERIFICATION_DATA \ + static const char *qt_plugin_verification_data = \ + "pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \ + "version="QT_VERSION_STR"\n" \ + "debug="QPLUGIN_DEBUG_STR"\n" \ + "buildkey="QT_BUILD_KEY; + +# if defined (Q_OS_WIN32) && defined(Q_CC_BOR) +# define Q_STANDARD_CALL __stdcall +# else +# define Q_STANDARD_CALL +# endif + +# define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \ + Q_PLUGIN_VERIFICATION_DATA \ + Q_EXTERN_C Q_DECL_EXPORT \ + const char * Q_STANDARD_CALL qt_plugin_query_verification_data() \ + { return qt_plugin_verification_data; } \ + Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) * Q_STANDARD_CALL qt_plugin_instance() \ + Q_PLUGIN_INSTANCE(PLUGINCLASS) + +# define Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGINCLASS) + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_PLUGIN_H diff --git a/qtinterface/qt4/Qt/qpluginloader.h b/qtinterface/qt4/Qt/qpluginloader.h new file mode 100644 index 0000000..8ce3c7a --- /dev/null +++ b/qtinterface/qt4/Qt/qpluginloader.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLUGINLOADER_H +#define QPLUGINLOADER_H + +#include <QtCore/qlibrary.h> + +#if defined(QT_NO_LIBRARY) && defined(Q_OS_WIN) +#undef QT_NO_LIBRARY +#pragma message("QT_NO_LIBRARY is not supported on Windows") +#endif + +#ifndef QT_NO_LIBRARY + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QLibraryPrivate; + +class Q_CORE_EXPORT QPluginLoader : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString fileName READ fileName WRITE setFileName) + Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints) +public: + explicit QPluginLoader(QObject *parent = 0); + explicit QPluginLoader(const QString &fileName, QObject *parent = 0); + ~QPluginLoader(); + + QObject *instance(); + + static QObjectList staticInstances(); + + bool load(); + bool unload(); + bool isLoaded() const; + + void setFileName(const QString &fileName); + QString fileName() const; + + QString errorString() const; + + void setLoadHints(QLibrary::LoadHints loadHints); + QLibrary::LoadHints loadHints() const; + +private: + QLibraryPrivate *d; + bool did_load; + Q_DISABLE_COPY(QPluginLoader) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_LIBRARY + +#endif //QPLUGINLOADER_H diff --git a/qtinterface/qt4/Qt/qpoint.h b/qtinterface/qt4/Qt/qpoint.h new file mode 100644 index 0000000..0b32547 --- /dev/null +++ b/qtinterface/qt4/Qt/qpoint.h @@ -0,0 +1,363 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPOINT_H +#define QPOINT_H + +#include <QtCore/qnamespace.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QPoint +{ +public: + QPoint(); + QPoint(int xpos, int ypos); + + bool isNull() const; + + int x() const; + int y() const; + void setX(int x); + void setY(int y); + + int manhattanLength() const; + + int &rx(); + int &ry(); + + QPoint &operator+=(const QPoint &p); + QPoint &operator-=(const QPoint &p); + QPoint &operator*=(qreal c); + QPoint &operator/=(qreal c); + + friend inline bool operator==(const QPoint &, const QPoint &); + friend inline bool operator!=(const QPoint &, const QPoint &); + friend inline const QPoint operator+(const QPoint &, const QPoint &); + friend inline const QPoint operator-(const QPoint &, const QPoint &); + friend inline const QPoint operator*(const QPoint &, qreal); + friend inline const QPoint operator*(qreal, const QPoint &); + friend inline const QPoint operator-(const QPoint &); + friend inline const QPoint operator/(const QPoint &, qreal); + +private: + friend class QTransform; + // ### Qt 5; remove the ifdef and just have the same order on all platforms. +#if defined(Q_OS_MAC) + int yp; + int xp; +#else + int xp; + int yp; +#endif +}; + +Q_DECLARE_TYPEINFO(QPoint, Q_MOVABLE_TYPE); + +/***************************************************************************** + QPoint stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QPoint &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QPoint &); +#endif + +/***************************************************************************** + QPoint inline functions + *****************************************************************************/ + +inline QPoint::QPoint() +{ xp=0; yp=0; } + +inline QPoint::QPoint(int xpos, int ypos) +{ xp = xpos; yp = ypos; } + +inline bool QPoint::isNull() const +{ return xp == 0 && yp == 0; } + +inline int QPoint::x() const +{ return xp; } + +inline int QPoint::y() const +{ return yp; } + +inline void QPoint::setX(int xpos) +{ xp = xpos; } + +inline void QPoint::setY(int ypos) +{ yp = ypos; } + +inline int &QPoint::rx() +{ return xp; } + +inline int &QPoint::ry() +{ return yp; } + +inline QPoint &QPoint::operator+=(const QPoint &p) +{ xp+=p.xp; yp+=p.yp; return *this; } + +inline QPoint &QPoint::operator-=(const QPoint &p) +{ xp-=p.xp; yp-=p.yp; return *this; } + +inline QPoint &QPoint::operator*=(qreal c) +{ xp = qRound(xp*c); yp = qRound(yp*c); return *this; } + +inline bool operator==(const QPoint &p1, const QPoint &p2) +{ return p1.xp == p2.xp && p1.yp == p2.yp; } + +inline bool operator!=(const QPoint &p1, const QPoint &p2) +{ return p1.xp != p2.xp || p1.yp != p2.yp; } + +inline const QPoint operator+(const QPoint &p1, const QPoint &p2) +{ return QPoint(p1.xp+p2.xp, p1.yp+p2.yp); } + +inline const QPoint operator-(const QPoint &p1, const QPoint &p2) +{ return QPoint(p1.xp-p2.xp, p1.yp-p2.yp); } + +inline const QPoint operator*(const QPoint &p, qreal c) +{ return QPoint(qRound(p.xp*c), qRound(p.yp*c)); } + +inline const QPoint operator*(qreal c, const QPoint &p) +{ return QPoint(qRound(p.xp*c), qRound(p.yp*c)); } + +inline const QPoint operator-(const QPoint &p) +{ return QPoint(-p.xp, -p.yp); } + +inline QPoint &QPoint::operator/=(qreal c) +{ + xp = qRound(xp/c); + yp = qRound(yp/c); + return *this; +} + +inline const QPoint operator/(const QPoint &p, qreal c) +{ + return QPoint(qRound(p.xp/c), qRound(p.yp/c)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QPoint &); +#endif + + + + + +class Q_CORE_EXPORT QPointF +{ +public: + QPointF(); + QPointF(const QPoint &p); + QPointF(qreal xpos, qreal ypos); + + qreal manhattanLength() const; + + bool isNull() const; + + qreal x() const; + qreal y() const; + void setX(qreal x); + void setY(qreal y); + + qreal &rx(); + qreal &ry(); + + QPointF &operator+=(const QPointF &p); + QPointF &operator-=(const QPointF &p); + QPointF &operator*=(qreal c); + QPointF &operator/=(qreal c); + + friend inline bool operator==(const QPointF &, const QPointF &); + friend inline bool operator!=(const QPointF &, const QPointF &); + friend inline const QPointF operator+(const QPointF &, const QPointF &); + friend inline const QPointF operator-(const QPointF &, const QPointF &); + friend inline const QPointF operator*(qreal, const QPointF &); + friend inline const QPointF operator*(const QPointF &, qreal); + friend inline const QPointF operator-(const QPointF &); + friend inline const QPointF operator/(const QPointF &, qreal); + + QPoint toPoint() const; + +private: + friend class QMatrix; + friend class QTransform; + + qreal xp; + qreal yp; +}; + +Q_DECLARE_TYPEINFO(QPointF, Q_MOVABLE_TYPE); + +/***************************************************************************** + QPointF stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QPointF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QPointF &); +#endif + +/***************************************************************************** + QPointF inline functions + *****************************************************************************/ + +inline QPointF::QPointF() : xp(0), yp(0) { } + +inline QPointF::QPointF(qreal xpos, qreal ypos) : xp(xpos), yp(ypos) { } + +inline QPointF::QPointF(const QPoint &p) : xp(p.x()), yp(p.y()) { } + +inline bool QPointF::isNull() const +{ + return qIsNull(xp) && qIsNull(yp); +} + +inline qreal QPointF::x() const +{ + return xp; +} + +inline qreal QPointF::y() const +{ + return yp; +} + +inline void QPointF::setX(qreal xpos) +{ + xp = xpos; +} + +inline void QPointF::setY(qreal ypos) +{ + yp = ypos; +} + +inline qreal &QPointF::rx() +{ + return xp; +} + +inline qreal &QPointF::ry() +{ + return yp; +} + +inline QPointF &QPointF::operator+=(const QPointF &p) +{ + xp+=p.xp; + yp+=p.yp; + return *this; +} + +inline QPointF &QPointF::operator-=(const QPointF &p) +{ + xp-=p.xp; yp-=p.yp; return *this; +} + +inline QPointF &QPointF::operator*=(qreal c) +{ + xp*=c; yp*=c; return *this; +} + +inline bool operator==(const QPointF &p1, const QPointF &p2) +{ + return qFuzzyIsNull(p1.xp - p2.xp) && qFuzzyIsNull(p1.yp - p2.yp); +} + +inline bool operator!=(const QPointF &p1, const QPointF &p2) +{ + return !qFuzzyIsNull(p1.xp - p2.xp) || !qFuzzyIsNull(p1.yp - p2.yp); +} + +inline const QPointF operator+(const QPointF &p1, const QPointF &p2) +{ + return QPointF(p1.xp+p2.xp, p1.yp+p2.yp); +} + +inline const QPointF operator-(const QPointF &p1, const QPointF &p2) +{ + return QPointF(p1.xp-p2.xp, p1.yp-p2.yp); +} + +inline const QPointF operator*(const QPointF &p, qreal c) +{ + return QPointF(p.xp*c, p.yp*c); +} + +inline const QPointF operator*(qreal c, const QPointF &p) +{ + return QPointF(p.xp*c, p.yp*c); +} + +inline const QPointF operator-(const QPointF &p) +{ + return QPointF(-p.xp, -p.yp); +} + +inline QPointF &QPointF::operator/=(qreal c) +{ + xp/=c; + yp/=c; + return *this; +} + +inline const QPointF operator/(const QPointF &p, qreal c) +{ + return QPointF(p.xp/c, p.yp/c); +} + +inline QPoint QPointF::toPoint() const +{ + return QPoint(qRound(xp), qRound(yp)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug d, const QPointF &p); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPOINT_H diff --git a/qtinterface/qt4/Qt/qpointer.h b/qtinterface/qt4/Qt/qpointer.h new file mode 100644 index 0000000..65270ab --- /dev/null +++ b/qtinterface/qt4/Qt/qpointer.h @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPOINTER_H +#define QPOINTER_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class T> +class QPointer +{ + QObject *o; +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<T> &operator=(const QPointer<T> &p) + { if (this != &p) QMetaObject::changeGuard(&o, p.o); return *this; } + inline QPointer<T> &operator=(T* p) + { if (o != p) QMetaObject::changeGuard(&o, p); return *this; } + + inline bool isNull() const + { return !o; } + + inline T* operator->() const + { return static_cast<T*>(const_cast<QObject*>(o)); } + inline T& operator*() const + { return *static_cast<T*>(const_cast<QObject*>(o)); } + inline operator T*() const + { return static_cast<T*>(const_cast<QObject*>(o)); } + inline T* data() const + { return static_cast<T*>(const_cast<QObject*>(o)); } +}; + + +#if (!defined(Q_CC_SUN) || (__SUNPRO_CC >= 0x580)) // ambiguity between const T * and T * + +template <class T> +inline bool operator==(const T *o, const QPointer<T> &p) +{ return o == p.operator->(); } + +template<class T> +inline bool operator==(const QPointer<T> &p, const T *o) +{ return p.operator->() == o; } + +#else + +template<class T> +inline bool operator==(const void *o, const QPointer<T> &p) +{ return o == p.operator->(); } + +template<class T> +inline bool operator==(const QPointer<T> &p, const void *o) +{ return p.operator->() == o; } + +#endif + +template <class T> +inline bool operator==(T *o, const QPointer<T> &p) +{ return o == p.operator->(); } + +template<class T> +inline bool operator==(const QPointer<T> &p, T *o) +{ return p.operator->() == o; } + +template<class T> +inline bool operator==(const QPointer<T> &p1, const QPointer<T> &p2) +{ return p1.operator->() == p2.operator->(); } + + +#if (!defined(Q_CC_SUN) || (__SUNPRO_CC >= 0x580)) // ambiguity between const T * and T * + +template <class T> +inline bool operator!=(const T *o, const QPointer<T> &p) +{ return o != p.operator->(); } + +template<class T> +inline bool operator!= (const QPointer<T> &p, const T *o) +{ return p.operator->() != o; } + +#else + +template<class T> +inline bool operator!= (const void *o, const QPointer<T> &p) +{ return o != p.operator->(); } + +template<class T> +inline bool operator!= (const QPointer<T> &p, const void *o) +{ return p.operator->() != o; } + +#endif + +template <class T> +inline bool operator!=(T *o, const QPointer<T> &p) +{ return o != p.operator->(); } + +template<class T> +inline bool operator!= (const QPointer<T> &p, T *o) +{ return p.operator->() != o; } + +template<class T> +inline bool operator!= (const QPointer<T> &p1, const QPointer<T> &p2) +{ return p1.operator->() != p2.operator->() ; } + +// Make MSVC < 1400 (2005) handle "if (NULL == p)" syntax +#if defined(Q_CC_MSVC) && (_MSC_VER < 1400) +template<class T> +inline bool operator== (int i, const QPointer<T> &p) +{ Q_ASSERT(i == 0); return !i && p.isNull(); } + +template<class T> +inline bool operator!= (int i, const QPointer<T> &p) +{ Q_ASSERT(i == 0); return !i && !p.isNull(); } +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPOINTER_H diff --git a/qtinterface/qt4/Qt/qpolygon.h b/qtinterface/qt4/Qt/qpolygon.h new file mode 100644 index 0000000..c42007a --- /dev/null +++ b/qtinterface/qt4/Qt/qpolygon.h @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPOLYGON_H +#define QPOLYGON_H + +#include <QtCore/qvector.h> +#include <QtCore/qpoint.h> +#include <QtCore/qrect.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QMatrix; +class QTransform; +class QRect; +class QVariant; + +class Q_GUI_EXPORT QPolygon : public QVector<QPoint> +{ +public: + inline QPolygon() {} + inline ~QPolygon() {} + inline QPolygon(int size); + inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {} + inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {} + QPolygon(const QRect &r, bool closed=false); + QPolygon(int nPoints, const int *points); + operator QVariant() const; + + void translate(int dx, int dy); + void translate(const QPoint &offset); + + QPolygon translated(int dx, int dy) const; + inline QPolygon translated(const QPoint &offset) const; + + QRect boundingRect() const; + + void point(int i, int *x, int *y) const; + QPoint point(int i) const; + void setPoint(int index, int x, int y); + void setPoint(int index, const QPoint &p); + void setPoints(int nPoints, const int *points); + void setPoints(int nPoints, int firstx, int firsty, ...); + void putPoints(int index, int nPoints, const int *points); + void putPoints(int index, int nPoints, int firstx, int firsty, ...); + void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0); + + bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const; + + QPolygon united(const QPolygon &r) const; + QPolygon intersected(const QPolygon &r) const; + QPolygon subtracted(const QPolygon &r) const; +}; + +inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &); +#endif + +/***************************************************************************** + QPolygon stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygon &polygon); +#endif + +/***************************************************************************** + Misc. QPolygon functions + *****************************************************************************/ + +inline void QPolygon::setPoint(int index, const QPoint &pt) +{ (*this)[index] = pt; } + +inline void QPolygon::setPoint(int index, int x, int y) +{ (*this)[index] = QPoint(x, y); } + +inline QPoint QPolygon::point(int index) const +{ return at(index); } + +inline void QPolygon::translate(const QPoint &offset) +{ translate(offset.x(), offset.y()); } + +inline QPolygon QPolygon::translated(const QPoint &offset) const +{ return translated(offset.x(), offset.y()); } + +class QRectF; + +class Q_GUI_EXPORT QPolygonF : public QVector<QPointF> +{ +public: + inline QPolygonF() {} + inline ~QPolygonF() {} + inline QPolygonF(int size); + inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {} + inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {} + QPolygonF(const QRectF &r); + QPolygonF(const QPolygon &a); + + inline void translate(qreal dx, qreal dy); + void translate(const QPointF &offset); + + inline QPolygonF translated(qreal dx, qreal dy) const; + QPolygonF translated(const QPointF &offset) const; + + QPolygon toPolygon() const; + + bool isClosed() const { return !isEmpty() && first() == last(); } + + QRectF boundingRect() const; + + bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const; + + QPolygonF united(const QPolygonF &r) const; + QPolygonF intersected(const QPolygonF &r) const; + QPolygonF subtracted(const QPolygonF &r) const; +}; + +inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &); +#endif + +/***************************************************************************** + QPolygonF stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygonF &array); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygonF &array); +#endif + +inline void QPolygonF::translate(qreal dx, qreal dy) +{ translate(QPointF(dx, dy)); } + +inline QPolygonF QPolygonF::translated(qreal dx, qreal dy) const +{ return translated(QPointF(dx, dy)); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPOLYGON_H diff --git a/qtinterface/qt4/Qt/qprintdialog.h b/qtinterface/qt4/Qt/qprintdialog.h new file mode 100644 index 0000000..2ddd186 --- /dev/null +++ b/qtinterface/qt4/Qt/qprintdialog.h @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTDIALOG_H +#define QPRINTDIALOG_H + +#include <QtGui/qabstractprintdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTDIALOG + +class QPrintDialogPrivate; +class QPushButton; +class QPrinter; + +#if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) +class QUnixPrintWidgetPrivate; + +class Q_GUI_EXPORT QUnixPrintWidget : public QWidget +{ + Q_OBJECT + +public: + QUnixPrintWidget(QPrinter *printer, QWidget *parent = 0); + ~QUnixPrintWidget(); + void updatePrinter(); + +private: + friend class QPrintDialogPrivate; + friend class QUnixPrintWidgetPrivate; + QUnixPrintWidgetPrivate *d; + Q_PRIVATE_SLOT(d, void _q_printerChanged(int)) + Q_PRIVATE_SLOT(d, void _q_btnBrowseClicked()) + Q_PRIVATE_SLOT(d, void _q_btnPropertiesClicked()) +}; +#endif + +class Q_GUI_EXPORT QPrintDialog : public QAbstractPrintDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPrintDialog) + Q_ENUMS(PrintDialogOption) + Q_PROPERTY(PrintDialogOptions options READ options WRITE setOptions) + +public: + explicit QPrintDialog(QPrinter *printer, QWidget *parent = 0); + explicit QPrintDialog(QWidget *parent = 0); + ~QPrintDialog(); + + int exec(); +#if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) + virtual void accept(); +#endif + void done(int result); + +#if defined (Q_OS_UNIX) && defined (QT3_SUPPORT) + void setPrinter(QPrinter *, bool = false); + QPrinter *printer() const; + void addButton(QPushButton *button); +#endif + + void setOption(PrintDialogOption option, bool on = true); + bool testOption(PrintDialogOption option) const; + void setOptions(PrintDialogOptions options); + PrintDialogOptions options() const; + +#if defined(Q_OS_UNIX) || defined(Q_WS_MAC) || defined(Q_OS_WIN) + void setVisible(bool visible); +#endif + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + +#ifdef qdoc + QPrinter *printer(); +#endif + +#ifdef QTOPIA_PRINTDIALOG +public: + bool eventFilter(QObject *, QEvent *); +#endif + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void accepted() { QDialog::accepted(); } +#endif +#else + using QDialog::accepted; +#endif + +Q_SIGNALS: + void accepted(QPrinter *printer); + +private: +#ifndef QTOPIA_PRINTDIALOG + Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool)) +#if defined (Q_OS_UNIX) && !defined (Q_OS_MAC) + Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog()) +#endif +# if defined(Q_OS_UNIX) && !defined (Q_OS_MAC) && !defined(QT_NO_MESSAGEBOX) + Q_PRIVATE_SLOT(d_func(), void _q_checkFields()) +# endif +#else // QTOPIA_PRINTDIALOG + Q_PRIVATE_SLOT(d_func(), void _q_okClicked()) + Q_PRIVATE_SLOT(d_func(),void _q_printerOrFileSelected(QAbstractButton *b)) + Q_PRIVATE_SLOT(d_func(),void _q_paperSizeSelected(int)) + Q_PRIVATE_SLOT(d_func(), void _q_orientSelected(int)) + Q_PRIVATE_SLOT(d_func(), void _q_pageOrderSelected(int)) + Q_PRIVATE_SLOT(d_func(), void _q_colorModeSelected(QAbstractButton *)) + Q_PRIVATE_SLOT(d_func(), void _q_setNumCopies(int)) + Q_PRIVATE_SLOT(d_func(), void _q_printRangeSelected(int)) + Q_PRIVATE_SLOT(d_func(), void _q_setFirstPage(int)) + Q_PRIVATE_SLOT(d_func(), void _q_setLastPage(int)) + Q_PRIVATE_SLOT(d_func(), void _q_fileNameEditChanged(const QString &text)) +#endif // QTOPIA_PRINTDIALOG + friend class QUnixPrintWidget; +}; + +#endif // QT_NO_PRINTDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPRINTDIALOG_H diff --git a/qtinterface/qt4/Qt/qprintengine.h b/qtinterface/qt4/Qt/qprintengine.h new file mode 100644 index 0000000..ac40218 --- /dev/null +++ b/qtinterface/qt4/Qt/qprintengine.h @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTENGINE_H +#define QPRINTENGINE_H + +#include <QtCore/qvariant.h> +#include <QtGui/qprinter.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTER + +class Q_GUI_EXPORT QPrintEngine +{ +public: + virtual ~QPrintEngine() {} + enum PrintEnginePropertyKey { + PPK_CollateCopies, + PPK_ColorMode, + PPK_Creator, + PPK_DocumentName, + PPK_FullPage, + PPK_NumberOfCopies, + PPK_Orientation, + PPK_OutputFileName, + PPK_PageOrder, + PPK_PageRect, + PPK_PageSize, + PPK_PaperRect, + PPK_PaperSource, + PPK_PrinterName, + PPK_PrinterProgram, + PPK_Resolution, + PPK_SelectionOption, + PPK_SupportedResolutions, + + PPK_WindowsPageSize, + PPK_FontEmbedding, + PPK_SuppressSystemPrintStatus, + + PPK_Duplex, + + PPK_PaperSources, + PPK_CustomPaperSize, + PPK_PageMargins, + PPK_PaperSize = PPK_PageSize, + + PPK_CustomBase = 0xff00 + }; + + virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value) = 0; + virtual QVariant property(PrintEnginePropertyKey key) const = 0; + + virtual bool newPage() = 0; + virtual bool abort() = 0; + + virtual int metric(QPaintDevice::PaintDeviceMetric) const = 0; + + virtual QPrinter::PrinterState printerState() const = 0; + +#ifdef Q_WS_WIN + virtual HDC getPrinterDC() const { return 0; } + virtual void releasePrinterDC(HDC) const { } +#endif + +}; + +#endif // QT_NO_PRINTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPRINTENGINE_H diff --git a/qtinterface/qt4/Qt/qprinter.h b/qtinterface/qt4/Qt/qprinter.h new file mode 100644 index 0000000..e22f8a0 --- /dev/null +++ b/qtinterface/qt4/Qt/qprinter.h @@ -0,0 +1,333 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTER_H +#define QPRINTER_H + +#include <QtCore/qstring.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qpaintdevice.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTER + +#if defined(B0) +#undef B0 // Terminal hang-up. We assume that you do not want that. +#endif + +class QPrinterPrivate; +class QPaintEngine; +class QPrintEngine; +class QPrinterInfo; + +class Q_GUI_EXPORT QPrinter : public QPaintDevice +{ + Q_DECLARE_PRIVATE(QPrinter) +public: + enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution }; + + explicit QPrinter(PrinterMode mode = ScreenResolution); + explicit QPrinter(const QPrinterInfo& printer, PrinterMode mode = ScreenResolution); + ~QPrinter(); + + int devType() const; + + enum Orientation { Portrait, Landscape }; + +#ifndef Q_QDOC + enum PageSize { A4, B5, Letter, Legal, Executive, + A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, + B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, + DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom, NPaperSize = Custom }; + typedef PageSize PaperSize; +#else + enum PageSize { A4, B5, Letter, Legal, Executive, + A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, + B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, + DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom }; + enum PaperSize { A4, B5, Letter, Legal, Executive, + A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, + B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, + DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom, NPaperSize = Custom }; +#endif + + enum PageOrder { FirstPageFirst, + LastPageFirst }; + + enum ColorMode { GrayScale, + Color }; + + enum PaperSource { OnlyOne, + Lower, + Middle, + Manual, + Envelope, + EnvelopeManual, + Auto, + Tractor, + SmallFormat, + LargeFormat, + LargeCapacity, + Cassette, + FormSource, + MaxPageSource + }; + + enum PrinterState { Idle, + Active, + Aborted, + Error }; + + enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat }; + + // ### Qt 5: Merge with QAbstractPrintDialog::PrintRange + enum PrintRange { AllPages, Selection, PageRange }; + + enum Unit { + Millimeter, + Point, + Inch, + Pica, + Didot, + Cicero, + DevicePixel + }; + + enum DuplexMode { + DuplexNone = 0, + DuplexAuto, + DuplexLongSide, + DuplexShortSide + }; + +#ifdef QT3_SUPPORT + enum PrinterOption { PrintToFile, PrintSelection, PrintPageRange }; +#endif // QT3_SUPPORT + + void setOutputFormat(OutputFormat format); + OutputFormat outputFormat() const; + + void setPrinterName(const QString &); + QString printerName() const; + + bool isValid() const; + + void setOutputFileName(const QString &); + QString outputFileName()const; + + void setPrintProgram(const QString &); + QString printProgram() const; + + void setDocName(const QString &); + QString docName() const; + + void setCreator(const QString &); + QString creator() const; + + void setOrientation(Orientation); + Orientation orientation() const; + + void setPageSize(PageSize); + PageSize pageSize() const; + + void setPaperSize(PaperSize); + PaperSize paperSize() const; + + void setPaperSize(const QSizeF &paperSize, Unit unit); + QSizeF paperSize(Unit unit) const; + + void setPageOrder(PageOrder); + PageOrder pageOrder() const; + + void setResolution(int); + int resolution() const; + + void setColorMode(ColorMode); + ColorMode colorMode() const; + + void setCollateCopies(bool collate); + bool collateCopies() const; + + void setFullPage(bool); + bool fullPage() const; + + void setNumCopies(int); + int numCopies() const; + + int actualNumCopies() const; + + void setPaperSource(PaperSource); + PaperSource paperSource() const; + + void setDuplex(DuplexMode duplex); + DuplexMode duplex() const; + + QList<int> supportedResolutions() const; + +#ifdef Q_WS_WIN + QList<PaperSource> supportedPaperSources() const; +#endif + + void setFontEmbeddingEnabled(bool enable); + bool fontEmbeddingEnabled() const; + + void setDoubleSidedPrinting(bool enable); + bool doubleSidedPrinting() const; + +#ifdef Q_WS_WIN + void setWinPageSize(int winPageSize); + int winPageSize() const; +#endif + + QRect paperRect() const; + QRect pageRect() const; + QRectF paperRect(Unit) const; + QRectF pageRect(Unit) const; + +#if !defined(Q_WS_WIN) || defined(qdoc) + QString printerSelectionOption() const; + void setPrinterSelectionOption(const QString &); +#endif + + bool newPage(); + bool abort(); + + PrinterState printerState() const; + + QPaintEngine *paintEngine() const; + QPrintEngine *printEngine() const; + +#ifdef Q_WS_WIN + HDC getDC() const; + void releaseDC(HDC hdc) const; +#endif + + void setFromTo(int fromPage, int toPage); + int fromPage() const; + int toPage() const; + + void setPrintRange(PrintRange range); + PrintRange printRange() const; + + void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, Unit unit); + void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, Unit unit) const; + +#ifdef QT3_SUPPORT +#ifdef Q_WS_MAC + QT3_SUPPORT bool pageSetup(QWidget *parent = 0); + QT3_SUPPORT bool printSetup(QWidget *parent = 0); +#endif + + QT3_SUPPORT bool setup(QWidget *parent = 0); + + QT3_SUPPORT void setMinMax(int minPage, int maxPage); + QT3_SUPPORT int minPage() const; + QT3_SUPPORT int maxPage() const; + + QT3_SUPPORT void setCollateCopiesEnabled(bool); + QT3_SUPPORT bool collateCopiesEnabled() const; + + QT3_SUPPORT void setOptionEnabled(PrinterOption, bool enable); + QT3_SUPPORT bool isOptionEnabled(PrinterOption) const; + + inline QT3_SUPPORT QSize margins() const; + inline QT3_SUPPORT void margins(uint *top, uint *left, uint *bottom, uint *right) const; + + inline QT3_SUPPORT bool aborted() { return printerState() == Aborted; } + + QT3_SUPPORT void setOutputToFile(bool); + inline QT3_SUPPORT bool outputToFile() const { return !outputFileName().isEmpty(); } +#endif + +protected: + int metric(PaintDeviceMetric) const; + void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine); + +private: + void init(PrinterMode mode); + + Q_DISABLE_COPY(QPrinter) + + QScopedPointer<QPrinterPrivate> d_ptr; + + friend class QPrintDialogPrivate; + friend class QAbstractPrintDialog; + friend class QAbstractPrintDialogPrivate; + friend class QPrintPreviewWidgetPrivate; + friend class QTextDocument; + friend class QPageSetupWidget; +}; + +#ifdef QT3_SUPPORT +inline QSize QPrinter::margins() const +{ + QRect page = pageRect(); + QRect paper = paperRect(); + return QSize(page.left() - paper.left(), page.top() - paper.top()); +} + +inline void QPrinter::margins(uint *top, uint *left, uint *bottom, uint *right) const +{ + QRect page = pageRect(); + QRect paper = paperRect(); + if (top) + *top = page.top() - paper.top(); + if (left) + *left = page.left() - paper.left(); + if (bottom) + *bottom = paper.bottom() - page.bottom(); + if (right) + *right = paper.right() - page.right(); +} +#endif + +#endif // QT_NO_PRINTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPRINTER_H diff --git a/qtinterface/qt4/Qt/qprinterinfo.h b/qtinterface/qt4/Qt/qprinterinfo.h new file mode 100644 index 0000000..456767c --- /dev/null +++ b/qtinterface/qt4/Qt/qprinterinfo.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTERINFO_H +#define QPRINTERINFO_H + +#include <QtGui/QPrinter> +#include <QtCore/QList> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PRINTER +class QPrinterInfoPrivate; +class QPrinterInfoPrivateDeleter; +class Q_GUI_EXPORT QPrinterInfo +{ +Q_DECLARE_PRIVATE(QPrinterInfo) + +public: + QPrinterInfo(); + QPrinterInfo(const QPrinterInfo& src); + QPrinterInfo(const QPrinter& printer); + ~QPrinterInfo(); + + QPrinterInfo& operator=(const QPrinterInfo& src); + + QString printerName() const; + bool isNull() const; + bool isDefault() const; + QList<QPrinter::PaperSize> supportedPaperSizes() const; + + static QList<QPrinterInfo> availablePrinters(); + static QPrinterInfo defaultPrinter(); + +private: + QPrinterInfo(const QString& name); + + QScopedPointer<QPrinterInfoPrivate, QPrinterInfoPrivateDeleter> d_ptr; +}; + +#endif // QT_NO_PRINTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPRINTERINFO_H diff --git a/qtinterface/qt4/Qt/qprintpreviewdialog.h b/qtinterface/qt4/Qt/qprintpreviewdialog.h new file mode 100644 index 0000000..7619c99 --- /dev/null +++ b/qtinterface/qt4/Qt/qprintpreviewdialog.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTPREVIEWDIALOG_H +#define QPRINTPREVIEWDIALOG_H + +#include <QtGui/qdialog.h> + +#ifndef QT_NO_PRINTPREVIEWDIALOG + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGraphicsView; +class QPrintPreviewDialogPrivate; + +class Q_GUI_EXPORT QPrintPreviewDialog : public QDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPrintPreviewDialog) + +public: + explicit QPrintPreviewDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QPrintPreviewDialog(QPrinter *printer, QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QPrintPreviewDialog(); + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + + QPrinter *printer(); + + void setVisible(bool visible); + void done(int result); + +Q_SIGNALS: + void paintRequested(QPrinter *printer); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_fit(QAction *action)) + Q_PRIVATE_SLOT(d_func(), void _q_zoomIn()) + Q_PRIVATE_SLOT(d_func(), void _q_zoomOut()) + Q_PRIVATE_SLOT(d_func(), void _q_navigate(QAction *action)) + Q_PRIVATE_SLOT(d_func(), void _q_setMode(QAction *action)) + Q_PRIVATE_SLOT(d_func(), void _q_pageNumEdited()) + Q_PRIVATE_SLOT(d_func(), void _q_print()) + Q_PRIVATE_SLOT(d_func(), void _q_pageSetup()) + Q_PRIVATE_SLOT(d_func(), void _q_previewChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_zoomFactorChanged()) + + void *dummy; // ### Qt 5 - remove me +}; + + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_PRINTPREVIEWDIALOG + +#endif // QPRINTPREVIEWDIALOG_H diff --git a/qtinterface/qt4/Qt/qprintpreviewwidget.h b/qtinterface/qt4/Qt/qprintpreviewwidget.h new file mode 100644 index 0000000..f70ff50 --- /dev/null +++ b/qtinterface/qt4/Qt/qprintpreviewwidget.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPRINTPREVIEWWIDGET_H +#define QPRINTPREVIEWWIDGET_H + +#include <QtGui/qwidget.h> +#include <QtGui/qprinter.h> + +#ifndef QT_NO_PRINTPREVIEWWIDGET + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPrintPreviewWidgetPrivate; + +class Q_GUI_EXPORT QPrintPreviewWidget : public QWidget +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPrintPreviewWidget) +public: + + enum ViewMode { + SinglePageView, + FacingPagesView, + AllPagesView + }; + + enum ZoomMode { + CustomZoom, + FitToWidth, + FitInView + }; + + explicit QPrintPreviewWidget(QPrinter *printer, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QPrintPreviewWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QPrintPreviewWidget(); + + qreal zoomFactor() const; + QPrinter::Orientation orientation() const; + ViewMode viewMode() const; + ZoomMode zoomMode() const; + int currentPage() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numPages() const; +#endif + int pageCount() const; + void setVisible(bool visible); + +public Q_SLOTS: + void print(); + + void zoomIn(qreal zoom = 1.1); + void zoomOut(qreal zoom = 1.1); + void setZoomFactor(qreal zoomFactor); + void setOrientation(QPrinter::Orientation orientation); + void setViewMode(ViewMode viewMode); + void setZoomMode(ZoomMode zoomMode); + void setCurrentPage(int pageNumber); + + void fitToWidth(); + void fitInView(); + void setLandscapeOrientation(); + void setPortraitOrientation(); + void setSinglePageViewMode(); + void setFacingPagesViewMode(); + void setAllPagesViewMode(); + + void updatePreview(); + +Q_SIGNALS: + void paintRequested(QPrinter *printer); + void previewChanged(); + +private: + void *dummy; // ### remove in Qt 5.0 + Q_PRIVATE_SLOT(d_func(), void _q_fit()) + Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentPage()) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_PRINTPREVIEWWIDGET +#endif // QPRINTPREVIEWWIDGET_H diff --git a/qtinterface/qt4/Qt/qprocess.h b/qtinterface/qt4/Qt/qprocess.h new file mode 100644 index 0000000..8ad94ed --- /dev/null +++ b/qtinterface/qt4/Qt/qprocess.h @@ -0,0 +1,236 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROCESS_H +#define QPROCESS_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qshareddata.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_PROCESS + +#if (!defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)) || defined(qdoc) +typedef qint64 Q_PID; +#else +QT_END_NAMESPACE +typedef struct _PROCESS_INFORMATION *Q_PID; +QT_BEGIN_NAMESPACE +#endif + +class QProcessPrivate; +class QProcessEnvironmentPrivate; + +class Q_CORE_EXPORT QProcessEnvironment +{ +public: + QProcessEnvironment(); + QProcessEnvironment(const QProcessEnvironment &other); + ~QProcessEnvironment(); + QProcessEnvironment &operator=(const QProcessEnvironment &other); + + bool operator==(const QProcessEnvironment &other) const; + inline bool operator!=(const QProcessEnvironment &other) const + { return !(*this == other); } + + bool isEmpty() const; + void clear(); + + bool contains(const QString &name) const; + void insert(const QString &name, const QString &value); + void remove(const QString &name); + QString value(const QString &name, const QString &defaultValue = QString()) const; + + QStringList toStringList() const; + + static QProcessEnvironment systemEnvironment(); + +private: + friend class QProcessPrivate; + friend class QProcessEnvironmentPrivate; + QSharedDataPointer<QProcessEnvironmentPrivate> d; +}; + +class Q_CORE_EXPORT QProcess : public QIODevice +{ + Q_OBJECT +public: + enum ProcessError { + FailedToStart, //### file not found, resource error + Crashed, + Timedout, + ReadError, + WriteError, + UnknownError + }; + enum ProcessState { + NotRunning, + Starting, + Running + }; + enum ProcessChannel { + StandardOutput, + StandardError + }; + enum ProcessChannelMode { + SeparateChannels, + MergedChannels, + ForwardedChannels + }; + enum ExitStatus { + NormalExit, + CrashExit + }; + + explicit QProcess(QObject *parent = 0); + virtual ~QProcess(); + + void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite); + void start(const QString &program, OpenMode mode = ReadWrite); + + ProcessChannelMode readChannelMode() const; + void setReadChannelMode(ProcessChannelMode mode); + ProcessChannelMode processChannelMode() const; + void setProcessChannelMode(ProcessChannelMode mode); + + ProcessChannel readChannel() const; + void setReadChannel(ProcessChannel channel); + + void closeReadChannel(ProcessChannel channel); + void closeWriteChannel(); + + void setStandardInputFile(const QString &fileName); + void setStandardOutputFile(const QString &fileName, OpenMode mode = Truncate); + void setStandardErrorFile(const QString &fileName, OpenMode mode = Truncate); + void setStandardOutputProcess(QProcess *destination); + + QString workingDirectory() const; + void setWorkingDirectory(const QString &dir); + + void setEnvironment(const QStringList &environment); + QStringList environment() const; + void setProcessEnvironment(const QProcessEnvironment &environment); + QProcessEnvironment processEnvironment() const; + + QProcess::ProcessError error() const; + QProcess::ProcessState state() const; + + // #### Qt 5: Q_PID is a pointer on Windows and a value on Unix + Q_PID pid() const; + + bool waitForStarted(int msecs = 30000); + bool waitForReadyRead(int msecs = 30000); + bool waitForBytesWritten(int msecs = 30000); + bool waitForFinished(int msecs = 30000); + + QByteArray readAllStandardOutput(); + QByteArray readAllStandardError(); + + int exitCode() const; + QProcess::ExitStatus exitStatus() const; + + // QIODevice + qint64 bytesAvailable() const; + qint64 bytesToWrite() const; + bool isSequential() const; + bool canReadLine() const; + void close(); + bool atEnd() const; + + static int execute(const QString &program, const QStringList &arguments); + static int execute(const QString &program); + + static bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, + qint64 *pid = 0); + static bool startDetached(const QString &program, const QStringList &arguments); + static bool startDetached(const QString &program); + + static QStringList systemEnvironment(); + +public Q_SLOTS: + void terminate(); + void kill(); + +Q_SIGNALS: + void started(); + void finished(int exitCode); + void finished(int exitCode, QProcess::ExitStatus exitStatus); + void error(QProcess::ProcessError error); + void stateChanged(QProcess::ProcessState state); + + void readyReadStandardOutput(); + void readyReadStandardError(); + +protected: + void setProcessState(ProcessState state); + + virtual void setupChildProcess(); + + // QIODevice + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + +private: + Q_DECLARE_PRIVATE(QProcess) + Q_DISABLE_COPY(QProcess) + + Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardOutput()) + Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardError()) + Q_PRIVATE_SLOT(d_func(), bool _q_canWrite()) + Q_PRIVATE_SLOT(d_func(), bool _q_startupNotification()) + Q_PRIVATE_SLOT(d_func(), bool _q_processDied()) + Q_PRIVATE_SLOT(d_func(), void _q_notified()) + friend class QProcessManager; +}; + +#endif // QT_NO_PROCESS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROCESS_H diff --git a/qtinterface/qt4/Qt/qprogressbar.h b/qtinterface/qt4/Qt/qprogressbar.h new file mode 100644 index 0000000..2076382 --- /dev/null +++ b/qtinterface/qt4/Qt/qprogressbar.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROGRESSBAR_H +#define QPROGRESSBAR_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PROGRESSBAR + +class QProgressBarPrivate; +class QStyleOptionProgressBar; + +class Q_GUI_EXPORT QProgressBar : public QWidget +{ + Q_OBJECT + Q_ENUMS(Direction) + Q_PROPERTY(int minimum READ minimum WRITE setMinimum) + Q_PROPERTY(int maximum READ maximum WRITE setMaximum) + Q_PROPERTY(QString text READ text) + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(bool textVisible READ isTextVisible WRITE setTextVisible) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance) + Q_PROPERTY(Direction textDirection READ textDirection WRITE setTextDirection) + Q_PROPERTY(QString format READ format WRITE setFormat) + +public: + enum Direction { TopToBottom, BottomToTop }; + + explicit QProgressBar(QWidget *parent = 0); + + int minimum() const; + int maximum() const; + + int value() const; + + virtual QString text() const; + void setTextVisible(bool visible); + bool isTextVisible() const; + + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment alignment); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + Qt::Orientation orientation() const; + + void setInvertedAppearance(bool invert); + bool invertedAppearance(); + void setTextDirection(QProgressBar::Direction textDirection); + QProgressBar::Direction textDirection(); + + void setFormat(const QString &format); + QString format() const; + +public Q_SLOTS: + void reset(); + void setRange(int minimum, int maximum); + void setMinimum(int minimum); + void setMaximum(int maximum); + void setValue(int value); + void setOrientation(Qt::Orientation); + +Q_SIGNALS: + void valueChanged(int value); + +protected: + bool event(QEvent *e); + void paintEvent(QPaintEvent *); + void initStyleOption(QStyleOptionProgressBar *option) const; + +private: + Q_DECLARE_PRIVATE(QProgressBar) + Q_DISABLE_COPY(QProgressBar) +}; + +#endif // QT_NO_PROGRESSBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROGRESSBAR_H diff --git a/qtinterface/qt4/Qt/qprogressdialog.h b/qtinterface/qt4/Qt/qprogressdialog.h new file mode 100644 index 0000000..ded5114 --- /dev/null +++ b/qtinterface/qt4/Qt/qprogressdialog.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROGRESSDIALOG_H +#define QPROGRESSDIALOG_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PROGRESSDIALOG + +class QPushButton; +class QLabel; +class QProgressBar; +class QTimer; +class QProgressDialogPrivate; + +class Q_GUI_EXPORT QProgressDialog : public QDialog +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QProgressDialog) + Q_PROPERTY(bool wasCanceled READ wasCanceled) + Q_PROPERTY(int minimum READ minimum WRITE setMinimum) + Q_PROPERTY(int maximum READ maximum WRITE setMaximum) + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset) + Q_PROPERTY(bool autoClose READ autoClose WRITE setAutoClose) + Q_PROPERTY(int minimumDuration READ minimumDuration WRITE setMinimumDuration) + Q_PROPERTY(QString labelText READ labelText WRITE setLabelText) + +public: + explicit QProgressDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); + QProgressDialog(const QString &labelText, const QString &cancelButtonText, + int minimum, int maximum, QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QProgressDialog(); + + void setLabel(QLabel *label); + void setCancelButton(QPushButton *button); + void setBar(QProgressBar *bar); + + bool wasCanceled() const; + + int minimum() const; + int maximum() const; + + int value() const; + + QSize sizeHint() const; + + QString labelText() const; + int minimumDuration() const; + + void setAutoReset(bool reset); + bool autoReset() const; + void setAutoClose(bool close); + bool autoClose() const; + +#ifdef Q_NO_USING_KEYWORD +#ifndef Q_QDOC + void open() { QDialog::open(); } +#endif +#else + using QDialog::open; +#endif + void open(QObject *receiver, const char *member); + +public Q_SLOTS: + void cancel(); + void reset(); + void setMaximum(int maximum); + void setMinimum(int minimum); + void setRange(int minimum, int maximum); + void setValue(int progress); + void setLabelText(const QString &text); + void setCancelButtonText(const QString &text); + void setMinimumDuration(int ms); + +Q_SIGNALS: + void canceled(); + +protected: + void resizeEvent(QResizeEvent *event); + void closeEvent(QCloseEvent *event); + void changeEvent(QEvent *event); + void showEvent(QShowEvent *event); + +protected Q_SLOTS: + void forceShow(); + +private: + Q_DISABLE_COPY(QProgressDialog) + + Q_PRIVATE_SLOT(d_func(), void _q_disconnectOnClose()) +}; + +#endif // QT_NO_PROGRESSDIALOG + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROGRESSDIALOG_H diff --git a/qtinterface/qt4/Qt/qpropertyanimation.h b/qtinterface/qt4/Qt/qpropertyanimation.h new file mode 100644 index 0000000..b141b8a --- /dev/null +++ b/qtinterface/qt4/Qt/qpropertyanimation.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROPERTYANIMATION_H +#define QPROPERTYANIMATION_H + +#include <QtCore/qvariantanimation.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QPropertyAnimationPrivate; +class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation +{ + Q_OBJECT + Q_PROPERTY(QByteArray propertyName READ propertyName WRITE setPropertyName) + Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject) + +public: + QPropertyAnimation(QObject *parent = 0); + QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = 0); + ~QPropertyAnimation(); + + QObject *targetObject() const; + void setTargetObject(QObject *target); + + QByteArray propertyName() const; + void setPropertyName(const QByteArray &propertyName); + +protected: + bool event(QEvent *event); + void updateCurrentValue(const QVariant &value); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + +private: + Q_DISABLE_COPY(QPropertyAnimation) + Q_DECLARE_PRIVATE(QPropertyAnimation) +}; + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROPERTYANIMATION_H diff --git a/qtinterface/qt4/Qt/qproxymodel.h b/qtinterface/qt4/Qt/qproxymodel.h new file mode 100644 index 0000000..a4d8280 --- /dev/null +++ b/qtinterface/qt4/Qt/qproxymodel.h @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROXYMODEL_H +#define QPROXYMODEL_H + +#include <QtCore/qabstractitemmodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_PROXYMODEL + +class QProxyModelPrivate; + +class Q_GUI_EXPORT QProxyModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + explicit QProxyModel(QObject *parent = 0); + ~QProxyModel(); + + virtual void setModel(QAbstractItemModel *model); + QAbstractItemModel *model() const; + + // implementing model interface + + QModelIndex index(int row, int column, const QModelIndex &parent) const; + QModelIndex parent(const QModelIndex &child) const; + + int rowCount(const QModelIndex &parent) const; + int columnCount(const QModelIndex &parent) const; + bool hasChildren(const QModelIndex &parent) const; + + QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, int role); + + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, + int role); + + QStringList mimeTypes() const; + QMimeData *mimeData(const QModelIndexList &indexes) const; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); + Qt::DropActions supportedDropActions() const; + + bool insertRows(int row, int count, const QModelIndex &parent); + bool insertColumns(int column, int count, const QModelIndex &parent); + + void fetchMore(const QModelIndex &parent); + Qt::ItemFlags flags(const QModelIndex &index) const; + + void sort(int column, Qt::SortOrder order); + + QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const; + + QSize span(const QModelIndex &index) const; + + bool submit(); + void revert(); + +#ifdef Q_NO_USING_KEYWORD + inline QObject *parent() const { return QObject::parent(); } +#else + using QObject::parent; +#endif + +protected: + QProxyModel(QProxyModelPrivate &, QObject *parent = 0); + + QModelIndex setProxyModel(const QModelIndex &source_index) const; + QModelIndex setSourceModel(const QModelIndex &proxy_index) const; + + void connectToModel(const QAbstractItemModel *model) const; + void disconnectFromModel(const QAbstractItemModel *model) const; + +private: + Q_DECLARE_PRIVATE(QProxyModel) + Q_DISABLE_COPY(QProxyModel) + + Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex&,const QModelIndex&)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeInserted(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsInserted(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeRemoved(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsRemoved(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeInserted(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsInserted(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeRemoved(const QModelIndex&,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsRemoved(const QModelIndex&,int,int)) +}; + +#endif // QT_NO_PROXYMODEL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROXYMODEL_H diff --git a/qtinterface/qt4/Qt/qproxystyle.h b/qtinterface/qt4/Qt/qproxystyle.h new file mode 100644 index 0000000..d44da9f --- /dev/null +++ b/qtinterface/qt4/Qt/qproxystyle.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROXYSTYLE_H +#define QPROXYSTYLE_H + +#include <QtGui/QCommonStyle> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_PROXY) + +class QProxyStylePrivate; +class Q_GUI_EXPORT QProxyStyle : public QCommonStyle +{ + Q_OBJECT + +public: + QProxyStyle(QStyle *baseStyle = 0); + ~QProxyStyle(); + + QStyle *baseStyle() const; + void setBaseStyle(QStyle *style); + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; + void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const; + + QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const; + + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const; + QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; + QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + + SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const; + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; + QPalette standardPalette() const; + + void polish(QWidget *widget); + void polish(QPalette &pal); + void polish(QApplication *app); + + void unpolish(QWidget *widget); + void unpolish(QApplication *app); + +protected: + bool event(QEvent *e); + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; + int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, + Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const; +private: + Q_DISABLE_COPY(QProxyStyle) + Q_DECLARE_PRIVATE(QProxyStyle) +}; + +#endif // QT_NO_STYLE_PROXY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROXYSTYLE_H diff --git a/qtinterface/qt4/Qt/qpushbutton.h b/qtinterface/qt4/Qt/qpushbutton.h new file mode 100644 index 0000000..959b408 --- /dev/null +++ b/qtinterface/qt4/Qt/qpushbutton.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPUSHBUTTON_H +#define QPUSHBUTTON_H + +#include <QtGui/qabstractbutton.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPushButtonPrivate; +class QMenu; +class QStyleOptionButton; + +class Q_GUI_EXPORT QPushButton : public QAbstractButton +{ + Q_OBJECT + + Q_PROPERTY(bool autoDefault READ autoDefault WRITE setAutoDefault) + Q_PROPERTY(bool default READ isDefault WRITE setDefault) + Q_PROPERTY(bool flat READ isFlat WRITE setFlat) + +public: + explicit QPushButton(QWidget *parent=0); + explicit QPushButton(const QString &text, QWidget *parent=0); + QPushButton(const QIcon& icon, const QString &text, QWidget *parent=0); + ~QPushButton(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + bool autoDefault() const; + void setAutoDefault(bool); + bool isDefault() const; + void setDefault(bool); + +#ifndef QT_NO_MENU + void setMenu(QMenu* menu); + QMenu* menu() const; +#endif + + void setFlat(bool); + bool isFlat() const; + +public Q_SLOTS: +#ifndef QT_NO_MENU + void showMenu(); +#endif + +protected: + bool event(QEvent *e); + void paintEvent(QPaintEvent *); + void keyPressEvent(QKeyEvent *); + void focusInEvent(QFocusEvent *); + void focusOutEvent(QFocusEvent *); + void initStyleOption(QStyleOptionButton *option) const; + QPushButton(QPushButtonPrivate &dd, QWidget* parent = 0); + +public: +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QPushButton(QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QPushButton(const QString &text, QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QPushButton(const QIcon& icon, const QString &text, QWidget *parent, const char* name); + inline QT3_SUPPORT void openPopup() { showMenu(); } + inline QT3_SUPPORT bool isMenuButton() const { return menu() != 0; } + inline QT3_SUPPORT void setPopup(QMenu* popup) {setMenu(popup); } + inline QT3_SUPPORT QMenu* popup() const { return menu(); } +#endif + +private: + Q_DISABLE_COPY(QPushButton) + Q_DECLARE_PRIVATE(QPushButton) +#ifndef QT_NO_MENU + Q_PRIVATE_SLOT(d_func(), void _q_popupPressed()) +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPUSHBUTTON_H diff --git a/qtinterface/qt4/Qt/qquaternion.h b/qtinterface/qt4/Qt/qquaternion.h new file mode 100644 index 0000000..ed7b191 --- /dev/null +++ b/qtinterface/qt4/Qt/qquaternion.h @@ -0,0 +1,328 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUATERNION_H +#define QQUATERNION_H + +#include <QtGui/qvector3d.h> +#include <QtGui/qvector4d.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QUATERNION + +class QMatrix4x4; +class QVariant; + +class Q_GUI_EXPORT QQuaternion +{ +public: + QQuaternion(); + QQuaternion(qreal scalar, qreal xpos, qreal ypos, qreal zpos); +#ifndef QT_NO_VECTOR3D + QQuaternion(qreal scalar, const QVector3D& vector); +#endif +#ifndef QT_NO_VECTOR4D + explicit QQuaternion(const QVector4D& vector); +#endif + + bool isNull() const; + bool isIdentity() const; + +#ifndef QT_NO_VECTOR3D + QVector3D vector() const; + void setVector(const QVector3D& vector); +#endif + void setVector(qreal x, qreal y, qreal z); + + qreal x() const; + qreal y() const; + qreal z() const; + qreal scalar() const; + + void setX(qreal x); + void setY(qreal y); + void setZ(qreal z); + void setScalar(qreal scalar); + + qreal length() const; + qreal lengthSquared() const; + + QQuaternion normalized() const; + void normalize(); + + QQuaternion conjugate() const; + + QVector3D rotatedVector(const QVector3D& vector) const; + + QQuaternion &operator+=(const QQuaternion &quaternion); + QQuaternion &operator-=(const QQuaternion &quaternion); + QQuaternion &operator*=(qreal factor); + QQuaternion &operator*=(const QQuaternion &quaternion); + QQuaternion &operator/=(qreal divisor); + + friend inline bool operator==(const QQuaternion &q1, const QQuaternion &q2); + friend inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2); + friend inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2); + friend inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2); + friend inline const QQuaternion operator*(qreal factor, const QQuaternion &quaternion); + friend inline const QQuaternion operator*(const QQuaternion &quaternion, qreal factor); + friend inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2); + friend inline const QQuaternion operator-(const QQuaternion &quaternion); + friend inline const QQuaternion operator/(const QQuaternion &quaternion, qreal divisor); + + friend inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2); + +#ifndef QT_NO_VECTOR4D + QVector4D toVector4D() const; +#endif + + operator QVariant() const; + +#ifndef QT_NO_VECTOR3D + static QQuaternion fromAxisAndAngle(const QVector3D& axis, qreal angle); +#endif + static QQuaternion fromAxisAndAngle + (qreal x, qreal y, qreal z, qreal angle); + + static QQuaternion slerp + (const QQuaternion& q1, const QQuaternion& q2, qreal t); + static QQuaternion nlerp + (const QQuaternion& q1, const QQuaternion& q2, qreal t); + +private: + qreal wp, xp, yp, zp; +}; + +inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {} + +inline QQuaternion::QQuaternion(qreal aScalar, qreal xpos, qreal ypos, qreal zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {} + + +inline bool QQuaternion::isNull() const +{ + return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp); +} + +inline bool QQuaternion::isIdentity() const +{ + return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && wp == 1.0f; +} + +inline qreal QQuaternion::x() const { return qreal(xp); } +inline qreal QQuaternion::y() const { return qreal(yp); } +inline qreal QQuaternion::z() const { return qreal(zp); } +inline qreal QQuaternion::scalar() const { return qreal(wp); } + +inline void QQuaternion::setX(qreal aX) { xp = aX; } +inline void QQuaternion::setY(qreal aY) { yp = aY; } +inline void QQuaternion::setZ(qreal aZ) { zp = aZ; } +inline void QQuaternion::setScalar(qreal aScalar) { wp = aScalar; } + +inline QQuaternion QQuaternion::conjugate() const +{ + return QQuaternion(wp, -xp, -yp, -zp); +} + +inline QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion) +{ + xp += quaternion.xp; + yp += quaternion.yp; + zp += quaternion.zp; + wp += quaternion.wp; + return *this; +} + +inline QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion) +{ + xp -= quaternion.xp; + yp -= quaternion.yp; + zp -= quaternion.zp; + wp -= quaternion.wp; + return *this; +} + +inline QQuaternion &QQuaternion::operator*=(qreal factor) +{ + xp *= factor; + yp *= factor; + zp *= factor; + wp *= factor; + return *this; +} + +inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2) +{ + qreal ww = (q1.zp + q1.xp) * (q2.xp + q2.yp); + qreal yy = (q1.wp - q1.yp) * (q2.wp + q2.zp); + qreal zz = (q1.wp + q1.yp) * (q2.wp - q2.zp); + qreal xx = ww + yy + zz; + qreal qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp)); + + qreal w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp); + qreal x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp); + qreal y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp); + qreal z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp); + + return QQuaternion(w, x, y, z); +} + +inline QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion) +{ + *this = *this * quaternion; + return *this; +} + +inline QQuaternion &QQuaternion::operator/=(qreal divisor) +{ + xp /= divisor; + yp /= divisor; + zp /= divisor; + wp /= divisor; + return *this; +} + +inline bool operator==(const QQuaternion &q1, const QQuaternion &q2) +{ + return q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp && q1.wp == q2.wp; +} + +inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2) +{ + return q1.xp != q2.xp || q1.yp != q2.yp || q1.zp != q2.zp || q1.wp != q2.wp; +} + +inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2) +{ + return QQuaternion(q1.wp + q2.wp, q1.xp + q2.xp, q1.yp + q2.yp, q1.zp + q2.zp); +} + +inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2) +{ + return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp); +} + +inline const QQuaternion operator*(qreal factor, const QQuaternion &quaternion) +{ + return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor); +} + +inline const QQuaternion operator*(const QQuaternion &quaternion, qreal factor) +{ + return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor); +} + +inline const QQuaternion operator-(const QQuaternion &quaternion) +{ + return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp); +} + +inline const QQuaternion operator/(const QQuaternion &quaternion, qreal divisor) +{ + return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor); +} + +inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2) +{ + return qFuzzyCompare(q1.xp, q2.xp) && + qFuzzyCompare(q1.yp, q2.yp) && + qFuzzyCompare(q1.zp, q2.zp) && + qFuzzyCompare(q1.wp, q2.wp); +} + +#ifndef QT_NO_VECTOR3D + +inline QQuaternion::QQuaternion(qreal aScalar, const QVector3D& aVector) + : wp(aScalar), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {} + +inline void QQuaternion::setVector(const QVector3D& aVector) +{ + xp = aVector.x(); + yp = aVector.y(); + zp = aVector.z(); +} + +inline QVector3D QQuaternion::vector() const +{ + return QVector3D(xp, yp, zp); +} + +#endif + +inline void QQuaternion::setVector(qreal aX, qreal aY, qreal aZ) +{ + xp = aX; + yp = aY; + zp = aZ; +} + +#ifndef QT_NO_VECTOR4D + +inline QQuaternion::QQuaternion(const QVector4D& aVector) + : wp(aVector.w()), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {} + +inline QVector4D QQuaternion::toVector4D() const +{ + return QVector4D(xp, yp, zp, wp); +} + +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QQuaternion &q); +#endif + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QQuaternion &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QQuaternion &); +#endif + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qqueue.h b/qtinterface/qt4/Qt/qqueue.h new file mode 100644 index 0000000..85c32e8 --- /dev/null +++ b/qtinterface/qt4/Qt/qqueue.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUEUE_H +#define QQUEUE_H + +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class T> +class QQueue : public QList<T> +{ +public: + inline QQueue() {} + inline ~QQueue() {} + inline void enqueue(const T &t) { QList<T>::append(t); } + inline T dequeue() { return QList<T>::takeFirst(); } + inline T &head() { return QList<T>::first(); } + inline const T &head() const { return QList<T>::first(); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QQUEUE_H diff --git a/qtinterface/qt4/Qt/qradiobutton.h b/qtinterface/qt4/Qt/qradiobutton.h new file mode 100644 index 0000000..c2588a4 --- /dev/null +++ b/qtinterface/qt4/Qt/qradiobutton.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRADIOBUTTON_H +#define QRADIOBUTTON_H + +#include <QtGui/qabstractbutton.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QRadioButtonPrivate; +class QStyleOptionButton; + +class Q_GUI_EXPORT QRadioButton : public QAbstractButton +{ + Q_OBJECT + +public: + explicit QRadioButton(QWidget *parent=0); + explicit QRadioButton(const QString &text, QWidget *parent=0); + + QSize sizeHint() const; + +protected: + bool event(QEvent *e); + bool hitButton(const QPoint &) const; + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent *); + void initStyleOption(QStyleOptionButton *button) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QRadioButton(QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QRadioButton(const QString &text, QWidget *parent, const char* name); +#endif + +private: + Q_DECLARE_PRIVATE(QRadioButton) + Q_DISABLE_COPY(QRadioButton) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QRADIOBUTTON_H diff --git a/qtinterface/qt4/Qt/qreadwritelock.h b/qtinterface/qt4/Qt/qreadwritelock.h new file mode 100644 index 0000000..bc01ad5 --- /dev/null +++ b/qtinterface/qt4/Qt/qreadwritelock.h @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QREADWRITELOCK_H +#define QREADWRITELOCK_H + +#include <QtCore/qglobal.h> +#include <limits.h> // ### Qt 5: remove + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_THREAD + +struct QReadWriteLockPrivate; + +class Q_CORE_EXPORT QReadWriteLock +{ +public: + enum RecursionMode { NonRecursive, Recursive }; + + QReadWriteLock(); // ### Qt 5: merge with below + QReadWriteLock(RecursionMode recursionMode); + ~QReadWriteLock(); + + void lockForRead(); + bool tryLockForRead(); + bool tryLockForRead(int timeout); + + void lockForWrite(); + bool tryLockForWrite(); + bool tryLockForWrite(int timeout); + + void unlock(); + +private: + Q_DISABLE_COPY(QReadWriteLock) + QReadWriteLockPrivate *d; + + friend class QWaitCondition; +}; + +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4312 ) // ignoring the warning from /Wp64 +#endif + +class Q_CORE_EXPORT QReadLocker +{ +public: + inline QReadLocker(QReadWriteLock *readWriteLock); + + inline ~QReadLocker() + { unlock(); } + + inline void unlock() + { + if (q_lock) { + if ((q_val & quintptr(1u)) == quintptr(1u)) { + q_val &= ~quintptr(1u); + q_lock->unlock(); + } + } + } + + inline void relock() + { + if (q_lock) { + if ((q_val & quintptr(1u)) == quintptr(0u)) { + q_lock->lockForRead(); + q_val |= quintptr(1u); + } + } + } + + inline QReadWriteLock *readWriteLock() const + { return reinterpret_cast<QReadWriteLock *>(q_val & ~quintptr(1u)); } + +private: + Q_DISABLE_COPY(QReadLocker) + union { + QReadWriteLock *q_lock; + quintptr q_val; + }; +}; + +inline QReadLocker::QReadLocker(QReadWriteLock *areadWriteLock) + : q_lock(areadWriteLock) +{ + Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0), + "QReadLocker", "QReadWriteLock pointer is misaligned"); + relock(); +} + +class Q_CORE_EXPORT QWriteLocker +{ +public: + inline QWriteLocker(QReadWriteLock *readWriteLock); + + inline ~QWriteLocker() + { unlock(); } + + inline void unlock() + { + if (q_lock) { + if ((q_val & quintptr(1u)) == quintptr(1u)) { + q_val &= ~quintptr(1u); + q_lock->unlock(); + } + } + } + + inline void relock() + { + if (q_lock) { + if ((q_val & quintptr(1u)) == quintptr(0u)) { + q_lock->lockForWrite(); + q_val |= quintptr(1u); + } + } + } + + inline QReadWriteLock *readWriteLock() const + { return reinterpret_cast<QReadWriteLock *>(q_val & ~quintptr(1u)); } + + +private: + Q_DISABLE_COPY(QWriteLocker) + union{ + QReadWriteLock *q_lock; + quintptr q_val; + }; +}; + +inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock) + : q_lock(areadWriteLock) +{ + Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0), + "QWriteLocker", "QReadWriteLock pointer is misaligned"); + relock(); +} + +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif + +#else // QT_NO_THREAD + +class Q_CORE_EXPORT QReadWriteLock +{ +public: + enum RecursionMode { NonRecursive, Recursive }; + inline explicit QReadWriteLock(RecursionMode = NonRecursive) { } + inline ~QReadWriteLock() { } + + static inline void lockForRead() { } + static inline bool tryLockForRead() { return true; } + static inline bool tryLockForRead(int timeout) { Q_UNUSED(timeout); return true; } + + static inline void lockForWrite() { } + static inline bool tryLockForWrite() { return true; } + static inline bool tryLockForWrite(int timeout) { Q_UNUSED(timeout); return true; } + + static inline void unlock() { } + +private: + Q_DISABLE_COPY(QReadWriteLock) +}; + +class Q_CORE_EXPORT QReadLocker +{ +public: + inline QReadLocker(QReadWriteLock *) { } + inline ~QReadLocker() { } + + static inline void unlock() { } + static inline void relock() { } + static inline QReadWriteLock *readWriteLock() { return 0; } + +private: + Q_DISABLE_COPY(QReadLocker) +}; + +class Q_CORE_EXPORT QWriteLocker +{ +public: + inline explicit QWriteLocker(QReadWriteLock *) { } + inline ~QWriteLocker() { } + + static inline void unlock() { } + static inline void relock() { } + static inline QReadWriteLock *readWriteLock() { return 0; } + +private: + Q_DISABLE_COPY(QWriteLocker) +}; + +#endif // QT_NO_THREAD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QREADWRITELOCK_H diff --git a/qtinterface/qt4/Qt/qrect.h b/qtinterface/qt4/Qt/qrect.h new file mode 100644 index 0000000..5dec1fb --- /dev/null +++ b/qtinterface/qt4/Qt/qrect.h @@ -0,0 +1,858 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRECT_H +#define QRECT_H + +#include <QtCore/qsize.h> +#include <QtCore/qpoint.h> + +#ifdef topLeft +#error qrect.h must be included before any header file that defines topLeft +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QRect +{ +public: + QRect() { x1 = y1 = 0; x2 = y2 = -1; } + QRect(const QPoint &topleft, const QPoint &bottomright); + QRect(const QPoint &topleft, const QSize &size); + QRect(int left, int top, int width, int height); + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + + int left() const; + int top() const; + int right() const; + int bottom() const; + QRect normalized() const; + +#ifdef QT3_SUPPORT + QT3_SUPPORT int &rLeft() { return x1; } + QT3_SUPPORT int &rTop() { return y1; } + QT3_SUPPORT int &rRight() { return x2; } + QT3_SUPPORT int &rBottom() { return y2; } + + QT3_SUPPORT QRect normalize() const { return normalized(); } +#endif + + int x() const; + int y() const; + void setLeft(int pos); + void setTop(int pos); + void setRight(int pos); + void setBottom(int pos); + void setX(int x); + void setY(int y); + + void setTopLeft(const QPoint &p); + void setBottomRight(const QPoint &p); + void setTopRight(const QPoint &p); + void setBottomLeft(const QPoint &p); + + QPoint topLeft() const; + QPoint bottomRight() const; + QPoint topRight() const; + QPoint bottomLeft() const; + QPoint center() const; + + void moveLeft(int pos); + void moveTop(int pos); + void moveRight(int pos); + void moveBottom(int pos); + void moveTopLeft(const QPoint &p); + void moveBottomRight(const QPoint &p); + void moveTopRight(const QPoint &p); + void moveBottomLeft(const QPoint &p); + void moveCenter(const QPoint &p); + + inline void translate(int dx, int dy); + inline void translate(const QPoint &p); + inline QRect translated(int dx, int dy) const; + inline QRect translated(const QPoint &p) const; + + void moveTo(int x, int t); + void moveTo(const QPoint &p); + +#ifdef QT3_SUPPORT + QT3_SUPPORT void moveBy(int dx, int dy) { translate(dx, dy); } + QT3_SUPPORT void moveBy(const QPoint &p) { translate(p); } +#endif + + void setRect(int x, int y, int w, int h); + inline void getRect(int *x, int *y, int *w, int *h) const; + + void setCoords(int x1, int y1, int x2, int y2); +#ifdef QT3_SUPPORT + QT3_SUPPORT void addCoords(int x1, int y1, int x2, int y2); +#endif + inline void getCoords(int *x1, int *y1, int *x2, int *y2) const; + + inline void adjust(int x1, int y1, int x2, int y2); + inline QRect adjusted(int x1, int y1, int x2, int y2) const; + + QSize size() const; + int width() const; + int height() const; + void setWidth(int w); + void setHeight(int h); + void setSize(const QSize &s); + + QRect operator|(const QRect &r) const; + QRect operator&(const QRect &r) const; + QRect& operator|=(const QRect &r); + QRect& operator&=(const QRect &r); + + bool contains(const QPoint &p, bool proper=false) const; + 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; + + friend Q_CORE_EXPORT_INLINE bool operator==(const QRect &, const QRect &); + friend Q_CORE_EXPORT_INLINE bool operator!=(const QRect &, const QRect &); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void rect(int *x, int *y, int *w, int *h) const { getRect(x, y, w, h); } + inline QT3_SUPPORT void coords(int *ax1, int *ay1, int *ax2, int *ay2) const + { getCoords(ax1, ay1, ax2, ay2); } +#endif + +private: +#if defined(Q_WS_X11) + friend void qt_setCoords(QRect *r, int xp1, int yp1, int xp2, int yp2); +#endif + // ### 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); + +Q_CORE_EXPORT_INLINE bool operator==(const QRect &, const QRect &); +Q_CORE_EXPORT_INLINE bool operator!=(const QRect &, const QRect &); + + +/***************************************************************************** + QRect stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRect &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &); +#endif + +/***************************************************************************** + QRect inline member functions + *****************************************************************************/ + +inline QRect::QRect(int aleft, int atop, int awidth, int aheight) +{ + x1 = aleft; + y1 = atop; + x2 = (aleft + awidth - 1); + y2 = (atop + aheight - 1); +} + +inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) +{ + x1 = atopLeft.x(); + y1 = atopLeft.y(); + x2 = abottomRight.x(); + y2 = abottomRight.y(); +} + +inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) +{ + x1 = atopLeft.x(); + y1 = atopLeft.y(); + x2 = (x1+asize.width() - 1); + y2 = (y1+asize.height() - 1); +} + +inline bool QRect::isNull() const +{ return x2 == x1 - 1 && y2 == y1 - 1; } + +inline bool QRect::isEmpty() const +{ return x1 > x2 || y1 > y2; } + +inline bool QRect::isValid() const +{ return x1 <= x2 && y1 <= y2; } + +inline int QRect::left() const +{ return x1; } + +inline int QRect::top() const +{ return y1; } + +inline int QRect::right() const +{ return x2; } + +inline int QRect::bottom() const +{ return y2; } + +inline int QRect::x() const +{ return x1; } + +inline int QRect::y() const +{ return y1; } + +inline void QRect::setLeft(int pos) +{ x1 = pos; } + +inline void QRect::setTop(int pos) +{ y1 = pos; } + +inline void QRect::setRight(int pos) +{ x2 = pos; } + +inline void QRect::setBottom(int pos) +{ y2 = pos; } + +inline void QRect::setTopLeft(const QPoint &p) +{ x1 = p.x(); y1 = p.y(); } + +inline void QRect::setBottomRight(const QPoint &p) +{ x2 = p.x(); y2 = p.y(); } + +inline void QRect::setTopRight(const QPoint &p) +{ x2 = p.x(); y1 = p.y(); } + +inline void QRect::setBottomLeft(const QPoint &p) +{ x1 = p.x(); y2 = p.y(); } + +inline void QRect::setX(int ax) +{ x1 = ax; } + +inline void QRect::setY(int ay) +{ y1 = ay; } + +inline QPoint QRect::topLeft() const +{ return QPoint(x1, y1); } + +inline QPoint QRect::bottomRight() const +{ return QPoint(x2, y2); } + +inline QPoint QRect::topRight() const +{ return QPoint(x2, y1); } + +inline QPoint QRect::bottomLeft() const +{ return QPoint(x1, y2); } + +inline QPoint QRect::center() const +{ return QPoint((x1+x2)/2, (y1+y2)/2); } + +inline int QRect::width() const +{ return x2 - x1 + 1; } + +inline int QRect::height() const +{ return y2 - y1 + 1; } + +inline QSize QRect::size() const +{ return QSize(width(), height()); } + +inline void QRect::translate(int dx, int dy) +{ + x1 += dx; + y1 += dy; + x2 += dx; + y2 += dy; +} + +inline void QRect::translate(const QPoint &p) +{ + x1 += p.x(); + y1 += p.y(); + x2 += p.x(); + y2 += p.y(); +} + +inline QRect QRect::translated(int dx, int dy) const +{ return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } + +inline QRect QRect::translated(const QPoint &p) const +{ return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } + +inline void QRect::moveTo(int ax, int ay) +{ + x2 += ax - x1; + y2 += ay - y1; + x1 = ax; + y1 = ay; +} + +inline void QRect::moveTo(const QPoint &p) +{ + x2 += p.x() - x1; + y2 += p.y() - y1; + x1 = p.x(); + y1 = p.y(); +} + +inline void QRect::moveLeft(int pos) +{ x2 += (pos - x1); x1 = pos; } + +inline void QRect::moveTop(int pos) +{ y2 += (pos - y1); y1 = pos; } + +inline void QRect::moveRight(int pos) +{ + x1 += (pos - x2); + x2 = pos; +} + +inline void QRect::moveBottom(int pos) +{ + y1 += (pos - y2); + y2 = pos; +} + +inline void QRect::moveTopLeft(const QPoint &p) +{ + moveLeft(p.x()); + moveTop(p.y()); +} + +inline void QRect::moveBottomRight(const QPoint &p) +{ + moveRight(p.x()); + moveBottom(p.y()); +} + +inline void QRect::moveTopRight(const QPoint &p) +{ + moveRight(p.x()); + moveTop(p.y()); +} + +inline void QRect::moveBottomLeft(const QPoint &p) +{ + moveLeft(p.x()); + moveBottom(p.y()); +} + +inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const +{ + *ax = x1; + *ay = y1; + *aw = x2 - x1 + 1; + *ah = y2 - y1 + 1; +} + +inline void QRect::setRect(int ax, int ay, int aw, int ah) +{ + x1 = ax; + y1 = ay; + x2 = (ax + aw - 1); + y2 = (ay + ah - 1); +} + +inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const +{ + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) +{ + x1 = xp1; + y1 = yp1; + x2 = xp2; + y2 = yp2; +} + +#ifdef QT3_SUPPORT +inline void QRect::addCoords(int dx1, int dy1, int dx2, int dy2) +{ + adjust(dx1, dy1, dx2, dy2); +} +#endif + +inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const +{ return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); } + +inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) +{ + x1 += dx1; + y1 += dy1; + x2 += dx2; + y2 += dy2; +} + +inline void QRect::setWidth(int w) +{ x2 = (x1 + w - 1); } + +inline void QRect::setHeight(int h) +{ y2 = (y1 + h - 1); } + +inline void QRect::setSize(const QSize &s) +{ + x2 = (s.width() + x1 - 1); + y2 = (s.height() + y1 - 1); +} + +inline bool QRect::contains(int ax, int ay, bool aproper) const +{ + return contains(QPoint(ax, ay), aproper); +} + +inline bool QRect::contains(int ax, int ay) const +{ + return contains(QPoint(ax, ay), false); +} + +inline QRect& QRect::operator|=(const QRect &r) +{ + *this = *this | r; + return *this; +} + +inline QRect& QRect::operator&=(const QRect &r) +{ + *this = *this & 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; +} + +inline QRect QRect::united(const QRect &r) const +{ + return unite(r); +} + +inline bool operator==(const QRect &r1, const QRect &r2) +{ + return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; +} + +inline bool operator!=(const QRect &r1, const QRect &r2) +{ + return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &); +#endif + + +class Q_CORE_EXPORT QRectF +{ +public: + QRectF() { xp = yp = 0.; w = h = 0.; } + QRectF(const QPointF &topleft, const QSizeF &size); + QRectF(const QPointF &topleft, const QPointF &bottomRight); + QRectF(qreal left, qreal top, qreal width, qreal height); + QRectF(const QRect &rect); + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + QRectF normalized() const; + + inline qreal left() const { return xp; } + inline qreal top() const { return yp; } + inline qreal right() const { return xp + w; } + inline qreal bottom() const { return yp + h; } + + inline qreal x() const; + inline qreal y() const; + inline void setLeft(qreal pos); + inline void setTop(qreal pos); + inline void setRight(qreal pos); + inline void setBottom(qreal pos); + inline void setX(qreal pos) { setLeft(pos); } + inline void setY(qreal pos) { setTop(pos); } + + inline QPointF topLeft() const { return QPointF(xp, yp); } + inline QPointF bottomRight() const { return QPointF(xp+w, yp+h); } + inline QPointF topRight() const { return QPointF(xp+w, yp); } + inline QPointF bottomLeft() const { return QPointF(xp, yp+h); } + inline QPointF center() const; + + void setTopLeft(const QPointF &p); + void setBottomRight(const QPointF &p); + void setTopRight(const QPointF &p); + void setBottomLeft(const QPointF &p); + + void moveLeft(qreal pos); + void moveTop(qreal pos); + void moveRight(qreal pos); + void moveBottom(qreal pos); + void moveTopLeft(const QPointF &p); + void moveBottomRight(const QPointF &p); + void moveTopRight(const QPointF &p); + void moveBottomLeft(const QPointF &p); + void moveCenter(const QPointF &p); + + void translate(qreal dx, qreal dy); + void translate(const QPointF &p); + + QRectF translated(qreal dx, qreal dy) const; + QRectF translated(const QPointF &p) const; + + void moveTo(qreal x, qreal t); + void moveTo(const QPointF &p); + + void setRect(qreal x, qreal y, qreal w, qreal h); + void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const; + + void setCoords(qreal x1, qreal y1, qreal x2, qreal y2); + void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const; + + inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2); + inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const; + + QSizeF size() const; + qreal width() const; + qreal height() const; + void setWidth(qreal w); + void setHeight(qreal h); + void setSize(const QSizeF &s); + + QRectF operator|(const QRectF &r) const; + QRectF operator&(const QRectF &r) const; + QRectF& operator|=(const QRectF &r); + QRectF& operator&=(const QRectF &r); + + 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; + + friend Q_CORE_EXPORT_INLINE bool operator==(const QRectF &, const QRectF &); + friend Q_CORE_EXPORT_INLINE bool operator!=(const QRectF &, const QRectF &); + + QRect toRect() const; + QRect toAlignedRect() const; + +private: + qreal xp; + qreal yp; + qreal w; + qreal h; +}; +Q_DECLARE_TYPEINFO(QRectF, Q_MOVABLE_TYPE); + +Q_CORE_EXPORT_INLINE bool operator==(const QRectF &, const QRectF &); +Q_CORE_EXPORT_INLINE bool operator!=(const QRectF &, const QRectF &); + + +/***************************************************************************** + QRectF stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRectF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &); +#endif + +/***************************************************************************** + QRectF inline member functions + *****************************************************************************/ + +inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) + : xp(aleft), yp(atop), w(awidth), h(aheight) +{ +} + +inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) +{ + xp = atopLeft.x(); + yp = atopLeft.y(); + w = asize.width(); + h = asize.height(); +} + +inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) +{ + xp = atopLeft.x(); + yp = atopLeft.y(); + w = abottomRight.x() - xp; + h = abottomRight.y() - yp; +} + +inline QRectF::QRectF(const QRect &r) + : xp(r.x()), yp(r.y()), w(r.width()), h(r.height()) +{ +} + +inline bool QRectF::isNull() const +{ return w == 0. && h == 0.; } + +inline bool QRectF::isEmpty() const +{ return w <= 0. || h <= 0.; } + +inline bool QRectF::isValid() const +{ return w > 0. && h > 0.; } + +inline qreal QRectF::x() const +{ return xp; } + +inline qreal QRectF::y() const +{ return yp; } + +inline void QRectF::setLeft(qreal pos) { qreal diff = pos - xp; xp += diff; w -= diff; } + +inline void QRectF::setRight(qreal pos) { w = pos - xp; } + +inline void QRectF::setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; } + +inline void QRectF::setBottom(qreal pos) { h = pos - yp; } + +inline void QRectF::setTopLeft(const QPointF &p) { setLeft(p.x()); setTop(p.y()); } + +inline void QRectF::setTopRight(const QPointF &p) { setRight(p.x()); setTop(p.y()); } + +inline void QRectF::setBottomLeft(const QPointF &p) { setLeft(p.x()); setBottom(p.y()); } + +inline void QRectF::setBottomRight(const QPointF &p) { setRight(p.x()); setBottom(p.y()); } + +inline QPointF QRectF::center() const +{ return QPointF(xp + w/2, yp + h/2); } + +inline void QRectF::moveLeft(qreal pos) { xp = pos; } + +inline void QRectF::moveTop(qreal pos) { yp = pos; } + +inline void QRectF::moveRight(qreal pos) { xp = pos - w; } + +inline void QRectF::moveBottom(qreal pos) { yp = pos - h; } + +inline void QRectF::moveTopLeft(const QPointF &p) { moveLeft(p.x()); moveTop(p.y()); } + +inline void QRectF::moveTopRight(const QPointF &p) { moveRight(p.x()); moveTop(p.y()); } + +inline void QRectF::moveBottomLeft(const QPointF &p) { moveLeft(p.x()); moveBottom(p.y()); } + +inline void QRectF::moveBottomRight(const QPointF &p) { moveRight(p.x()); moveBottom(p.y()); } + +inline void QRectF::moveCenter(const QPointF &p) { xp = p.x() - w/2; yp = p.y() - h/2; } + +inline qreal QRectF::width() const +{ return w; } + +inline qreal QRectF::height() const +{ return h; } + +inline QSizeF QRectF::size() const +{ return QSizeF(w, h); } + +inline void QRectF::translate(qreal dx, qreal dy) +{ + xp += dx; + yp += dy; +} + +inline void QRectF::translate(const QPointF &p) +{ + xp += p.x(); + yp += p.y(); +} + +inline void QRectF::moveTo(qreal ax, qreal ay) +{ + xp = ax; + yp = ay; +} + +inline void QRectF::moveTo(const QPointF &p) +{ + xp = p.x(); + yp = p.y(); +} + +inline QRectF QRectF::translated(qreal dx, qreal dy) const +{ return QRectF(xp + dx, yp + dy, w, h); } + +inline QRectF QRectF::translated(const QPointF &p) const +{ return QRectF(xp + p.x(), yp + p.y(), w, h); } + +inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const +{ + *ax = this->xp; + *ay = this->yp; + *aaw = this->w; + *aah = this->h; +} + +inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) +{ + this->xp = ax; + this->yp = ay; + this->w = aaw; + this->h = aah; +} + +inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const +{ + *xp1 = xp; + *yp1 = yp; + *xp2 = xp + w; + *yp2 = yp + h; +} + +inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) +{ + xp = xp1; + yp = yp1; + w = xp2 - xp1; + h = yp2 - yp1; +} + +inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) +{ xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; } + +inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const +{ return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); } + +inline void QRectF::setWidth(qreal aw) +{ this->w = aw; } + +inline void QRectF::setHeight(qreal ah) +{ this->h = ah; } + +inline void QRectF::setSize(const QSizeF &s) +{ + w = s.width(); + h = s.height(); +} + +inline bool QRectF::contains(qreal ax, qreal ay) const +{ + return contains(QPointF(ax, ay)); +} + +inline QRectF& QRectF::operator|=(const QRectF &r) +{ + *this = *this | r; + return *this; +} + +inline QRectF& QRectF::operator&=(const QRectF &r) +{ + *this = *this & 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; +} + +inline QRectF QRectF::united(const QRectF &r) const +{ + return unite(r); +} + +inline bool operator==(const QRectF &r1, const QRectF &r2) +{ + return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp) + && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h); +} + +inline bool operator!=(const QRectF &r1, const QRectF &r2) +{ + return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp) + || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h); +} + +inline QRect QRectF::toRect() const +{ + return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QRECT_H diff --git a/qtinterface/qt4/Qt/qregexp.h b/qtinterface/qt4/Qt/qregexp.h new file mode 100644 index 0000000..33420d1 --- /dev/null +++ b/qtinterface/qt4/Qt/qregexp.h @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QREGEXP_H +#define QREGEXP_H + +#ifndef QT_NO_REGEXP + +#include <QtCore/qstring.h> +#ifdef QT3_SUPPORT +#include <new> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +struct QRegExpPrivate; +class QStringList; + +class Q_CORE_EXPORT QRegExp +{ +public: + enum PatternSyntax { + RegExp, + Wildcard, + FixedString, + RegExp2, + WildcardUnix, + W3CXmlSchema11 }; + enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch }; + + QRegExp(); + explicit QRegExp(const QString &pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive, + PatternSyntax syntax = RegExp); + QRegExp(const QRegExp &rx); + ~QRegExp(); + QRegExp &operator=(const QRegExp &rx); + + bool operator==(const QRegExp &rx) const; + inline bool operator!=(const QRegExp &rx) const { return !operator==(rx); } + + bool isEmpty() const; + bool isValid() const; + QString pattern() const; + void setPattern(const QString &pattern); + Qt::CaseSensitivity caseSensitivity() const; + void setCaseSensitivity(Qt::CaseSensitivity cs); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool caseSensitive() const { return caseSensitivity() == Qt::CaseSensitive; } + inline QT3_SUPPORT void setCaseSensitive(bool sensitive) + { setCaseSensitivity(sensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); } +#endif + PatternSyntax patternSyntax() const; + void setPatternSyntax(PatternSyntax syntax); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool wildcard() const { return patternSyntax() == Wildcard; } + inline QT3_SUPPORT void setWildcard(bool aWildcard) + { setPatternSyntax(aWildcard ? Wildcard : RegExp); } +#endif + + bool isMinimal() const; + void setMinimal(bool minimal); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool minimal() const { return isMinimal(); } +#endif + + bool exactMatch(const QString &str) const; + + int indexIn(const QString &str, int offset = 0, CaretMode caretMode = CaretAtZero) const; + int lastIndexIn(const QString &str, int offset = -1, CaretMode caretMode = CaretAtZero) const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT int search(const QString &str, int from = 0, + CaretMode caretMode = CaretAtZero) const + { return indexIn(str, from, caretMode); } + inline QT3_SUPPORT int searchRev(const QString &str, int from = -1, + CaretMode caretMode = CaretAtZero) const + { return lastIndexIn(str, from, caretMode); } +#endif + int matchedLength() const; +#ifndef QT_NO_REGEXP_CAPTURE +#ifdef QT_DEPRECATED + QT_DEPRECATED int numCaptures() const; +#endif + int captureCount() const; + QStringList capturedTexts() const; + QStringList capturedTexts(); + QString cap(int nth = 0) const; + QString cap(int nth = 0); + int pos(int nth = 0) const; + int pos(int nth = 0); + QString errorString() const; + QString errorString(); +#endif + + static QString escape(const QString &str); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT_CONSTRUCTOR QRegExp(const QString &aPattern, bool cs, bool aWildcard = false) + { + new (this) + QRegExp(aPattern, cs ? Qt::CaseSensitive : Qt::CaseInsensitive, + aWildcard ? Wildcard : RegExp); + } +#endif + +private: + QRegExpPrivate *priv; +}; + +Q_DECLARE_TYPEINFO(QRegExp, Q_MOVABLE_TYPE); + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QRegExp ®Exp); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QRegExp ®Exp); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_REGEXP + +#endif // QREGEXP_H diff --git a/qtinterface/qt4/Qt/qregion.h b/qtinterface/qt4/Qt/qregion.h new file mode 100644 index 0000000..c8629af --- /dev/null +++ b/qtinterface/qt4/Qt/qregion.h @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QREGION_H +#define QREGION_H + +#include <QtCore/qatomic.h> +#include <QtCore/qrect.h> +#include <QtGui/qwindowdefs.h> + +#ifndef QT_NO_DATASTREAM +#include <QtCore/qdatastream.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +template <class T> class QVector; +class QVariant; + +#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +struct QRegionPrivate; +#endif + +class QBitmap; + +class Q_GUI_EXPORT QRegion +{ +public: + enum RegionType { Rectangle, Ellipse }; + + QRegion(); + QRegion(int x, int y, int w, int h, RegionType t = Rectangle); + QRegion(const QRect &r, RegionType t = Rectangle); + QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QRegion(const QPolygon &pa, bool winding); +#endif + QRegion(const QRegion ®ion); + QRegion(const QBitmap &bitmap); + ~QRegion(); + QRegion &operator=(const QRegion &); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool isNull() const { return isEmpty(); } +#endif + bool isEmpty() const; + + bool contains(const QPoint &p) const; + bool contains(const QRect &r) const; + + void translate(int dx, int dy); + inline void translate(const QPoint &p) { translate(p.x(), p.y()); } + QRegion translated(int dx, int dy) const; + inline QRegion translated(const QPoint &p) const { return translated(p.x(), p.y()); } + + // ### Qt 5: make these four functions QT4_SUPPORT + QRegion unite(const QRegion &r) const; + QRegion unite(const QRect &r) const; + QRegion intersect(const QRegion &r) const; + QRegion intersect(const QRect &r) const; + QRegion subtract(const QRegion &r) const; + QRegion eor(const QRegion &r) const; + + inline QRegion united(const QRegion &r) const { return unite(r); } + inline QRegion united(const QRect &r) const { return unite(r); } + inline QRegion intersected(const QRegion &r) const { return intersect(r); } + inline QRegion intersected(const QRect &r) const { return intersect(r); } + inline QRegion subtracted(const QRegion &r) const { return subtract(r); } + inline QRegion xored(const QRegion &r) const { return eor(r); } + + bool intersects(const QRegion &r) const; + bool intersects(const QRect &r) const; + + QRect boundingRect() const; + QVector<QRect> rects() const; + void setRects(const QRect *rect, int num); +#ifdef QT_DEPRECATED + QT_DEPRECATED int numRects() const; +#endif + int rectCount() const; + + const QRegion operator|(const QRegion &r) const; + const QRegion operator+(const QRegion &r) const; + const QRegion operator+(const QRect &r) const; + const QRegion operator&(const QRegion &r) const; + const QRegion operator&(const QRect &r) const; + const QRegion operator-(const QRegion &r) const; + const QRegion operator^(const QRegion &r) const; + QRegion& operator|=(const QRegion &r); + QRegion& operator+=(const QRegion &r); + QRegion& operator+=(const QRect &r); + QRegion& operator&=(const QRegion &r); + QRegion& operator&=(const QRect &r); + QRegion& operator-=(const QRegion &r); + QRegion& operator^=(const QRegion &r); + + bool operator==(const QRegion &r) const; + inline bool operator!=(const QRegion &r) const { return !(operator==(r)); } + operator QVariant() const; + +#ifdef qdoc + Handle handle() const; +#endif +#ifndef qdoc +#if defined(Q_WS_WIN) + inline HRGN handle() const { ensureHandle(); return d->rgn; } +#elif defined(Q_WS_X11) + inline Region handle() const { if(!d->rgn) updateX11Region(); return d->rgn; } +#elif defined(Q_WS_MAC) +#if defined Q_WS_MAC32 + RgnHandle toQDRgn() const; + RgnHandle toQDRgnForUpdate_sys() const; + static QRegion fromQDRgn(RgnHandle shape); +#endif +#ifdef QT_MAC_USE_COCOA + inline HIMutableShapeRef handle(bool unused = false) const + { Q_UNUSED(unused); return toHIMutableShape(); } +#else + inline RgnHandle handle() const { return handle(false); } + inline RgnHandle handle(bool) const { return toQDRgn(); } +#endif + HIMutableShapeRef toHIMutableShape() const; + static QRegion fromHIShapeRef(HIShapeRef shape); +#elif defined(Q_WS_QWS) + inline void *handle() const { return d->qt_rgn; } +#endif +#endif + +#ifndef QT_NO_DATASTREAM + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QRegion &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QRegion &); +#endif +private: + QRegion copy() const; // helper of detach. + void detach(); +#if defined(Q_WS_WIN) + void ensureHandle() const; + QRegion winCombine(const QRegion &r, int num) const; +#elif defined(Q_WS_X11) + void updateX11Region() const; + void *clipRectangles(int &num) const; + friend void *qt_getClipRects(const QRegion &r, int &num); +#elif defined(Q_WS_MAC) + static OSStatus shape2QRegionHelper(int inMessage, HIShapeRef inShape, + const CGRect *inRect, void *inRefcon); +#endif + friend bool qt_region_strictContains(const QRegion ®ion, + const QRect &rect); + friend struct QRegionPrivate; + +#ifndef QT_NO_DATASTREAM + void exec(const QByteArray &ba, int ver = 0, QDataStream::ByteOrder byteOrder = QDataStream::BigEndian); +#endif + struct QRegionData { + QBasicAtomicInt ref; +#if defined(Q_WS_WIN) + HRGN rgn; +#elif defined(Q_WS_X11) + Region rgn; + void *xrectangles; +#elif defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) + mutable RgnHandle unused; // Here for binary compatability reasons. ### Qt 5 remove. +#endif +#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) + QRegionPrivate *qt_rgn; +#endif + }; +#if defined(Q_WS_WIN) + friend class QETWidget; +#endif + struct QRegionData *d; + static struct QRegionData shared_empty; + static void cleanUp(QRegionData *x); +}; + +/***************************************************************************** + QRegion stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QRegion &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QRegion &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QRegion &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QREGION_H diff --git a/qtinterface/qt4/Qt/qresource.h b/qtinterface/qt4/Qt/qresource.h new file mode 100644 index 0000000..8ffeb18 --- /dev/null +++ b/qtinterface/qt4/Qt/qresource.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRESOURCE_H +#define QRESOURCE_H + +#include <QtCore/qstring.h> +#include <QtCore/qlocale.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QResourcePrivate; + +class Q_CORE_EXPORT QResource +{ +public: + QResource(const QString &file=QString(), const QLocale &locale=QLocale()); + ~QResource(); + + void setFileName(const QString &file); + QString fileName() const; + QString absoluteFilePath() const; + + void setLocale(const QLocale &locale); + QLocale locale() const; + + bool isValid() const; + + bool isCompressed() const; + qint64 size() const; + const uchar *data() const; + + static void addSearchPath(const QString &path); + static QStringList searchPaths(); + + static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString()); + static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString()); + + static bool registerResource(const uchar *rccData, const QString &resourceRoot=QString()); + static bool unregisterResource(const uchar *rccData, const QString &resourceRoot=QString()); + +protected: + friend class QResourceFileEngine; + friend class QResourceFileEngineIterator; + bool isDir() const; + inline bool isFile() const { return !isDir(); } + QStringList children() const; + +protected: + QScopedPointer<QResourcePrivate> d_ptr; + +private: + Q_DECLARE_PRIVATE(QResource) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QRESOURCE_H diff --git a/qtinterface/qt4/Qt/qrgb.h b/qtinterface/qt4/Qt/qrgb.h new file mode 100644 index 0000000..8682e4e --- /dev/null +++ b/qtinterface/qt4/Qt/qrgb.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRGB_H +#define QRGB_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +typedef unsigned int QRgb; // RGB triplet + +const QRgb RGB_MASK = 0x00ffffff; // masks RGB values + +Q_GUI_EXPORT_INLINE int qRed(QRgb rgb) // get red part of RGB +{ return ((rgb >> 16) & 0xff); } + +Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb) // get green part of RGB +{ return ((rgb >> 8) & 0xff); } + +Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb) // get blue part of RGB +{ return (rgb & 0xff); } + +Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb) // get alpha part of RGBA +{ return ((rgb >> 24) & 0xff); } + +Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value +{ return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } + +Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)// set RGBA value +{ return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } + +Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 +{ return (r*11+g*16+b*5)/32; } + +Q_GUI_EXPORT_INLINE int qGray(QRgb rgb) // convert RGB to gray 0..255 +{ return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); } + +Q_GUI_EXPORT_INLINE bool qIsGray(QRgb rgb) +{ return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QRGB_H diff --git a/qtinterface/qt4/Qt/qrubberband.h b/qtinterface/qt4/Qt/qrubberband.h new file mode 100644 index 0000000..7d2da70 --- /dev/null +++ b/qtinterface/qt4/Qt/qrubberband.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRUBBERBAND_H +#define QRUBBERBAND_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_RUBBERBAND + +class QRubberBandPrivate; +class QStyleOptionRubberBand; + +class Q_GUI_EXPORT QRubberBand : public QWidget +{ + Q_OBJECT + +public: + enum Shape { Line, Rectangle }; + explicit QRubberBand(Shape, QWidget * =0); + ~QRubberBand(); + + Shape shape() const; + + void setGeometry(const QRect &r); + + inline void setGeometry(int x, int y, int w, int h); + inline void move(int x, int y); + inline void move(const QPoint &p) + { move(p.x(), p.y()); } + inline void resize(int w, int h) + { setGeometry(geometry().x(), geometry().y(), w, h); } + inline void resize(const QSize &s) + { resize(s.width(), s.height()); } + +protected: + bool event(QEvent *e); + void paintEvent(QPaintEvent *); + void changeEvent(QEvent *); + void showEvent(QShowEvent *); + void resizeEvent(QResizeEvent *); + void moveEvent(QMoveEvent *); + void initStyleOption(QStyleOptionRubberBand *option) const; + +private: + Q_DECLARE_PRIVATE(QRubberBand) +}; + +inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah) +{ setGeometry(QRect(ax, ay, aw, ah)); } +inline void QRubberBand::move(int ax, int ay) +{ setGeometry(ax, ay, width(), height()); } + +#endif // QT_NO_RUBBERBAND + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QRUBBERBAND_H diff --git a/qtinterface/qt4/Qt/qrunnable.h b/qtinterface/qt4/Qt/qrunnable.h new file mode 100644 index 0000000..38af11e --- /dev/null +++ b/qtinterface/qt4/Qt/qrunnable.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRUNNABLE_H +#define QRUNNABLE_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QRunnable +{ + int ref; + + friend class QThreadPool; + friend class QThreadPoolPrivate; + friend class QThreadPoolThread; + +public: + virtual void run() = 0; + + QRunnable() : ref(0) { } + virtual ~QRunnable() { } + + bool autoDelete() const { return ref != -1; } + void setAutoDelete(bool _autoDelete) { ref = _autoDelete ? 0 : -1; } +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qs60mainapplication.h b/qtinterface/qt4/Qt/qs60mainapplication.h new file mode 100644 index 0000000..3b810bc --- /dev/null +++ b/qtinterface/qt4/Qt/qs60mainapplication.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPLICATION_H +#define QS60MAINAPPLICATION_H + +#include <QtCore/qglobal.h> + +#ifdef Q_WS_S60 + +#include <aknapp.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +{ +public: + QS60MainApplication(); + // The virtuals are for qdoc. + virtual ~QS60MainApplication(); + + virtual TUid AppDllUid() const; + + virtual TFileName ResourceFileName() const; + +protected: + + virtual CApaDocument *CreateDocumentL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINAPPLICATION_H diff --git a/qtinterface/qt4/Qt/qs60mainappui.h b/qtinterface/qt4/Qt/qs60mainappui.h new file mode 100644 index 0000000..e0a701a --- /dev/null +++ b/qtinterface/qt4/Qt/qs60mainappui.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPUI_H +#define QS60MAINAPPUI_H + +#include <QtCore/qglobal.h> + +#ifdef Q_WS_S60 + +#include <aknappui.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +{ +public: + QS60MainAppUi(); + // The virtuals are for qdoc. + virtual ~QS60MainAppUi(); + + virtual void ConstructL(); + + virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType); + virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); + virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); + + virtual void HandleCommandL( TInt command ); + + virtual void HandleResourceChangeL(TInt type); + + virtual void HandleStatusPaneSizeChange(); + +protected: + virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINAPPUI_H diff --git a/qtinterface/qt4/Qt/qs60maindocument.h b/qtinterface/qt4/Qt/qs60maindocument.h new file mode 100644 index 0000000..90d69a4 --- /dev/null +++ b/qtinterface/qt4/Qt/qs60maindocument.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINDOCUMENT_H +#define QS60MAINDOCUMENT_H + +#include <QtCore/qglobal.h> + +#ifdef Q_WS_S60 + +#include <akndoc.h> + +class CEikApplication; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QS60MainAppUi; + +class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +{ +public: + + QS60MainDocument(CEikApplication &mainApplication); + // The virtuals are for qdoc. + virtual ~QS60MainDocument(); + +public: + + virtual CEikAppUi *CreateAppUiL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINDOCUMENT_H diff --git a/qtinterface/qt4/Qt/qs60style.h b/qtinterface/qt4/Qt/qs60style.h new file mode 100644 index 0000000..92f1693 --- /dev/null +++ b/qtinterface/qt4/Qt/qs60style.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60STYLE_H +#define QS60STYLE_H + +#include <QtGui/qcommonstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_S60) + +class QS60StylePrivate; + +class Q_GUI_EXPORT QS60Style : public QCommonStyle +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QS60Style) + +public: + QS60Style(); + ~QS60Style(); + + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const; + int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0, + QStyleHintReturn *shret = 0) const; + QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget = 0) const; + QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const; + void polish(QWidget *widget); + void unpolish(QWidget *widget); + void polish(QApplication *application); + void unpolish(QApplication *application); +#ifndef Q_NO_USING_KEYWORD + using QCommonStyle::polish; +#endif + bool event(QEvent *e); + +#ifndef Q_WS_S60 + static QStringList partKeys(); + static QStringList colorListKeys(); + void setS60Theme(const QHash<QString, QPicture> &parts, + const QHash<QPair<QString , int>, QColor> &colors); + bool loadS60ThemeFromBlob(const QString &blobFile); + bool saveS60ThemeToBlob(const QString &blobFile) const; +#endif // !Q_WS_S60 + +protected Q_SLOTS: + QIcon standardIconImplementation( + StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const; + +protected: + void timerEvent(QTimerEvent *event); + bool eventFilter(QObject *o, QEvent *e); +private: + Q_DISABLE_COPY(QS60Style) + friend class QStyleFactory; + friend class QApplicationPrivate; +}; + +#endif // QT_NO_STYLE_S60 + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QS60STYLE_H diff --git a/qtinterface/qt4/Qt/qscopedpointer.h b/qtinterface/qt4/Qt/qscopedpointer.h new file mode 100644 index 0000000..f526334 --- /dev/null +++ b/qtinterface/qt4/Qt/qscopedpointer.h @@ -0,0 +1,215 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCOPEDPOINTER_H +#define QSCOPEDPOINTER_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE +QT_MODULE(Core) + +template <typename T> +struct QScopedPointerDeleter +{ + static inline void cleanup(T *pointer) + { + // Enforce a complete type. + // If you get a compile error here, read the secion on forward declared + // classes in the QScopedPointer documentation. + typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; + (void) sizeof(IsIncompleteType); + + delete pointer; + } +}; + +template <typename T> +struct QScopedPointerArrayDeleter +{ + static inline void cleanup(T *pointer) + { + // Enforce a complete type. + // If you get a compile error here, read the secion on forward declared + // classes in the QScopedPointer documentation. + typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; + (void) sizeof(IsIncompleteType); + + delete [] pointer; + } +}; + +struct QScopedPointerPodDeleter +{ + static inline void cleanup(void *pointer) { if (pointer) qFree(pointer); } +}; + +template <typename T, typename Cleanup = QScopedPointerDeleter<T> > +class QScopedPointer +{ +#ifndef Q_CC_NOKIAX86 + typedef T *QScopedPointer:: *RestrictedBool; +#endif +public: + explicit inline QScopedPointer(T *p = 0) : d(p) + { + } + + inline ~QScopedPointer() + { + T *oldD = this->d; + Cleanup::cleanup(oldD); + this->d = 0; + } + + inline T &operator*() const + { + Q_ASSERT(d); + return *d; + } + + inline T *operator->() const + { + Q_ASSERT(d); + return d; + } + + inline bool operator!() const + { + return !d; + } + +#if defined(Q_CC_NOKIAX86) || defined(Q_QDOC) + inline operator bool() const + { + return isNull() ? 0 : &QScopedPointer::d; + } +#else + inline operator RestrictedBool() const + { + return isNull() ? 0 : &QScopedPointer::d; + } +#endif + + inline T *data() const + { + return d; + } + + inline bool isNull() const + { + return !d; + } + + inline void reset(T *other = 0) + { + if (d == other) + return; + T *oldD = d; + d = other; + Cleanup::cleanup(oldD); + } + + inline T *take() + { + T *oldD = d; + d = 0; + return oldD; + } + + inline void swap(QScopedPointer<T, Cleanup> &other) + { + qSwap(d, other.d); + } + + typedef T *pointer; + +protected: + T *d; + +private: + Q_DISABLE_COPY(QScopedPointer) +}; + +template <class T, class Cleanup> +inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) +{ + return lhs.data() == rhs.data(); +} + +template <class T, class Cleanup> +inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) +{ + return lhs.data() != rhs.data(); +} + +template <class T, class Cleanup> +Q_INLINE_TEMPLATE void qSwap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) +{ p1.swap(p2); } + +template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> > +class QScopedArrayPointer : public QScopedPointer<T, Cleanup> +{ +public: + explicit inline QScopedArrayPointer(T *p = 0) + : QScopedPointer<T, Cleanup>(p) + { + } + + inline T &operator[](int i) + { + return this->d[i]; + } + + inline const T &operator[](int i) const + { + return this->d[i]; + } + +private: + Q_DISABLE_COPY(QScopedArrayPointer) +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QSCOPEDPOINTER_H diff --git a/qtinterface/qt4/Qt/qscreen_qws.h b/qtinterface/qt4/Qt/qscreen_qws.h new file mode 100644 index 0000000..a64adf6 --- /dev/null +++ b/qtinterface/qt4/Qt/qscreen_qws.h @@ -0,0 +1,390 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREEN_QWS_H +#define QSCREEN_QWS_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qpoint.h> +#include <QtCore/qlist.h> +#include <QtGui/qrgb.h> +#include <QtCore/qrect.h> +#include <QtGui/qimage.h> +#include <QtGui/qregion.h> + +struct fb_cmap; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QScreenCursor; +class QBrush; +class QWSWindow; +class QWSWindowSurface; +class QGraphicsSystem; +class QPixmapData; + +#ifndef QT_QWS_DEPTH16_RGB +#define QT_QWS_DEPTH16_RGB 565 +#endif +static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); +static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); +static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); +static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); +static const int qt_green_shift = qt_bbits-(8-qt_gbits); +static const int qt_neg_blue_shift = 8-qt_bbits; +static const int qt_blue_mask = (1<<qt_bbits)-1; +static const int qt_green_mask = (1<<(qt_gbits+qt_bbits))-(1<<qt_bbits); +static const int qt_red_mask = (1<<(qt_rbits+qt_gbits+qt_bbits))-(1<<(qt_gbits+qt_bbits)); + +static const int qt_red_rounding_shift = qt_red_shift + qt_rbits; +static const int qt_green_rounding_shift = qt_green_shift + qt_gbits; +static const int qt_blue_rounding_shift = qt_bbits - qt_neg_blue_shift; + + +inline ushort qt_convRgbTo16(const int r, const int g, const int b) +{ + const int tr = r << qt_red_shift; + const int tg = g << qt_green_shift; + const int tb = b >> qt_neg_blue_shift; + + return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask); +} + +inline ushort qt_convRgbTo16(QRgb c) +{ + const int tr = qRed(c) << qt_red_shift; + const int tg = qGreen(c) << qt_green_shift; + const int tb = qBlue(c) >> qt_neg_blue_shift; + + return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask); +} + +inline QRgb qt_conv16ToRgb(ushort c) +{ + const int r=(c & qt_red_mask); + const int g=(c & qt_green_mask); + const int b=(c & qt_blue_mask); + const int tr = r >> qt_red_shift | r >> qt_red_rounding_shift; + const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; + const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; + + return qRgb(tr,tg,tb); +} + +inline void qt_conv16ToRgb(ushort c, int& r, int& g, int& b) +{ + const int tr=(c & qt_red_mask); + const int tg=(c & qt_green_mask); + const int tb=(c & qt_blue_mask); + r = tr >> qt_red_shift | tr >> qt_red_rounding_shift; + g = tg >> qt_green_shift | tg >> qt_green_rounding_shift; + b = tb << qt_neg_blue_shift | tb >> qt_blue_rounding_shift; +} + +const int SourceSolid=0; +const int SourcePixmap=1; + +#ifndef QT_NO_QWS_CURSOR + +class QScreenCursor; +extern QScreenCursor *qt_screencursor; +extern bool qt_sw_cursor; + +class Q_GUI_EXPORT QScreenCursor +{ +public: + QScreenCursor(); + virtual ~QScreenCursor(); + + virtual void set(const QImage &image, int hotx, int hoty); + virtual void move(int x, int y); + virtual void show(); + virtual void hide(); + + bool supportsAlphaCursor() const { return supportsAlpha; } + + static bool enabled() { return qt_sw_cursor; } + + QRect boundingRect() const { return QRect(pos - hotspot, size); } + QImage image() const { return cursor; } + bool isVisible() const { return enable; } + bool isAccelerated() const { return hwaccel; } + + static void initSoftwareCursor(); + static QScreenCursor* instance() { return qt_screencursor; } + +protected: + QImage cursor; + + QSize size; + QPoint pos; + QPoint hotspot; + uint enable : 1; + uint hwaccel : 1; + uint supportsAlpha : 1; + +private: + friend class QProxyScreenCursor; +}; + +#endif // QT_NO_QWS_CURSOR + +// A (used) chunk of offscreen memory + +class QPoolEntry +{ +public: + unsigned int start; + unsigned int end; + int clientId; +}; + +class QScreen; +class QScreenPrivate; +class QPixmapDataFactory; + +extern Q_GUI_EXPORT QScreen *qt_screen; +typedef void(*ClearCacheFunc)(QScreen *obj, int); + +class Q_GUI_EXPORT QScreen { + +public: + enum ClassId { LinuxFBClass, TransformedClass, VNCClass, MultiClass, + VFbClass, DirectFBClass, SvgalibClass, ProxyClass, + GLClass, CustomClass = 1024 }; + + QScreen(int display_id, ClassId classId); + explicit QScreen(int display_id); + virtual ~QScreen(); + static QScreen* instance() { return qt_screen; } + virtual bool initDevice() = 0; + virtual bool connect(const QString &displaySpec) = 0; + virtual void disconnect() = 0; + virtual void shutdownDevice(); + virtual void setMode(int,int,int) = 0; + virtual bool supportsDepth(int) const; + + virtual void save(); + virtual void restore(); + virtual void blank(bool on); + + virtual int pixmapOffsetAlignment() { return 64; } + virtual int pixmapLinestepAlignment() { return 64; } + virtual int sharedRamSize(void *) { return 0; } + + virtual bool onCard(const unsigned char *) const; + virtual bool onCard(const unsigned char *, ulong& out_offset) const; + + enum PixelType { NormalPixel, BGRPixel }; + + // sets a single color in the colormap + virtual void set(unsigned int,unsigned int,unsigned int,unsigned int); + // allocates a color + virtual int alloc(unsigned int,unsigned int,unsigned int); + + int width() const { return w; } + int height() const { return h; } + int depth() const { return d; } + virtual int pixmapDepth() const; + PixelType pixelType() const { return pixeltype; } + int linestep() const { return lstep; } + int deviceWidth() const { return dw; } + int deviceHeight() const { return dh; } + uchar * base() const { return data; } + // Ask for memory from card cache with alignment + virtual uchar * cache(int) { return 0; } + virtual void uncache(uchar *) {} + + QImage::Format pixelFormat() const; + + int screenSize() const { return size; } + int totalSize() const { return mapsize; } + + QRgb * clut() { return screenclut; } +#ifdef QT_DEPRECATED + QT_DEPRECATED int numCols() { return screencols; } +#endif + int colorCount() { return screencols; } + + virtual QSize mapToDevice(const QSize &) const; + virtual QSize mapFromDevice(const QSize &) const; + virtual QPoint mapToDevice(const QPoint &, const QSize &) const; + virtual QPoint mapFromDevice(const QPoint &, const QSize &) const; + virtual QRect mapToDevice(const QRect &, const QSize &) const; + virtual QRect mapFromDevice(const QRect &, const QSize &) const; + virtual QImage mapToDevice(const QImage &) const; + virtual QImage mapFromDevice(const QImage &) const; + virtual QRegion mapToDevice(const QRegion &, const QSize &) const; + virtual QRegion mapFromDevice(const QRegion &, const QSize &) const; + virtual int transformOrientation() const; + virtual bool isTransformed() const; + virtual bool isInterlaced() const; + + virtual void setDirty(const QRect&); + + virtual int memoryNeeded(const QString&); + + virtual void haltUpdates(); + virtual void resumeUpdates(); + + // composition manager methods + virtual void exposeRegion(QRegion r, int changing); + + // these work directly on the screen + virtual void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); + virtual void solidFill(const QColor &color, const QRegion ®ion); + void blit(QWSWindow *bs, const QRegion &clip); + + virtual QWSWindowSurface* createSurface(QWidget *widget) const; + virtual QWSWindowSurface* createSurface(const QString &key) const; + + virtual QList<QScreen*> subScreens() const { return QList<QScreen*>(); } + virtual QRegion region() const { return QRect(offset(), QSize(w, h)); } + int subScreenIndexAt(const QPoint &p) const; + + void setOffset(const QPoint &p); + QPoint offset() const; + + int physicalWidth() const { return physWidth; } // physical display size in mm + int physicalHeight() const { return physHeight; } // physical display size in mm + + QPixmapDataFactory* pixmapDataFactory() const; // Deprecated, will be removed in 4.6 + QGraphicsSystem* graphicsSystem() const; + +#ifdef QT_QWS_CLIENTBLIT + bool supportsBlitInClients() const; + void setSupportsBlitInClients(bool); +#endif + + ClassId classId() const; + +protected: + void setPixelFormat(QImage::Format format); + void setPixmapDataFactory(QPixmapDataFactory *factory); // Deprecated, will be removed in 4.6 + void setGraphicsSystem(QGraphicsSystem* system); + + QRgb screenclut[256]; + int screencols; + + uchar * data; + + // Table of allocated lumps, kept in sorted highest-to-lowest order + // The table itself is allocated at the bottom of offscreen memory + // i.e. it's similar to having a stack (the table) and a heap + // (the allocated blocks). Freed space is implicitly described + // by the gaps between the allocated lumps (this saves entries and + // means we don't need to worry about coalescing freed lumps) + + QPoolEntry * entries; + int * entryp; + unsigned int * lowest; + + int w; + int lstep; + int h; + int d; + PixelType pixeltype; + bool grayscale; + + int dw; + int dh; + + int size; // Screen size + int mapsize; // Total mapped memory + + int displayId; + + int physWidth; + int physHeight; + + friend class QWSServer; + friend class QWSServerPrivate; + static ClearCacheFunc clearCacheFunc; + +private: + void compose(int level, const QRegion &exposed, QRegion &blend, + QImage **blendbuffer, int changing_level); + void paintBackground(const QRegion &); + + friend class QWSOnScreenSurface; + static bool isWidgetPaintOnScreen(const QWidget *w); + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + void setFrameBufferLittleEndian(bool littleEndian); + bool frameBufferLittleEndian() const; + friend class QVNCScreen; + friend class QLinuxFbScreen; + friend class QVFbScreen; + friend class QProxyScreen; +#endif + friend void qt_solidFill_setup(QScreen*, const QColor&, const QRegion&); + friend void qt_blit_setup(QScreen *screen, const QImage &image, + const QPoint &topLeft, const QRegion ®ion); +#ifdef QT_QWS_DEPTH_GENERIC + friend void qt_set_generic_blit(QScreen *screen, int bpp, + int len_red, int len_green, int len_blue, + int len_alpha, int off_red, int off_green, + int off_blue, int off_alpha); +#endif + + QScreenPrivate *d_ptr; +}; + +// This lives in loadable modules + +#ifndef QT_LOADABLE_MODULES +extern "C" QScreen * qt_get_screen(int display_id, const char* spec); +#endif + +// This is in main lib, loads the right module, calls qt_get_screen +// In non-loadable cases just aliases to qt_get_screen + +const unsigned char * qt_probe_bus(); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREEN_QWS_H diff --git a/qtinterface/qt4/Qt/qscreendriverfactory_qws.h b/qtinterface/qt4/Qt/qscreendriverfactory_qws.h new file mode 100644 index 0000000..e287b9c --- /dev/null +++ b/qtinterface/qt4/Qt/qscreendriverfactory_qws.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENDRIVERFACTORY_QWS_H +#define QSCREENDRIVERFACTORY_QWS_H + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QString; +class QScreen; + +class Q_GUI_EXPORT QScreenDriverFactory +{ +public: + static QStringList keys(); + static QScreen *create(const QString&, int); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENDRIVERFACTORY_QWS_H diff --git a/qtinterface/qt4/Qt/qscreendriverplugin_qws.h b/qtinterface/qt4/Qt/qscreendriverplugin_qws.h new file mode 100644 index 0000000..cb55e13 --- /dev/null +++ b/qtinterface/qt4/Qt/qscreendriverplugin_qws.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENDRIVERPLUGIN_QWS_H +#define QSCREENDRIVERPLUGIN_QWS_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LIBRARY + +class QScreen; + +struct Q_GUI_EXPORT QScreenDriverFactoryInterface : public QFactoryInterface +{ + virtual QScreen* create(const QString& driver, int displayId) = 0; +}; + +#define QScreenDriverFactoryInterface_iid "com.trolltech.Qt.QScreenDriverFactoryInterface" +Q_DECLARE_INTERFACE(QScreenDriverFactoryInterface, QScreenDriverFactoryInterface_iid) + +class Q_GUI_EXPORT QScreenDriverPlugin : public QObject, public QScreenDriverFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QScreenDriverFactoryInterface:QFactoryInterface) +public: + explicit QScreenDriverPlugin(QObject *parent = 0); + ~QScreenDriverPlugin(); + + virtual QStringList keys() const = 0; + virtual QScreen *create(const QString& driver, int displayId) = 0; +}; + +#endif // QT_NO_LIBRARY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENDRIVERPLUGIN_QWS_H diff --git a/qtinterface/qt4/Qt/qscreenlinuxfb_qws.h b/qtinterface/qt4/Qt/qscreenlinuxfb_qws.h new file mode 100644 index 0000000..43db62f --- /dev/null +++ b/qtinterface/qt4/Qt/qscreenlinuxfb_qws.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENLINUXFB_QWS_H +#define QSCREENLINUXFB_QWS_H + +#include <QtGui/qscreen_qws.h> + +struct fb_cmap; +struct fb_var_screeninfo; +struct fb_fix_screeninfo; + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_LINUXFB + +class QLinuxFb_Shared +{ +public: + volatile int lastop; + volatile int optype; + volatile int fifocount; // Accel drivers only + volatile int fifomax; + volatile int forecol; // Foreground colour caching + volatile unsigned int buffer_offset; // Destination + volatile int linestep; + volatile int cliptop; // Clip rectangle + volatile int clipleft; + volatile int clipright; + volatile int clipbottom; + volatile unsigned int rop; + +}; + +class QLinuxFbScreenPrivate; + +class Q_GUI_EXPORT QLinuxFbScreen : public QScreen +{ +public: + explicit QLinuxFbScreen(int display_id); + virtual ~QLinuxFbScreen(); + + virtual bool initDevice(); + virtual bool connect(const QString &displaySpec); + + virtual bool useOffscreen(); + + virtual void disconnect(); + virtual void shutdownDevice(); + virtual void setMode(int,int,int); + virtual void save(); + virtual void restore(); + virtual void blank(bool on); + virtual void set(unsigned int,unsigned int,unsigned int,unsigned int); + virtual uchar * cache(int); + virtual void uncache(uchar *); + virtual int sharedRamSize(void *); + + QLinuxFb_Shared * shared; + +protected: + + void deleteEntry(uchar *); + + bool canaccel; + int dataoffset; + int cacheStart; + + static void clearCache(QScreen *instance, int); + +private: + + void delete_entry(int); + void insert_entry(int,int,int); + void setupOffScreen(); + void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); + void setPixelFormat(struct fb_var_screeninfo); + + QLinuxFbScreenPrivate *d_ptr; +}; + +#endif // QT_NO_QWS_LINUXFB + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENLINUXFB_QWS_H diff --git a/qtinterface/qt4/Qt/qscreenproxy_qws.h b/qtinterface/qt4/Qt/qscreenproxy_qws.h new file mode 100644 index 0000000..5946c42 --- /dev/null +++ b/qtinterface/qt4/Qt/qscreenproxy_qws.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROXYSCREEN_QWS_H +#define QPROXYSCREEN_QWS_H + +#include <QtGui/qscreen_qws.h> + +#ifndef QT_NO_QWS_PROXYSCREEN + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QProxyScreenPrivate; + +#ifndef QT_NO_QWS_CURSOR + +class QProxyScreenCursorPrivate; + +class Q_GUI_EXPORT QProxyScreenCursor : public QScreenCursor +{ +public: + QProxyScreenCursor(); + ~QProxyScreenCursor(); + + void setScreenCursor(QScreenCursor *cursor); + QScreenCursor* screenCursor() const; + + void set(const QImage &image, int hotx, int hoty); + void move(int x, int y); + void show(); + void hide(); + +private: + void configure(); + + QScreenCursor *realCursor; + QProxyScreenCursorPrivate *d_ptr; +}; + +#endif // QT_NO_QWS_CURSOR + +class Q_GUI_EXPORT QProxyScreen : public QScreen +{ +public: + QProxyScreen(int display_id, ClassId = ProxyClass); + ~QProxyScreen(); + + void setScreen(QScreen *screen); + QScreen *screen() const; + + QSize mapToDevice(const QSize &s) const; + QSize mapFromDevice(const QSize &s) const; + + QPoint mapToDevice(const QPoint &, const QSize &) const; + QPoint mapFromDevice(const QPoint &, const QSize &) const; + + QRect mapToDevice(const QRect &, const QSize &) const; + QRect mapFromDevice(const QRect &, const QSize &) const; + + QRegion mapToDevice(const QRegion &, const QSize &) const; + QRegion mapFromDevice(const QRegion &, const QSize &) const; + + bool connect(const QString &displaySpec); + bool initDevice(); + void shutdownDevice(); + void disconnect(); + + void setMode(int width, int height, int depth); + bool supportsDepth(int) const; + + void save(); + void restore(); + void blank(bool on); + + bool onCard(const unsigned char *) const; + bool onCard(const unsigned char *, ulong& out_offset) const; + + bool isInterlaced() const; + bool isTransformed() const; + int transformOrientation() const; + + int memoryNeeded(const QString&); + int sharedRamSize(void *); + + void haltUpdates(); + void resumeUpdates(); + + void exposeRegion(QRegion r, int changing); + void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); + void solidFill(const QColor &color, const QRegion ®ion); + void setDirty(const QRect&); + + QWSWindowSurface* createSurface(QWidget *widget) const; + QWSWindowSurface* createSurface(const QString &key) const; + + QList<QScreen*> subScreens() const; + QRegion region() const; + +private: + void configure(); + + QScreen *realScreen; + QProxyScreenPrivate *d_ptr; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_QWS_PROXYSCREEN +#endif // QPROXYSCREEN_QWS_H diff --git a/qtinterface/qt4/Qt/qscreenqnx_qws.h b/qtinterface/qt4/Qt/qscreenqnx_qws.h new file mode 100644 index 0000000..b906ab2 --- /dev/null +++ b/qtinterface/qt4/Qt/qscreenqnx_qws.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENQNX_QWS_H +#define QSCREENQNX_QWS_H + +#include <QtGui/qscreen_qws.h> + +#ifndef QT_NO_QWS_QNX + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +struct QQnxScreenContext; + +class QQnxScreen : public QScreen +{ +public: + explicit QQnxScreen(int display_id); + ~QQnxScreen(); + + bool initDevice(); + bool connect(const QString &displaySpec); + void disconnect(); + void shutdownDevice(); + void setMode(int,int,int); + bool supportsDepth(int) const; + + void exposeRegion(QRegion r, int changing); + +private: + QQnxScreenContext * const d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_QWS_QNX + +#endif diff --git a/qtinterface/qt4/Qt/qscreentransformed_qws.h b/qtinterface/qt4/Qt/qscreentransformed_qws.h new file mode 100644 index 0000000..45dcf62 --- /dev/null +++ b/qtinterface/qt4/Qt/qscreentransformed_qws.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENTRANSFORMED_QWS_H +#define QSCREENTRANSFORMED_QWS_H + +#include <QtGui/qscreenproxy_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_TRANSFORMED + +class QTransformedScreenPrivate; + +class Q_AUTOTEST_EXPORT QTransformedScreen : public QProxyScreen +{ +public: + explicit QTransformedScreen(int display_id); + ~QTransformedScreen(); + + enum Transformation { None, Rot90, Rot180, Rot270 }; + + void setTransformation(Transformation t); + Transformation transformation() const; + int transformOrientation() const; + + QSize mapToDevice(const QSize &s) const; + QSize mapFromDevice(const QSize &s) const; + + QPoint mapToDevice(const QPoint &, const QSize &) const; + QPoint mapFromDevice(const QPoint &, const QSize &) const; + + QRect mapToDevice(const QRect &, const QSize &) const; + QRect mapFromDevice(const QRect &, const QSize &) const; + + QRegion mapToDevice(const QRegion &, const QSize &) const; + QRegion mapFromDevice(const QRegion &, const QSize &) const; + + bool connect(const QString &displaySpec); + + bool isTransformed() const { return transformation() != None; } + + void exposeRegion(QRegion region, int changing); + void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); + void solidFill(const QColor &color, const QRegion ®ion); + void setDirty(const QRect&); + + QRegion region() const; + +private: + friend class QTransformedScreenPrivate; + QTransformedScreenPrivate *d_ptr; +}; + +#endif // QT_NO_QWS_TRANSFORMED + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENTRANSFORMED_QWS_H diff --git a/qtinterface/qt4/Qt/qscreenvfb_qws.h b/qtinterface/qt4/Qt/qscreenvfb_qws.h new file mode 100644 index 0000000..09db7e0 --- /dev/null +++ b/qtinterface/qt4/Qt/qscreenvfb_qws.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENVFB_QWS_H +#define QSCREENVFB_QWS_H + +#include <QtGui/qscreen_qws.h> +#include <QtGui/qvfbhdr.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_QVFB + +class QVFbScreenPrivate; + +class Q_GUI_EXPORT QVFbScreen : public QScreen +{ +public: + explicit QVFbScreen(int display_id); + virtual ~QVFbScreen(); + virtual bool initDevice(); + virtual bool connect(const QString &displaySpec); + virtual void disconnect(); + virtual void shutdownDevice(); + virtual void save(); + virtual void restore(); + virtual void setMode(int nw,int nh,int nd); + virtual void setDirty(const QRect& r); + virtual void blank(bool); +#ifdef QTOPIA_QVFB_BRIGHTNESS + static void setBrightness(int b); +#endif + +private: + QVFbScreenPrivate *d_ptr; +}; + +#endif // QT_NO_QWS_QVFB + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENVFB_QWS_H diff --git a/qtinterface/qt4/Qt/qscriptable.h b/qtinterface/qt4/Qt/qscriptable.h new file mode 100644 index 0000000..ce2732f --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptable.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTABLE_H +#define QSCRIPTABLE_H + +#include <QtCore/qobjectdefs.h> + +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +#ifndef QT_NO_QOBJECT + +class QScriptEngine; +class QScriptContext; +class QScriptValue; + +class QScriptablePrivate; + +class Q_SCRIPT_EXPORT QScriptable +{ +public: + QScriptable(); + ~QScriptable(); + + QScriptEngine *engine() const; + QScriptContext *context() const; + QScriptValue thisObject() const; + int argumentCount() const; + QScriptValue argument(int index) const; + +private: + QScopedPointer<QScriptablePrivate> d_ptr; + + Q_DISABLE_COPY(QScriptable) + Q_DECLARE_PRIVATE(QScriptable) +}; + +#endif // QT_NO_QOBJECT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTABLE_H diff --git a/qtinterface/qt4/Qt/qscriptclass.h b/qtinterface/qt4/Qt/qscriptclass.h new file mode 100644 index 0000000..d2c579e --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptclass.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTCLASS_H +#define QSCRIPTCLASS_H + +#include <QtCore/qstring.h> + +#include <QtCore/qvariant.h> +#include <QtCore/qscopedpointer.h> +#include <QtScript/qscriptvalue.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptString; +class QScriptClassPropertyIterator; + +class QScriptClassPrivate; +class Q_SCRIPT_EXPORT QScriptClass +{ +public: + enum QueryFlag { + HandlesReadAccess = 0x01, + HandlesWriteAccess = 0x02 + }; + Q_DECLARE_FLAGS(QueryFlags, QueryFlag) + + enum Extension { + Callable, + HasInstance + }; + + QScriptClass(QScriptEngine *engine); + virtual ~QScriptClass(); + + QScriptEngine *engine() const; + + virtual QueryFlags queryProperty(const QScriptValue &object, + const QScriptString &name, + QueryFlags flags, uint *id); + + virtual QScriptValue property(const QScriptValue &object, + const QScriptString &name, uint id); + + virtual void setProperty(QScriptValue &object, const QScriptString &name, + uint id, const QScriptValue &value); + + virtual QScriptValue::PropertyFlags propertyFlags( + const QScriptValue &object, const QScriptString &name, uint id); + + virtual QScriptClassPropertyIterator *newIterator(const QScriptValue &object); + + virtual QScriptValue prototype() const; + + virtual QString name() const; + + virtual bool supportsExtension(Extension extension) const; + virtual QVariant extension(Extension extension, + const QVariant &argument = QVariant()); + +protected: + QScriptClass(QScriptEngine *engine, QScriptClassPrivate &dd); + QScopedPointer<QScriptClassPrivate> d_ptr; + +private: + Q_DECLARE_PRIVATE(QScriptClass) + Q_DISABLE_COPY(QScriptClass) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptClass::QueryFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptclasspropertyiterator.h b/qtinterface/qt4/Qt/qscriptclasspropertyiterator.h new file mode 100644 index 0000000..4dbe8e1 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptclasspropertyiterator.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTCLASSPROPERTYITERATOR_H +#define QSCRIPTCLASSPROPERTYITERATOR_H + +#include <QtCore/qstring.h> + +#include <QtCore/qscopedpointer.h> +#include <QtScript/qscriptvalue.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptClassPropertyIteratorPrivate; +class Q_SCRIPT_EXPORT QScriptClassPropertyIterator +{ +protected: + QScriptClassPropertyIterator(const QScriptValue &object); + +public: + virtual ~QScriptClassPropertyIterator(); + + QScriptValue object() const; + + virtual bool hasNext() const = 0; + virtual void next() = 0; + + virtual bool hasPrevious() const = 0; + virtual void previous() = 0; + + virtual void toFront() = 0; + virtual void toBack() = 0; + + virtual QScriptString name() const = 0; + virtual uint id() const; + virtual QScriptValue::PropertyFlags flags() const; + +protected: + QScriptClassPropertyIterator(const QScriptValue &object, QScriptClassPropertyIteratorPrivate &dd); + QScopedPointer<QScriptClassPropertyIteratorPrivate> d_ptr; + +private: + Q_DECLARE_PRIVATE(QScriptClassPropertyIterator) + Q_DISABLE_COPY(QScriptClassPropertyIterator) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptcontext.h b/qtinterface/qt4/Qt/qscriptcontext.h new file mode 100644 index 0000000..65e8b91 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptcontext.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTCONTEXT_H +#define QSCRIPTCONTEXT_H + +#include <QtCore/qobjectdefs.h> + +#include <QtScript/qscriptvalue.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptContextPrivate; + +class Q_SCRIPT_EXPORT QScriptContext +{ +public: + enum ExecutionState { + NormalState, + ExceptionState + }; + + enum Error { + UnknownError, + ReferenceError, + SyntaxError, + TypeError, + RangeError, + URIError + }; + + ~QScriptContext(); + + QScriptContext *parentContext() const; + QScriptEngine *engine() const; + + ExecutionState state() const; + QScriptValue callee() const; + + int argumentCount() const; + QScriptValue argument(int index) const; + QScriptValue argumentsObject() const; + + QScriptValueList scopeChain() const; + void pushScope(const QScriptValue &object); + QScriptValue popScope(); + + QScriptValue returnValue() const; + void setReturnValue(const QScriptValue &result); + + QScriptValue activationObject() const; + void setActivationObject(const QScriptValue &activation); + + QScriptValue thisObject() const; + void setThisObject(const QScriptValue &thisObject); + + bool isCalledAsConstructor() const; + + QScriptValue throwValue(const QScriptValue &value); + QScriptValue throwError(Error error, const QString &text); + QScriptValue throwError(const QString &text); + + QStringList backtrace() const; + + QString toString() const; + +private: + QScriptContext(); + + QScriptContextPrivate *d_ptr; + + Q_DECLARE_PRIVATE(QScriptContext) + Q_DISABLE_COPY(QScriptContext) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptcontextinfo.h b/qtinterface/qt4/Qt/qscriptcontextinfo.h new file mode 100644 index 0000000..d0b3f21 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptcontextinfo.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTCONTEXTINFO_H +#define QSCRIPTCONTEXTINFO_H + +#include <QtCore/qobjectdefs.h> + +#include <QtCore/qlist.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qsharedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptContext; +#ifndef QT_NO_DATASTREAM +class QDataStream; +#endif + +class QScriptContextInfoPrivate; +class Q_SCRIPT_EXPORT QScriptContextInfo +{ +public: +#ifndef QT_NO_DATASTREAM + friend Q_SCRIPT_EXPORT QDataStream &operator<<(QDataStream &, const QScriptContextInfo &); + friend Q_SCRIPT_EXPORT QDataStream &operator>>(QDataStream &, QScriptContextInfo &); +#endif + + enum FunctionType { + ScriptFunction, + QtFunction, + QtPropertyFunction, + NativeFunction + }; + + QScriptContextInfo(const QScriptContext *context); + QScriptContextInfo(const QScriptContextInfo &other); + QScriptContextInfo(); + ~QScriptContextInfo(); + + QScriptContextInfo &operator=(const QScriptContextInfo &other); + + bool isNull() const; + + qint64 scriptId() const; + QString fileName() const; + int lineNumber() const; + int columnNumber() const; + + QString functionName() const; + FunctionType functionType() const; + + QStringList functionParameterNames() const; + + int functionStartLineNumber() const; + int functionEndLineNumber() const; + + int functionMetaIndex() const; + + bool operator==(const QScriptContextInfo &other) const; + bool operator!=(const QScriptContextInfo &other) const; + +private: + QExplicitlySharedDataPointer<QScriptContextInfoPrivate> d_ptr; + + Q_DECLARE_PRIVATE(QScriptContextInfo) +}; + +typedef QList<QScriptContextInfo> QScriptContextInfoList; + +#ifndef QT_NO_DATASTREAM +Q_SCRIPT_EXPORT QDataStream &operator<<(QDataStream &, const QScriptContextInfo &); +Q_SCRIPT_EXPORT QDataStream &operator>>(QDataStream &, QScriptContextInfo &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptengine.h b/qtinterface/qt4/Qt/qscriptengine.h new file mode 100644 index 0000000..2ce3183 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptengine.h @@ -0,0 +1,465 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTENGINE_H +#define QSCRIPTENGINE_H + +#include <QtCore/qmetatype.h> + +#include <QtCore/qvariant.h> +#include <QtCore/qsharedpointer.h> + +#ifndef QT_NO_QOBJECT +#include <QtCore/qobject.h> +#else +#include <QtCore/qobjectdefs.h> +#endif + +#include <QtScript/qscriptvalue.h> +#include <QtScript/qscriptcontext.h> +#include <QtScript/qscriptstring.h> +#include <QtScript/qscriptprogram.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QDateTime; +class QScriptClass; +class QScriptEngineAgent; +class QScriptEnginePrivate; + +#ifndef QT_NO_QOBJECT + +template <class T> +inline QScriptValue qscriptQMetaObjectConstructor(QScriptContext *, QScriptEngine *, T *) +{ + return QScriptValue(); +} + +#endif // QT_NO_QOBJECT + +#ifndef QT_NO_REGEXP +class QRegExp; +#endif + +#ifndef QT_NO_MEMBER_TEMPLATES +template <typename T> +inline QScriptValue qScriptValueFromValue(QScriptEngine *, const T &); + +template <typename T> +inline T qScriptValueToValue(const QScriptValue &); +#endif + +class QScriptSyntaxCheckResultPrivate; +class Q_SCRIPT_EXPORT QScriptSyntaxCheckResult +{ +public: + enum State { + Error, + Intermediate, + Valid + }; + + QScriptSyntaxCheckResult(const QScriptSyntaxCheckResult &other); + ~QScriptSyntaxCheckResult(); + + State state() const; + int errorLineNumber() const; + int errorColumnNumber() const; + QString errorMessage() const; + + QScriptSyntaxCheckResult &operator=(const QScriptSyntaxCheckResult &other); + +private: + QScriptSyntaxCheckResult(); + QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate *d); + QExplicitlySharedDataPointer<QScriptSyntaxCheckResultPrivate> d_ptr; + + Q_DECLARE_PRIVATE(QScriptSyntaxCheckResult) + friend class QScriptEngine; + friend class QScriptEnginePrivate; +}; + +class Q_SCRIPT_EXPORT QScriptEngine +#ifndef QT_NO_QOBJECT + : public QObject +#endif +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif +public: + enum ValueOwnership { + QtOwnership, + ScriptOwnership, + AutoOwnership + }; + + enum QObjectWrapOption { + ExcludeChildObjects = 0x0001, + ExcludeSuperClassMethods = 0x0002, + ExcludeSuperClassProperties = 0x0004, + ExcludeSuperClassContents = 0x0006, + SkipMethodsInEnumeration = 0x0008, + ExcludeDeleteLater = 0x0010, + + AutoCreateDynamicProperties = 0x0100, + PreferExistingWrapperObject = 0x0200 + }; + Q_DECLARE_FLAGS(QObjectWrapOptions, QObjectWrapOption) + + QScriptEngine(); +#ifndef QT_NO_QOBJECT + explicit QScriptEngine(QObject *parent); +#endif + virtual ~QScriptEngine(); + + QScriptValue globalObject() const; + void setGlobalObject(const QScriptValue &object); + + QScriptContext *currentContext() const; + QScriptContext *pushContext(); + void popContext(); + + bool canEvaluate(const QString &program) const; + static QScriptSyntaxCheckResult checkSyntax(const QString &program); + + QScriptValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1); + + QScriptValue evaluate(const QScriptProgram &program); + + bool isEvaluating() const; + void abortEvaluation(const QScriptValue &result = QScriptValue()); + + bool hasUncaughtException() const; + QScriptValue uncaughtException() const; + int uncaughtExceptionLineNumber() const; + QStringList uncaughtExceptionBacktrace() const; + void clearExceptions(); + + QScriptValue nullValue(); + QScriptValue undefinedValue(); + + typedef QScriptValue (*FunctionSignature)(QScriptContext *, QScriptEngine *); + typedef QScriptValue (*FunctionWithArgSignature)(QScriptContext *, QScriptEngine *, void *); + + QScriptValue newFunction(FunctionSignature signature, int length = 0); + QScriptValue newFunction(FunctionSignature signature, const QScriptValue &prototype, int length = 0); + + QScriptValue newFunction(FunctionWithArgSignature signature, void *arg); + + QScriptValue newVariant(const QVariant &value); + QScriptValue newVariant(const QScriptValue &object, const QVariant &value); + +#ifndef QT_NO_REGEXP + QScriptValue newRegExp(const QRegExp ®exp); +#endif + + QScriptValue newObject(); + QScriptValue newObject(QScriptClass *scriptClass, const QScriptValue &data = QScriptValue()); + QScriptValue newArray(uint length = 0); + QScriptValue newRegExp(const QString &pattern, const QString &flags); + QScriptValue newDate(qsreal value); + QScriptValue newDate(const QDateTime &value); + QScriptValue newActivationObject(); + +#ifndef QT_NO_QOBJECT + QScriptValue newQObject(QObject *object, ValueOwnership ownership = QtOwnership, + const QObjectWrapOptions &options = 0); + QScriptValue newQObject(const QScriptValue &scriptObject, QObject *qtObject, + ValueOwnership ownership = QtOwnership, + const QObjectWrapOptions &options = 0); + + QScriptValue newQMetaObject(const QMetaObject *metaObject, const QScriptValue &ctor = QScriptValue()); + +# ifndef QT_NO_MEMBER_TEMPLATES + template <class T> QScriptValue scriptValueFromQMetaObject(); +# endif // QT_NO_MEMBER_TEMPLATES + +#endif // QT_NO_QOBJECT + + + + QScriptValue defaultPrototype(int metaTypeId) const; + void setDefaultPrototype(int metaTypeId, const QScriptValue &prototype); + + + typedef QScriptValue (*MarshalFunction)(QScriptEngine *, const void *); + typedef void (*DemarshalFunction)(const QScriptValue &, void *); + + + +#ifndef QT_NO_MEMBER_TEMPLATES + template <typename T> + inline QScriptValue toScriptValue(const T &value) + { + return qScriptValueFromValue(this, value); + } + template <typename T> + inline T fromScriptValue(const QScriptValue &value) + { + return qScriptValueToValue<T>(value); + } +#endif // QT_NO_MEMBER_TEMPLATES + + void installTranslatorFunctions(const QScriptValue &object = QScriptValue()); + + QScriptValue importExtension(const QString &extension); + QStringList availableExtensions() const; + QStringList importedExtensions() const; + + void collectGarbage(); + + void setProcessEventsInterval(int interval); + int processEventsInterval() const; + + void setAgent(QScriptEngineAgent *agent); + QScriptEngineAgent *agent() const; + + QScriptString toStringHandle(const QString &str); + QScriptValue toObject(const QScriptValue &value); + + QScriptValue objectById(qint64 id) const; + +#ifndef QT_NO_QOBJECT +Q_SIGNALS: + void signalHandlerException(const QScriptValue &exception); +#endif + +private: + QScriptValue create(int type, const void *ptr); + + bool convert(const QScriptValue &value, int type, void *ptr); + static bool convertV2(const QScriptValue &value, int type, void *ptr); + + void registerCustomType(int type, MarshalFunction mf, DemarshalFunction df, + const QScriptValue &prototype); + + friend inline void qScriptRegisterMetaType_helper(QScriptEngine *, + int, MarshalFunction, DemarshalFunction, const QScriptValue &); + + friend inline QScriptValue qScriptValueFromValue_helper(QScriptEngine *, int, const void *); + + friend inline bool qscriptvalue_cast_helper(const QScriptValue &, int, void *); + +protected: +#ifdef QT_NO_QOBJECT + QScopedPointer<QScriptEnginePrivate> d_ptr; + + QScriptEngine(QScriptEnginePrivate &dd); +#else + QScriptEngine(QScriptEnginePrivate &dd, QObject *parent = 0); +#endif + +private: + Q_DECLARE_PRIVATE(QScriptEngine) + Q_DISABLE_COPY(QScriptEngine) +#ifndef QT_NO_QOBJECT + Q_PRIVATE_SLOT(d_func(), void _q_objectDestroyed(QObject *)) +#endif +}; + +#ifndef QT_NO_QOBJECT +template <class T> +inline QScriptValue qScriptValueFromQMetaObject( + QScriptEngine *engine +#ifndef qdoc + , T * /* dummy */ = 0 +#endif + ) +{ + typedef QScriptValue(*ConstructPtr)(QScriptContext *, QScriptEngine *, T *); + ConstructPtr cptr = qscriptQMetaObjectConstructor<T>; + return engine->newQMetaObject(&T::staticMetaObject, + engine->newFunction(reinterpret_cast<QScriptEngine::FunctionWithArgSignature>(cptr), 0)); +} + +#define Q_SCRIPT_DECLARE_QMETAOBJECT(T, _Arg1) \ +template<> inline QScriptValue qscriptQMetaObjectConstructor<T>(QScriptContext *ctx, QScriptEngine *eng, T *) \ +{ \ + _Arg1 arg1 = qscriptvalue_cast<_Arg1> (ctx->argument(0)); \ + T* t = new T(arg1); \ + if (ctx->isCalledAsConstructor()) \ + return eng->newQObject(ctx->thisObject(), t, QScriptEngine::AutoOwnership); \ + QScriptValue o = eng->newQObject(t, QScriptEngine::AutoOwnership); \ + o.setPrototype(ctx->callee().property(QString::fromLatin1("prototype"))); \ + return o; \ +} + +# ifndef QT_NO_MEMBER_TEMPLATES + template <class T> QScriptValue QScriptEngine::scriptValueFromQMetaObject() + { + return qScriptValueFromQMetaObject<T>(this); + } +# endif // QT_NO_MEMBER_TEMPLATES + +#endif // QT_NO_QOBJECT + +inline QScriptValue qScriptValueFromValue_helper(QScriptEngine *engine, int type, const void *ptr) +{ + if (!engine) + return QScriptValue(); + + return engine->create(type, ptr); +} + +template <typename T> +inline QScriptValue qScriptValueFromValue(QScriptEngine *engine, const T &t) +{ + return qScriptValueFromValue_helper(engine, qMetaTypeId<T>(), &t); +} + +template <> +inline QScriptValue qScriptValueFromValue<QVariant>(QScriptEngine *engine, const QVariant &v) +{ + QScriptValue result = qScriptValueFromValue_helper(engine, v.userType(), v.data()); + if (!result.isValid()) + result = engine->newVariant(v); + return result; +} + +inline bool qscriptvalue_cast_helper(const QScriptValue &value, int type, void *ptr) +{ + return QScriptEngine::convertV2(value, type, ptr); +} + +template<typename T> +T qscriptvalue_cast(const QScriptValue &value +#if !defined qdoc && defined Q_CC_MSVC && _MSC_VER < 1300 +, T * = 0 +#endif + ) +{ + T t; + const int id = qMetaTypeId<T>(); + + if (qscriptvalue_cast_helper(value, id, &t)) + return t; + else if (value.isVariant()) + return qvariant_cast<T>(value.toVariant()); + + return T(); +} + +#if !defined Q_CC_MSVC || _MSC_VER >= 1300 +template <> +inline QVariant qscriptvalue_cast<QVariant>(const QScriptValue &value) +{ + return value.toVariant(); +} +#endif + +template <typename T> +inline T qScriptValueToValue(const QScriptValue &value) +{ + return qscriptvalue_cast<T>(value); +} + +inline void qScriptRegisterMetaType_helper(QScriptEngine *eng, int type, + QScriptEngine::MarshalFunction mf, + QScriptEngine::DemarshalFunction df, + const QScriptValue &prototype) +{ + eng->registerCustomType(type, mf, df, prototype); +} + +template<typename T> +int qScriptRegisterMetaType( + QScriptEngine *eng, + QScriptValue (*toScriptValue)(QScriptEngine *, const T &t), + void (*fromScriptValue)(const QScriptValue &, T &t), + const QScriptValue &prototype = QScriptValue() +#ifndef qdoc + , T * /* dummy */ = 0 +#endif +) +{ + const int id = qRegisterMetaType<T>(); // make sure it's registered + + qScriptRegisterMetaType_helper( + eng, id, reinterpret_cast<QScriptEngine::MarshalFunction>(toScriptValue), + reinterpret_cast<QScriptEngine::DemarshalFunction>(fromScriptValue), + prototype); + + return id; +} + +template <class Container> +QScriptValue qScriptValueFromSequence(QScriptEngine *eng, const Container &cont) +{ + QScriptValue a = eng->newArray(); + typename Container::const_iterator begin = cont.begin(); + typename Container::const_iterator end = cont.end(); + typename Container::const_iterator it; + quint32 i; + for (it = begin, i = 0; it != end; ++it, ++i) + a.setProperty(i, qScriptValueFromValue(eng, *it)); + return a; +} + +template <class Container> +void qScriptValueToSequence(const QScriptValue &value, Container &cont) +{ + quint32 len = value.property(QLatin1String("length")).toUInt32(); + for (quint32 i = 0; i < len; ++i) { + QScriptValue item = value.property(i); +#if defined Q_CC_MSVC && !defined Q_CC_MSVC_NET + cont.push_back(qscriptvalue_cast<Container::value_type>(item)); +#else + cont.push_back(qscriptvalue_cast<typename Container::value_type>(item)); +#endif + } +} + +template<typename T> +int qScriptRegisterSequenceMetaType( + QScriptEngine *engine, + const QScriptValue &prototype = QScriptValue() +#ifndef qdoc + , T * /* dummy */ = 0 +#endif +) +{ + return qScriptRegisterMetaType<T>(engine, qScriptValueFromSequence, + qScriptValueToSequence, prototype); +} + +#ifndef QT_NO_QOBJECT +Q_SCRIPT_EXPORT bool qScriptConnect(QObject *sender, const char *signal, + const QScriptValue &receiver, + const QScriptValue &function); +Q_SCRIPT_EXPORT bool qScriptDisconnect(QObject *sender, const char *signal, + const QScriptValue &receiver, + const QScriptValue &function); +#endif // QT_NO_QOBJECT + +Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptEngine::QObjectWrapOptions) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTENGINE_H diff --git a/qtinterface/qt4/Qt/qscriptengineagent.h b/qtinterface/qt4/Qt/qscriptengineagent.h new file mode 100644 index 0000000..892deaa --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptengineagent.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTENGINEAGENT_H +#define QSCRIPTENGINEAGENT_H + +#include <QtCore/qobjectdefs.h> + +#include <QtCore/qvariant.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptEngine; +class QScriptValue; + +class QScriptEngineAgentPrivate; +class Q_SCRIPT_EXPORT QScriptEngineAgent +{ +public: + enum Extension { + DebuggerInvocationRequest + }; + + QScriptEngineAgent(QScriptEngine *engine); + virtual ~QScriptEngineAgent(); + + virtual void scriptLoad(qint64 id, const QString &program, + const QString &fileName, int baseLineNumber); + virtual void scriptUnload(qint64 id); + + virtual void contextPush(); + virtual void contextPop(); + + virtual void functionEntry(qint64 scriptId); + virtual void functionExit(qint64 scriptId, + const QScriptValue &returnValue); + + virtual void positionChange(qint64 scriptId, + int lineNumber, int columnNumber); + + virtual void exceptionThrow(qint64 scriptId, + const QScriptValue &exception, + bool hasHandler); + virtual void exceptionCatch(qint64 scriptId, + const QScriptValue &exception); + + virtual bool supportsExtension(Extension extension) const; + virtual QVariant extension(Extension extension, + const QVariant &argument = QVariant()); + + QScriptEngine *engine() const; + +protected: + QScriptEngineAgent(QScriptEngineAgentPrivate &dd, QScriptEngine *engine); + QScopedPointer<QScriptEngineAgentPrivate> d_ptr; + +private: + Q_DECLARE_PRIVATE(QScriptEngineAgent) + Q_DISABLE_COPY(QScriptEngineAgent) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptenginedebugger.h b/qtinterface/qt4/Qt/qscriptenginedebugger.h new file mode 100644 index 0000000..8902570 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptenginedebugger.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSCriptTools module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTENGINEDEBUGGER_H +#define QSCRIPTENGINEDEBUGGER_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(ScriptTools) + +class QAction; +class QScriptEngine; +class QWidget; +#ifndef QT_NO_MAINWINDOW +class QMainWindow; +#endif +class QMenu; +class QToolBar; + +class QScriptEngineDebuggerPrivate; +class Q_SCRIPTTOOLS_EXPORT QScriptEngineDebugger : public QObject +{ + Q_OBJECT +public: + enum DebuggerWidget { + ConsoleWidget, + StackWidget, + ScriptsWidget, + LocalsWidget, + CodeWidget, + CodeFinderWidget, + BreakpointsWidget, + DebugOutputWidget, + ErrorLogWidget + }; + + enum DebuggerAction { + InterruptAction, + ContinueAction, + StepIntoAction, + StepOverAction, + StepOutAction, + RunToCursorAction, + RunToNewScriptAction, + ToggleBreakpointAction, + ClearDebugOutputAction, + ClearErrorLogAction, + ClearConsoleAction, + FindInScriptAction, + FindNextInScriptAction, + FindPreviousInScriptAction, + GoToLineAction + }; + + enum DebuggerState { + RunningState, + SuspendedState + }; + + QScriptEngineDebugger(QObject *parent = 0); + ~QScriptEngineDebugger(); + + void attachTo(QScriptEngine *engine); + void detach(); + + bool autoShowStandardWindow() const; + void setAutoShowStandardWindow(bool autoShow); + +#ifndef QT_NO_MAINWINDOW + QMainWindow *standardWindow() const; +#endif + QToolBar *createStandardToolBar(QWidget *parent = 0); + QMenu *createStandardMenu(QWidget *parent = 0); + + QWidget *widget(DebuggerWidget widget) const; + QAction *action(DebuggerAction action) const; + + DebuggerState state() const; + +Q_SIGNALS: + void evaluationSuspended(); + void evaluationResumed(); + +private: + Q_DECLARE_PRIVATE(QScriptEngineDebugger) + Q_DISABLE_COPY(QScriptEngineDebugger) + + Q_PRIVATE_SLOT(d_func(), void _q_showStandardWindow()) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptextensioninterface.h b/qtinterface/qt4/Qt/qscriptextensioninterface.h new file mode 100644 index 0000000..101fc04 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptextensioninterface.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTEXTENSIONINTERFACE_H +#define QSCRIPTEXTENSIONINTERFACE_H + +#include <QtCore/qfactoryinterface.h> + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptEngine; + +struct Q_SCRIPT_EXPORT QScriptExtensionInterface + : public QFactoryInterface +{ + virtual void initialize(const QString &key, QScriptEngine *engine) = 0; +}; + +Q_DECLARE_INTERFACE(QScriptExtensionInterface, + "com.trolltech.Qt.QScriptExtensionInterface/1.0") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTEXTENSIONINTERFACE_H diff --git a/qtinterface/qt4/Qt/qscriptextensionplugin.h b/qtinterface/qt4/Qt/qscriptextensionplugin.h new file mode 100644 index 0000000..4600cce --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptextensionplugin.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTEXTENSIONPLUGIN_H +#define QSCRIPTEXTENSIONPLUGIN_H + +#include <QtCore/qplugin.h> + +#include <QtScript/qscriptextensioninterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptValue; + +class Q_SCRIPT_EXPORT QScriptExtensionPlugin : public QObject, + public QScriptExtensionInterface +{ + Q_OBJECT + Q_INTERFACES(QScriptExtensionInterface:QFactoryInterface) +public: + explicit QScriptExtensionPlugin(QObject *parent = 0); + ~QScriptExtensionPlugin(); + + virtual QStringList keys() const = 0; + virtual void initialize(const QString &key, QScriptEngine *engine) = 0; + + QScriptValue setupPackage(const QString &key, QScriptEngine *engine) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTEXTENSIONPLUGIN_H diff --git a/qtinterface/qt4/Qt/qscriptprogram.h b/qtinterface/qt4/Qt/qscriptprogram.h new file mode 100644 index 0000000..21b3685 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptprogram.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTPROGRAM_H +#define QSCRIPTPROGRAM_H + +#include <QtCore/qsharedpointer.h> + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptProgramPrivate; +class Q_SCRIPT_EXPORT QScriptProgram +{ +public: + QScriptProgram(); + QScriptProgram(const QString &sourceCode, + const QString fileName = QString(), + int firstLineNumber = 1); + QScriptProgram(const QScriptProgram &other); + ~QScriptProgram(); + + QScriptProgram &operator=(const QScriptProgram &other); + + bool isNull() const; + + QString sourceCode() const; + QString fileName() const; + int firstLineNumber() const; + + bool operator==(const QScriptProgram &other) const; + bool operator!=(const QScriptProgram &other) const; + +private: + QExplicitlySharedDataPointer<QScriptProgramPrivate> d_ptr; + Q_DECLARE_PRIVATE(QScriptProgram) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTPROGRAM_H diff --git a/qtinterface/qt4/Qt/qscriptstring.h b/qtinterface/qt4/Qt/qscriptstring.h new file mode 100644 index 0000000..3b5bf62 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptstring.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTSTRING_H +#define QSCRIPTSTRING_H + +#include <QtCore/qstring.h> + +#include <QtCore/qsharedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptStringPrivate; +class Q_SCRIPT_EXPORT QScriptString +{ +public: + QScriptString(); + QScriptString(const QScriptString &other); + ~QScriptString(); + + QScriptString &operator=(const QScriptString &other); + + bool isValid() const; + + bool operator==(const QScriptString &other) const; + bool operator!=(const QScriptString &other) const; + + quint32 toArrayIndex(bool *ok = 0) const; + + QString toString() const; + operator QString() const; + +private: + QExplicitlySharedDataPointer<QScriptStringPrivate> d_ptr; + friend class QScriptValue; + Q_DECLARE_PRIVATE(QScriptString) +}; + +Q_SCRIPT_EXPORT uint qHash(const QScriptString &key); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTSTRING_H diff --git a/qtinterface/qt4/Qt/qscriptvalue.h b/qtinterface/qt4/Qt/qscriptvalue.h new file mode 100644 index 0000000..954e145 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptvalue.h @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTVALUE_H +#define QSCRIPTVALUE_H + +#include <QtCore/qstring.h> + +#include <QtCore/qlist.h> +#include <QtCore/qsharedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QScriptClass; +class QScriptValue; +class QScriptEngine; +class QScriptString; +class QVariant; +class QObject; +struct QMetaObject; +class QDateTime; +#ifndef QT_NO_REGEXP +class QRegExp; +#endif + +typedef QList<QScriptValue> QScriptValueList; + +typedef double qsreal; + +class QScriptValuePrivate; +class QScriptEnginePrivate; +struct QScriptValuePrivatePointerDeleter; +class Q_SCRIPT_EXPORT QScriptValue +{ +public: + enum ResolveFlag { + ResolveLocal = 0x00, + ResolvePrototype = 0x01, + ResolveScope = 0x02, + ResolveFull = ResolvePrototype | ResolveScope + }; + + Q_DECLARE_FLAGS(ResolveFlags, ResolveFlag) + + enum PropertyFlag { + ReadOnly = 0x00000001, + Undeletable = 0x00000002, + SkipInEnumeration = 0x00000004, + + PropertyGetter = 0x00000008, + PropertySetter = 0x00000010, + + QObjectMember = 0x00000020, + + KeepExistingFlags = 0x00000800, + + UserRange = 0xff000000 // Users may use these as they see fit. + }; + Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag) + + enum SpecialValue { + NullValue, + UndefinedValue + }; + +public: + QScriptValue(); + ~QScriptValue(); + QScriptValue(const QScriptValue &other); + QScriptValue(QScriptEngine *engine, SpecialValue val); + QScriptValue(QScriptEngine *engine, bool val); + QScriptValue(QScriptEngine *engine, int val); + QScriptValue(QScriptEngine *engine, uint val); + QScriptValue(QScriptEngine *engine, qsreal val); + QScriptValue(QScriptEngine *engine, const QString &val); +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN_CONSTRUCTOR QScriptValue(QScriptEngine *engine, const char *val); +#endif + + QScriptValue(SpecialValue value); + QScriptValue(bool value); + QScriptValue(int value); + QScriptValue(uint value); + QScriptValue(qsreal value); + QScriptValue(const QString &value); + QScriptValue(const QLatin1String &value); +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN_CONSTRUCTOR QScriptValue(const char *value); +#endif + + QScriptValue &operator=(const QScriptValue &other); + + QScriptEngine *engine() const; + + bool isValid() const; + bool isBool() const; + bool isBoolean() const; + bool isNumber() const; + bool isFunction() const; + bool isNull() const; + bool isString() const; + bool isUndefined() const; + bool isVariant() const; + bool isQObject() const; + bool isQMetaObject() const; + bool isObject() const; + bool isDate() const; + bool isRegExp() const; + bool isArray() const; + bool isError() const; + + QString toString() const; + qsreal toNumber() const; + bool toBool() const; + bool toBoolean() const; + qsreal toInteger() const; + qint32 toInt32() const; + quint32 toUInt32() const; + quint16 toUInt16() const; + QVariant toVariant() const; + QObject *toQObject() const; + const QMetaObject *toQMetaObject() const; + QScriptValue toObject() const; + QDateTime toDateTime() const; +#ifndef QT_NO_REGEXP + QRegExp toRegExp() const; +#endif + + bool instanceOf(const QScriptValue &other) const; + + bool lessThan(const QScriptValue &other) const; + bool equals(const QScriptValue &other) const; + bool strictlyEquals(const QScriptValue &other) const; + + QScriptValue prototype() const; + void setPrototype(const QScriptValue &prototype); + + QScriptValue scope() const; + void setScope(const QScriptValue &scope); + + QScriptValue property(const QString &name, + const ResolveFlags &mode = ResolvePrototype) const; + void setProperty(const QString &name, const QScriptValue &value, + const PropertyFlags &flags = KeepExistingFlags); + + QScriptValue property(quint32 arrayIndex, + const ResolveFlags &mode = ResolvePrototype) const; + void setProperty(quint32 arrayIndex, const QScriptValue &value, + const PropertyFlags &flags = KeepExistingFlags); + + QScriptValue property(const QScriptString &name, + const ResolveFlags &mode = ResolvePrototype) const; + void setProperty(const QScriptString &name, const QScriptValue &value, + const PropertyFlags &flags = KeepExistingFlags); + + QScriptValue::PropertyFlags propertyFlags( + const QString &name, const ResolveFlags &mode = ResolvePrototype) const; + QScriptValue::PropertyFlags propertyFlags( + const QScriptString &name, const ResolveFlags &mode = ResolvePrototype) const; + + QScriptValue call(const QScriptValue &thisObject = QScriptValue(), + const QScriptValueList &args = QScriptValueList()); + QScriptValue call(const QScriptValue &thisObject, + const QScriptValue &arguments); + QScriptValue construct(const QScriptValueList &args = QScriptValueList()); + QScriptValue construct(const QScriptValue &arguments); + + QScriptValue data() const; + void setData(const QScriptValue &data); + + QScriptClass *scriptClass() const; + void setScriptClass(QScriptClass *scriptClass); + + qint64 objectId() const; + +private: + // force compile error, prevent QScriptValue(bool) to be called + QScriptValue(void *); + // force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called + QScriptValue(QScriptEngine *, void *); + + QScriptValue(QScriptValuePrivate*); + +private: + QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr; + + Q_DECLARE_PRIVATE(QScriptValue) + + friend class QScriptEnginePrivate; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptValue::ResolveFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptValue::PropertyFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qscriptvalueiterator.h b/qtinterface/qt4/Qt/qscriptvalueiterator.h new file mode 100644 index 0000000..3c4d111 --- /dev/null +++ b/qtinterface/qt4/Qt/qscriptvalueiterator.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtScript module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTVALUEITERATOR_H +#define QSCRIPTVALUEITERATOR_H + +#include <QtScript/qscriptvalue.h> + +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Script) + +class QString; +class QScriptString; + +class QScriptValueIteratorPrivate; +class Q_SCRIPT_EXPORT QScriptValueIterator +{ +public: + QScriptValueIterator(const QScriptValue &value); + ~QScriptValueIterator(); + + bool hasNext() const; + void next(); + + bool hasPrevious() const; + void previous(); + + QString name() const; + QScriptString scriptName() const; + + QScriptValue value() const; + void setValue(const QScriptValue &value); + + QScriptValue::PropertyFlags flags() const; + + void remove(); + + void toFront(); + void toBack(); + + QScriptValueIterator& operator=(QScriptValue &value); + +private: + QScopedPointer<QScriptValueIteratorPrivate> d_ptr; + + Q_DECLARE_PRIVATE(QScriptValueIterator) + Q_DISABLE_COPY(QScriptValueIterator) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCRIPTVALUEITERATOR_H diff --git a/qtinterface/qt4/Qt/qscrollarea.h b/qtinterface/qt4/Qt/qscrollarea.h new file mode 100644 index 0000000..3dd124d --- /dev/null +++ b/qtinterface/qt4/Qt/qscrollarea.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCROLLAREA_H +#define QSCROLLAREA_H + +#include <QtGui/qabstractscrollarea.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SCROLLAREA + +class QScrollAreaPrivate; + +class Q_GUI_EXPORT QScrollArea : public QAbstractScrollArea +{ + Q_OBJECT + Q_PROPERTY(bool widgetResizable READ widgetResizable WRITE setWidgetResizable) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + +public: + explicit QScrollArea(QWidget* parent=0); + ~QScrollArea(); + + QWidget *widget() const; + void setWidget(QWidget *widget); + QWidget *takeWidget(); + + bool widgetResizable() const; + void setWidgetResizable(bool resizable); + + QSize sizeHint() const; + bool focusNextPrevChild(bool next); + + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment); + + void ensureVisible(int x, int y, int xmargin = 50, int ymargin = 50); + void ensureWidgetVisible(QWidget *childWidget, int xmargin = 50, int ymargin = 50); + +protected: + QScrollArea(QScrollAreaPrivate &dd, QWidget *parent = 0); + bool event(QEvent *); + bool eventFilter(QObject *, QEvent *); + void resizeEvent(QResizeEvent *); + void scrollContentsBy(int dx, int dy); + +private: + Q_DECLARE_PRIVATE(QScrollArea) + Q_DISABLE_COPY(QScrollArea) +}; + +#endif // QT_NO_SCROLLAREA + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCROLLAREA_H diff --git a/qtinterface/qt4/Qt/qscrollbar.h b/qtinterface/qt4/Qt/qscrollbar.h new file mode 100644 index 0000000..84c01b7 --- /dev/null +++ b/qtinterface/qt4/Qt/qscrollbar.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCROLLBAR_H +#define QSCROLLBAR_H + +#include <QtGui/qwidget.h> +#include <QtGui/qabstractslider.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SCROLLBAR + +class QScrollBarPrivate; +class QStyleOptionSlider; + +class Q_GUI_EXPORT QScrollBar : public QAbstractSlider +{ + Q_OBJECT +public: + explicit QScrollBar(QWidget *parent=0); + explicit QScrollBar(Qt::Orientation, QWidget *parent=0); + ~QScrollBar(); + + QSize sizeHint() const; + bool event(QEvent *event); + +protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void hideEvent(QHideEvent*); + void sliderChange(SliderChange change); +#ifndef QT_NO_CONTEXTMENU + void contextMenuEvent(QContextMenuEvent *); +#endif + void initStyleOption(QStyleOptionSlider *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QScrollBar(QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QScrollBar(Qt::Orientation, QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QScrollBar(int minValue, int maxValue, int lineStep, int pageStep, + int value, Qt::Orientation, QWidget *parent=0, const char* name = 0); + inline QT3_SUPPORT bool draggingSlider() { return isSliderDown(); } +#endif + +private: + friend Q_GUI_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar); + + Q_DISABLE_COPY(QScrollBar) + Q_DECLARE_PRIVATE(QScrollBar) +}; + +#endif // QT_NO_SCROLLBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCROLLBAR_H diff --git a/qtinterface/qt4/Qt/qsemaphore.h b/qtinterface/qt4/Qt/qsemaphore.h new file mode 100644 index 0000000..01caa96 --- /dev/null +++ b/qtinterface/qt4/Qt/qsemaphore.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSEMAPHORE_H +#define QSEMAPHORE_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_THREAD + +class QSemaphorePrivate; + +class Q_CORE_EXPORT QSemaphore +{ +public: + explicit QSemaphore(int n = 0); + ~QSemaphore(); + + void acquire(int n = 1); + bool tryAcquire(int n = 1); + bool tryAcquire(int n, int timeout); + + void release(int n = 1); + + int available() const; + +private: + Q_DISABLE_COPY(QSemaphore) + + QSemaphorePrivate *d; +}; + +#endif // QT_NO_THREAD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSEMAPHORE_H diff --git a/qtinterface/qt4/Qt/qsequentialanimationgroup.h b/qtinterface/qt4/Qt/qsequentialanimationgroup.h new file mode 100644 index 0000000..f4c6128 --- /dev/null +++ b/qtinterface/qt4/Qt/qsequentialanimationgroup.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSEQUENTIALANIMATIONGROUP_H +#define QSEQUENTIALANIMATIONGROUP_H + +#include <QtCore/qanimationgroup.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QPauseAnimation; +class QSequentialAnimationGroupPrivate; + +class Q_CORE_EXPORT QSequentialAnimationGroup : public QAnimationGroup +{ + Q_OBJECT + Q_PROPERTY(QAbstractAnimation* currentAnimation READ currentAnimation NOTIFY currentAnimationChanged) + +public: + QSequentialAnimationGroup(QObject *parent = 0); + ~QSequentialAnimationGroup(); + + QPauseAnimation *addPause(int msecs); + QPauseAnimation *insertPause(int index, int msecs); + + QAbstractAnimation *currentAnimation() const; + int duration() const; + +Q_SIGNALS: + void currentAnimationChanged(QAbstractAnimation *current); + +protected: + QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent); + bool event(QEvent *event); + + void updateCurrentTime(int); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + void updateDirection(QAbstractAnimation::Direction direction); + +private: + Q_DISABLE_COPY(QSequentialAnimationGroup) + Q_DECLARE_PRIVATE(QSequentialAnimationGroup) + Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished()) +}; + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QSEQUENTIALANIMATIONGROUP_H diff --git a/qtinterface/qt4/Qt/qsessionmanager.h b/qtinterface/qt4/Qt/qsessionmanager.h new file mode 100644 index 0000000..7e45c29 --- /dev/null +++ b/qtinterface/qt4/Qt/qsessionmanager.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSESSIONMANAGER_H +#define QSESSIONMANAGER_H + +#include <QtCore/qobject.h> +#include <QtGui/qwindowdefs.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> + +#ifndef QT_NO_SESSIONMANAGER + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QSessionManagerPrivate; + +class Q_GUI_EXPORT QSessionManager : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSessionManager) + QSessionManager(QApplication *app, QString &id, QString &key); + ~QSessionManager(); +public: + QString sessionId() const; + QString sessionKey() const; +#if defined(Q_WS_X11) || defined(Q_WS_MAC) + void *handle() const; +#endif + + bool allowsInteraction(); + bool allowsErrorInteraction(); + void release(); + + void cancel(); + + enum RestartHint { + RestartIfRunning, + RestartAnyway, + RestartImmediately, + RestartNever + }; + void setRestartHint(RestartHint); + RestartHint restartHint() const; + + void setRestartCommand(const QStringList&); + QStringList restartCommand() const; + void setDiscardCommand(const QStringList&); + QStringList discardCommand() const; + + void setManagerProperty(const QString& name, const QString& value); + void setManagerProperty(const QString& name, const QStringList& value); + + bool isPhase2() const; + void requestPhase2(); + +private: + friend class QApplication; + friend class QApplicationPrivate; + friend class QBaseApplication; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SESSIONMANAGER + +#endif // QSESSIONMANAGER_H diff --git a/qtinterface/qt4/Qt/qset.h b/qtinterface/qt4/Qt/qset.h new file mode 100644 index 0000000..037d6de --- /dev/null +++ b/qtinterface/qt4/Qt/qset.h @@ -0,0 +1,366 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSET_H +#define QSET_H + +#include <QtCore/qhash.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class T> +class QSet +{ + typedef QHash<T, QHashDummyValue> Hash; + +public: + inline QSet() {} + inline QSet(const QSet<T> &other) : q_hash(other.q_hash) {} + + inline QSet<T> &operator=(const QSet<T> &other) + { q_hash = other.q_hash; return *this; } + + inline bool operator==(const QSet<T> &other) const + { return q_hash == other.q_hash; } + inline bool operator!=(const QSet<T> &other) const + { return q_hash != other.q_hash; } + + inline int size() const { return q_hash.size(); } + + inline bool isEmpty() const { return q_hash.isEmpty(); } + + inline int capacity() const { return q_hash.capacity(); } + inline void reserve(int size); + inline void squeeze() { q_hash.squeeze(); } + + inline void detach() { q_hash.detach(); } + inline bool isDetached() const { return q_hash.isDetached(); } + inline void setSharable(bool sharable) { q_hash.setSharable(sharable); } + + inline void clear() { q_hash.clear(); } + + inline bool remove(const T &value) { return q_hash.remove(value) != 0; } + + inline bool contains(const T &value) const { return q_hash.contains(value); } + + bool contains(const QSet<T> &set) const; + + class const_iterator; + + class iterator + { + typedef QHash<T, QHashDummyValue> Hash; + typename Hash::iterator i; + friend class const_iterator; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline iterator() {} + inline iterator(typename Hash::iterator o) : i(o) {} + inline iterator(const iterator &o) : i(o.i) {} + inline iterator &operator=(const iterator &o) { i = o.i; return *this; } + inline const T &operator*() const { return i.key(); } + inline const T *operator->() const { return &i.key(); } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator==(const const_iterator &o) const + { return i == o.i; } + inline bool operator!=(const const_iterator &o) const + { return i != o.i; } + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { iterator r = *this; ++i; return r; } + inline iterator &operator--() { --i; return *this; } + inline iterator operator--(int) { iterator r = *this; --i; return r; } + inline iterator operator+(int j) const { return i + j; } + inline iterator operator-(int j) const { return i - j; } + inline iterator &operator+=(int j) { i += j; return *this; } + inline iterator &operator-=(int j) { i -= j; return *this; } + }; + + class const_iterator + { + typedef QHash<T, QHashDummyValue> Hash; + typename Hash::const_iterator i; + friend class iterator; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() {} + inline const_iterator(typename Hash::const_iterator o) : i(o) {} + inline const_iterator(const const_iterator &o) : i(o.i) {} + inline const_iterator(const iterator &o) + : i(o.i) {} + inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; } + inline const T &operator*() const { return i.key(); } + inline const T *operator->() const { return &i.key(); } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator r = *this; ++i; return r; } + inline const_iterator &operator--() { --i; return *this; } + inline const_iterator operator--(int) { const_iterator r = *this; --i; return r; } + inline const_iterator operator+(int j) const { return i + j; } + inline const_iterator operator-(int j) const { return i - j; } + inline const_iterator &operator+=(int j) { i += j; return *this; } + inline const_iterator &operator-=(int j) { i -= j; return *this; } + }; + + // STL style + inline iterator begin() { return q_hash.begin(); } + inline const_iterator begin() const { return q_hash.begin(); } + inline const_iterator constBegin() const { return q_hash.constBegin(); } + inline iterator end() { return q_hash.end(); } + inline const_iterator end() const { return q_hash.end(); } + inline const_iterator constEnd() const { return q_hash.constEnd(); } + iterator erase(iterator i) + { return q_hash.erase(reinterpret_cast<typename Hash::iterator &>(i)); } + + // more Qt + 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())); } + 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); } + QSet<T> &unite(const QSet<T> &other); + QSet<T> &intersect(const QSet<T> &other); + QSet<T> &subtract(const QSet<T> &other); + + // STL compatibility + typedef T key_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef ptrdiff_t difference_type; + typedef int size_type; + + inline bool empty() const { return isEmpty(); } + + // comfort + inline QSet<T> &operator<<(const T &value) { insert(value); return *this; } + inline QSet<T> &operator|=(const QSet<T> &other) { unite(other); return *this; } + inline QSet<T> &operator|=(const T &value) { insert(value); return *this; } + inline QSet<T> &operator&=(const QSet<T> &other) { intersect(other); return *this; } + inline QSet<T> &operator&=(const T &value) + { QSet<T> result; if (contains(value)) result.insert(value); return (*this = result); } + inline QSet<T> &operator+=(const QSet<T> &other) { unite(other); return *this; } + inline QSet<T> &operator+=(const T &value) { insert(value); return *this; } + inline QSet<T> &operator-=(const QSet<T> &other) { subtract(other); return *this; } + inline QSet<T> &operator-=(const T &value) { remove(value); return *this; } + inline QSet<T> operator|(const QSet<T> &other) const + { 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; } + inline QSet<T> operator+(const QSet<T> &other) const + { 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(); } + + static QSet<T> fromList(const QList<T> &list); + +private: + Hash q_hash; +}; + +template <class T> +Q_INLINE_TEMPLATE void QSet<T>::reserve(int asize) { q_hash.reserve(asize); } + +template <class T> +Q_INLINE_TEMPLATE QSet<T> &QSet<T>::unite(const QSet<T> &other) +{ + QSet<T> copy(other); + typename QSet<T>::const_iterator i = copy.constEnd(); + while (i != copy.constBegin()) { + --i; + insert(*i); + } + return *this; +} + +template <class T> +Q_INLINE_TEMPLATE QSet<T> &QSet<T>::intersect(const QSet<T> &other) +{ + QSet<T> copy1(*this); + QSet<T> copy2(other); + typename QSet<T>::const_iterator i = copy1.constEnd(); + while (i != copy1.constBegin()) { + --i; + if (!copy2.contains(*i)) + remove(*i); + } + return *this; +} + +template <class T> +Q_INLINE_TEMPLATE QSet<T> &QSet<T>::subtract(const QSet<T> &other) +{ + QSet<T> copy1(*this); + QSet<T> copy2(other); + typename QSet<T>::const_iterator i = copy1.constEnd(); + while (i != copy1.constBegin()) { + --i; + if (copy2.contains(*i)) + remove(*i); + } + return *this; +} + +template <class T> +Q_INLINE_TEMPLATE bool QSet<T>::contains(const QSet<T> &other) const +{ + typename QSet<T>::const_iterator i = other.constBegin(); + while (i != other.constEnd()) { + if (!contains(*i)) + return false; + ++i; + } + return true; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QList<T> QSet<T>::toList() const +{ + QList<T> result; + typename QSet<T>::const_iterator i = constBegin(); + while (i != constEnd()) { + result.append(*i); + ++i; + } + return result; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QSet<T> QList<T>::toSet() const +{ + QSet<T> result; + result.reserve(size()); + for (int i = 0; i < size(); ++i) + result.insert(at(i)); + return result; +} + +template <typename T> +QSet<T> QSet<T>::fromList(const QList<T> &list) +{ + return list.toSet(); +} + +template <typename T> +QList<T> QList<T>::fromSet(const QSet<T> &set) +{ + return set.toList(); +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(Set) + +template <typename T> +class QMutableSetIterator +{ + typedef typename QSet<T>::iterator iterator; + QSet<T> *c; + iterator i, n; + inline bool item_exists() const { return n != c->constEnd(); } + +public: + inline QMutableSetIterator(QSet<T> &container) + : c(&container) + { c->setSharable(false); i = c->begin(); n = c->end(); } + inline ~QMutableSetIterator() + { c->setSharable(true); } + inline QMutableSetIterator &operator=(QSet<T> &container) + { c->setSharable(true); c = &container; c->setSharable(false); + i = c->begin(); n = c->end(); return *this; } + inline void toFront() { i = c->begin(); n = c->end(); } + inline void toBack() { i = c->end(); n = i; } + inline bool hasNext() const { return c->constEnd() != i; } + inline const T &next() { n = i++; return *n; } + inline const T &peekNext() const { return *i; } + inline bool hasPrevious() const { return c->constBegin() != i; } + inline const T &previous() { n = --i; return *n; } + inline const T &peekPrevious() const { iterator p = i; return *--p; } + inline void remove() + { if (c->constEnd() != n) { i = c->erase(n); n = c->end(); } } + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } + inline bool findNext(const T &t) + { while (c->constEnd() != (n = i)) if (*i++ == t) return true; return false; } + inline bool findPrevious(const T &t) + { while (c->constBegin() != i) if (*(n = --i) == t) return true; + n = c->end(); return false; } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSET_H diff --git a/qtinterface/qt4/Qt/qsettings.h b/qtinterface/qt4/Qt/qsettings.h new file mode 100644 index 0000000..de73940 --- /dev/null +++ b/qtinterface/qt4/Qt/qsettings.h @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSETTINGS_H +#define QSETTINGS_H + +#include <QtCore/qobject.h> +#include <QtCore/qvariant.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE +QT_MODULE(Core) +QT_END_NAMESPACE + +#ifndef QT_NO_SETTINGS + +#ifdef QT3_SUPPORT +#include <QtCore/qstringlist.h> +#endif + +#include <ctype.h> + +QT_BEGIN_NAMESPACE + +#ifdef Status // we seem to pick up a macro Status --> int somewhere +#undef Status +#endif + +class QIODevice; +class QSettingsPrivate; + +#ifndef QT_NO_QOBJECT +class Q_CORE_EXPORT QSettings : public QObject +#else +class Q_CORE_EXPORT QSettings +#endif +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#else + QScopedPointer<QSettingsPrivate> d_ptr; +#endif + Q_DECLARE_PRIVATE(QSettings) + +public: + enum Status { + NoError = 0, + AccessError, + FormatError + }; + + enum Format { + NativeFormat, + IniFormat, + + InvalidFormat = 16, + CustomFormat1, + CustomFormat2, + CustomFormat3, + CustomFormat4, + CustomFormat5, + CustomFormat6, + CustomFormat7, + CustomFormat8, + CustomFormat9, + CustomFormat10, + CustomFormat11, + CustomFormat12, + CustomFormat13, + CustomFormat14, + CustomFormat15, + CustomFormat16 + }; + + enum Scope { + UserScope, + SystemScope +#ifdef QT3_SUPPORT + , + User = UserScope, + Global = SystemScope +#endif + }; + +#ifndef QT_NO_QOBJECT + explicit QSettings(const QString &organization, + const QString &application = QString(), QObject *parent = 0); + QSettings(Scope scope, const QString &organization, + const QString &application = QString(), QObject *parent = 0); + QSettings(Format format, Scope scope, const QString &organization, + const QString &application = QString(), QObject *parent = 0); + QSettings(const QString &fileName, Format format, QObject *parent = 0); + explicit QSettings(QObject *parent = 0); +#else + explicit QSettings(const QString &organization, + const QString &application = QString()); + QSettings(Scope scope, const QString &organization, + const QString &application = QString()); + QSettings(Format format, Scope scope, const QString &organization, + const QString &application = QString()); + QSettings(const QString &fileName, Format format); +#endif + ~QSettings(); + + void clear(); + void sync(); + Status status() const; + + void beginGroup(const QString &prefix); + void endGroup(); + QString group() const; + + int beginReadArray(const QString &prefix); + void beginWriteArray(const QString &prefix, int size = -1); + void endArray(); + void setArrayIndex(int i); + + QStringList allKeys() const; + QStringList childKeys() const; + QStringList childGroups() const; + bool isWritable() const; + + void setValue(const QString &key, const QVariant &value); + QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; + + void remove(const QString &key); + bool contains(const QString &key) const; + + void setFallbacksEnabled(bool b); + bool fallbacksEnabled() const; + + QString fileName() const; + Format format() const; + Scope scope() const; + QString organizationName() const; + QString applicationName() const; + +#ifndef QT_NO_TEXTCODEC + void setIniCodec(QTextCodec *codec); + void setIniCodec(const char *codecName); + QTextCodec *iniCodec() const; +#endif + + static void setDefaultFormat(Format format); + static Format defaultFormat(); + static void setSystemIniPath(const QString &dir); // ### remove in 5.0 (use setPath() instead) + static void setUserIniPath(const QString &dir); // ### remove in 5.0 (use setPath() instead) + static void setPath(Format format, Scope scope, const QString &path); + + typedef QMap<QString, QVariant> SettingsMap; + typedef bool (*ReadFunc)(QIODevice &device, SettingsMap &map); + typedef bool (*WriteFunc)(QIODevice &device, const SettingsMap &map); + + static Format registerFormat(const QString &extension, ReadFunc readFunc, WriteFunc writeFunc, + Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool writeEntry(const QString &key, bool value) + { setValue(key, value); return isWritable(); } + inline QT3_SUPPORT bool writeEntry(const QString &key, double value) + { setValue(key, value); return isWritable(); } + inline QT3_SUPPORT bool writeEntry(const QString &key, int value) + { setValue(key, value); return isWritable(); } + inline QT3_SUPPORT bool writeEntry(const QString &key, const char *value) + { setValue(key, QString::fromAscii(value)); return isWritable(); } + inline QT3_SUPPORT bool writeEntry(const QString &key, const QString &value) + { setValue(key, value); return isWritable(); } + inline QT3_SUPPORT bool writeEntry(const QString &key, const QStringList &value) + { setValue(key, value); return isWritable(); } + inline QT3_SUPPORT bool writeEntry(const QString &key, const QStringList &value, QChar separator) + { setValue(key, value.join(QString(separator))); return isWritable(); } + inline QT3_SUPPORT QStringList readListEntry(const QString &key, bool *ok = 0) + { + if (ok) + *ok = contains(key); + return value(key).toStringList(); + } + inline QT3_SUPPORT QStringList readListEntry(const QString &key, QChar separator, bool *ok = 0) + { + if (ok) + *ok = contains(key); + QString str = value(key).toString(); + if (str.isEmpty()) + return QStringList(); + return str.split(separator); + } + inline QT3_SUPPORT QString readEntry(const QString &key, const QString &defaultValue = QString(), + bool *ok = 0) + { + if (ok) + *ok = contains(key); + return value(key, defaultValue).toString(); + } + inline QT3_SUPPORT int readNumEntry(const QString &key, int defaultValue = 0, bool *ok = 0) + { + if (ok) + *ok = contains(key); + return value(key, defaultValue).toInt(); + } + inline QT3_SUPPORT double readDoubleEntry(const QString &key, double defaultValue = 0, + bool *ok = 0) + { + if (ok) + *ok = contains(key); + return value(key, defaultValue).toDouble(); + } + inline QT3_SUPPORT bool readBoolEntry(const QString &key, bool defaultValue = false, + bool *ok = 0) + { + if (ok) + *ok = contains(key); + return value(key, defaultValue).toBool(); + } + inline QT3_SUPPORT bool removeEntry(const QString &key) + { remove(key); return true; } + + enum System { Unix, Windows, Mac }; + inline QT3_SUPPORT void insertSearchPath(System, const QString &) {} + inline QT3_SUPPORT void removeSearchPath(System, const QString &) {} + + inline QT3_SUPPORT void setPath(const QString &organization, const QString &application, + Scope scope = Global) + { + setPath_helper(scope == Global ? QSettings::SystemScope : QSettings::UserScope, + organization, application); + } + inline QT3_SUPPORT void resetGroup() + { + while (!group().isEmpty()) + endGroup(); + } + inline QT3_SUPPORT QStringList entryList(const QString &key) const + { + QSettings *that = const_cast<QSettings *>(this); + QStringList result; + + that->beginGroup(key); + result = that->childKeys(); + that->endGroup(); + return result; + } + inline QT3_SUPPORT QStringList subkeyList(const QString &key) const + { + QSettings *that = const_cast<QSettings *>(this); + QStringList result; + + that->beginGroup(key); + result = that->childGroups(); + that->endGroup(); + return result; + } +#endif + +protected: +#ifndef QT_NO_QOBJECT + bool event(QEvent *event); +#endif + +private: +#ifdef QT3_SUPPORT + void setPath_helper(Scope scope, const QString &organization, const QString &application); +#endif + + Q_DISABLE_COPY(QSettings) +}; + +QT_END_NAMESPACE + +#endif // QT_NO_SETTINGS + +QT_END_HEADER + +#endif // QSETTINGS_H diff --git a/qtinterface/qt4/Qt/qshareddata.h b/qtinterface/qt4/Qt/qshareddata.h new file mode 100644 index 0000000..5a1d522 --- /dev/null +++ b/qtinterface/qt4/Qt/qshareddata.h @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSHAREDDATA_H +#define QSHAREDDATA_H + +#include <QtCore/qglobal.h> +#include <QtCore/qatomic.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <class T> class QSharedDataPointer; + +class Q_CORE_EXPORT QSharedData +{ +public: + mutable QAtomicInt ref; + + inline QSharedData() : ref(0) { } + inline QSharedData(const QSharedData &) : ref(0) { } + +private: + // using the assignment operator would lead to corruption in the ref-counting + QSharedData &operator=(const QSharedData &); +}; + +template <class T> class QSharedDataPointer +{ +public: + typedef T Type; + typedef T *pointer; + + inline void detach() { if (d && d->ref != 1) detach_helper(); } + inline T &operator*() { detach(); return *d; } + inline const T &operator*() const { return *d; } + inline T *operator->() { detach(); return d; } + inline const T *operator->() const { return d; } + inline operator T *() { detach(); return d; } + inline operator const T *() const { return d; } + inline T *data() { detach(); return d; } + inline const T *data() const { return d; } + inline const T *constData() const { return d; } + + inline bool operator==(const QSharedDataPointer<T> &other) const { return d == other.d; } + inline bool operator!=(const QSharedDataPointer<T> &other) const { return d != other.d; } + + inline QSharedDataPointer() { d = 0; } + inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } + + explicit QSharedDataPointer(T *data); + inline QSharedDataPointer(const QSharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); } + inline QSharedDataPointer<T> & operator=(const QSharedDataPointer<T> &o) { + if (o.d != d) { + if (o.d) + o.d->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = o.d; + } + return *this; + } + inline QSharedDataPointer &operator=(T *o) { + if (o != d) { + if (o) + o->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = o; + } + return *this; + } + + inline bool operator!() const { return !d; } + + inline void swap(QSharedDataPointer &other) + { qSwap(d, other.d); } + +protected: + T *clone(); + +private: + void detach_helper(); + + T *d; +}; + +template <class T> class QExplicitlySharedDataPointer +{ +public: + typedef T Type; + typedef T *pointer; + + inline T &operator*() const { return *d; } + inline T *operator->() { return d; } + inline T *operator->() const { return d; } + inline T *data() const { return d; } + inline const T *constData() const { return d; } + + inline void detach() { if (d && d->ref != 1) detach_helper(); } + + inline void reset() + { + if(d && !d->ref.deref()) + delete d; + + d = 0; + } + + inline operator bool () const { return d != 0; } + + inline bool operator==(const QExplicitlySharedDataPointer<T> &other) const { return d == other.d; } + inline bool operator!=(const QExplicitlySharedDataPointer<T> &other) const { return d != other.d; } + inline bool operator==(const T *ptr) const { return d == ptr; } + inline bool operator!=(const T *ptr) const { return d != ptr; } + + inline QExplicitlySharedDataPointer() { d = 0; } + inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } + + explicit QExplicitlySharedDataPointer(T *data); + inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); } + +#ifndef QT_NO_MEMBER_TEMPLATES + template<class X> + inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<X> &o) : d(static_cast<T *>(o.data())) + { + if(d) + d->ref.ref(); + } +#endif + + inline QExplicitlySharedDataPointer<T> & operator=(const QExplicitlySharedDataPointer<T> &o) { + if (o.d != d) { + if (o.d) + o.d->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = o.d; + } + return *this; + } + inline QExplicitlySharedDataPointer &operator=(T *o) { + if (o != d) { + if (o) + o->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = o; + } + return *this; + } + + inline bool operator!() const { return !d; } + + inline void swap(QExplicitlySharedDataPointer &other) + { qSwap(d, other.d); } + +protected: + T *clone(); + +private: + void detach_helper(); + + T *d; +}; + +template <class T> +Q_INLINE_TEMPLATE QSharedDataPointer<T>::QSharedDataPointer(T *adata) : d(adata) +{ if (d) d->ref.ref(); } + +template <class T> +Q_INLINE_TEMPLATE T *QSharedDataPointer<T>::clone() +{ + return new T(*d); +} + +template <class T> +Q_OUTOFLINE_TEMPLATE void QSharedDataPointer<T>::detach_helper() +{ + T *x = clone(); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; +} + +template <class T> +Q_INLINE_TEMPLATE T *QExplicitlySharedDataPointer<T>::clone() +{ + return new T(*d); +} + +template <class T> +Q_OUTOFLINE_TEMPLATE void QExplicitlySharedDataPointer<T>::detach_helper() +{ + T *x = clone(); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; +} + +template <class T> +Q_INLINE_TEMPLATE QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(T *adata) : d(adata) +{ if (d) d->ref.ref(); } + +template <class T> +Q_INLINE_TEMPLATE void qSwap(QSharedDataPointer<T> &p1, QSharedDataPointer<T> &p2) +{ p1.swap(p2); } + +template <class T> +Q_INLINE_TEMPLATE void qSwap(QExplicitlySharedDataPointer<T> &p1, QExplicitlySharedDataPointer<T> &p2) +{ p1.swap(p2); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSHAREDDATA_H diff --git a/qtinterface/qt4/Qt/qsharedmemory.h b/qtinterface/qt4/Qt/qsharedmemory.h new file mode 100644 index 0000000..7430154 --- /dev/null +++ b/qtinterface/qt4/Qt/qsharedmemory.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSHAREDMEMORY_H +#define QSHAREDMEMORY_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_SHAREDMEMORY + +class QSharedMemoryPrivate; + +class Q_CORE_EXPORT QSharedMemory : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSharedMemory) + +public: + enum AccessMode + { + ReadOnly, + ReadWrite + }; + + enum SharedMemoryError + { + NoError, + PermissionDenied, + InvalidSize, + KeyError, + AlreadyExists, + NotFound, + LockError, + OutOfResources, + UnknownError + }; + + QSharedMemory(QObject *parent = 0); + QSharedMemory(const QString &key, QObject *parent = 0); + ~QSharedMemory(); + + void setKey(const QString &key); + QString key() const; + + bool create(int size, AccessMode mode = ReadWrite); + int size() const; + + bool attach(AccessMode mode = ReadWrite); + bool isAttached() const; + bool detach(); + + void *data(); + const void* constData() const; + const void *data() const; + +#ifndef QT_NO_SYSTEMSEMAPHORE + bool lock(); + bool unlock(); +#endif + + SharedMemoryError error() const; + QString errorString() const; + +private: + Q_DISABLE_COPY(QSharedMemory) +}; + +#endif // QT_NO_SHAREDMEMORY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSHAREDMEMORY_H + diff --git a/qtinterface/qt4/Qt/qsharedpointer.h b/qtinterface/qt4/Qt/qsharedpointer.h new file mode 100644 index 0000000..9d2312a --- /dev/null +++ b/qtinterface/qt4/Qt/qsharedpointer.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSHAREDPOINTER_H +#define QSHAREDPOINTER_H + +#include <QtCore/qglobal.h> +#include <QtCore/qatomic.h> +#include <QtCore/qshareddata.h> + +#ifndef Q_QDOC +# if !defined(QT_NO_MEMBER_TEMPLATES) +// QSharedPointer requires member template support +# include <QtCore/qsharedpointer_impl.h> +# endif +#else + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// These classes are here to fool qdoc into generating a better documentation + +template <class T> +class QSharedPointer +{ +public: + // basic accessor functions + T *data() const; + bool isNull() const; + operator bool() const; + bool operator!() const; + T &operator*() const; + T *operator ->() const; + + // constructors + QSharedPointer(); + explicit QSharedPointer(T *ptr); + QSharedPointer(T *ptr, Deleter d); + QSharedPointer(const QSharedPointer<T> &other); + QSharedPointer(const QWeakPointer<T> &other); + + ~QSharedPointer() { } + + QSharedPointer<T> &operator=(const QSharedPointer<T> &other); + QSharedPointer<T> &operator=(const QWeakPointer<T> &other); + + QWeakPointer<T> toWeakRef() const; + + void clear(); + + // casts: + template <class X> QSharedPointer<X> staticCast() const; + template <class X> QSharedPointer<X> dynamicCast() const; + template <class X> QSharedPointer<X> constCast() const; + template <class X> QSharedPointer<X> objectCast() const; +}; + +template <class T> +class QWeakPointer +{ +public: + // basic accessor functions + bool isNull() const; + operator bool() const; + bool operator!() const; + + // constructors: + QWeakPointer(); + QWeakPointer(const QWeakPointer<T> &other); + QWeakPointer(const QSharedPointer<T> &other); + + ~QWeakPointer(); + + QWeakPointer<T> operator=(const QWeakPointer<T> &other); + QWeakPointer<T> operator=(const QSharedPointer<T> &other); + + QWeakPointer(const QObject *other); + QWeakPointer<T> operator=(const QObject *other); + + T *data() const; + void clear(); + + QSharedPointer<T> toStrongRef() const; +}; + +template<class T, class X> bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2); +template<class T, class X> bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2); +template<class T, class X> bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2); +template<class T, class X> bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2); +template<class T, class X> bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2); +template<class T, class X> bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2); +template<class T, class X> bool operator==(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2); +template<class T, class X> bool operator!=(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2); +template<class T, class X> bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2); +template<class T, class X> bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2); + +template <class X, class T> QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &other); +template <class X, class T> QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &other); +template <class X, class T> QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src); +template <class X, class T> QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer<T> &src); +template <class X, class T> QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &src); +template <class X, class T> QSharedPointer<X> qSharedPointerConstCast(const QWeakPointer<T> &src); +template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src); +template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &src); + +template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_QDOC + +#endif // QSHAREDPOINTER_H diff --git a/qtinterface/qt4/Qt/qsharedpointer_impl.h b/qtinterface/qt4/Qt/qsharedpointer_impl.h new file mode 100644 index 0000000..e25e0c1 --- /dev/null +++ b/qtinterface/qt4/Qt/qsharedpointer_impl.h @@ -0,0 +1,805 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q_QDOC + +#ifndef QSHAREDPOINTER_H +#error Do not include qsharedpointer_impl.h directly +#endif +#if 0 +#pragma qt_sync_stop_processing +#endif + +#include <new> +#include <QtCore/qatomic.h> +#include <QtCore/qobject.h> // for qobject_cast + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// Macro QSHAREDPOINTER_VERIFY_AUTO_CAST +// generates a compiler error if the following construct isn't valid: +// T *ptr1; +// X *ptr2 = ptr1; +// +#ifdef QT_NO_DEBUG +# define QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X) qt_noop() +#else + +template<typename T> inline void qt_sharedpointer_cast_check(T *) { } +# define QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X) \ + qt_sharedpointer_cast_check<T>(static_cast<X *>(0)) +#endif + +// +// forward declarations +// +template <class T> class QWeakPointer; +template <class T> class QSharedPointer; + +template <class X, class T> +QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &ptr); +template <class X, class T> +QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &ptr); +template <class X, class T> +QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &ptr); + +#ifndef QT_NO_QOBJECT +template <class X, class T> +QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &ptr); +#endif + +namespace QtSharedPointer { + template <class T> class InternalRefCount; + template <class T> class ExternalRefCount; + + template <class X, class Y> QSharedPointer<X> copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src); + + // used in debug mode to verify the reuse of pointers + Q_CORE_EXPORT void internalSafetyCheckAdd2(const void *, const volatile void *); + Q_CORE_EXPORT void internalSafetyCheckRemove2(const void *); + + template <class T, typename Klass, typename RetVal> + inline void executeDeleter(T *t, RetVal (Klass:: *memberDeleter)()) + { (t->*memberDeleter)(); } + template <class T, typename Deleter> + inline void executeDeleter(T *t, Deleter d) + { d(t); } + template <class T> inline void normalDeleter(T *t) { delete t; } + + // this uses partial template specialization + // the only compilers that didn't support this were MSVC 6.0 and 2002 + template <class T> struct RemovePointer; + template <class T> struct RemovePointer<T *> { typedef T Type; }; + template <class T> struct RemovePointer<QSharedPointer<T> > { typedef T Type; }; + template <class T> struct RemovePointer<QWeakPointer<T> > { typedef T Type; }; + + // This class provides the basic functionality of a pointer wrapper. + // Its existence is mostly legacy, since originally QSharedPointer + // could also be used for internally-refcounted objects. + template <class T> + class Basic + { +#ifndef Q_CC_NOKIAX86 + typedef T *Basic:: *RestrictedBool; +#endif + public: + typedef T Type; + typedef T element_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef ptrdiff_t difference_type; + + inline T *data() const { return value; } + inline bool isNull() const { return !data(); } +#ifndef Q_CC_NOKIAX86 + inline operator RestrictedBool() const { return isNull() ? 0 : &Basic::value; } +#else + inline operator bool() const { return isNull() ? 0 : &Basic::value; } +#endif + inline bool operator !() const { return isNull(); } + inline T &operator*() const { return *data(); } + inline T *operator->() const { return data(); } + + protected: + inline Basic(T *ptr = 0) : value(ptr) { } + inline Basic(Qt::Initialization) { } + // ~Basic(); + + inline void internalConstruct(T *ptr) + { + value = ptr; + } + +#if defined(Q_NO_TEMPLATE_FRIENDS) + public: +#else + template <class X> friend class QWeakPointer; +#endif + + Type *value; + }; + + // This class is the d-pointer of QSharedPointer and QWeakPointer. + // + // It is a reference-counted reference counter. "strongref" is the inner + // reference counter, and it tracks the lifetime of the pointer itself. + // "weakref" is the outer reference counter and it tracks the lifetime of + // the ExternalRefCountData object. + struct ExternalRefCountData + { + QBasicAtomicInt weakref; + QBasicAtomicInt strongref; + + inline ExternalRefCountData() + { + strongref = 1; + weakref = 1; + } + inline ExternalRefCountData(Qt::Initialization) { } + virtual inline ~ExternalRefCountData() { Q_ASSERT(!weakref); Q_ASSERT(strongref <= 0); } + + // overridden by derived classes + // returns false to indicate caller should delete the pointer + // returns true in case it has already done so + virtual inline bool destroy() { return false; } + +#ifndef QT_NO_QOBJECT + Q_CORE_EXPORT static ExternalRefCountData *getAndRef(const QObject *); + Q_CORE_EXPORT void setQObjectShared(const QObject *, bool enable); +#endif + inline void setQObjectShared(...) { } + }; + // sizeof(ExternalRefCount) = 12 (32-bit) / 16 (64-bit) + + // This class extends ExternalRefCountData with a pointer + // to a function, which is called by the destroy() function. + struct ExternalRefCountWithDestroyFn: public ExternalRefCountData + { + typedef void (*DestroyerFn)(ExternalRefCountData *); + DestroyerFn destroyer; + + inline ExternalRefCountWithDestroyFn(DestroyerFn d) + : destroyer(d) + { } + + inline bool destroy() { destroyer(this); return true; } + inline void operator delete(void *ptr) { ::operator delete(ptr); } + }; + // sizeof(ExternalRefCountWithDestroyFn) = 16 (32-bit) / 24 (64-bit) + + // This class extends ExternalRefCountWithDestroyFn and implements + // the static function that deletes the object. The pointer and the + // custom deleter are kept in the "extra" member. + template <class T, typename Deleter> + struct ExternalRefCountWithCustomDeleter: public ExternalRefCountWithDestroyFn + { + typedef ExternalRefCountWithCustomDeleter Self; + typedef ExternalRefCountWithDestroyFn BaseClass; + + struct CustomDeleter + { + Deleter deleter; + T *ptr; + + inline CustomDeleter(T *p, Deleter d) : deleter(d), ptr(p) {} + }; + CustomDeleter extra; + // sizeof(CustomDeleter) = sizeof(Deleter) + sizeof(void*) + // for Deleter = function pointer: 8 (32-bit) / 16 (64-bit) + // for Deleter = PMF: 12 (32-bit) / 24 (64-bit) (GCC) + + static inline void deleter(ExternalRefCountData *self) + { + Self *realself = static_cast<Self *>(self); + executeDeleter(realself->extra.ptr, realself->extra.deleter); + + // delete the deleter too + realself->extra.~CustomDeleter(); + } + static void safetyCheckDeleter(ExternalRefCountData *self) + { + internalSafetyCheckRemove2(self); + deleter(self); + } + + static inline Self *create(T *ptr, Deleter userDeleter) + { +# ifdef QT_SHAREDPOINTER_TRACK_POINTERS + DestroyerFn destroy = &safetyCheckDeleter; +# else + DestroyerFn destroy = &deleter; +# endif + Self *d = static_cast<Self *>(::operator new(sizeof(Self))); + + // initialize the two sub-objects + new (&d->extra) CustomDeleter(ptr, userDeleter); + new (d) BaseClass(destroy); // can't throw + + return d; + } + private: + // prevent construction and the emission of virtual symbols + ExternalRefCountWithCustomDeleter(); + ~ExternalRefCountWithCustomDeleter(); + }; + + // This class extends ExternalRefCountWithDestroyFn and adds a "T" + // member. That way, when the create() function is called, we allocate + // memory for both QSharedPointer's d-pointer and the actual object being + // tracked. + template <class T> + struct ExternalRefCountWithContiguousData: public ExternalRefCountWithDestroyFn + { + typedef ExternalRefCountWithDestroyFn Parent; + T data; + + static void deleter(ExternalRefCountData *self) + { + ExternalRefCountWithContiguousData *that = + static_cast<ExternalRefCountWithContiguousData *>(self); + that->data.~T(); + } + static void safetyCheckDeleter(ExternalRefCountData *self) + { + internalSafetyCheckRemove2(self); + deleter(self); + } + + static inline ExternalRefCountData *create(T **ptr) + { +# ifdef QT_SHAREDPOINTER_TRACK_POINTERS + DestroyerFn destroy = &safetyCheckDeleter; +# else + DestroyerFn destroy = &deleter; +# endif + ExternalRefCountWithContiguousData *d = + static_cast<ExternalRefCountWithContiguousData *>(::operator new(sizeof(ExternalRefCountWithContiguousData))); + + // initialize the d-pointer sub-object + // leave d->data uninitialized + new (d) Parent(destroy); // can't throw + + *ptr = &d->data; + return d; + } + + private: + // prevent construction and the emission of virtual symbols + ExternalRefCountWithContiguousData(); + ~ExternalRefCountWithContiguousData(); + }; + + // This is the main body of QSharedPointer. It implements the + // external reference counting functionality. + template <class T> + class ExternalRefCount: public Basic<T> + { + protected: + typedef ExternalRefCountData Data; + + inline void ref() const { d->weakref.ref(); d->strongref.ref(); } + inline bool deref() + { + if (!d->strongref.deref()) { + internalDestroy(); + } + return d->weakref.deref(); + } + + inline void internalConstruct(T *ptr) + { +#ifdef QT_SHAREDPOINTER_TRACK_POINTERS + internalConstruct<void (*)(T *)>(ptr, normalDeleter); +#else + if (ptr) + d = new Data; + else + d = 0; + internalFinishConstruction(ptr); +#endif + } + + template <typename Deleter> + inline void internalConstruct(T *ptr, Deleter deleter) + { + if (ptr) + d = ExternalRefCountWithCustomDeleter<T, Deleter>::create(ptr, deleter); + else + d = 0; + internalFinishConstruction(ptr); + } + + inline void internalCreate() + { + T *ptr; + d = ExternalRefCountWithContiguousData<T>::create(&ptr); + Basic<T>::internalConstruct(ptr); + } + + inline void internalFinishConstruction(T *ptr) + { + Basic<T>::internalConstruct(ptr); + if (ptr) d->setQObjectShared(ptr, true); +#ifdef QT_SHAREDPOINTER_TRACK_POINTERS + if (ptr) internalSafetyCheckAdd2(d, ptr); +#endif + } + + inline ExternalRefCount() : d(0) { } + inline ExternalRefCount(Qt::Initialization i) : Basic<T>(i) { } + inline ExternalRefCount(const ExternalRefCount<T> &other) : Basic<T>(other), d(other.d) + { if (d) ref(); } + template <class X> + inline ExternalRefCount(const ExternalRefCount<X> &other) : Basic<T>(other.value), d(other.d) + { if (d) ref(); } + inline ~ExternalRefCount() { if (d && !deref()) delete d; } + + template <class X> + inline void internalCopy(const ExternalRefCount<X> &other) + { + internalSet(other.d, other.data()); + } + + inline void internalDestroy() + { + if (!d->destroy()) + delete this->value; + } + + inline void internalSwap(ExternalRefCount &other) + { + qSwap(d, other.d); + qSwap(this->value, other.value); + } + +#if defined(Q_NO_TEMPLATE_FRIENDS) + public: +#else + template <class X> friend class ExternalRefCount; + template <class X> friend class QWeakPointer; + template <class X, class Y> friend QSharedPointer<X> copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src); +#endif + + inline void internalSet(Data *o, T *actual) + { + if (o) { + // increase the strongref, but never up from zero + // or less (-1 is used by QWeakPointer on untracked QObject) + register int tmp = o->strongref; + while (tmp > 0) { + // try to increment from "tmp" to "tmp + 1" + if (o->strongref.testAndSetRelaxed(tmp, tmp + 1)) + break; // succeeded + tmp = o->strongref; // failed, try again + } + + if (tmp > 0) + o->weakref.ref(); + else + o = 0; + } + if (d && !deref()) + delete d; + d = o; + this->value = d && d->strongref ? actual : 0; + } + + Data *d; + + private: + template<class X> ExternalRefCount(const InternalRefCount<X> &); + }; +} // namespace QtSharedPointer + +template <class T> +class QSharedPointer: public QtSharedPointer::ExternalRefCount<T> +{ + typedef typename QtSharedPointer::ExternalRefCount<T> BaseClass; +public: + inline QSharedPointer() { } + // inline ~QSharedPointer() { } + + inline explicit QSharedPointer(T *ptr) : BaseClass(Qt::Uninitialized) + { BaseClass::internalConstruct(ptr); } + + template <typename Deleter> + inline QSharedPointer(T *ptr, Deleter d) { BaseClass::internalConstruct(ptr, d); } + + inline QSharedPointer(const QSharedPointer<T> &other) : BaseClass(other) { } + inline QSharedPointer<T> &operator=(const QSharedPointer<T> &other) + { + BaseClass::internalCopy(other); + return *this; + } + + template <class X> + inline QSharedPointer(const QSharedPointer<X> &other) : BaseClass(other) + { } + + template <class X> + inline QSharedPointer<T> &operator=(const QSharedPointer<X> &other) + { + QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid + BaseClass::internalCopy(other); + return *this; + } + + template <class X> + inline QSharedPointer(const QWeakPointer<X> &other) : BaseClass(Qt::Uninitialized) + { this->d = 0; *this = other; } + + template <class X> + inline QSharedPointer<T> &operator=(const QWeakPointer<X> &other) + { BaseClass::internalSet(other.d, other.value); return *this; } + + inline void swap(QSharedPointer &other) + { QSharedPointer<T>::internalSwap(other); } + + template <class X> + QSharedPointer<X> staticCast() const + { + return qSharedPointerCast<X, T>(*this); + } + + template <class X> + QSharedPointer<X> dynamicCast() const + { + return qSharedPointerDynamicCast<X, T>(*this); + } + + template <class X> + QSharedPointer<X> constCast() const + { + return qSharedPointerConstCast<X, T>(*this); + } + +#ifndef QT_NO_QOBJECT + template <class X> + QSharedPointer<X> objectCast() const + { + return qSharedPointerObjectCast<X, T>(*this); + } +#endif + + inline void clear() { *this = QSharedPointer<T>(); } + + QWeakPointer<T> toWeakRef() const; + +protected: + inline explicit QSharedPointer(Qt::Initialization i) : BaseClass(i) {} + +public: + static inline QSharedPointer<T> create() + { + QSharedPointer<T> result(Qt::Uninitialized); + result.internalCreate(); + + // now initialize the data + new (result.data()) T(); + result.internalFinishConstruction(result.data()); + return result; + } +}; + +template <class T> +class QWeakPointer +{ +#ifndef Q_CC_NOKIAX86 + typedef T *QWeakPointer:: *RestrictedBool; +#endif + typedef QtSharedPointer::ExternalRefCountData Data; + +public: + typedef T element_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef ptrdiff_t difference_type; + + inline bool isNull() const { return d == 0 || d->strongref == 0 || value == 0; } +#ifndef Q_CC_NOKIAX86 + inline operator RestrictedBool() const { return isNull() ? 0 : &QWeakPointer::value; } +#else + inline operator bool() const { return isNull() ? 0 : &QWeakPointer::value; } +#endif + inline bool operator !() const { return isNull(); } + inline T *data() const { return d == 0 || d->strongref == 0 ? 0 : value; } + + inline QWeakPointer() : d(0), value(0) { } + inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } + +#ifndef QT_NO_QOBJECT + // special constructor that is enabled only if X derives from QObject + template <class X> + inline QWeakPointer(X *ptr) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr) + { } +#endif + template <class X> + inline QWeakPointer &operator=(X *ptr) + { return *this = QWeakPointer(ptr); } + + inline QWeakPointer(const QWeakPointer<T> &o) : d(o.d), value(o.value) + { if (d) d->weakref.ref(); } + inline QWeakPointer<T> &operator=(const QWeakPointer<T> &o) + { + internalSet(o.d, o.value); + return *this; + } + + inline QWeakPointer(const QSharedPointer<T> &o) : d(o.d), value(o.data()) + { if (d) d->weakref.ref();} + inline QWeakPointer<T> &operator=(const QSharedPointer<T> &o) + { + internalSet(o.d, o.value); + return *this; + } + + template <class X> + inline QWeakPointer(const QWeakPointer<X> &o) : d(0), value(0) + { *this = o; } + + template <class X> + inline QWeakPointer<T> &operator=(const QWeakPointer<X> &o) + { + // conversion between X and T could require access to the virtual table + // so force the operation to go through QSharedPointer + *this = o.toStrongRef(); + return *this; + } + + template <class X> + inline bool operator==(const QWeakPointer<X> &o) const + { return d == o.d && value == static_cast<const T *>(o.value); } + + template <class X> + inline bool operator!=(const QWeakPointer<X> &o) const + { return !(*this == o); } + + template <class X> + inline QWeakPointer(const QSharedPointer<X> &o) : d(0), value(0) + { *this = o; } + + template <class X> + inline QWeakPointer<T> &operator=(const QSharedPointer<X> &o) + { + QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid + internalSet(o.d, o.data()); + return *this; + } + + template <class X> + inline bool operator==(const QSharedPointer<X> &o) const + { return d == o.d; } + + template <class X> + inline bool operator!=(const QSharedPointer<X> &o) const + { return !(*this == o); } + + inline void clear() { *this = QWeakPointer<T>(); } + + inline QSharedPointer<T> toStrongRef() const { return QSharedPointer<T>(*this); } + +#if defined(QWEAKPOINTER_ENABLE_ARROW) + inline T *operator->() const { return data(); } +#endif + +private: + +#if defined(Q_NO_TEMPLATE_FRIENDS) +public: +#else + template <class X> friend class QSharedPointer; +#endif + + inline void internalSet(Data *o, T *actual) + { + if (d == o) return; + if (o) + o->weakref.ref(); + if (d && !d->weakref.deref()) + delete d; + d = o; + value = actual; + } + + Data *d; + T *value; +}; + +template <class T, class X> +bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) +{ + return ptr1.data() == ptr2.data(); +} +template <class T, class X> +bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) +{ + return ptr1.data() != ptr2.data(); +} + +template <class T, class X> +bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2) +{ + return ptr1.data() == ptr2; +} +template <class T, class X> +bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2) +{ + return ptr1 == ptr2.data(); +} + +template <class T, class X> +bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2) +{ + return !(ptr1 == ptr2); +} +template <class T, class X> +bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2) +{ + return !(ptr2 == ptr1); +} + +template <class T, class X> +bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) +{ + return ptr2 == ptr1; +} +template <class T, class X> +bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) +{ + return ptr2 != ptr1; +} + +template <class T, class X> +Q_INLINE_TEMPLATE typename T::difference_type operator-(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) +{ + return ptr1.data() - ptr2.data(); +} + +template <class T> +Q_INLINE_TEMPLATE QWeakPointer<T> QSharedPointer<T>::toWeakRef() const +{ + return QWeakPointer<T>(*this); +} + +template <class T> +inline void qSwap(QSharedPointer<T> &p1, QSharedPointer<T> &p2) +{ + p1.swap(p2); +} + +namespace QtSharedPointer { +// helper functions: + template <class X, class T> + Q_INLINE_TEMPLATE QSharedPointer<X> copyAndSetPointer(X *ptr, const QSharedPointer<T> &src) + { + QSharedPointer<X> result; + result.internalSet(src.d, ptr); + return result; + } +} + +// cast operators +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &src) +{ + register X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &src) +{ + return qSharedPointerCast<X, T>(src.toStrongRef()); +} + +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src) +{ + register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer<T> &src) +{ + return qSharedPointerDynamicCast<X, T>(src.toStrongRef()); +} + +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &src) +{ + register X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast(const QWeakPointer<T> &src) +{ + return qSharedPointerConstCast<X, T>(src.toStrongRef()); +} + +template <class X, class T> +Q_INLINE_TEMPLATE +QWeakPointer<X> qWeakPointerCast(const QSharedPointer<T> &src) +{ + return qSharedPointerCast<X, T>(src).toWeakRef(); +} + +#ifndef QT_NO_QOBJECT +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src) +{ + register X *ptr = qobject_cast<X *>(src.data()); + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template <class X, class T> +Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &src) +{ + return qSharedPointerObjectCast<X>(src.toStrongRef()); +} + +template <class X, class T> +inline QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type> +qobject_cast(const QSharedPointer<T> &src) +{ + return qSharedPointerObjectCast<typename QtSharedPointer::RemovePointer<X>::Type, T>(src); +} +template <class X, class T> +inline QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type> +qobject_cast(const QWeakPointer<T> &src) +{ + return qSharedPointerObjectCast<typename QtSharedPointer::RemovePointer<X>::Type, T>(src); +} + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qshortcut.h b/qtinterface/qt4/Qt/qshortcut.h new file mode 100644 index 0000000..3119e78 --- /dev/null +++ b/qtinterface/qt4/Qt/qshortcut.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSHORTCUT_H +#define QSHORTCUT_H + +#include <QtGui/qwidget.h> +#include <QtGui/qkeysequence.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SHORTCUT + +class QShortcutPrivate; +class Q_GUI_EXPORT QShortcut : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QShortcut) + Q_PROPERTY(QKeySequence key READ key WRITE setKey) + Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat) + Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext) +public: + explicit QShortcut(QWidget *parent); + QShortcut(const QKeySequence& key, QWidget *parent, + const char *member = 0, const char *ambiguousMember = 0, + Qt::ShortcutContext context = Qt::WindowShortcut); + ~QShortcut(); + + void setKey(const QKeySequence& key); + QKeySequence key() const; + + void setEnabled(bool enable); + bool isEnabled() const; + + void setContext(Qt::ShortcutContext context); + Qt::ShortcutContext context(); + + void setWhatsThis(const QString &text); + QString whatsThis() const; + + void setAutoRepeat(bool on); + bool autoRepeat() const; + + int id() const; + + inline QWidget *parentWidget() const + { return static_cast<QWidget *>(QObject::parent()); } + +Q_SIGNALS: + void activated(); + void activatedAmbiguously(); + +protected: + bool event(QEvent *e); +}; + +#endif // QT_NO_SHORTCUT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSHORTCUT_H diff --git a/qtinterface/qt4/Qt/qsignalmapper.h b/qtinterface/qt4/Qt/qsignalmapper.h new file mode 100644 index 0000000..a601689 --- /dev/null +++ b/qtinterface/qt4/Qt/qsignalmapper.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIGNALMAPPER_H +#define QSIGNALMAPPER_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_SIGNALMAPPER +class QSignalMapperPrivate; + +class Q_CORE_EXPORT QSignalMapper : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSignalMapper) +public: + explicit QSignalMapper(QObject *parent = 0); + ~QSignalMapper(); + + void setMapping(QObject *sender, int id); + void setMapping(QObject *sender, const QString &text); + void setMapping(QObject *sender, QWidget *widget); + void setMapping(QObject *sender, QObject *object); + void removeMappings(QObject *sender); + + QObject *mapping(int id) const; + QObject *mapping(const QString &text) const; + QObject *mapping(QWidget *widget) const; + QObject *mapping(QObject *object) const; + +Q_SIGNALS: + void mapped(int); + void mapped(const QString &); + void mapped(QWidget *); + void mapped(QObject *); + +public Q_SLOTS: + void map(); + void map(QObject *sender); + +private: + Q_DISABLE_COPY(QSignalMapper) + Q_PRIVATE_SLOT(d_func(), void _q_senderDestroyed()) + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QSignalMapper(QObject *parent, const char *name); +#endif +}; +#endif // QT_NO_SIGNALMAPPER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSIGNALMAPPER_H diff --git a/qtinterface/qt4/Qt/qsignalspy.h b/qtinterface/qt4/Qt/qsignalspy.h new file mode 100644 index 0000000..fe36a40 --- /dev/null +++ b/qtinterface/qt4/Qt/qsignalspy.h @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIGNALSPY_H +#define QSIGNALSPY_H + +#include <QtCore/qbytearray.h> +#include <QtCore/qlist.h> +#include <QtCore/qobject.h> +#include <QtCore/qmetaobject.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +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: + QSignalSpy(QObject *obj, const char *aSignal) + { +#ifdef Q_CC_BOR + const int memberOffset = QObject::staticMetaObject.methodCount(); +#else + static const int memberOffset = QObject::staticMetaObject.methodCount(); +#endif + Q_ASSERT(obj); + Q_ASSERT(aSignal); + + if (((aSignal[0] - '0') & 0x03) != QSIGNAL_CODE) { + qWarning("QSignalSpy: Not a valid signal, use the SIGNAL macro"); + return; + } + + QByteArray ba = QMetaObject::normalizedSignature(aSignal + 1); + const QMetaObject *mo = obj->metaObject(); + int sigIndex = mo->indexOfMethod(ba.constData()); + if (sigIndex < 0) { + qWarning("QSignalSpy: No such signal: '%s'", ba.constData()); + return; + } + + if (!QMetaObject::connect(obj, sigIndex, this, memberOffset, + Qt::DirectConnection, 0)) { + qWarning("QSignalSpy: QMetaObject::connect returned false. Unable to connect."); + return; + } + sig = ba; + initArgs(mo->method(sigIndex)); + } + + inline bool isValid() const { return !sig.isEmpty(); } + inline QByteArray signal() const { return sig; } + + + int qt_metacall(QMetaObject::Call call, int methodId, void **a) + { + methodId = QObject::qt_metacall(call, methodId, a); + if (methodId < 0) + return methodId; + + if (call == QMetaObject::InvokeMetaMethod) { + if (methodId == 0) { + appendArgs(a); + } + --methodId; + } + return methodId; + } + +private: + void initArgs(const QMetaMethod &member) + { + QList<QByteArray> params = member.parameterTypes(); + for (int i = 0; i < params.count(); ++i) { + int tp = QMetaType::type(params.at(i).constData()); + if (tp == QMetaType::Void) + qWarning("Don't know how to handle '%s', use qRegisterMetaType to register it.", + params.at(i).constData()); + args << tp; + } + } + + void appendArgs(void **a) + { + QList<QVariant> list; + for (int i = 0; i < args.count(); ++i) { + QMetaType::Type type = static_cast<QMetaType::Type>(args.at(i)); + list << QVariant(type, a[i + 1]); + } + append(list); + } + + // the full, normalized signal name + QByteArray sig; + // holds the QMetaType types for the argument list of the signal + QList<int> args; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsignaltransition.h b/qtinterface/qt4/Qt/qsignaltransition.h new file mode 100644 index 0000000..e7593d9 --- /dev/null +++ b/qtinterface/qt4/Qt/qsignaltransition.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIGNALTRANSITION_H +#define QSIGNALTRANSITION_H + +#include <QtCore/qabstracttransition.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QSignalTransitionPrivate; +class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition +{ + Q_OBJECT + Q_PROPERTY(QObject* senderObject READ senderObject WRITE setSenderObject) + Q_PROPERTY(QByteArray signal READ signal WRITE setSignal) +public: + QSignalTransition(QState *sourceState = 0); + QSignalTransition(QObject *sender, const char *signal, + QState *sourceState = 0); + ~QSignalTransition(); + + QObject *senderObject() const; + void setSenderObject(QObject *sender); + + QByteArray signal() const; + void setSignal(const QByteArray &signal); + +protected: + bool eventTest(QEvent *event); + void onTransition(QEvent *event); + + bool event(QEvent *e); + +private: + Q_DISABLE_COPY(QSignalTransition) + Q_DECLARE_PRIVATE(QSignalTransition) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsimplexmlnodemodel.h b/qtinterface/qt4/Qt/qsimplexmlnodemodel.h new file mode 100644 index 0000000..784bcb6 --- /dev/null +++ b/qtinterface/qt4/Qt/qsimplexmlnodemodel.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIMPLEXMLNODEMODEL_H +#define QSIMPLEXMLNODEMODEL_H + +#include <QtXmlPatterns/QAbstractXmlNodeModel> +#include <QtXmlPatterns/QXmlQuery> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +template<typename T> class QExplicitlySharedDataPointer; +class QSimpleXmlNodeModelPrivate; +class Q_XMLPATTERNS_EXPORT QSimpleXmlNodeModel : public QAbstractXmlNodeModel +{ +public: + QSimpleXmlNodeModel(const QXmlNamePool &namePool); + virtual ~QSimpleXmlNodeModel(); + + virtual QUrl baseUri(const QXmlNodeModelIndex &node) const; + QXmlNamePool &namePool() const; + virtual QVector<QXmlName> namespaceBindings(const QXmlNodeModelIndex&) const; + virtual QString stringValue(const QXmlNodeModelIndex &node) const; + virtual QXmlNodeModelIndex elementById(const QXmlName &id) const; + virtual QVector<QXmlNodeModelIndex> nodesByIdref(const QXmlName &idref) const; + +private: + Q_DECLARE_PRIVATE(QSimpleXmlNodeModel) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsize.h b/qtinterface/qt4/Qt/qsize.h new file mode 100644 index 0000000..a17f53d --- /dev/null +++ b/qtinterface/qt4/Qt/qsize.h @@ -0,0 +1,368 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIZE_H +#define QSIZE_H + +#include <QtCore/qnamespace.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QSize +{ +public: + QSize(); + QSize(int w, int h); + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + + int width() const; + int height() const; + void setWidth(int w); + void setHeight(int h); + void transpose(); + + void scale(int w, int h, Qt::AspectRatioMode mode); + void scale(const QSize &s, Qt::AspectRatioMode mode); + + QSize expandedTo(const QSize &) const; + QSize boundedTo(const QSize &) const; + + int &rwidth(); + int &rheight(); + + QSize &operator+=(const QSize &); + QSize &operator-=(const QSize &); + QSize &operator*=(qreal c); + QSize &operator/=(qreal c); + + friend inline bool operator==(const QSize &, const QSize &); + friend inline bool operator!=(const QSize &, const QSize &); + friend inline const QSize operator+(const QSize &, const QSize &); + friend inline const QSize operator-(const QSize &, const QSize &); + friend inline const QSize operator*(const QSize &, qreal); + friend inline const QSize operator*(qreal, const QSize &); + friend inline const QSize operator/(const QSize &, qreal); + +private: + int wd; + int ht; +}; +Q_DECLARE_TYPEINFO(QSize, Q_MOVABLE_TYPE); + +/***************************************************************************** + QSize stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QSize &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSize &); +#endif + + +/***************************************************************************** + QSize inline functions + *****************************************************************************/ + +inline QSize::QSize() +{ wd = ht = -1; } + +inline QSize::QSize(int w, int h) +{ wd = w; ht = h; } + +inline bool QSize::isNull() const +{ return wd==0 && ht==0; } + +inline bool QSize::isEmpty() const +{ return wd<1 || ht<1; } + +inline bool QSize::isValid() const +{ return wd>=0 && ht>=0; } + +inline int QSize::width() const +{ return wd; } + +inline int QSize::height() const +{ return ht; } + +inline void QSize::setWidth(int w) +{ wd = w; } + +inline void QSize::setHeight(int h) +{ ht = h; } + +inline void QSize::scale(int w, int h, Qt::AspectRatioMode mode) +{ scale(QSize(w, h), mode); } + +inline int &QSize::rwidth() +{ return wd; } + +inline int &QSize::rheight() +{ return ht; } + +inline QSize &QSize::operator+=(const QSize &s) +{ wd+=s.wd; ht+=s.ht; return *this; } + +inline QSize &QSize::operator-=(const QSize &s) +{ wd-=s.wd; ht-=s.ht; return *this; } + +inline QSize &QSize::operator*=(qreal c) +{ wd = qRound(wd*c); ht = qRound(ht*c); return *this; } + +inline bool operator==(const QSize &s1, const QSize &s2) +{ return s1.wd == s2.wd && s1.ht == s2.ht; } + +inline bool operator!=(const QSize &s1, const QSize &s2) +{ return s1.wd != s2.wd || s1.ht != s2.ht; } + +inline const QSize operator+(const QSize & s1, const QSize & s2) +{ return QSize(s1.wd+s2.wd, s1.ht+s2.ht); } + +inline const QSize operator-(const QSize &s1, const QSize &s2) +{ return QSize(s1.wd-s2.wd, s1.ht-s2.ht); } + +inline const QSize operator*(const QSize &s, qreal c) +{ return QSize(qRound(s.wd*c), qRound(s.ht*c)); } + +inline const QSize operator*(qreal c, const QSize &s) +{ return QSize(qRound(s.wd*c), qRound(s.ht*c)); } + +inline QSize &QSize::operator/=(qreal c) +{ + Q_ASSERT(!qFuzzyIsNull(c)); + wd = qRound(wd/c); ht = qRound(ht/c); + return *this; +} + +inline const QSize operator/(const QSize &s, qreal c) +{ + Q_ASSERT(!qFuzzyIsNull(c)); + return QSize(qRound(s.wd/c), qRound(s.ht/c)); +} + +inline QSize QSize::expandedTo(const QSize & otherSize) const +{ + return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); +} + +inline QSize QSize::boundedTo(const QSize & otherSize) const +{ + return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QSize &); +#endif + + +class Q_CORE_EXPORT QSizeF +{ +public: + QSizeF(); + QSizeF(const QSize &sz); + QSizeF(qreal w, qreal h); + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + + qreal width() const; + qreal height() const; + void setWidth(qreal w); + void setHeight(qreal h); + void transpose(); + + void scale(qreal w, qreal h, Qt::AspectRatioMode mode); + void scale(const QSizeF &s, Qt::AspectRatioMode mode); + + QSizeF expandedTo(const QSizeF &) const; + QSizeF boundedTo(const QSizeF &) const; + + qreal &rwidth(); + qreal &rheight(); + + QSizeF &operator+=(const QSizeF &); + QSizeF &operator-=(const QSizeF &); + QSizeF &operator*=(qreal c); + QSizeF &operator/=(qreal c); + + friend inline bool operator==(const QSizeF &, const QSizeF &); + friend inline bool operator!=(const QSizeF &, const QSizeF &); + friend inline const QSizeF operator+(const QSizeF &, const QSizeF &); + friend inline const QSizeF operator-(const QSizeF &, const QSizeF &); + friend inline const QSizeF operator*(const QSizeF &, qreal); + friend inline const QSizeF operator*(qreal, const QSizeF &); + friend inline const QSizeF operator/(const QSizeF &, qreal); + + inline QSize toSize() const; + +private: + qreal wd; + qreal ht; +}; +Q_DECLARE_TYPEINFO(QSizeF, Q_MOVABLE_TYPE); + + +/***************************************************************************** + QSizeF stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QSizeF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSizeF &); +#endif + + +/***************************************************************************** + QSizeF inline functions + *****************************************************************************/ + +inline QSizeF::QSizeF() +{ wd = ht = -1.; } + +inline QSizeF::QSizeF(const QSize &sz) + : wd(sz.width()), ht(sz.height()) +{ +} + +inline QSizeF::QSizeF(qreal w, qreal h) +{ wd = w; ht = h; } + +inline bool QSizeF::isNull() const +{ return qIsNull(wd) && qIsNull(ht); } + +inline bool QSizeF::isEmpty() const +{ return wd <= 0. || ht <= 0.; } + +inline bool QSizeF::isValid() const +{ return wd >= 0. && ht >= 0.; } + +inline qreal QSizeF::width() const +{ return wd; } + +inline qreal QSizeF::height() const +{ return ht; } + +inline void QSizeF::setWidth(qreal w) +{ wd = w; } + +inline void QSizeF::setHeight(qreal h) +{ ht = h; } + +inline void QSizeF::scale(qreal w, qreal h, Qt::AspectRatioMode mode) +{ scale(QSizeF(w, h), mode); } + +inline qreal &QSizeF::rwidth() +{ return wd; } + +inline qreal &QSizeF::rheight() +{ return ht; } + +inline QSizeF &QSizeF::operator+=(const QSizeF &s) +{ wd += s.wd; ht += s.ht; return *this; } + +inline QSizeF &QSizeF::operator-=(const QSizeF &s) +{ wd -= s.wd; ht -= s.ht; return *this; } + +inline QSizeF &QSizeF::operator*=(qreal c) +{ wd *= c; ht *= c; return *this; } + +inline bool operator==(const QSizeF &s1, const QSizeF &s2) +{ return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht); } + +inline bool operator!=(const QSizeF &s1, const QSizeF &s2) +{ return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht); } + +inline const QSizeF operator+(const QSizeF & s1, const QSizeF & s2) +{ return QSizeF(s1.wd+s2.wd, s1.ht+s2.ht); } + +inline const QSizeF operator-(const QSizeF &s1, const QSizeF &s2) +{ return QSizeF(s1.wd-s2.wd, s1.ht-s2.ht); } + +inline const QSizeF operator*(const QSizeF &s, qreal c) +{ return QSizeF(s.wd*c, s.ht*c); } + +inline const QSizeF operator*(qreal c, const QSizeF &s) +{ return QSizeF(s.wd*c, s.ht*c); } + +inline QSizeF &QSizeF::operator/=(qreal c) +{ + Q_ASSERT(!qFuzzyIsNull(c)); + wd = wd/c; ht = ht/c; + return *this; +} + +inline const QSizeF operator/(const QSizeF &s, qreal c) +{ + Q_ASSERT(!qFuzzyIsNull(c)); + return QSizeF(s.wd/c, s.ht/c); +} + +inline QSizeF QSizeF::expandedTo(const QSizeF & otherSize) const +{ + return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); +} + +inline QSizeF QSizeF::boundedTo(const QSizeF & otherSize) const +{ + return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); +} + +inline QSize QSizeF::toSize() const +{ + return QSize(qRound(wd), qRound(ht)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QSizeF &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSIZE_H diff --git a/qtinterface/qt4/Qt/qsizegrip.h b/qtinterface/qt4/Qt/qsizegrip.h new file mode 100644 index 0000000..beadcd1 --- /dev/null +++ b/qtinterface/qt4/Qt/qsizegrip.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIZEGRIP_H +#define QSIZEGRIP_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SIZEGRIP +class QSizeGripPrivate; +class Q_GUI_EXPORT QSizeGrip : public QWidget +{ + Q_OBJECT +public: + explicit QSizeGrip(QWidget *parent); + ~QSizeGrip(); + + QSize sizeHint() const; + void setVisible(bool); + +protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *mouseEvent); + void moveEvent(QMoveEvent *moveEvent); + void showEvent(QShowEvent *showEvent); + void hideEvent(QHideEvent *hideEvent); + bool eventFilter(QObject *, QEvent *); + bool event(QEvent *); +#ifdef Q_WS_WIN + bool winEvent(MSG *m, long *result); +#endif + +public: +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QSizeGrip(QWidget *parent, const char *name); +#endif + +private: + Q_DECLARE_PRIVATE(QSizeGrip) + Q_DISABLE_COPY(QSizeGrip) + Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) +}; +#endif // QT_NO_SIZEGRIP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSIZEGRIP_H diff --git a/qtinterface/qt4/Qt/qsizepolicy.h b/qtinterface/qt4/Qt/qsizepolicy.h new file mode 100644 index 0000000..76a8e75 --- /dev/null +++ b/qtinterface/qt4/Qt/qsizepolicy.h @@ -0,0 +1,239 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSIZEPOLICY_H +#define QSIZEPOLICY_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QVariant; + +class Q_GUI_EXPORT QSizePolicy +{ + Q_GADGET + Q_ENUMS(Policy) + +private: + enum SizePolicyMasks { + HSize = 4, + HMask = 0x0f, + VMask = HMask << HSize, + CTShift = 9, + CTSize = 5, + WFHShift = CTShift + CTSize, + CTMask = ((0x1 << CTSize) - 1) << CTShift, + UnusedShift = CTShift + CTSize, + UnusedSize = 2 + }; + +public: + enum PolicyFlag { + GrowFlag = 1, + ExpandFlag = 2, + ShrinkFlag = 4, + IgnoreFlag = 8 + }; + + enum Policy { + Fixed = 0, + Minimum = GrowFlag, + Maximum = ShrinkFlag, + Preferred = GrowFlag | ShrinkFlag, + MinimumExpanding = GrowFlag | ExpandFlag, + Expanding = GrowFlag | ShrinkFlag | ExpandFlag, + Ignored = ShrinkFlag | GrowFlag | IgnoreFlag + }; + + enum ControlType { + DefaultType = 0x00000001, + ButtonBox = 0x00000002, + CheckBox = 0x00000004, + ComboBox = 0x00000008, + Frame = 0x00000010, + GroupBox = 0x00000020, + Label = 0x00000040, + Line = 0x00000080, + LineEdit = 0x00000100, + PushButton = 0x00000200, + RadioButton = 0x00000400, + Slider = 0x00000800, + SpinBox = 0x00001000, + TabWidget = 0x00002000, + ToolButton = 0x00004000 + }; + Q_DECLARE_FLAGS(ControlTypes, ControlType) + + QSizePolicy() : data(0) { } + + // ### Qt 5: merge these two constructors (with type == DefaultType) + QSizePolicy(Policy horizontal, Policy vertical) + : data(horizontal | (vertical << HSize)) { } + QSizePolicy(Policy horizontal, Policy vertical, ControlType type) + : data(horizontal | (vertical << HSize)) { setControlType(type); } + + Policy horizontalPolicy() const { return static_cast<Policy>(data & HMask); } + Policy verticalPolicy() const { return static_cast<Policy>((data & VMask) >> HSize); } + ControlType controlType() const; + + void setHorizontalPolicy(Policy d) { data = (data & ~HMask) | d; } + void setVerticalPolicy(Policy d) { data = (data & ~(HMask << HSize)) | (d << HSize); } + void setControlType(ControlType type); + + Qt::Orientations expandingDirections() const { + Qt::Orientations result; + if (verticalPolicy() & ExpandFlag) + result |= Qt::Vertical; + if (horizontalPolicy() & ExpandFlag) + result |= Qt::Horizontal; + return result; + } + + void setHeightForWidth(bool b) { data = b ? (data | (1 << 2*HSize)) : (data & ~(1 << 2*HSize)); } + bool hasHeightForWidth() const { return data & (1 << 2*HSize); } + + bool operator==(const QSizePolicy& s) const { return data == s.data; } + bool operator!=(const QSizePolicy& s) const { return data != s.data; } + operator QVariant() const; // implemented in qabstractlayout.cpp + + int horizontalStretch() const { return data >> 24; } + int verticalStretch() const { return (data >> 16) & 0xff; } + void setHorizontalStretch(uchar stretchFactor) { data = (data&0x00ffffff) | (uint(stretchFactor)<<24); } + void setVerticalStretch(uchar stretchFactor) { data = (data&0xff00ffff) | (uint(stretchFactor)<<16); } + + void transpose(); + +#ifdef QT3_SUPPORT + typedef Policy SizeType; +#ifndef qdoc + typedef Qt::Orientations ExpandData; + enum { + NoDirection = 0, + Horizontally = 1, + Vertically = 2, + BothDirections = Horizontally | Vertically + }; +#else + enum ExpandData { + NoDirection = 0x0, + Horizontally = 0x1, + Vertically = 0x2, + BothDirections = 0x3 + }; +#endif // qdoc + + inline QT3_SUPPORT bool mayShrinkHorizontally() const + { return horizontalPolicy() & ShrinkFlag; } + inline QT3_SUPPORT bool mayShrinkVertically() const { return verticalPolicy() & ShrinkFlag; } + inline QT3_SUPPORT bool mayGrowHorizontally() const { return horizontalPolicy() & GrowFlag; } + inline QT3_SUPPORT bool mayGrowVertically() const { return verticalPolicy() & GrowFlag; } + inline QT3_SUPPORT Qt::Orientations expanding() const { return expandingDirections(); } + + QT3_SUPPORT_CONSTRUCTOR QSizePolicy(Policy hor, Policy ver, bool hfw) + : data(hor | (ver<<HSize) | (hfw ? (1U<<2*HSize) : 0)) { } + + QT3_SUPPORT_CONSTRUCTOR QSizePolicy(Policy hor, Policy ver, uchar hors, uchar vers, bool hfw = false) + : data(hor | (ver<<HSize) | (hfw ? (1U<<2*HSize) : 0)) { + setHorizontalStretch(hors); + setVerticalStretch(vers); + } + + inline QT3_SUPPORT Policy horData() const { return static_cast<Policy>(data & HMask); } + inline QT3_SUPPORT Policy verData() const { return static_cast<Policy>((data & VMask) >> HSize); } + inline QT3_SUPPORT void setHorData(Policy d) { setHorizontalPolicy(d); } + inline QT3_SUPPORT void setVerData(Policy d) { setVerticalPolicy(d); } + + inline QT3_SUPPORT uint horStretch() const { return horizontalStretch(); } + inline QT3_SUPPORT uint verStretch() const { return verticalStretch(); } + inline QT3_SUPPORT void setHorStretch(uchar sf) { setHorizontalStretch(sf); } + inline QT3_SUPPORT void setVerStretch(uchar sf) { setVerticalStretch(sf); } +#endif + +private: +#ifndef QT_NO_DATASTREAM + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); +#endif + QSizePolicy(int i) : data(i) { } + + quint32 data; +/* use bit flags instead, keep it here for improved readability for now + quint32 horzPolicy : 4; + quint32 vertPolicy : 4; + quint32 hfw : 1; + quint32 ctype : 5; + quint32 wfh : 1; + quint32 padding : 1; // we cannot use the highest bit + quint32 horStretch : 8; + quint32 verStretch : 8; +*/ + +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes) + +#ifndef QT_NO_DATASTREAM +// implemented in qlayout.cpp +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); +#endif + +inline void QSizePolicy::transpose() { + Policy hData = horizontalPolicy(); + Policy vData = verticalPolicy(); + uchar hStretch = uchar(horizontalStretch()); + uchar vStretch = uchar(verticalStretch()); + setHorizontalPolicy(vData); + setVerticalPolicy(hData); + setHorizontalStretch(vStretch); + setVerticalStretch(hStretch); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSIZEPOLICY_H diff --git a/qtinterface/qt4/Qt/qslider.h b/qtinterface/qt4/Qt/qslider.h new file mode 100644 index 0000000..cfd1932 --- /dev/null +++ b/qtinterface/qt4/Qt/qslider.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSLIDER_H +#define QSLIDER_H + +#include <QtGui/qabstractslider.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SLIDER + +class QSliderPrivate; +class QStyleOptionSlider; +class Q_GUI_EXPORT QSlider : public QAbstractSlider +{ + Q_OBJECT + + Q_ENUMS(TickPosition) + Q_PROPERTY(TickPosition tickPosition READ tickPosition WRITE setTickPosition) + Q_PROPERTY(int tickInterval READ tickInterval WRITE setTickInterval) + +public: + enum TickPosition { + NoTicks = 0, + TicksAbove = 1, + TicksLeft = TicksAbove, + TicksBelow = 2, + TicksRight = TicksBelow, + TicksBothSides = 3 + +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + ,NoMarks = NoTicks, + Above = TicksAbove, + Left = TicksAbove, + Below = TicksBelow, + Right = TicksRight, + Both = TicksBothSides +#endif + }; + + explicit QSlider(QWidget *parent = 0); + explicit QSlider(Qt::Orientation orientation, QWidget *parent = 0); + + ~QSlider(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setTickPosition(TickPosition position); + TickPosition tickPosition() const; + + void setTickInterval(int ti); + int tickInterval() const; + + bool event(QEvent *event); + +protected: + void paintEvent(QPaintEvent *ev); + void mousePressEvent(QMouseEvent *ev); + void mouseReleaseEvent(QMouseEvent *ev); + void mouseMoveEvent(QMouseEvent *ev); + void initStyleOption(QStyleOptionSlider *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QSlider(QWidget *parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QSlider(Qt::Orientation, QWidget *parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QSlider(int minValue, int maxValue, int pageStep, int value, + Qt::Orientation orientation, + QWidget *parent = 0, const char *name = 0); + inline QT3_SUPPORT void setTickmarks(TickPosition position) { setTickPosition(position); } + inline QT3_SUPPORT TickPosition tickmarks() const { return tickPosition(); } +public Q_SLOTS: + inline QT_MOC_COMPAT void addStep() { triggerAction(SliderSingleStepAdd); } + inline QT_MOC_COMPAT void subtractStep() { triggerAction(SliderSingleStepSub); } +#endif + +private: + friend Q_GUI_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider); + + Q_DISABLE_COPY(QSlider) + Q_DECLARE_PRIVATE(QSlider) +}; + +#endif // QT_NO_SLIDER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSLIDER_H diff --git a/qtinterface/qt4/Qt/qsocketnotifier.h b/qtinterface/qt4/Qt/qsocketnotifier.h new file mode 100644 index 0000000..640f7f5 --- /dev/null +++ b/qtinterface/qt4/Qt/qsocketnotifier.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOCKETNOTIFIER_H +#define QSOCKETNOTIFIER_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QSocketNotifier : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QObject) + +public: + enum Type { Read, Write, Exception }; + + QSocketNotifier(int socket, Type, QObject *parent = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QSocketNotifier(int socket, Type, QObject *parent, const char *name); +#endif + ~QSocketNotifier(); + + inline int socket() const { return sockfd; } + inline Type type() const { return sntype; } + + inline bool isEnabled() const { return snenabled; } + +public Q_SLOTS: + void setEnabled(bool); + +Q_SIGNALS: + void activated(int socket); + +protected: + bool event(QEvent *); + +private: + Q_DISABLE_COPY(QSocketNotifier) + + int sockfd; + Type sntype; + bool snenabled; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSOCKETNOTIFIER_H diff --git a/qtinterface/qt4/Qt/qsortfilterproxymodel.h b/qtinterface/qt4/Qt/qsortfilterproxymodel.h new file mode 100644 index 0000000..4fc649d --- /dev/null +++ b/qtinterface/qt4/Qt/qsortfilterproxymodel.h @@ -0,0 +1,200 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSORTFILTERPROXYMODEL_H +#define QSORTFILTERPROXYMODEL_H + +#include <QtGui/qabstractproxymodel.h> + +#ifndef QT_NO_SORTFILTERPROXYMODEL + +#include <QtCore/qregexp.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QSortFilterProxyModelPrivate; +class QSortFilterProxyModelLessThan; +class QSortFilterProxyModelGreaterThan; + +class Q_GUI_EXPORT QSortFilterProxyModel : public QAbstractProxyModel +{ + friend class QSortFilterProxyModelLessThan; + friend class QSortFilterProxyModelGreaterThan; + + Q_OBJECT + Q_PROPERTY(QRegExp filterRegExp READ filterRegExp WRITE setFilterRegExp) + Q_PROPERTY(int filterKeyColumn READ filterKeyColumn WRITE setFilterKeyColumn) + Q_PROPERTY(bool dynamicSortFilter READ dynamicSortFilter WRITE setDynamicSortFilter) + Q_PROPERTY(Qt::CaseSensitivity filterCaseSensitivity READ filterCaseSensitivity WRITE setFilterCaseSensitivity) + Q_PROPERTY(Qt::CaseSensitivity sortCaseSensitivity READ sortCaseSensitivity WRITE setSortCaseSensitivity) + Q_PROPERTY(bool isSortLocaleAware READ isSortLocaleAware WRITE setSortLocaleAware) + Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole) + Q_PROPERTY(int filterRole READ filterRole WRITE setFilterRole) + +public: + QSortFilterProxyModel(QObject *parent = 0); + ~QSortFilterProxyModel(); + + void setSourceModel(QAbstractItemModel *sourceModel); + + QModelIndex mapToSource(const QModelIndex &proxyIndex) const; + QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; + + QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const; + QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const; + + QRegExp filterRegExp() const; + void setFilterRegExp(const QRegExp ®Exp); + + int filterKeyColumn() const; + void setFilterKeyColumn(int column); + + Qt::CaseSensitivity filterCaseSensitivity() const; + void setFilterCaseSensitivity(Qt::CaseSensitivity cs); + + Qt::CaseSensitivity sortCaseSensitivity() const; + void setSortCaseSensitivity(Qt::CaseSensitivity cs); + + bool isSortLocaleAware() const; + void setSortLocaleAware(bool on); + + int sortColumn() const; + Qt::SortOrder sortOrder() const; + + bool dynamicSortFilter() const; + void setDynamicSortFilter(bool enable); + + int sortRole() const; + void setSortRole(int role); + + int filterRole() const; + void setFilterRole(int role); + +public Q_SLOTS: + void setFilterRegExp(const QString &pattern); + void setFilterWildcard(const QString &pattern); + void setFilterFixedString(const QString &pattern); + void clear(); + void invalidate(); + +protected: + virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; + virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const; + virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; + + void filterChanged(); + void invalidateFilter(); + +public: +#ifdef Q_NO_USING_KEYWORD + inline QObject *parent() const { return QObject::parent(); } +#else + using QObject::parent; +#endif + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &child) const; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + bool setHeaderData(int section, Qt::Orientation orientation, + const QVariant &value, int role = Qt::EditRole); + + QMimeData *mimeData(const QModelIndexList &indexes) const; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); + + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + + void fetchMore(const QModelIndex &parent); + bool canFetchMore(const QModelIndex &parent) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + + QModelIndex buddy(const QModelIndex &index) const; + QModelIndexList match(const QModelIndex &start, int role, + const QVariant &value, int hits = 1, + Qt::MatchFlags flags = + Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const; + QSize span(const QModelIndex &index) const; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + + QStringList mimeTypes() const; + Qt::DropActions supportedDropActions() const; +private: + Q_DECLARE_PRIVATE(QSortFilterProxyModel) + Q_DISABLE_COPY(QSortFilterProxyModel) + + Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceAboutToBeReset()) + Q_PRIVATE_SLOT(d_func(), void _q_sourceReset()) + Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsInserted(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsRemoved(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeInserted(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsInserted(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsRemoved(const QModelIndex &source_parent, int start, int end)) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SORTFILTERPROXYMODEL + +#endif // QSORTFILTERPROXYMODEL_H diff --git a/qtinterface/qt4/Qt/qsound.h b/qtinterface/qt4/Qt/qsound.h new file mode 100644 index 0000000..5df6de5 --- /dev/null +++ b/qtinterface/qt4/Qt/qsound.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOUND_H +#define QSOUND_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SOUND + +class QSoundPrivate; + +class Q_GUI_EXPORT QSound : public QObject +{ + Q_OBJECT + +public: + static bool isAvailable(); + static void play(const QString& filename); + + explicit QSound(const QString& filename, QObject* parent = 0); + ~QSound(); + + int loops() const; + int loopsRemaining() const; + void setLoops(int); + QString fileName() const; + + bool isFinished() const; + +public Q_SLOTS: + void play(); + void stop(); + +public: +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QSound(const QString& filename, QObject* parent, const char* name); + static inline QT3_SUPPORT bool available() { return isAvailable(); } +#endif +private: + Q_DECLARE_PRIVATE(QSound) + friend class QAuServer; +}; + +#endif // QT_NO_SOUND + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSOUND_H diff --git a/qtinterface/qt4/Qt/qsoundqss_qws.h b/qtinterface/qt4/Qt/qsoundqss_qws.h new file mode 100644 index 0000000..e15abed --- /dev/null +++ b/qtinterface/qt4/Qt/qsoundqss_qws.h @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOUNDQSS_QWS_H +#define QSOUNDQSS_QWS_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_SOUND + +#include <QtNetwork/qtcpserver.h> +#include <QtNetwork/qtcpsocket.h> +#include <QtGui/qwssocket_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if defined(QT_NO_NETWORK) || defined(QT_NO_DNS) +#define QT_NO_QWS_SOUNDSERVER +#endif + +#ifndef Q_OS_MAC + +class QWSSoundServerPrivate; + +class Q_GUI_EXPORT QWSSoundServer : public QObject { + Q_OBJECT +public: + explicit QWSSoundServer(QObject *parent=0); + ~QWSSoundServer(); + void playFile( int id, const QString& filename ); + void stopFile( int id ); + void pauseFile( int id ); + void resumeFile( int id ); + +Q_SIGNALS: + void soundCompleted( int ); + +private Q_SLOTS: + void translateSoundCompleted( int, int ); + +private: + QWSSoundServerPrivate* d; +}; + +#ifndef QT_NO_QWS_SOUNDSERVER +class Q_GUI_EXPORT QWSSoundClient : public QWSSocket { + Q_OBJECT +public: + + enum SoundFlags { + Priority = 0x01, + Streaming = 0x02 // currently ignored, but but could set up so both Raw and non raw can be done streaming or not. + }; + enum DeviceErrors { + ErrOpeningAudioDevice = 0x01, + ErrOpeningFile = 0x02, + ErrReadingFile = 0x04 + }; + explicit QWSSoundClient(QObject* parent=0); + ~QWSSoundClient( ); + void reconnect(); + void play( int id, const QString& filename ); + void play( int id, const QString& filename, int volume, int flags = 0 ); + void playRaw( int id, const QString&, int, int, int, int flags = 0 ); + + void pause( int id ); + void stop( int id ); + void resume( int id ); + void setVolume( int id, int left, int right ); + void setMute( int id, bool m ); + + // to be used by server only, to protect phone conversation/rings. + void playPriorityOnly(bool); + + // If silent, tell sound server to release audio device + // Otherwise, allow sound server to regain audio device + void setSilent(bool); + +Q_SIGNALS: + void soundCompleted(int); + void deviceReady(int id); + void deviceError(int id, QWSSoundClient::DeviceErrors); + +private Q_SLOTS: + void tryReadCommand(); + void emitConnectionRefused(); + +private: + void sendServerMessage(QString msg); +}; + +class QWSSoundServerSocket : public QWSServerSocket { + Q_OBJECT + +public: + explicit QWSSoundServerSocket(QObject *parent=0); +public Q_SLOTS: + void newConnection(); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QWSSoundServerSocket(QObject *parent, const char *name); +#endif + +Q_SIGNALS: + void playFile(int, int, const QString&); + void playFile(int, int, const QString&, int, int); + void playRawFile(int, int, const QString&, int, int, int, int); + void pauseFile(int, int); + void stopFile(int, int); + void resumeFile(int, int); + void setVolume(int, int, int, int); + void setMute(int, int, bool); + + void stopAll(int); + + void playPriorityOnly(bool); + + void setSilent(bool); + + void soundFileCompleted(int, int); + void deviceReady(int, int); + void deviceError(int, int, int); +}; +#endif + +#endif // Q_OS_MAC + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SOUND + +#endif // QSOUNDQSS_QWS_H diff --git a/qtinterface/qt4/Qt/qsourcelocation.h b/qtinterface/qt4/Qt/qsourcelocation.h new file mode 100644 index 0000000..eaeaa39 --- /dev/null +++ b/qtinterface/qt4/Qt/qsourcelocation.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOURCELOCATION_H +#define QSOURCELOCATION_H + +#include <QtCore/QMetaType> +#include <QtCore/QUrl> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QSourceLocationPrivate; + +class Q_XMLPATTERNS_EXPORT QSourceLocation +{ +public: + QSourceLocation(); + QSourceLocation(const QSourceLocation &other); + QSourceLocation(const QUrl &uri, int line = -1, int column = -1); + ~QSourceLocation(); + QSourceLocation &operator=(const QSourceLocation &other); + bool operator==(const QSourceLocation &other) const; + bool operator!=(const QSourceLocation &other) const; + + qint64 column() const; + void setColumn(qint64 newColumn); + + qint64 line() const; + void setLine(qint64 newLine); + + QUrl uri() const; + void setUri(const QUrl &newUri); + bool isNull() const; + +private: + union + { + qint64 m_line; + QSourceLocationPrivate *m_ptr; + }; + qint64 m_column; + QUrl m_uri; +}; + +Q_XMLPATTERNS_EXPORT uint qHash(const QSourceLocation &location); + +#ifndef QT_NO_DEBUG_STREAM +Q_XMLPATTERNS_EXPORT QDebug operator<<(QDebug debug, const QSourceLocation &sourceLocation); +#endif + +Q_DECLARE_TYPEINFO(QSourceLocation, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QSourceLocation) /* This macro must appear after QT_END_NAMESPACE. */ + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qspinbox.h b/qtinterface/qt4/Qt/qspinbox.h new file mode 100644 index 0000000..8789092 --- /dev/null +++ b/qtinterface/qt4/Qt/qspinbox.h @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSPINBOX_H +#define QSPINBOX_H + +#include <QtGui/qabstractspinbox.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SPINBOX + +class QSpinBoxPrivate; +class Q_GUI_EXPORT QSpinBox : public QAbstractSpinBox +{ + Q_OBJECT + + Q_PROPERTY(QString suffix READ suffix WRITE setSuffix) + Q_PROPERTY(QString prefix READ prefix WRITE setPrefix) + Q_PROPERTY(QString cleanText READ cleanText) + Q_PROPERTY(int minimum READ minimum WRITE setMinimum) + Q_PROPERTY(int maximum READ maximum WRITE setMaximum) + Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true) + +public: + explicit QSpinBox(QWidget *parent = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QSpinBox(QWidget *parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QSpinBox(int min, int max, int step, QWidget *parent, + const char *name = 0); +#endif + + int value() const; + + QString prefix() const; + void setPrefix(const QString &prefix); + + QString suffix() const; + void setSuffix(const QString &suffix); + + QString cleanText() const; + + int singleStep() const; + void setSingleStep(int val); + + int minimum() const; + void setMinimum(int min); + + int maximum() const; + void setMaximum(int max); + + void setRange(int min, int max); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void setLineStep(int step) { setSingleStep(step); } + inline QT3_SUPPORT void setMaxValue(int val) { setMaximum(val); } + inline QT3_SUPPORT void setMinValue(int val) { setMinimum(val); } + inline QT3_SUPPORT int maxValue() const { return maximum(); } + inline QT3_SUPPORT int minValue() const { return minimum(); } +#endif + +protected: + bool event(QEvent *event); + virtual QValidator::State validate(QString &input, int &pos) const; + virtual int valueFromText(const QString &text) const; + virtual QString textFromValue(int val) const; + virtual void fixup(QString &str) const; + + +public Q_SLOTS: + void setValue(int val); + +Q_SIGNALS: + void valueChanged(int); + void valueChanged(const QString &); + +private: + Q_DISABLE_COPY(QSpinBox) + Q_DECLARE_PRIVATE(QSpinBox) +}; + +class QDoubleSpinBoxPrivate; +class Q_GUI_EXPORT QDoubleSpinBox : public QAbstractSpinBox +{ + Q_OBJECT + + Q_PROPERTY(QString prefix READ prefix WRITE setPrefix) + Q_PROPERTY(QString suffix READ suffix WRITE setSuffix) + Q_PROPERTY(QString cleanText READ cleanText) + Q_PROPERTY(int decimals READ decimals WRITE setDecimals) + Q_PROPERTY(double minimum READ minimum WRITE setMinimum) + Q_PROPERTY(double maximum READ maximum WRITE setMaximum) + Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep) + Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true) +public: + explicit QDoubleSpinBox(QWidget *parent = 0); + + double value() const; + + QString prefix() const; + void setPrefix(const QString &prefix); + + QString suffix() const; + void setSuffix(const QString &suffix); + + QString cleanText() const; + + double singleStep() const; + void setSingleStep(double val); + + double minimum() const; + void setMinimum(double min); + + double maximum() const; + void setMaximum(double max); + + void setRange(double min, double max); + + int decimals() const; + void setDecimals(int prec); + + virtual QValidator::State validate(QString &input, int &pos) const; + virtual double valueFromText(const QString &text) const; + virtual QString textFromValue(double val) const; + virtual void fixup(QString &str) const; + +public Q_SLOTS: + void setValue(double val); + +Q_SIGNALS: + void valueChanged(double); + void valueChanged(const QString &); + +private: + Q_DISABLE_COPY(QDoubleSpinBox) + Q_DECLARE_PRIVATE(QDoubleSpinBox) +}; + +#endif // QT_NO_SPINBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSPINBOX_H diff --git a/qtinterface/qt4/Qt/qsplashscreen.h b/qtinterface/qt4/Qt/qsplashscreen.h new file mode 100644 index 0000000..77dbfdd --- /dev/null +++ b/qtinterface/qt4/Qt/qsplashscreen.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSPLASHSCREEN_H +#define QSPLASHSCREEN_H + +#include <QtGui/qpixmap.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SPLASHSCREEN +class QSplashScreenPrivate; + +class Q_GUI_EXPORT QSplashScreen : public QWidget +{ + Q_OBJECT +public: + explicit QSplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0); + QSplashScreen(QWidget *parent, const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0); + virtual ~QSplashScreen(); + + void setPixmap(const QPixmap &pixmap); + const QPixmap pixmap() const; + void finish(QWidget *w); + void repaint(); + +public Q_SLOTS: + void showMessage(const QString &message, int alignment = Qt::AlignLeft, + const QColor &color = Qt::black); + void clearMessage(); +#ifdef QT3_SUPPORT + inline QT_MOC_COMPAT void message(const QString &str, int alignment = Qt::AlignLeft, + const QColor &color = Qt::black) { showMessage(str, alignment, color); } + inline QT_MOC_COMPAT void clear() { clearMessage(); } +#endif + +Q_SIGNALS: + void messageChanged(const QString &message); + +protected: + bool event(QEvent *e); + virtual void drawContents(QPainter *painter); + void mousePressEvent(QMouseEvent *); + +private: + Q_DISABLE_COPY(QSplashScreen) + Q_DECLARE_PRIVATE(QSplashScreen) +}; + +#endif // QT_NO_SPLASHSCREEN + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSPLASHSCREEN_H diff --git a/qtinterface/qt4/Qt/qsplitter.h b/qtinterface/qt4/Qt/qsplitter.h new file mode 100644 index 0000000..0b1f083 --- /dev/null +++ b/qtinterface/qt4/Qt/qsplitter.h @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSPLITTER_H +#define QSPLITTER_H + +#include <QtGui/qframe.h> +#include <QtGui/qsizepolicy.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SPLITTER + +class QSplitterPrivate; +class QTextStream; +template <typename T> class QList; + +class QSplitterHandle; + +class Q_GUI_EXPORT QSplitter : public QFrame +{ + Q_OBJECT + + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(bool opaqueResize READ opaqueResize WRITE setOpaqueResize) + Q_PROPERTY(int handleWidth READ handleWidth WRITE setHandleWidth) + Q_PROPERTY(bool childrenCollapsible READ childrenCollapsible WRITE setChildrenCollapsible) + +public: + explicit QSplitter(QWidget* parent = 0); + explicit QSplitter(Qt::Orientation, QWidget* parent = 0); + ~QSplitter(); + + void addWidget(QWidget *widget); + void insertWidget(int index, QWidget *widget); + + void setOrientation(Qt::Orientation); + Qt::Orientation orientation() const; + + void setChildrenCollapsible(bool); + bool childrenCollapsible() const; + + void setCollapsible(int index, bool); + bool isCollapsible(int index) const; + void setOpaqueResize(bool opaque = true); + bool opaqueResize() const; + void refresh(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + QList<int> sizes() const; + void setSizes(const QList<int> &list); + + QByteArray saveState() const; + bool restoreState(const QByteArray &state); + + int handleWidth() const; + void setHandleWidth(int); + + int indexOf(QWidget *w) const; + QWidget *widget(int index) const; + int count() const; + + void getRange(int index, int *, int *) const; + QSplitterHandle *handle(int index) const; + + void setStretchFactor(int index, int stretch); + +Q_SIGNALS: + void splitterMoved(int pos, int index); + +protected: + virtual QSplitterHandle *createHandle(); + + void childEvent(QChildEvent *); + + bool event(QEvent *); + void resizeEvent(QResizeEvent *); + + void changeEvent(QEvent *); + void moveSplitter(int pos, int index); + void setRubberBand(int position); + int closestLegalPosition(int, int); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QSplitter(QWidget* parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QSplitter(Qt::Orientation, QWidget* parent, const char* name); + enum ResizeMode { Stretch, KeepSize, FollowSizeHint, Auto }; + QT3_SUPPORT void setResizeMode(QWidget *w, ResizeMode mode); + inline QT3_SUPPORT void moveToFirst(QWidget *w) { insertWidget(0,w); } + inline QT3_SUPPORT void moveToLast(QWidget *w) { addWidget(w); } + inline QT3_SUPPORT void setCollapsible(QWidget *w, bool collapse) + { setCollapsible(indexOf(w), collapse); } + QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + QT3_SUPPORT int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } +#endif + +private: + Q_DISABLE_COPY(QSplitter) + Q_DECLARE_PRIVATE(QSplitter) +private: + friend class QSplitterHandle; +}; + +//#ifdef QT3_SUPPORT +#ifndef QT_NO_TEXTSTREAM +Q_GUI_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&); +Q_GUI_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&); +#endif +//#endif + +class QSplitterHandlePrivate; +class Q_GUI_EXPORT QSplitterHandle : public QWidget +{ + Q_OBJECT +public: + QSplitterHandle(Qt::Orientation o, QSplitter *parent); + void setOrientation(Qt::Orientation o); + Qt::Orientation orientation() const; + bool opaqueResize() const; + QSplitter *splitter() const; + + QSize sizeHint() const; + +protected: + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + bool event(QEvent *); + + void moveSplitter(int p); + int closestLegalPosition(int p); + +private: + Q_DISABLE_COPY(QSplitterHandle) + Q_DECLARE_PRIVATE(QSplitterHandle) +}; + +#endif // QT_NO_SPLITTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSPLITTER_H diff --git a/qtinterface/qt4/Qt/qsql.h b/qtinterface/qt4/Qt/qsql.h new file mode 100644 index 0000000..884b721 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_H +#define QSQL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +namespace QSql +{ + enum Location + { + BeforeFirstRow = -1, + AfterLastRow = -2 +#ifdef QT3_SUPPORT + , BeforeFirst = BeforeFirstRow, + AfterLast = AfterLastRow +#endif + }; + + enum ParamTypeFlag + { + In = 0x00000001, + Out = 0x00000002, + InOut = In | Out, + Binary = 0x00000004 + }; + Q_DECLARE_FLAGS(ParamType, ParamTypeFlag) + + enum TableType + { + Tables = 0x01, + SystemTables = 0x02, + Views = 0x04, + AllTables = 0xff + }; + + enum NumericalPrecisionPolicy + { + LowPrecisionInt32 = 0x01, + LowPrecisionInt64 = 0x02, + LowPrecisionDouble = 0x04, + + HighPrecision = 0 + }; + +#ifdef QT3_SUPPORT + enum Op { + None = -1, + Insert = 0, + Update = 1, + Delete = 2 + }; + + enum Confirm { + Cancel = -1, + No = 0, + Yes = 1 + }; +#endif +} + +Q_DECLARE_OPERATORS_FOR_FLAGS(QSql::ParamType) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_H diff --git a/qtinterface/qt4/Qt/qsql_db2.h b/qtinterface/qt4/Qt/qsql_db2.h new file mode 100644 index 0000000..a1e91ff --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_db2.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_DB2_H +#define QSQL_DB2_H + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_DB2 +#else +#define Q_EXPORT_SQLDRIVER_DB2 Q_SQL_EXPORT +#endif + +#include <QtSql/qsqlresult.h> +#include <QtSql/qsqldriver.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE +class QDB2Driver; +class QDB2DriverPrivate; +class QDB2ResultPrivate; +class QSqlRecord; + +class QDB2Result : public QSqlResult +{ +public: + QDB2Result(const QDB2Driver* dr, const QDB2DriverPrivate* dp); + ~QDB2Result(); + bool prepare(const QString& query); + bool exec(); + QVariant handle() const; + +protected: + QVariant data(int field); + bool reset (const QString& query); + bool fetch(int i); + bool fetchNext(); + bool fetchFirst(); + bool fetchLast(); + bool isNull(int i); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + void virtual_hook(int id, void *data); + bool nextResult(); + +private: + QDB2ResultPrivate* d; +}; + +class Q_EXPORT_SQLDRIVER_DB2 QDB2Driver : public QSqlDriver +{ + Q_OBJECT +public: + explicit QDB2Driver(QObject* parent = 0); + QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent = 0); + ~QDB2Driver(); + bool hasFeature(DriverFeature) const; + void close(); + QSqlRecord record(const QString& tableName) const; + QStringList tables(QSql::TableType type) const; + QSqlResult *createResult() const; + QSqlIndex primaryIndex(const QString& tablename) const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QString formatValue(const QSqlField &field, bool trimStrings) const; + QVariant handle() const; + bool open(const QString& db, + const QString& user, + const QString& password, + const QString& host, + int port, + const QString& connOpts); + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +private: + bool setAutoCommit(bool autoCommit); + QDB2DriverPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_DB2_H diff --git a/qtinterface/qt4/Qt/qsql_ibase.h b/qtinterface/qt4/Qt/qsql_ibase.h new file mode 100644 index 0000000..6143b0a --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_ibase.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_IBASE_H +#define QSQL_IBASE_H + +#include <QtSql/qsqlresult.h> +#include <QtSql/qsqldriver.h> +#include <QtSql/private/qsqlcachedresult_p.h> +#include <ibase.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE +class QIBaseDriverPrivate; +class QIBaseResultPrivate; +class QIBaseDriver; + +class QIBaseResult : public QSqlCachedResult +{ + friend class QIBaseResultPrivate; + +public: + explicit QIBaseResult(const QIBaseDriver* db); + virtual ~QIBaseResult(); + + bool prepare(const QString& query); + bool exec(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + +private: + QIBaseResultPrivate* d; +}; + +class QIBaseDriver : public QSqlDriver +{ + Q_OBJECT + friend class QIBaseDriverPrivate; + friend class QIBaseResultPrivate; +public: + explicit QIBaseDriver(QObject *parent = 0); + explicit QIBaseDriver(isc_db_handle connection, QObject *parent = 0); + virtual ~QIBaseDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString & connOpts); + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port) { return open (db, user, password, host, port, QString()); } + void close(); + QSqlResult *createResult() const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QStringList tables(QSql::TableType) const; + + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString &table) const; + + QString formatValue(const QSqlField &field, bool trimStrings) const; + QVariant handle() const; + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +protected Q_SLOTS: + bool subscribeToNotificationImplementation(const QString &name); + bool unsubscribeFromNotificationImplementation(const QString &name); + QStringList subscribedToNotificationsImplementation() const; + +private Q_SLOTS: + void qHandleEventNotification(void* updatedResultBuffer); + +private: + QIBaseDriverPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif // QSQL_IBASE_H diff --git a/qtinterface/qt4/Qt/qsql_mysql.h b/qtinterface/qt4/Qt/qsql_mysql.h new file mode 100644 index 0000000..4e47325 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_mysql.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_MYSQL_H +#define QSQL_MYSQL_H + +#include <QtSql/qsqldriver.h> +#include <QtSql/qsqlresult.h> + +#if defined (Q_OS_WIN32) +#include <QtCore/qt_windows.h> +#endif + +#include <mysql.h> + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_MYSQL +#else +#define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QMYSQLDriverPrivate; +class QMYSQLResultPrivate; +class QMYSQLDriver; +class QSqlRecordInfo; + +class QMYSQLResult : public QSqlResult +{ + friend class QMYSQLDriver; + friend class QMYSQLResultPrivate; +public: + explicit QMYSQLResult(const QMYSQLDriver* db); + ~QMYSQLResult(); + + QVariant handle() const; +protected: + void cleanup(); + bool fetch(int i); + bool fetchNext(); + bool fetchLast(); + bool fetchFirst(); + QVariant data(int field); + bool isNull(int field); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QVariant lastInsertId() const; + QSqlRecord record() const; + void virtual_hook(int id, void *data); + bool nextResult(); + +#if MYSQL_VERSION_ID >= 40108 + bool prepare(const QString& stmt); + bool exec(); +#endif +private: + QMYSQLResultPrivate* d; +}; + +class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver +{ + Q_OBJECT + friend class QMYSQLResult; +public: + explicit QMYSQLDriver(QObject *parent=0); + explicit QMYSQLDriver(MYSQL *con, QObject * parent=0); + ~QMYSQLDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QSqlRecord record(const QString& tablename) const; + QString formatValue(const QSqlField &field, + bool trimStrings) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +protected Q_SLOTS: + bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); +private: + void init(); + QMYSQLDriverPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_MYSQL_H diff --git a/qtinterface/qt4/Qt/qsql_oci.h b/qtinterface/qt4/Qt/qsql_oci.h new file mode 100644 index 0000000..8850d37 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_oci.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_OCI_H +#define QSQL_OCI_H + +#include <QtSql/qsqlresult.h> +#include <QtSql/qsqldriver.h> +#include <QtSql/private/qsqlcachedresult_p.h> + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_OCI +#else +#define Q_EXPORT_SQLDRIVER_OCI Q_SQL_EXPORT +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QOCIDriver; +class QOCICols; +struct QOCIDriverPrivate; +struct QOCIResultPrivate; + +typedef struct OCIEnv OCIEnv; +typedef struct OCISvcCtx OCISvcCtx; + +class Q_EXPORT_SQLDRIVER_OCI QOCIResult : public QSqlCachedResult +{ + friend class QOCIDriver; + friend struct QOCIResultPrivate; + friend class QOCICols; +public: + QOCIResult(const QOCIDriver * db, const QOCIDriverPrivate* p); + ~QOCIResult(); + bool prepare(const QString& query); + bool exec(); + QVariant handle() const; + +protected: + bool gotoNext(ValueCache &values, int index); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + QVariant lastInsertId() const; + void virtual_hook(int id, void *data); + +private: + QOCIResultPrivate *d; +}; + +class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver +{ + Q_OBJECT + friend struct QOCIResultPrivate; + friend class QOCIPrivate; +public: + explicit QOCIDriver(QObject* parent = 0); + QOCIDriver(OCIEnv* env, OCISvcCtx* ctx, QObject* parent = 0); + ~QOCIDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QString formatValue(const QSqlField &field, + bool trimStrings) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); +private: + QOCIDriverPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_OCI_H diff --git a/qtinterface/qt4/Qt/qsql_odbc.h b/qtinterface/qt4/Qt/qsql_odbc.h new file mode 100644 index 0000000..4aaa7bd --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_odbc.h @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_ODBC_H +#define QSQL_ODBC_H + +#include <QtSql/qsqldriver.h> +#include <QtSql/qsqlresult.h> + +#if defined (Q_OS_WIN32) +#include <QtCore/qt_windows.h> +#endif + +#if defined (Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3) +// assume we use iodbc on MACX +// comment next line out if you use a +// unicode compatible manager +# define Q_ODBC_VERSION_2 +#endif + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_ODBC +#else +#define Q_EXPORT_SQLDRIVER_ODBC Q_SQL_EXPORT +#endif + +#ifdef Q_OS_UNIX +#define HAVE_LONG_LONG 1 // force UnixODBC NOT to fall back to a struct for BIGINTs +#endif + +#if defined(Q_CC_BOR) +// workaround for Borland to make sure that SQLBIGINT is defined +# define _MSC_VER 900 +#endif +#include <sql.h> +#if defined(Q_CC_BOR) +# undef _MSC_VER +#endif + +#ifndef Q_ODBC_VERSION_2 +#include <sqlucode.h> +#endif + +#include <sqlext.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QODBCPrivate; +class QODBCDriverPrivate; +class QODBCDriver; +class QSqlRecordInfo; + +class QODBCResult : public QSqlResult +{ +public: + QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p); + virtual ~QODBCResult(); + + bool prepare(const QString& query); + bool exec(); + + QVariant handle() const; + virtual void setForwardOnly(bool forward); + +protected: + bool fetchNext(); + bool fetchFirst(); + bool fetchLast(); + bool fetchPrevious(); + bool fetch(int i); + bool reset (const QString& query); + QVariant data(int field); + bool isNull(int field); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + void virtual_hook(int id, void *data); + bool nextResult(); + +private: + QODBCPrivate *d; +}; + +class Q_EXPORT_SQLDRIVER_ODBC QODBCDriver : public QSqlDriver +{ + Q_OBJECT +public: + explicit QODBCDriver(QObject *parent=0); + QODBCDriver(SQLHANDLE env, SQLHANDLE con, QObject * parent=0); + virtual ~QODBCDriver(); + bool hasFeature(DriverFeature f) const; + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QVariant handle() const; + QString formatValue(const QSqlField &field, + bool trimStrings) const; + bool open(const QString& db, + const QString& user, + const QString& password, + const QString& host, + int port, + const QString& connOpts); + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +protected Q_SLOTS: + bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + +private: + void init(); + bool endTrans(); + void cleanup(); + QODBCDriverPrivate* d; + friend class QODBCPrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_ODBC_H diff --git a/qtinterface/qt4/Qt/qsql_psql.h b/qtinterface/qt4/Qt/qsql_psql.h new file mode 100644 index 0000000..341e7e6 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_psql.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_PSQL_H +#define QSQL_PSQL_H + +#include <QtSql/qsqlresult.h> +#include <QtSql/qsqldriver.h> + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_PSQL +#else +#define Q_EXPORT_SQLDRIVER_PSQL Q_SQL_EXPORT +#endif + +QT_BEGIN_HEADER + +typedef struct pg_conn PGconn; +typedef struct pg_result PGresult; + +QT_BEGIN_NAMESPACE + +class QPSQLResultPrivate; +class QPSQLDriverPrivate; +class QPSQLDriver; +class QSqlRecordInfo; + +class QPSQLResult : public QSqlResult +{ + friend class QPSQLResultPrivate; +public: + QPSQLResult(const QPSQLDriver* db, const QPSQLDriverPrivate* p); + ~QPSQLResult(); + + QVariant handle() const; + void virtual_hook(int id, void *data); + +protected: + void cleanup(); + bool fetch(int i); + bool fetchFirst(); + bool fetchLast(); + QVariant data(int i); + bool isNull(int field); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + QVariant lastInsertId() const; + bool prepare(const QString& query); + bool exec(); + +private: + QPSQLResultPrivate *d; +}; + +class Q_EXPORT_SQLDRIVER_PSQL QPSQLDriver : public QSqlDriver +{ + Q_OBJECT +public: + enum Protocol { + Version6 = 6, + Version7 = 7, + Version71 = 8, + Version73 = 9, + Version74 = 10, + Version8 = 11, + Version81 = 12, + Version82 = 13, + Version83 = 14 + }; + + explicit QPSQLDriver(QObject *parent=0); + explicit QPSQLDriver(PGconn *conn, QObject *parent=0); + ~QPSQLDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + bool isOpen() const; + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QSqlRecord record(const QString& tablename) const; + + Protocol protocol() const; + QVariant handle() const; + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + QString formatValue(const QSqlField &field, bool trimStrings) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + +protected Q_SLOTS: + bool subscribeToNotificationImplementation(const QString &name); + bool unsubscribeFromNotificationImplementation(const QString &name); + QStringList subscribedToNotificationsImplementation() const; + +private Q_SLOTS: + void _q_handleNotification(int); + +private: + void init(); + QPSQLDriverPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_PSQL_H diff --git a/qtinterface/qt4/Qt/qsql_sqlite.h b/qtinterface/qt4/Qt/qsql_sqlite.h new file mode 100644 index 0000000..3c840a4 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_sqlite.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_SQLITE_H +#define QSQL_SQLITE_H + +#include <QtSql/qsqldriver.h> +#include <QtSql/qsqlresult.h> +#include <QtSql/private/qsqlcachedresult_p.h> + +struct sqlite3; + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_SQLITE +#else +#define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE +class QSQLiteDriverPrivate; +class QSQLiteResultPrivate; +class QSQLiteDriver; + +class QSQLiteResult : public QSqlCachedResult +{ + friend class QSQLiteDriver; + friend class QSQLiteResultPrivate; +public: + explicit QSQLiteResult(const QSQLiteDriver* db); + ~QSQLiteResult(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); + bool reset(const QString &query); + bool prepare(const QString &query); + bool exec(); + int size(); + int numRowsAffected(); + QVariant lastInsertId() const; + QSqlRecord record() const; + void virtual_hook(int id, void *data); + +private: + QSQLiteResultPrivate* d; +}; + +class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver +{ + Q_OBJECT + friend class QSQLiteResult; +public: + explicit QSQLiteDriver(QObject *parent = 0); + explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = 0); + ~QSQLiteDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString & connOpts); + void close(); + QSqlResult *createResult() const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QStringList tables(QSql::TableType) const; + + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString &table) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType) const; + +private: + QSQLiteDriverPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_SQLITE_H diff --git a/qtinterface/qt4/Qt/qsql_sqlite2.h b/qtinterface/qt4/Qt/qsql_sqlite2.h new file mode 100644 index 0000000..80276e2 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_sqlite2.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_SQLITE2_H +#define QSQL_SQLITE2_H + +#include <QtSql/qsqldriver.h> +#include <QtSql/qsqlresult.h> +#include <QtSql/qsqlrecord.h> +#include <QtSql/qsqlindex.h> +#include <QtSql/private/qsqlcachedresult_p.h> + +#if defined (Q_OS_WIN32) +# include <QtCore/qt_windows.h> +#endif + +struct sqlite; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSQLite2DriverPrivate; +class QSQLite2ResultPrivate; +class QSQLite2Driver; + +class QSQLite2Result : public QSqlCachedResult +{ + friend class QSQLite2Driver; + friend class QSQLite2ResultPrivate; +public: + explicit QSQLite2Result(const QSQLite2Driver* db); + ~QSQLite2Result(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + void virtual_hook(int id, void *data); + +private: + QSQLite2ResultPrivate* d; +}; + +class QSQLite2Driver : public QSqlDriver +{ + Q_OBJECT + friend class QSQLite2Result; +public: + explicit QSQLite2Driver(QObject *parent = 0); + explicit QSQLite2Driver(sqlite *connection, QObject *parent = 0); + ~QSQLite2Driver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString & connOpts); + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port) { return open (db, user, password, host, port, QString()); } + void close(); + QSqlResult *createResult() const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QStringList tables(QSql::TableType) const; + + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString &table) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType) const; + +private: + QSQLite2DriverPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_SQLITE2_H diff --git a/qtinterface/qt4/Qt/qsql_tds.h b/qtinterface/qt4/Qt/qsql_tds.h new file mode 100644 index 0000000..cb318f3 --- /dev/null +++ b/qtinterface/qt4/Qt/qsql_tds.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_TDS_H +#define QSQL_TDS_H + +#include <QtSql/qsqlresult.h> +#include <QtSql/qsqldriver.h> +#include <QtSql/private/qsqlcachedresult_p.h> + +#ifdef Q_OS_WIN32 +#define WIN32_LEAN_AND_MEAN +#define DBNTWIN32 // indicates 32bit windows dblib +#include <QtCore/qt_windows.h> +#include <sqlfront.h> +#include <sqldb.h> +#define CS_PUBLIC +#else +#include <sybfront.h> +#include <sybdb.h> +#endif //Q_OS_WIN32 + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_TDS +#else +#define Q_EXPORT_SQLDRIVER_TDS Q_SQL_EXPORT +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QTDSDriverPrivate; +class QTDSResultPrivate; +class QTDSDriver; + +class QTDSResult : public QSqlCachedResult +{ +public: + explicit QTDSResult(const QTDSDriver* db); + ~QTDSResult(); + QVariant handle() const; + +protected: + void cleanup(); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + bool gotoNext(QSqlCachedResult::ValueCache &values, int index); + QSqlRecord record() const; + +private: + QTDSResultPrivate* d; +}; + +class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver +{ + Q_OBJECT + friend class QTDSResult; +public: + explicit QTDSDriver(QObject* parent = 0); + QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0); + ~QTDSDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + void close(); + QStringList tables(QSql::TableType) const; + QSqlResult *createResult() const; + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString& tablename) const; + + QString formatValue(const QSqlField &field, + bool trimStrings) const; + QVariant handle() const; + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); +private: + void init(); + QTDSDriverPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQL_TDS_H diff --git a/qtinterface/qt4/Qt/qsqldatabase.h b/qtinterface/qt4/Qt/qsqldatabase.h new file mode 100644 index 0000000..5eba895 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqldatabase.h @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLDATABASE_H +#define QSQLDATABASE_H + +#include <QtCore/qstring.h> +#include <QtSql/qsql.h> +#ifdef QT3_SUPPORT +#include <QtSql/qsqlrecord.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlError; +class QSqlDriver; +class QSqlIndex; +class QSqlRecord; +class QSqlQuery; +class QSqlDatabasePrivate; + +class Q_SQL_EXPORT QSqlDriverCreatorBase +{ +public: + virtual ~QSqlDriverCreatorBase() {} + virtual QSqlDriver *createObject() const = 0; +}; + +template <class T> +class QSqlDriverCreator : public QSqlDriverCreatorBase +{ +public: + QSqlDriver *createObject() const { return new T; } +}; + +class Q_SQL_EXPORT QSqlDatabase +{ +public: + QSqlDatabase(); + QSqlDatabase(const QSqlDatabase &other); + ~QSqlDatabase(); + + QSqlDatabase &operator=(const QSqlDatabase &other); + + bool open(); + bool open(const QString& user, const QString& password); + void close(); + bool isOpen() const; + bool isOpenError() const; + QStringList tables(QSql::TableType type = QSql::Tables) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QSqlRecord record(const QString& tablename) const; +#ifdef QT3_SUPPORT + QT3_SUPPORT QSqlRecord record(const QSqlQuery& query) const; + inline QT3_SUPPORT QSqlRecord recordInfo(const QString& tablename) const + { return record(tablename); } + QT3_SUPPORT QSqlRecord recordInfo(const QSqlQuery& query) const; +#endif + QSqlQuery exec(const QString& query = QString()) const; + QSqlError lastError() const; + bool isValid() const; + + bool transaction(); + bool commit(); + bool rollback(); + + void setDatabaseName(const QString& name); + void setUserName(const QString& name); + void setPassword(const QString& password); + void setHostName(const QString& host); + void setPort(int p); + void setConnectOptions(const QString& options = QString()); + QString databaseName() const; + QString userName() const; + QString password() const; + QString hostName() const; + QString driverName() const; + int port() const; + QString connectOptions() const; + QString connectionName() const; + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; + + QSqlDriver* driver() const; + + QT_STATIC_CONST char *defaultConnection; + + static QSqlDatabase addDatabase(const QString& type, + const QString& connectionName = QLatin1String(defaultConnection)); + static QSqlDatabase addDatabase(QSqlDriver* driver, + const QString& connectionName = QLatin1String(defaultConnection)); + static QSqlDatabase cloneDatabase(const QSqlDatabase &other, const QString& connectionName); + static QSqlDatabase database(const QString& connectionName = QLatin1String(defaultConnection), + bool open = true); + static void removeDatabase(const QString& connectionName); + static bool contains(const QString& connectionName = QLatin1String(defaultConnection)); + static QStringList drivers(); + static QStringList connectionNames(); + static void registerSqlDriver(const QString &name, QSqlDriverCreatorBase *creator); + static bool isDriverAvailable(const QString &name); + +protected: + explicit QSqlDatabase(const QString& type); + explicit QSqlDatabase(QSqlDriver* driver); + +private: + friend class QSqlDatabasePrivate; + QSqlDatabasePrivate *d; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlDatabase &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLDATABASE_H diff --git a/qtinterface/qt4/Qt/qsqldriver.h b/qtinterface/qt4/Qt/qsqldriver.h new file mode 100644 index 0000000..f9db907 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqldriver.h @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLDRIVER_H +#define QSQLDRIVER_H + +#include <QtCore/qobject.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtSql/qsql.h> +#ifdef QT3_SUPPORT +#include <QtSql/qsqlquery.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlDatabase; +class QSqlDriverPrivate; +class QSqlError; +class QSqlField; +class QSqlIndex; +class QSqlRecord; +class QSqlResult; +class QVariant; + +class Q_SQL_EXPORT QSqlDriver : public QObject +{ + friend class QSqlDatabase; + Q_OBJECT + Q_DECLARE_PRIVATE(QSqlDriver) + +public: + enum DriverFeature { Transactions, QuerySize, BLOB, Unicode, PreparedQueries, + NamedPlaceholders, PositionalPlaceholders, LastInsertId, + BatchOperations, SimpleLocking, LowPrecisionNumbers, + EventNotifications, FinishQuery, MultipleResultSets }; + + enum StatementType { WhereStatement, SelectStatement, UpdateStatement, + InsertStatement, DeleteStatement }; + + enum IdentifierType { FieldName, TableName }; + + explicit QSqlDriver(QObject *parent=0); + ~QSqlDriver(); + virtual bool isOpen() const; + bool isOpenError() const; + + virtual bool beginTransaction(); + virtual bool commitTransaction(); + virtual bool rollbackTransaction(); + virtual QStringList tables(QSql::TableType tableType) const; + virtual QSqlIndex primaryIndex(const QString &tableName) const; + virtual QSqlRecord record(const QString &tableName) const; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QSqlRecord record(const QSqlQuery& query) const + { return query.record(); } + inline QT3_SUPPORT QSqlRecord recordInfo(const QString& tablename) const + { return record(tablename); } + inline QT3_SUPPORT QSqlRecord recordInfo(const QSqlQuery& query) const + { return query.record(); } + inline QT3_SUPPORT QString nullText() const { return QLatin1String("NULL"); } + inline QT3_SUPPORT QString formatValue(const QSqlField *field, bool trimStrings = false) const + { return field ? formatValue(*field, trimStrings) : QString(); } +#endif + virtual QString formatValue(const QSqlField& field, bool trimStrings = false) const; + + virtual QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + virtual QString sqlStatement(StatementType type, const QString &tableName, + const QSqlRecord &rec, bool preparedStatement) const; + + QSqlError lastError() const; + + virtual QVariant handle() const; + virtual bool hasFeature(DriverFeature f) const = 0; + virtual void close() = 0; + virtual QSqlResult *createResult() const = 0; + + virtual bool open(const QString& db, + const QString& user = QString(), + const QString& password = QString(), + const QString& host = QString(), + int port = -1, + const QString& connOpts = QString()) = 0; + bool subscribeToNotification(const QString &name); // ### Qt 5: make virtual + bool unsubscribeFromNotification(const QString &name); // ### Qt 5: make virtual + QStringList subscribedToNotifications() const; // ### Qt 5: make virtual + + bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual + QString stripDelimiters(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual + + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; + +Q_SIGNALS: + void notification(const QString &name); + +protected: + virtual void setOpen(bool o); + virtual void setOpenError(bool e); + virtual void setLastError(const QSqlError& e); + +protected Q_SLOTS: + bool subscribeToNotificationImplementation(const QString &name); // ### Qt 5: eliminate, see subscribeToNotification() + bool unsubscribeFromNotificationImplementation(const QString &name); // ### Qt 5: eliminate, see unsubscribeFromNotification() + QStringList subscribedToNotificationsImplementation() const; // ### Qt 5: eliminate, see subscribedNotifications() + + bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; // ### Qt 5: eliminate, see isIdentifierEscaped() + QString stripDelimitersImplementation(const QString &identifier, IdentifierType type) const; // ### Qt 5: eliminate, see stripDelimiters() + +private: + Q_DISABLE_COPY(QSqlDriver) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLDRIVER_H diff --git a/qtinterface/qt4/Qt/qsqldriverplugin.h b/qtinterface/qt4/Qt/qsqldriverplugin.h new file mode 100644 index 0000000..1a50c17 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqldriverplugin.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLDRIVERPLUGIN_H +#define QSQLDRIVERPLUGIN_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlDriver; + +struct Q_SQL_EXPORT QSqlDriverFactoryInterface : public QFactoryInterface +{ + virtual QSqlDriver *create(const QString &name) = 0; +}; + +#define QSqlDriverFactoryInterface_iid "com.trolltech.Qt.QSqlDriverFactoryInterface" +Q_DECLARE_INTERFACE(QSqlDriverFactoryInterface, QSqlDriverFactoryInterface_iid) + +class Q_SQL_EXPORT QSqlDriverPlugin : public QObject, public QSqlDriverFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QSqlDriverFactoryInterface:QFactoryInterface) +public: + explicit QSqlDriverPlugin(QObject *parent = 0); + ~QSqlDriverPlugin(); + + virtual QStringList keys() const = 0; + virtual QSqlDriver *create(const QString &key) = 0; + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLDRIVERPLUGIN_H diff --git a/qtinterface/qt4/Qt/qsqlerror.h b/qtinterface/qt4/Qt/qsqlerror.h new file mode 100644 index 0000000..ec73d86 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlerror.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLERROR_H +#define QSQLERROR_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class Q_SQL_EXPORT QSqlError +{ +public: + enum ErrorType { + NoError, + ConnectionError, + StatementError, + TransactionError, + UnknownError +#ifdef QT3_SUPPORT + , None = NoError, + Connection = ConnectionError, + Statement = StatementError, + Transaction = TransactionError, + Unknown = UnknownError +#endif + }; + QSqlError( const QString& driverText = QString(), + const QString& databaseText = QString(), + ErrorType type = NoError, + int number = -1); + QSqlError(const QSqlError& other); + QSqlError& operator=(const QSqlError& other); + ~QSqlError(); + + QString driverText() const; + void setDriverText(const QString& driverText); + QString databaseText() const; + void setDatabaseText(const QString& databaseText); + ErrorType type() const; + void setType(ErrorType type); + int number() const; + void setNumber(int number); + QString text() const; + bool isValid() const; + +private: + QString driverError; + QString databaseError; + ErrorType errorType; + int errorNumber; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlError &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLERROR_H diff --git a/qtinterface/qt4/Qt/qsqlfield.h b/qtinterface/qt4/Qt/qsqlfield.h new file mode 100644 index 0000000..483dc2d --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlfield.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLFIELD_H +#define QSQLFIELD_H + +#include <QtCore/qvariant.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlFieldPrivate; + +class Q_SQL_EXPORT QSqlField +{ +public: + enum RequiredStatus { Unknown = -1, Optional = 0, Required = 1 }; + + QSqlField(const QString& fieldName = QString(), + QVariant::Type type = QVariant::Invalid); + + QSqlField(const QSqlField& other); + QSqlField& operator=(const QSqlField& other); + bool operator==(const QSqlField& other) const; + inline bool operator!=(const QSqlField &other) const { return !operator==(other); } + ~QSqlField(); + + void setValue(const QVariant& value); + inline QVariant value() const + { return val; } + void setName(const QString& name); + QString name() const; + bool isNull() const; + void setReadOnly(bool readOnly); + bool isReadOnly() const; + void clear(); + QVariant::Type type() const; + bool isAutoValue() const; + + void setType(QVariant::Type type); + void setRequiredStatus(RequiredStatus status); + inline void setRequired(bool required) + { setRequiredStatus(required ? Required : Optional); } + void setLength(int fieldLength); + void setPrecision(int precision); + void setDefaultValue(const QVariant &value); + void setSqlType(int type); + void setGenerated(bool gen); + void setAutoValue(bool autoVal); + + RequiredStatus requiredStatus() const; + int length() const; + int precision() const; + QVariant defaultValue() const; + int typeID() const; + bool isGenerated() const; + bool isValid() const; + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT void setNull() { clear(); } +#endif + +private: + void detach(); + QVariant val; + QSqlFieldPrivate* d; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlField &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLFIELD_H diff --git a/qtinterface/qt4/Qt/qsqlindex.h b/qtinterface/qt4/Qt/qsqlindex.h new file mode 100644 index 0000000..135e651 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlindex.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLINDEX_H +#define QSQLINDEX_H + +#include <QtSql/qsqlrecord.h> +#include <QtCore/qstring.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class Q_SQL_EXPORT QSqlIndex : public QSqlRecord +{ +public: + QSqlIndex(const QString &cursorName = QString(), const QString &name = QString()); + QSqlIndex(const QSqlIndex &other); + ~QSqlIndex(); + QSqlIndex &operator=(const QSqlIndex &other); + void setCursorName(const QString &cursorName); + inline QString cursorName() const { return cursor; } + void setName(const QString& name); + inline QString name() const { return nm; } + + void append(const QSqlField &field); + void append(const QSqlField &field, bool desc); + + bool isDescending(int i) const; + void setDescending(int i, bool desc); + +#ifdef QT3_SUPPORT + QT3_SUPPORT QString toString(const QString &prefix = QString(), + const QString &sep = QLatin1String(","), + bool verbose = true) const; + QT3_SUPPORT QStringList toStringList(const QString& prefix = QString(), + bool verbose = true) const; +#endif + +private: + QString createField(int i, const QString& prefix, bool verbose) const; + QString cursor; + QString nm; + QList<bool> sorts; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLINDEX_H diff --git a/qtinterface/qt4/Qt/qsqlquery.h b/qtinterface/qt4/Qt/qsqlquery.h new file mode 100644 index 0000000..fb24d0f --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlquery.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLQUERY_H +#define QSQLQUERY_H + +#include <QtSql/qsql.h> +#include <QtSql/qsqldatabase.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QVariant; +class QSqlDriver; +class QSqlError; +class QSqlResult; +class QSqlRecord; +template <class Key, class T> class QMap; +class QSqlQueryPrivate; + +class Q_SQL_EXPORT QSqlQuery +{ +public: + QSqlQuery(QSqlResult *r); + QSqlQuery(const QString& query = QString(), QSqlDatabase db = QSqlDatabase()); + explicit QSqlQuery(QSqlDatabase db); + QSqlQuery(const QSqlQuery& other); + QSqlQuery& operator=(const QSqlQuery& other); + ~QSqlQuery(); + + bool isValid() const; + bool isActive() const; + bool isNull(int field) const; + int at() const; + QString lastQuery() const; + int numRowsAffected() const; + QSqlError lastError() const; + bool isSelect() const; + int size() const; + const QSqlDriver* driver() const; + const QSqlResult* result() const; + bool isForwardOnly() const; + QSqlRecord record() const; + + void setForwardOnly(bool forward); + bool exec(const QString& query); + QVariant value(int i) const; + + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; + + bool seek(int i, bool relative = false); + bool next(); + bool previous(); +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool prev() { return previous(); } +#endif + bool first(); + bool last(); + + void clear(); + + // prepared query support + bool exec(); + enum BatchExecutionMode { ValuesAsRows, ValuesAsColumns }; + bool execBatch(BatchExecutionMode mode = ValuesAsRows); + bool prepare(const QString& query); + void bindValue(const QString& placeholder, const QVariant& val, + QSql::ParamType type = QSql::In); + void bindValue(int pos, const QVariant& val, QSql::ParamType type = QSql::In); + void addBindValue(const QVariant& val, QSql::ParamType type = QSql::In); + QVariant boundValue(const QString& placeholder) const; + QVariant boundValue(int pos) const; + QMap<QString, QVariant> boundValues() const; + QString executedQuery() const; + QVariant lastInsertId() const; + void finish(); + bool nextResult(); + +private: + QSqlQueryPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLQUERY_H diff --git a/qtinterface/qt4/Qt/qsqlquerymodel.h b/qtinterface/qt4/Qt/qsqlquerymodel.h new file mode 100644 index 0000000..97081dd --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlquerymodel.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLQUERYMODEL_H +#define QSQLQUERYMODEL_H + +#include <QtCore/qabstractitemmodel.h> +#include <QtSql/qsqldatabase.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlQueryModelPrivate; +class QSqlError; +class QSqlRecord; +class QSqlQuery; + +class Q_SQL_EXPORT QSqlQueryModel: public QAbstractTableModel +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSqlQueryModel) + +public: + explicit QSqlQueryModel(QObject *parent = 0); + virtual ~QSqlQueryModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QSqlRecord record(int row) const; + QSqlRecord record() const; + + QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, + int role = Qt::EditRole); + + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + + void setQuery(const QSqlQuery &query); + void setQuery(const QString &query, const QSqlDatabase &db = QSqlDatabase()); + QSqlQuery query() const; + + virtual void clear(); + + QSqlError lastError() const; + + void fetchMore(const QModelIndex &parent = QModelIndex()); + bool canFetchMore(const QModelIndex &parent = QModelIndex()) const; + +protected: + virtual void queryChange(); + + QModelIndex indexInQuery(const QModelIndex &item) const; + void setLastError(const QSqlError &error); + QSqlQueryModel(QSqlQueryModelPrivate &dd, QObject *parent = 0); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLQUERYMODEL_H diff --git a/qtinterface/qt4/Qt/qsqlrecord.h b/qtinterface/qt4/Qt/qsqlrecord.h new file mode 100644 index 0000000..3f9aa49 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlrecord.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLRECORD_H +#define QSQLRECORD_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlField; +class QStringList; +class QVariant; +class QSqlRecordPrivate; + +class Q_SQL_EXPORT QSqlRecord +{ +public: + QSqlRecord(); + QSqlRecord(const QSqlRecord& other); + QSqlRecord& operator=(const QSqlRecord& other); + ~QSqlRecord(); + + bool operator==(const QSqlRecord &other) const; + inline bool operator!=(const QSqlRecord &other) const { return !operator==(other); } + + QVariant value(int i) const; + QVariant value(const QString& name) const; + void setValue(int i, const QVariant& val); + void setValue(const QString& name, const QVariant& val); + + void setNull(int i); + void setNull(const QString& name); + bool isNull(int i) const; + bool isNull(const QString& name) const; + + int indexOf(const QString &name) const; + QString fieldName(int i) const; + + QSqlField field(int i) const; + QSqlField field(const QString &name) const; + + bool isGenerated(int i) const; + bool isGenerated(const QString& name) const; + void setGenerated(const QString& name, bool generated); + void setGenerated(int i, bool generated); + +#ifdef QT3_SUPPORT + QT3_SUPPORT const QSqlField* fieldPtr(int i) const; + QT3_SUPPORT const QSqlField* fieldPtr(const QString& name) const; + inline QT3_SUPPORT int position(const QString& name) const { return indexOf(name); } + QT3_SUPPORT QString toString(const QString& prefix = QString(), + const QString& sep = QLatin1String(",")) const; + QT3_SUPPORT QStringList toStringList(const QString& prefix = QString()) const; +#endif + + void append(const QSqlField& field); + void replace(int pos, const QSqlField& field); + void insert(int pos, const QSqlField& field); + void remove(int pos); + + bool isEmpty() const; + bool contains(const QString& name) const; + void clear(); + void clearValues(); + int count() const; + +private: + void detach(); + QSqlRecordPrivate* d; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlRecord &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLRECORD_H diff --git a/qtinterface/qt4/Qt/qsqlrelationaldelegate.h b/qtinterface/qt4/Qt/qsqlrelationaldelegate.h new file mode 100644 index 0000000..46f1a31 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlrelationaldelegate.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLRELATIONALDELEGATE_H +#define QSQLRELATIONALDELEGATE_H + +#ifdef QT_GUI_LIB + +#include <QtGui/qitemdelegate.h> +#include <QtGui/qlistview.h> +#include <QtGui/qcombobox.h> +#include <QtSql/qsqlrelationaltablemodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlRelationalDelegate: public QItemDelegate +{ +public: + +explicit QSqlRelationalDelegate(QObject *parent = 0) + : QItemDelegate(parent) +{} + +~QSqlRelationalDelegate() +{} + +QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const +{ + const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model()); + QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0; + if (!childModel) + return QItemDelegate::createEditor(parent, option, index); + + QComboBox *combo = new QComboBox(parent); + combo->setModel(childModel); + combo->setModelColumn(childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn())); + combo->installEventFilter(const_cast<QSqlRelationalDelegate *>(this)); + + return combo; +} + +void setEditorData(QWidget *editor, const QModelIndex &index) const +{ + const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model()); + QComboBox *combo = qobject_cast<QComboBox *>(editor); + if (!sqlModel || !combo) { + QItemDelegate::setEditorData(editor, index); + return; + } + combo->setCurrentIndex(combo->findText(sqlModel->data(index).toString())); +} + +void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const +{ + if (!index.isValid()) + return; + + QSqlRelationalTableModel *sqlModel = qobject_cast<QSqlRelationalTableModel *>(model); + QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0; + QComboBox *combo = qobject_cast<QComboBox *>(editor); + if (!sqlModel || !childModel || !combo) { + QItemDelegate::setModelData(editor, model, index); + return; + } + + int currentItem = combo->currentIndex(); + int childColIndex = childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn()); + int childEditIndex = childModel->fieldIndex(sqlModel->relation(index.column()).indexColumn()); + sqlModel->setData(index, + childModel->data(childModel->index(currentItem, childColIndex), Qt::DisplayRole), + Qt::DisplayRole); + sqlModel->setData(index, + childModel->data(childModel->index(currentItem, childEditIndex), Qt::EditRole), + Qt::EditRole); +} + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_GUI_LIB + +#endif // QSQLRELATIONALDELEGATE_H diff --git a/qtinterface/qt4/Qt/qsqlrelationaltablemodel.h b/qtinterface/qt4/Qt/qsqlrelationaltablemodel.h new file mode 100644 index 0000000..39538ab --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlrelationaltablemodel.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLRELATIONALTABLEMODEL_H +#define QSQLRELATIONALTABLEMODEL_H + +#include <QtSql/qsqltablemodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class Q_SQL_EXPORT QSqlRelation +{ +public: + QSqlRelation() {} + QSqlRelation(const QString &aTableName, const QString &indexCol, + const QString &displayCol) + : tName(aTableName), iColumn(indexCol), dColumn(displayCol) {} + inline QString tableName() const + { return tName; } + inline QString indexColumn() const + { return iColumn; } + inline QString displayColumn() const + { return dColumn; } + inline bool isValid() const + { return !(tName.isEmpty() || iColumn.isEmpty() || dColumn.isEmpty()); } +private: + QString tName, iColumn, dColumn; +}; + +class QSqlRelationalTableModelPrivate; + +class Q_SQL_EXPORT QSqlRelationalTableModel: public QSqlTableModel +{ + Q_OBJECT + +public: + explicit QSqlRelationalTableModel(QObject *parent = 0, + QSqlDatabase db = QSqlDatabase()); + virtual ~QSqlRelationalTableModel(); + + QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &item, const QVariant &value, int role = Qt::EditRole); + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + + void clear(); + bool select(); + + void setTable(const QString &tableName); + virtual void setRelation(int column, const QSqlRelation &relation); + QSqlRelation relation(int column) const; + virtual QSqlTableModel *relationModel(int column) const; + +public Q_SLOTS: + void revertRow(int row); + +protected: + QString selectStatement() const; + bool updateRowInTable(int row, const QSqlRecord &values); + bool insertRowIntoTable(const QSqlRecord &values); + QString orderByClause() const; + +private: + Q_DECLARE_PRIVATE(QSqlRelationalTableModel) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLRELATIONALTABLEMODEL_H diff --git a/qtinterface/qt4/Qt/qsqlresult.h b/qtinterface/qt4/Qt/qsqlresult.h new file mode 100644 index 0000000..6400739 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqlresult.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLRESULT_H +#define QSQLRESULT_H + +#include <QtCore/qvariant.h> +#include <QtCore/qvector.h> +#include <QtSql/qsql.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QString; +class QSqlRecord; +template <typename T> class QVector; +class QVariant; +class QSqlDriver; +class QSqlError; +class QSqlResultPrivate; + +class Q_SQL_EXPORT QSqlResult +{ + friend class QSqlQuery; + friend class QSqlTableModelPrivate; + friend class QSqlResultPrivate; + +public: + virtual ~QSqlResult(); + virtual QVariant handle() const; + +protected: + enum BindingSyntax { + PositionalBinding, + NamedBinding +#ifdef QT3_SUPPORT + , BindByPosition = PositionalBinding, + BindByName = NamedBinding +#endif + }; + + explicit QSqlResult(const QSqlDriver * db); + int at() const; + QString lastQuery() const; + QSqlError lastError() const; + bool isValid() const; + bool isActive() const; + bool isSelect() const; + bool isForwardOnly() const; + const QSqlDriver* driver() const; + virtual void setAt(int at); + virtual void setActive(bool a); + virtual void setLastError(const QSqlError& e); + virtual void setQuery(const QString& query); + virtual void setSelect(bool s); + virtual void setForwardOnly(bool forward); + + // prepared query support + virtual bool exec(); + virtual bool prepare(const QString& query); + virtual bool savePrepare(const QString& sqlquery); + virtual void bindValue(int pos, const QVariant& val, QSql::ParamType type); + virtual void bindValue(const QString& placeholder, const QVariant& val, + QSql::ParamType type); + void addBindValue(const QVariant& val, QSql::ParamType type); + QVariant boundValue(const QString& placeholder) const; + QVariant boundValue(int pos) const; + QSql::ParamType bindValueType(const QString& placeholder) const; + QSql::ParamType bindValueType(int pos) const; + int boundValueCount() const; + QVector<QVariant>& boundValues() const; + QString executedQuery() const; + QString boundValueName(int pos) const; + void clear(); + bool hasOutValues() const; + + BindingSyntax bindingSyntax() const; + + virtual QVariant data(int i) = 0; + virtual bool isNull(int i) = 0; + virtual bool reset(const QString& sqlquery) = 0; + virtual bool fetch(int i) = 0; + virtual bool fetchNext(); + virtual bool fetchPrevious(); + virtual bool fetchFirst() = 0; + virtual bool fetchLast() = 0; + virtual int size() = 0; + virtual int numRowsAffected() = 0; + virtual QSqlRecord record() const; + virtual QVariant lastInsertId() const; + + enum VirtualHookOperation { BatchOperation, DetachFromResultSet, SetNumericalPrecision, NextResult }; + virtual void virtual_hook(int id, void *data); + bool execBatch(bool arrayBind = false); + void detachFromResultSet(); + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; + bool nextResult(); + +private: + QSqlResultPrivate* d; + void resetBindCount(); // HACK + +private: + Q_DISABLE_COPY(QSqlResult) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLRESULT_H diff --git a/qtinterface/qt4/Qt/qsqltablemodel.h b/qtinterface/qt4/Qt/qsqltablemodel.h new file mode 100644 index 0000000..8c83c93 --- /dev/null +++ b/qtinterface/qt4/Qt/qsqltablemodel.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLTABLEMODEL_H +#define QSQLTABLEMODEL_H + +#include <QtSql/qsqldatabase.h> +#include <QtSql/qsqlquerymodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Sql) + +class QSqlTableModelPrivate; +class QSqlRecord; +class QSqlField; +class QSqlIndex; + +class Q_SQL_EXPORT QSqlTableModel: public QSqlQueryModel +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSqlTableModel) + +public: + enum EditStrategy {OnFieldChange, OnRowChange, OnManualSubmit}; + + explicit QSqlTableModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()); + virtual ~QSqlTableModel(); + + virtual bool select(); + + virtual void setTable(const QString &tableName); + QString tableName() const; + + Qt::ItemFlags flags(const QModelIndex &index) const; + + QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + + bool isDirty(const QModelIndex &index) const; + void clear(); + + virtual void setEditStrategy(EditStrategy strategy); + EditStrategy editStrategy() const; + + QSqlIndex primaryKey() const; + QSqlDatabase database() const; + int fieldIndex(const QString &fieldName) const; + + void sort(int column, Qt::SortOrder order); + virtual void setSort(int column, Qt::SortOrder order); + + QString filter() const; + virtual void setFilter(const QString &filter); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + + bool insertRecord(int row, const QSqlRecord &record); + bool setRecord(int row, const QSqlRecord &record); + + virtual void revertRow(int row); + +public Q_SLOTS: + bool submit(); + void revert(); + + bool submitAll(); + void revertAll(); + +Q_SIGNALS: + void primeInsert(int row, QSqlRecord &record); + + void beforeInsert(QSqlRecord &record); + void beforeUpdate(int row, QSqlRecord &record); + void beforeDelete(int row); + +protected: + QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent = 0, QSqlDatabase db = QSqlDatabase()); + + virtual bool updateRowInTable(int row, const QSqlRecord &values); + virtual bool insertRowIntoTable(const QSqlRecord &values); + virtual bool deleteRowFromTable(int row); + virtual QString orderByClause() const; + virtual QString selectStatement() const; + + void setPrimaryKey(const QSqlIndex &key); + void setQuery(const QSqlQuery &query); + QModelIndex indexInQuery(const QModelIndex &item) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSQLTABLEMODEL_H diff --git a/qtinterface/qt4/Qt/qssl.h b/qtinterface/qt4/Qt/qssl.h new file mode 100644 index 0000000..5a85b4c --- /dev/null +++ b/qtinterface/qt4/Qt/qssl.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QSSL_H +#define QSSL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +namespace QSsl { + enum KeyType { + PrivateKey, + PublicKey + }; + + enum EncodingFormat { + Pem, + Der + }; + + enum KeyAlgorithm { + Rsa, + Dsa + }; + + enum AlternateNameEntryType { + EmailEntry, + DnsEntry + }; + + enum SslProtocol { + SslV3, + SslV2, + TlsV1, + AnyProtocol, + UnknownProtocol = -1 + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSSL_H diff --git a/qtinterface/qt4/Qt/qsslcertificate.h b/qtinterface/qt4/Qt/qsslcertificate.h new file mode 100644 index 0000000..c6b1bf2 --- /dev/null +++ b/qtinterface/qt4/Qt/qsslcertificate.h @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QSSLCERTIFICATE_H +#define QSSLCERTIFICATE_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qcryptographichash.h> +#include <QtCore/qregexp.h> +#include <QtCore/qsharedpointer.h> +#include <QtNetwork/qssl.h> + +typedef struct x509_st X509; // ### check if this works + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_OPENSSL + +class QDateTime; +class QIODevice; +class QSslKey; +class QStringList; +template <typename T, typename U> class QMultiMap; + +class QSslCertificatePrivate; +class Q_NETWORK_EXPORT QSslCertificate +{ +public: + enum SubjectInfo { + Organization, + CommonName, + LocalityName, + OrganizationalUnitName, + CountryName, + StateOrProvinceName + }; + + QSslCertificate(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); + QSslCertificate( // ### s/encoded/data (to be consistent with signature in .cpp file) ? + const QByteArray &encoded = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem); + QSslCertificate(const QSslCertificate &other); + ~QSslCertificate(); + QSslCertificate &operator=(const QSslCertificate &other); + bool operator==(const QSslCertificate &other) const; + inline bool operator!=(const QSslCertificate &other) const { return !operator==(other); } + + bool isNull() const; + bool isValid() const; + void clear(); + + // Certificate info + QByteArray version() const; + QByteArray serialNumber() const; + QByteArray digest(QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5) const; + QString issuerInfo(SubjectInfo info) const; + QString issuerInfo(const QByteArray &tag) const; + QString subjectInfo(SubjectInfo info) const; + QString subjectInfo(const QByteArray &tag) const; + QMultiMap<QSsl::AlternateNameEntryType, QString> alternateSubjectNames() const; + QDateTime effectiveDate() const; + QDateTime expiryDate() const; + QSslKey publicKey() const; + + QByteArray toPem() const; + QByteArray toDer() const; + + static QList<QSslCertificate> fromPath( + const QString &path, QSsl::EncodingFormat format = QSsl::Pem, + QRegExp::PatternSyntax syntax = QRegExp::FixedString); + static QList<QSslCertificate> fromDevice( + QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); + static QList<QSslCertificate> fromData( + const QByteArray &data, QSsl::EncodingFormat format = QSsl::Pem); + + Qt::HANDLE handle() const; + +private: + QExplicitlySharedDataPointer<QSslCertificatePrivate> d; + friend class QSslCertificatePrivate; + friend class QSslSocketBackendPrivate; +}; + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslCertificate &certificate); +Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QSslCertificate::SubjectInfo info); +#endif + +#endif // QT_NO_OPENSSL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsslcipher.h b/qtinterface/qt4/Qt/qsslcipher.h new file mode 100644 index 0000000..a056358 --- /dev/null +++ b/qtinterface/qt4/Qt/qsslcipher.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QSSLCIPHER_H +#define QSSLCIPHER_H + +#include <QtCore/qstring.h> +#include <QtCore/qscopedpointer.h> +#include <QtNetwork/qssl.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_OPENSSL + +class QSslCipherPrivate; +class Q_NETWORK_EXPORT QSslCipher +{ +public: + QSslCipher(); + QSslCipher(const QString &name, QSsl::SslProtocol protocol); + QSslCipher(const QSslCipher &other); + ~QSslCipher(); + QSslCipher &operator=(const QSslCipher &other); + bool operator==(const QSslCipher &other) const; + inline bool operator!=(const QSslCipher &other) const { return !operator==(other); } + + bool isNull() const; + QString name() const; + int supportedBits() const; + int usedBits() const; + + QString keyExchangeMethod() const; + QString authenticationMethod() const; + QString encryptionMethod() const; + QString protocolString() const; + QSsl::SslProtocol protocol() const; + +private: + QScopedPointer<QSslCipherPrivate> d; + friend class QSslSocketBackendPrivate; +}; + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslCipher &cipher); +#endif + +#endif // QT_NO_OPENSSL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qsslconfiguration.h b/qtinterface/qt4/Qt/qsslconfiguration.h new file mode 100644 index 0000000..8e3ae4b --- /dev/null +++ b/qtinterface/qt4/Qt/qsslconfiguration.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** In addition, as a special exception, Nokia gives permission to link +** the code of its release of Qt with the OpenSSL project's "OpenSSL" library +** (or modified versions of the "OpenSSL" library that use the same license +** as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ + +#ifndef QSSLCONFIGURATION_H +#define QSSLCONFIGURATION_H + +#include <QtCore/qshareddata.h> +#include <QtNetwork/qsslsocket.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_OPENSSL + +template<typename T> class QList; +class QSslCertificate; +class QSslCipher; +class QSslKey; + +class QSslConfigurationPrivate; +class Q_NETWORK_EXPORT QSslConfiguration +{ +public: + QSslConfiguration(); + QSslConfiguration(const QSslConfiguration &other); + ~QSslConfiguration(); + QSslConfiguration &operator=(const QSslConfiguration &other); + + bool operator==(const QSslConfiguration &other) const; + inline bool operator!=(const QSslConfiguration &other) const + { return !(*this == other); } + + bool isNull() const; + + QSsl::SslProtocol protocol() const; + void setProtocol(QSsl::SslProtocol protocol); + + // Verification + QSslSocket::PeerVerifyMode peerVerifyMode() const; + void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode); + + int peerVerifyDepth() const; + void setPeerVerifyDepth(int depth); + + // Certificate & cipher configuration + QSslCertificate localCertificate() const; + void setLocalCertificate(const QSslCertificate &certificate); + + QSslCertificate peerCertificate() const; + QList<QSslCertificate> peerCertificateChain() const; + QSslCipher sessionCipher() const; + + // Private keys, for server sockets + QSslKey privateKey() const; + void setPrivateKey(const QSslKey &key); + + // Cipher settings + QList<QSslCipher> ciphers() const; + void setCiphers(const QList<QSslCipher> &ciphers); + + // Certificate Authority (CA) settings + QList<QSslCertificate> caCertificates() const; + void setCaCertificates(const QList<QSslCertificate> &certificates); + + static QSslConfiguration defaultConfiguration(); + static void setDefaultConfiguration(const QSslConfiguration &configuration); + +private: + friend class QSslSocket; + friend class QSslConfigurationPrivate; + QSslConfiguration(QSslConfigurationPrivate *dd); + QSharedDataPointer<QSslConfigurationPrivate> d; +}; + +#endif // QT_NO_OPENSSL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsslerror.h b/qtinterface/qt4/Qt/qsslerror.h new file mode 100644 index 0000000..1cf18ba --- /dev/null +++ b/qtinterface/qt4/Qt/qsslerror.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QSSLERROR_H +#define QSSLERROR_H + +#include <QtCore/qvariant.h> +#include <QtNetwork/qsslcertificate.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_OPENSSL + +class QSslErrorPrivate; +class Q_NETWORK_EXPORT QSslError +{ +public: + enum SslError { + NoError, + UnableToGetIssuerCertificate, + UnableToDecryptCertificateSignature, + UnableToDecodeIssuerPublicKey, + CertificateSignatureFailed, + CertificateNotYetValid, + CertificateExpired, + InvalidNotBeforeField, + InvalidNotAfterField, + SelfSignedCertificate, + SelfSignedCertificateInChain, + UnableToGetLocalIssuerCertificate, + UnableToVerifyFirstCertificate, + CertificateRevoked, + InvalidCaCertificate, + PathLengthExceeded, + InvalidPurpose, + CertificateUntrusted, + CertificateRejected, + SubjectIssuerMismatch, // hostname mismatch? + AuthorityIssuerSerialNumberMismatch, + NoPeerCertificate, + HostNameMismatch, + NoSslSupport, + UnspecifiedError = -1 + }; + + // RVCT compiler in debug build does not like about default values in const- + // So as an workaround we define all constructor overloads here explicitly + QSslError(); + QSslError(SslError error); + QSslError(SslError error, const QSslCertificate &certificate); + + QSslError(const QSslError &other); + + ~QSslError(); + QSslError &operator=(const QSslError &other); + bool operator==(const QSslError &other) const; + inline bool operator!=(const QSslError &other) const + { return !(*this == other); } + + SslError error() const; + QString errorString() const; + QSslCertificate certificate() const; + +private: + QScopedPointer<QSslErrorPrivate> d; +}; + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +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 + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsslkey.h b/qtinterface/qt4/Qt/qsslkey.h new file mode 100644 index 0000000..4050763 --- /dev/null +++ b/qtinterface/qt4/Qt/qsslkey.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QSSLKEY_H +#define QSSLKEY_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qsharedpointer.h> +#include <QtNetwork/qssl.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_OPENSSL + +template <typename A, typename B> struct QPair; + +class QIODevice; + +class QSslKeyPrivate; +class Q_NETWORK_EXPORT QSslKey +{ +public: + QSslKey(); + QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm, + QSsl::EncodingFormat format = QSsl::Pem, + QSsl::KeyType type = QSsl::PrivateKey, + const QByteArray &passPhrase = QByteArray()); + QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, + QSsl::EncodingFormat format = QSsl::Pem, + QSsl::KeyType type = QSsl::PrivateKey, + const QByteArray &passPhrase = QByteArray()); + QSslKey(const QSslKey &other); + ~QSslKey(); + QSslKey &operator=(const QSslKey &other); + + bool isNull() const; + void clear(); + + int length() const; + QSsl::KeyType type() const; + QSsl::KeyAlgorithm algorithm() const; + + QByteArray toPem(const QByteArray &passPhrase = QByteArray()) const; + QByteArray toDer(const QByteArray &passPhrase = QByteArray()) const; + + Qt::HANDLE handle() const; + + bool operator==(const QSslKey &key) const; + inline bool operator!=(const QSslKey &key) const { return !operator==(key); } + +private: + QExplicitlySharedDataPointer<QSslKeyPrivate> d; + friend class QSslCertificate; +}; + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslKey &key); +#endif + +#endif // QT_NO_OPENSSL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qsslsocket.h b/qtinterface/qt4/Qt/qsslsocket.h new file mode 100644 index 0000000..6673b3f --- /dev/null +++ b/qtinterface/qt4/Qt/qsslsocket.h @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QSSLSOCKET_H +#define QSSLSOCKET_H + +#include <QtCore/qlist.h> +#include <QtCore/qregexp.h> +#ifndef QT_NO_OPENSSL +# include <QtNetwork/qtcpsocket.h> +# include <QtNetwork/qsslerror.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_OPENSSL + +class QDir; +class QSslCipher; +class QSslCertificate; +class QSslConfiguration; + +class QSslSocketPrivate; +class Q_NETWORK_EXPORT QSslSocket : public QTcpSocket +{ + Q_OBJECT +public: + enum SslMode { + UnencryptedMode, + SslClientMode, + SslServerMode + }; + + enum PeerVerifyMode { + VerifyNone, + QueryPeer, + VerifyPeer, + AutoVerifyPeer + }; + + QSslSocket(QObject *parent = 0); + ~QSslSocket(); + + // Autostarting the SSL client handshake. + void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite); + void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode = ReadWrite); + bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState, + OpenMode openMode = ReadWrite); + + // ### Qt 5: Make virtual + void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + QVariant socketOption(QAbstractSocket::SocketOption option); + + SslMode mode() const; + bool isEncrypted() const; + + QSsl::SslProtocol protocol() const; + void setProtocol(QSsl::SslProtocol protocol); + + QSslSocket::PeerVerifyMode peerVerifyMode() const; + void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode); + + int peerVerifyDepth() const; + void setPeerVerifyDepth(int depth); + + // From QIODevice + qint64 bytesAvailable() const; + qint64 bytesToWrite() const; + bool canReadLine() const; + void close(); + bool atEnd() const; + bool flush(); + void abort(); + + // From QAbstractSocket: + void setReadBufferSize(qint64 size); + + // Similar to QIODevice's: + qint64 encryptedBytesAvailable() const; + qint64 encryptedBytesToWrite() const; + + // SSL configuration + QSslConfiguration sslConfiguration() const; + void setSslConfiguration(const QSslConfiguration &config); + + // Certificate & cipher accessors. + void setLocalCertificate(const QSslCertificate &certificate); + void setLocalCertificate(const QString &fileName, QSsl::EncodingFormat format = QSsl::Pem); + QSslCertificate localCertificate() const; + QSslCertificate peerCertificate() const; + QList<QSslCertificate> peerCertificateChain() const; + QSslCipher sessionCipher() const; + + // Private keys, for server sockets. + void setPrivateKey(const QSslKey &key); + void setPrivateKey(const QString &fileName, QSsl::KeyAlgorithm algorithm = QSsl::Rsa, + QSsl::EncodingFormat format = QSsl::Pem, + const QByteArray &passPhrase = QByteArray()); + QSslKey privateKey() const; + + // Cipher settings. + QList<QSslCipher> ciphers() const; + void setCiphers(const QList<QSslCipher> &ciphers); + void setCiphers(const QString &ciphers); + static void setDefaultCiphers(const QList<QSslCipher> &ciphers); + static QList<QSslCipher> defaultCiphers(); + static QList<QSslCipher> supportedCiphers(); + + // CA settings. + bool addCaCertificates(const QString &path, QSsl::EncodingFormat format = QSsl::Pem, + QRegExp::PatternSyntax syntax = QRegExp::FixedString); + void addCaCertificate(const QSslCertificate &certificate); + void addCaCertificates(const QList<QSslCertificate> &certificates); + void setCaCertificates(const QList<QSslCertificate> &certificates); + QList<QSslCertificate> caCertificates() const; + static bool addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat format = QSsl::Pem, + QRegExp::PatternSyntax syntax = QRegExp::FixedString); + static void addDefaultCaCertificate(const QSslCertificate &certificate); + static void addDefaultCaCertificates(const QList<QSslCertificate> &certificates); + static void setDefaultCaCertificates(const QList<QSslCertificate> &certificates); + static QList<QSslCertificate> defaultCaCertificates(); + static QList<QSslCertificate> systemCaCertificates(); + + bool waitForConnected(int msecs = 30000); + bool waitForEncrypted(int msecs = 30000); + bool waitForReadyRead(int msecs = 30000); + bool waitForBytesWritten(int msecs = 30000); + bool waitForDisconnected(int msecs = 30000); + + QList<QSslError> sslErrors() const; + + static bool supportsSsl(); + void ignoreSslErrors(const QList<QSslError> &errors); + +public Q_SLOTS: + void startClientEncryption(); + void startServerEncryption(); + void ignoreSslErrors(); + +Q_SIGNALS: + void encrypted(); + void peerVerifyError(const QSslError &error); + void sslErrors(const QList<QSslError> &errors); + 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); + +private: + Q_DECLARE_PRIVATE(QSslSocket) + Q_DISABLE_COPY(QSslSocket) + Q_PRIVATE_SLOT(d_func(), void _q_connectedSlot()) + Q_PRIVATE_SLOT(d_func(), void _q_hostFoundSlot()) + Q_PRIVATE_SLOT(d_func(), void _q_disconnectedSlot()) + Q_PRIVATE_SLOT(d_func(), void _q_stateChangedSlot(QAbstractSocket::SocketState)) + Q_PRIVATE_SLOT(d_func(), void _q_errorSlot(QAbstractSocket::SocketError)) + Q_PRIVATE_SLOT(d_func(), void _q_readyReadSlot()) + Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64)) + Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) + Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) + friend class QSslSocketBackendPrivate; +}; + +#endif // QT_NO_OPENSSL + +QT_END_NAMESPACE + +#ifndef QT_NO_OPENSSL +Q_DECLARE_METATYPE(QList<QSslError>) +#endif + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qstack.h b/qtinterface/qt4/Qt/qstack.h new file mode 100644 index 0000000..5a18b3d --- /dev/null +++ b/qtinterface/qt4/Qt/qstack.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTACK_H +#define QSTACK_H + +#include <QtCore/qvector.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template<class T> +class QStack : public QVector<T> +{ +public: + inline QStack() {} + inline ~QStack() {} + inline void push(const T &t) { QVector<T>::append(t); } + T pop(); + T &top(); + const T &top() const; +}; + +template<class T> +inline T QStack<T>::pop() +{ Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1]; + this->resize(this->size()-1); return t; } + +template<class T> +inline T &QStack<T>::top() +{ Q_ASSERT(!this->isEmpty()); this->detach(); return this->data()[this->size()-1]; } + +template<class T> +inline const T &QStack<T>::top() const +{ Q_ASSERT(!this->isEmpty()); return this->data()[this->size()-1]; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTACK_H diff --git a/qtinterface/qt4/Qt/qstackedlayout.h b/qtinterface/qt4/Qt/qstackedlayout.h new file mode 100644 index 0000000..a59d550 --- /dev/null +++ b/qtinterface/qt4/Qt/qstackedlayout.h @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTACKEDLAYOUT_H +#define QSTACKEDLAYOUT_H + +#include <QtGui/qlayout.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStackedLayoutPrivate; + +class Q_GUI_EXPORT QStackedLayout : public QLayout +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QStackedLayout) + Q_ENUMS(StackingMode) + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) + Q_PROPERTY(StackingMode stackingMode READ stackingMode WRITE setStackingMode) + QDOC_PROPERTY(int count READ count) + +public: + enum StackingMode { + StackOne, + StackAll + }; + + QStackedLayout(); + explicit QStackedLayout(QWidget *parent); + explicit QStackedLayout(QLayout *parentLayout); + ~QStackedLayout(); + + int addWidget(QWidget *w); + int insertWidget(int index, QWidget *w); + + QWidget *currentWidget() const; + int currentIndex() const; +#ifdef Q_NO_USING_KEYWORD + inline QWidget *widget() { return QLayout::widget(); } +#else + using QLayout::widget; +#endif + QWidget *widget(int) const; + int count() const; + + StackingMode stackingMode() const; + void setStackingMode(StackingMode stackingMode); + + // abstract virtual functions: + void addItem(QLayoutItem *item); + QSize sizeHint() const; + QSize minimumSize() const; + QLayoutItem *itemAt(int) const; + QLayoutItem *takeAt(int); + void setGeometry(const QRect &rect); + +Q_SIGNALS: + void widgetRemoved(int index); + void currentChanged(int index); + +public Q_SLOTS: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *w); + +private: + Q_DISABLE_COPY(QStackedLayout) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTACKEDLAYOUT_H diff --git a/qtinterface/qt4/Qt/qstackedwidget.h b/qtinterface/qt4/Qt/qstackedwidget.h new file mode 100644 index 0000000..67ffc09 --- /dev/null +++ b/qtinterface/qt4/Qt/qstackedwidget.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTACKEDWIDGET_H +#define QSTACKEDWIDGET_H + +#include <QtGui/qframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_STACKEDWIDGET + +class QStackedWidgetPrivate; + +class Q_GUI_EXPORT QStackedWidget : public QFrame +{ + Q_OBJECT + + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) + Q_PROPERTY(int count READ count) +public: + explicit QStackedWidget(QWidget *parent=0); + ~QStackedWidget(); + + int addWidget(QWidget *w); + int insertWidget(int index, QWidget *w); + void removeWidget(QWidget *w); + + QWidget *currentWidget() const; + int currentIndex() const; + + int indexOf(QWidget *) const; + QWidget *widget(int) const; + int count() const; + +public Q_SLOTS: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *w); + +Q_SIGNALS: + void currentChanged(int); + void widgetRemoved(int index); + +protected: + bool event(QEvent *e); + +private: + Q_DISABLE_COPY(QStackedWidget) + Q_DECLARE_PRIVATE(QStackedWidget) +}; + +#endif // QT_NO_STACKEDWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTACKEDWIDGET_H diff --git a/qtinterface/qt4/Qt/qstandarditemmodel.h b/qtinterface/qt4/Qt/qstandarditemmodel.h new file mode 100644 index 0000000..3ac0714 --- /dev/null +++ b/qtinterface/qt4/Qt/qstandarditemmodel.h @@ -0,0 +1,456 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTANDARDITEMMODEL_H +#define QSTANDARDITEMMODEL_H + +#include <QtCore/qabstractitemmodel.h> +#include <QtGui/qbrush.h> +#include <QtGui/qfont.h> +#include <QtGui/qicon.h> +#ifndef QT_NO_DATASTREAM +#include <QtCore/qdatastream.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_STANDARDITEMMODEL + +template <class T> class QList; + +class QStandardItemModel; + +class QStandardItemPrivate; +class Q_GUI_EXPORT QStandardItem +{ +public: + QStandardItem(); + QStandardItem(const QString &text); + QStandardItem(const QIcon &icon, const QString &text); + explicit QStandardItem(int rows, int columns = 1); + virtual ~QStandardItem(); + + virtual QVariant data(int role = Qt::UserRole + 1) const; + virtual void setData(const QVariant &value, int role = Qt::UserRole + 1); + + inline QString text() const { + return qvariant_cast<QString>(data(Qt::DisplayRole)); + } + inline void setText(const QString &text); + + inline QIcon icon() const { + return qvariant_cast<QIcon>(data(Qt::DecorationRole)); + } + inline void setIcon(const QIcon &icon); + +#ifndef QT_NO_TOOLTIP + inline QString toolTip() const { + return qvariant_cast<QString>(data(Qt::ToolTipRole)); + } + inline void setToolTip(const QString &toolTip); +#endif + +#ifndef QT_NO_STATUSTIP + inline QString statusTip() const { + return qvariant_cast<QString>(data(Qt::StatusTipRole)); + } + inline void setStatusTip(const QString &statusTip); +#endif + +#ifndef QT_NO_WHATSTHIS + inline QString whatsThis() const { + return qvariant_cast<QString>(data(Qt::WhatsThisRole)); + } + inline void setWhatsThis(const QString &whatsThis); +#endif + + inline QSize sizeHint() const { + return qvariant_cast<QSize>(data(Qt::SizeHintRole)); + } + inline void setSizeHint(const QSize &sizeHint); + + inline QFont font() const { + return qvariant_cast<QFont>(data(Qt::FontRole)); + } + inline void setFont(const QFont &font); + + inline Qt::Alignment textAlignment() const { + return Qt::Alignment(qvariant_cast<int>(data(Qt::TextAlignmentRole))); + } + inline void setTextAlignment(Qt::Alignment textAlignment); + + inline QBrush background() const { + return qvariant_cast<QBrush>(data(Qt::BackgroundRole)); + } + inline void setBackground(const QBrush &brush); + + inline QBrush foreground() const { + return qvariant_cast<QBrush>(data(Qt::ForegroundRole)); + } + inline void setForeground(const QBrush &brush); + + inline Qt::CheckState checkState() const { + return Qt::CheckState(qvariant_cast<int>(data(Qt::CheckStateRole))); + } + inline void setCheckState(Qt::CheckState checkState); + + inline QString accessibleText() const { + return qvariant_cast<QString>(data(Qt::AccessibleTextRole)); + } + inline void setAccessibleText(const QString &accessibleText); + + inline QString accessibleDescription() const { + return qvariant_cast<QString>(data(Qt::AccessibleDescriptionRole)); + } + inline void setAccessibleDescription(const QString &accessibleDescription); + + Qt::ItemFlags flags() const; + void setFlags(Qt::ItemFlags flags); + + inline bool isEnabled() const { + return (flags() & Qt::ItemIsEnabled) != 0; + } + void setEnabled(bool enabled); + + inline bool isEditable() const { + return (flags() & Qt::ItemIsEditable) != 0; + } + void setEditable(bool editable); + + inline bool isSelectable() const { + return (flags() & Qt::ItemIsSelectable) != 0; + } + void setSelectable(bool selectable); + + inline bool isCheckable() const { + return (flags() & Qt::ItemIsUserCheckable) != 0; + } + void setCheckable(bool checkable); + + inline bool isTristate() const { + return (flags() & Qt::ItemIsTristate) != 0; + } + void setTristate(bool tristate); + +#ifndef QT_NO_DRAGANDDROP + inline bool isDragEnabled() const { + return (flags() & Qt::ItemIsDragEnabled) != 0; + } + void setDragEnabled(bool dragEnabled); + + inline bool isDropEnabled() const { + return (flags() & Qt::ItemIsDropEnabled) != 0; + } + void setDropEnabled(bool dropEnabled); +#endif // QT_NO_DRAGANDDROP + + QStandardItem *parent() const; + int row() const; + int column() const; + QModelIndex index() const; + QStandardItemModel *model() const; + + int rowCount() const; + void setRowCount(int rows); + int columnCount() const; + void setColumnCount(int columns); + + bool hasChildren() const; + QStandardItem *child(int row, int column = 0) const; + void setChild(int row, int column, QStandardItem *item); + inline void setChild(int row, QStandardItem *item); + + void insertRow(int row, const QList<QStandardItem*> &items); + void insertColumn(int column, const QList<QStandardItem*> &items); + void insertRows(int row, const QList<QStandardItem*> &items); + void insertRows(int row, int count); + void insertColumns(int column, int count); + + void removeRow(int row); + void removeColumn(int column); + void removeRows(int row, int count); + void removeColumns(int column, int count); + + inline void appendRow(const QList<QStandardItem*> &items); + inline void appendRows(const QList<QStandardItem*> &items); + inline void appendColumn(const QList<QStandardItem*> &items); + inline void insertRow(int row, QStandardItem *item); + inline void appendRow(QStandardItem *item); + + QStandardItem *takeChild(int row, int column = 0); + QList<QStandardItem*> takeRow(int row); + QList<QStandardItem*> takeColumn(int column); + + void sortChildren(int column, Qt::SortOrder order = Qt::AscendingOrder); + + virtual QStandardItem *clone() const; + + enum ItemType { Type = 0, UserType = 1000 }; + virtual int type() const; + +#ifndef QT_NO_DATASTREAM + virtual void read(QDataStream &in); + virtual void write(QDataStream &out) const; +#endif + virtual bool operator<(const QStandardItem &other) const; + +protected: + QStandardItem(const QStandardItem &other); + QStandardItem(QStandardItemPrivate &dd); + QStandardItem &operator=(const QStandardItem &other); + QScopedPointer<QStandardItemPrivate> d_ptr; + + void emitDataChanged(); + +private: + Q_DECLARE_PRIVATE(QStandardItem) + friend class QStandardItemModelPrivate; + friend class QStandardItemModel; +}; + +inline void QStandardItem::setText(const QString &atext) +{ setData(atext, Qt::DisplayRole); } + +inline void QStandardItem::setIcon(const QIcon &aicon) +{ setData(aicon, Qt::DecorationRole); } + +#ifndef QT_NO_TOOLTIP +inline void QStandardItem::setToolTip(const QString &atoolTip) +{ setData(atoolTip, Qt::ToolTipRole); } +#endif + +#ifndef QT_NO_STATUSTIP +inline void QStandardItem::setStatusTip(const QString &astatusTip) +{ setData(astatusTip, Qt::StatusTipRole); } +#endif + +#ifndef QT_NO_WHATSTHIS +inline void QStandardItem::setWhatsThis(const QString &awhatsThis) +{ setData(awhatsThis, Qt::WhatsThisRole); } +#endif + +inline void QStandardItem::setSizeHint(const QSize &asizeHint) +{ setData(asizeHint, Qt::SizeHintRole); } + +inline void QStandardItem::setFont(const QFont &afont) +{ setData(afont, Qt::FontRole); } + +inline void QStandardItem::setTextAlignment(Qt::Alignment atextAlignment) +{ setData(int(atextAlignment), Qt::TextAlignmentRole); } + +inline void QStandardItem::setBackground(const QBrush &abrush) +{ setData(abrush, Qt::BackgroundRole); } + +inline void QStandardItem::setForeground(const QBrush &abrush) +{ setData(abrush, Qt::ForegroundRole); } + +inline void QStandardItem::setCheckState(Qt::CheckState acheckState) +{ setData(acheckState, Qt::CheckStateRole); } + +inline void QStandardItem::setAccessibleText(const QString &aaccessibleText) +{ setData(aaccessibleText, Qt::AccessibleTextRole); } + +inline void QStandardItem::setAccessibleDescription(const QString &aaccessibleDescription) +{ setData(aaccessibleDescription, Qt::AccessibleDescriptionRole); } + +inline void QStandardItem::setChild(int arow, QStandardItem *aitem) +{ setChild(arow, 0, aitem); } + +inline void QStandardItem::appendRow(const QList<QStandardItem*> &aitems) +{ insertRow(rowCount(), aitems); } + +inline void QStandardItem::appendRows(const QList<QStandardItem*> &aitems) +{ insertRows(rowCount(), aitems); } + +inline void QStandardItem::appendColumn(const QList<QStandardItem*> &aitems) +{ insertColumn(columnCount(), aitems); } + +inline void QStandardItem::insertRow(int arow, QStandardItem *aitem) +{ insertRow(arow, QList<QStandardItem*>() << aitem); } + +inline void QStandardItem::appendRow(QStandardItem *aitem) +{ insertRow(rowCount(), aitem); } + +class QStandardItemModelPrivate; + +class Q_GUI_EXPORT QStandardItemModel : public QAbstractItemModel +{ + Q_OBJECT + Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole) + +public: + explicit QStandardItemModel(QObject *parent = 0); + QStandardItemModel(int rows, int columns, QObject *parent = 0); + ~QStandardItemModel(); + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &child) const; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, + int role = Qt::EditRole); + + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + + Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::DropActions supportedDropActions() const; + + QMap<int, QVariant> itemData(const QModelIndex &index) const; + bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles); + + void clear(); + +#ifdef Q_NO_USING_KEYWORD + inline QObject *parent() const { return QObject::parent(); } +#else + using QObject::parent; +#endif + + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + + QStandardItem *itemFromIndex(const QModelIndex &index) const; + QModelIndex indexFromItem(const QStandardItem *item) const; + + QStandardItem *item(int row, int column = 0) const; + void setItem(int row, int column, QStandardItem *item); + inline void setItem(int row, QStandardItem *item); + QStandardItem *invisibleRootItem() const; + + QStandardItem *horizontalHeaderItem(int column) const; + void setHorizontalHeaderItem(int column, QStandardItem *item); + QStandardItem *verticalHeaderItem(int row) const; + void setVerticalHeaderItem(int row, QStandardItem *item); + + void setHorizontalHeaderLabels(const QStringList &labels); + void setVerticalHeaderLabels(const QStringList &labels); + + void setRowCount(int rows); + void setColumnCount(int columns); + + void appendRow(const QList<QStandardItem*> &items); + void appendColumn(const QList<QStandardItem*> &items); + inline void appendRow(QStandardItem *item); + + void insertRow(int row, const QList<QStandardItem*> &items); + void insertColumn(int column, const QList<QStandardItem*> &items); + inline void insertRow(int row, QStandardItem *item); + + inline bool insertRow(int row, const QModelIndex &parent = QModelIndex()); + inline bool insertColumn(int column, const QModelIndex &parent = QModelIndex()); + + QStandardItem *takeItem(int row, int column = 0); + QList<QStandardItem*> takeRow(int row); + QList<QStandardItem*> takeColumn(int column); + + QStandardItem *takeHorizontalHeaderItem(int column); + QStandardItem *takeVerticalHeaderItem(int row); + + const QStandardItem *itemPrototype() const; + void setItemPrototype(const QStandardItem *item); + + QList<QStandardItem*> findItems(const QString &text, + Qt::MatchFlags flags = Qt::MatchExactly, + int column = 0) const; + + int sortRole() const; + void setSortRole(int role); + + QStringList mimeTypes() const; + QMimeData *mimeData(const QModelIndexList &indexes) const; + bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + +Q_SIGNALS: + void itemChanged(QStandardItem *item); + +protected: + QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent = 0); + +private: + friend class QStandardItemPrivate; + friend class QStandardItem; + Q_DISABLE_COPY(QStandardItemModel) + Q_DECLARE_PRIVATE(QStandardItemModel) + + Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &topLeft, + const QModelIndex &bottomRight)) +}; + +inline void QStandardItemModel::setItem(int arow, QStandardItem *aitem) +{ setItem(arow, 0, aitem); } + +inline void QStandardItemModel::appendRow(QStandardItem *aitem) +{ appendRow(QList<QStandardItem*>() << aitem); } + +inline void QStandardItemModel::insertRow(int arow, QStandardItem *aitem) +{ insertRow(arow, QList<QStandardItem*>() << aitem); } + +inline bool QStandardItemModel::insertRow(int arow, const QModelIndex &aparent) +{ return QAbstractItemModel::insertRow(arow, aparent); } +inline bool QStandardItemModel::insertColumn(int acolumn, const QModelIndex &aparent) +{ return QAbstractItemModel::insertColumn(acolumn, aparent); } + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QStandardItem &item); +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QStandardItem &item); +#endif + +#endif // QT_NO_STANDARDITEMMODEL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QSTANDARDITEMMODEL_H diff --git a/qtinterface/qt4/Qt/qstate.h b/qtinterface/qt4/Qt/qstate.h new file mode 100644 index 0000000..d860b76 --- /dev/null +++ b/qtinterface/qt4/Qt/qstate.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTATE_H +#define QSTATE_H + +#include <QtCore/qabstractstate.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QAbstractTransition; +class QSignalTransition; + +class QStatePrivate; +class Q_CORE_EXPORT QState : public QAbstractState +{ + Q_OBJECT + Q_PROPERTY(QAbstractState* initialState READ initialState WRITE setInitialState) + Q_PROPERTY(QAbstractState* errorState READ errorState WRITE setErrorState) + Q_PROPERTY(ChildMode childMode READ childMode WRITE setChildMode) + Q_ENUMS(ChildMode) +public: + enum ChildMode { + ExclusiveStates, + ParallelStates + }; + + QState(QState *parent = 0); + QState(ChildMode childMode, QState *parent = 0); + ~QState(); + + QAbstractState *errorState() const; + void setErrorState(QAbstractState *state); + + void addTransition(QAbstractTransition *transition); + QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target); + QAbstractTransition *addTransition(QAbstractState *target); + void removeTransition(QAbstractTransition *transition); + + QAbstractState *initialState() const; + void setInitialState(QAbstractState *state); + + ChildMode childMode() const; + void setChildMode(ChildMode mode); + +#ifndef QT_NO_PROPERTIES + void assignProperty(QObject *object, const char *name, + const QVariant &value); +#endif + +Q_SIGNALS: + void finished(); + void propertiesAssigned(); + +protected: + void onEntry(QEvent *event); + void onExit(QEvent *event); + + bool event(QEvent *e); + +protected: + QState(QStatePrivate &dd, QState *parent); + +private: + Q_DISABLE_COPY(QState) + Q_DECLARE_PRIVATE(QState) +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qstatemachine.h b/qtinterface/qt4/Qt/qstatemachine.h new file mode 100644 index 0000000..0b36998 --- /dev/null +++ b/qtinterface/qt4/Qt/qstatemachine.h @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTATEMACHINE_H +#define QSTATEMACHINE_H + +#include <QtCore/qstate.h> + +#include <QtCore/qcoreevent.h> +#include <QtCore/qlist.h> +#include <QtCore/qobject.h> +#include <QtCore/qset.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_STATEMACHINE + +class QStateMachinePrivate; +class QAbstractAnimation; +class Q_CORE_EXPORT QStateMachine : public QState +{ + Q_OBJECT + Q_PROPERTY(QString errorString READ errorString) + Q_PROPERTY(RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy) + Q_ENUMS(RestorePolicy) +#ifndef QT_NO_ANIMATION + Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) +#endif +public: + class Q_CORE_EXPORT SignalEvent : public QEvent + { + public: + SignalEvent(QObject *sender, int signalIndex, + const QList<QVariant> &arguments); + ~SignalEvent(); + + inline QObject *sender() const { return m_sender; } + inline int signalIndex() const { return m_signalIndex; } + inline QList<QVariant> arguments() const { return m_arguments; } + + private: + QObject *m_sender; + int m_signalIndex; + QList<QVariant> m_arguments; + + friend class QSignalTransitionPrivate; + }; + + class Q_CORE_EXPORT WrappedEvent : public QEvent + { + public: + WrappedEvent(QObject *object, QEvent *event); + ~WrappedEvent(); + + inline QObject *object() const { return m_object; } + inline QEvent *event() const { return m_event; } + + private: + QObject *m_object; + QEvent *m_event; + }; + + enum EventPriority { + NormalPriority, + HighPriority + }; + + enum RestorePolicy { + DontRestoreProperties, + RestoreProperties + }; + + enum Error { + NoError, + NoInitialStateError, + NoDefaultStateInHistoryStateError, + NoCommonAncestorForTransitionError + }; + + QStateMachine(QObject *parent = 0); + ~QStateMachine(); + + void addState(QAbstractState *state); + void removeState(QAbstractState *state); + + Error error() const; + QString errorString() const; + void clearError(); + + bool isRunning() const; + +#ifndef QT_NO_ANIMATION + bool isAnimated() const; + void setAnimated(bool enabled); + + void addDefaultAnimation(QAbstractAnimation *animation); + QList<QAbstractAnimation *> defaultAnimations() const; + void removeDefaultAnimation(QAbstractAnimation *animation); +#endif // QT_NO_ANIMATION + + QStateMachine::RestorePolicy globalRestorePolicy() const; + void setGlobalRestorePolicy(QStateMachine::RestorePolicy restorePolicy); + + void postEvent(QEvent *event, EventPriority priority = NormalPriority); + int postDelayedEvent(QEvent *event, int delay); + bool cancelDelayedEvent(int id); + + QSet<QAbstractState*> configuration() const; + +#ifndef QT_NO_STATEMACHINE_EVENTFILTER + bool eventFilter(QObject *watched, QEvent *event); +#endif + +public Q_SLOTS: + void start(); + void stop(); + +Q_SIGNALS: + void started(); + void stopped(); + +protected: + void onEntry(QEvent *event); + void onExit(QEvent *event); + + virtual void beginSelectTransitions(QEvent *event); + virtual void endSelectTransitions(QEvent *event); + + virtual void beginMicrostep(QEvent *event); + virtual void endMicrostep(QEvent *event); + + bool event(QEvent *e); + +protected: + QStateMachine(QStateMachinePrivate &dd, QObject *parent); + +private: + Q_DISABLE_COPY(QStateMachine) + Q_DECLARE_PRIVATE(QStateMachine) + Q_PRIVATE_SLOT(d_func(), void _q_start()) + Q_PRIVATE_SLOT(d_func(), void _q_process()) +#ifndef QT_NO_ANIMATION + Q_PRIVATE_SLOT(d_func(), void _q_animationFinished()) +#endif +}; + +#endif //QT_NO_STATEMACHINE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qstatusbar.h b/qtinterface/qt4/Qt/qstatusbar.h new file mode 100644 index 0000000..df92fb4 --- /dev/null +++ b/qtinterface/qt4/Qt/qstatusbar.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTATUSBAR_H +#define QSTATUSBAR_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_STATUSBAR + +class QStatusBarPrivate; + +class Q_GUI_EXPORT QStatusBar: public QWidget +{ + Q_OBJECT + + Q_PROPERTY(bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled) + +public: + explicit QStatusBar(QWidget* parent=0); + virtual ~QStatusBar(); + + void addWidget(QWidget *widget, int stretch = 0); + int insertWidget(int index, QWidget *widget, int stretch = 0); + void addPermanentWidget(QWidget *widget, int stretch = 0); + int insertPermanentWidget(int index, QWidget *widget, int stretch = 0); + void removeWidget(QWidget *widget); + + void setSizeGripEnabled(bool); + bool isSizeGripEnabled() const; + + QString currentMessage() const; + +public Q_SLOTS: + void showMessage(const QString &text, int timeout = 0); + void clearMessage(); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QStatusBar(QWidget* parent, const char* name); + QT3_SUPPORT void addWidget(QWidget *w, int stretch, bool permanent) + { if (permanent) addPermanentWidget(w, stretch); else addWidget(w, stretch); } +public Q_SLOTS: + inline QT_MOC_COMPAT void message(const QString &text, int timeout = 0) { showMessage(text, timeout); } + inline QT_MOC_COMPAT void clear() { clearMessage(); } +#endif + +Q_SIGNALS: + void messageChanged(const QString &text); + +protected: + void showEvent(QShowEvent *); + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + + // ### Qt 5: consider making reformat() and hideOrShow() private + void reformat(); + void hideOrShow(); + bool event(QEvent *); + +private: + Q_DISABLE_COPY(QStatusBar) + Q_DECLARE_PRIVATE(QStatusBar) +}; + +#endif // QT_NO_STATUSBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTATUSBAR_H diff --git a/qtinterface/qt4/Qt/qstring.h b/qtinterface/qt4/Qt/qstring.h new file mode 100644 index 0000000..6d6b5b4 --- /dev/null +++ b/qtinterface/qt4/Qt/qstring.h @@ -0,0 +1,1245 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTRING_H +#define QSTRING_H + +#include <QtCore/qchar.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qatomic.h> +#include <QtCore/qnamespace.h> +#ifdef QT_INCLUDE_COMPAT +#include <Qt3Support/q3cstring.h> +#endif + +#ifndef QT_NO_STL +# if defined (Q_CC_MSVC_NET) && _MSC_VER < 1310 // Avoids nasty warning for xlocale, line 450 +# pragma warning (push) +# pragma warning (disable : 4189) +# include <string> +# pragma warning (pop) +# else +# include <string> +# endif + +# 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> + +#ifdef truncate +#error qstring.h must be included before any header file that defines truncate +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QCharRef; +class QRegExp; +class QStringList; +class QTextCodec; +class QLatin1String; +class QStringRef; +template <typename T> class QVector; + +class Q_CORE_EXPORT QString +{ +public: + inline QString(); + QString(const QChar *unicode, int size); + QString(QChar c); + QString(int size, QChar c); + inline QString(const QLatin1String &latin1); + inline QString(const QString &); + inline ~QString(); + QString &operator=(QChar c); + QString &operator=(const QString &); + inline QString &operator=(const QLatin1String &); + + inline int size() const { return d->size; } + inline int count() const { return d->size; } + inline int length() const; + inline bool isEmpty() const; + void resize(int size); + + QString &fill(QChar c, int size = -1); + void truncate(int pos); + void chop(int n); + + int capacity() const; + inline void reserve(int size); + inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;} + + inline const QChar *unicode() const; + inline QChar *data(); + inline const QChar *data() const; + inline const QChar *constData() const; + + inline void detach(); + inline bool isDetached() const; + void clear(); + + inline const QChar at(int i) const; + const QChar operator[](int i) const; + QCharRef operator[](int i); + const QChar operator[](uint i) const; + QCharRef operator[](uint i); + + QString arg(qlonglong a, int fieldwidth=0, int base=10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(qulonglong a, int fieldwidth=0, int base=10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(long a, int fieldwidth=0, int base=10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(ulong a, int fieldwidth=0, int base=10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(int a, int fieldWidth = 0, int base = 10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(uint a, int fieldWidth = 0, int base = 10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(short a, int fieldWidth = 0, int base = 10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(ushort a, int fieldWidth = 0, int base = 10, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(char a, int fieldWidth = 0, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(QChar a, int fieldWidth = 0, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(const QString &a, int fieldWidth = 0, + const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6, + const QString &a7) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6, + const QString &a7, const QString &a8) const Q_REQUIRED_RESULT; + QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6, + const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT; + + QString &vsprintf(const char *format, va_list ap) +#if defined(Q_CC_GNU) && !defined(__INSURE__) + __attribute__ ((format (printf, 2, 0))) +#endif + ; + QString &sprintf(const char *format, ...) +#if defined(Q_CC_GNU) && !defined(__INSURE__) + __attribute__ ((format (printf, 2, 3))) +#endif + ; + + int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int indexOf(const QLatin1String &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int lastIndexOf(const QLatin1String &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + inline QBool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + inline QBool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + +#ifndef QT_NO_REGEXP + int indexOf(const QRegExp &, int from = 0) const; + int lastIndexOf(const QRegExp &, int from = -1) const; + inline QBool contains(const QRegExp &rx) const { return QBool(indexOf(rx) != -1); } + int count(const QRegExp &) const; + + int indexOf(QRegExp &, int from = 0) const; + int lastIndexOf(QRegExp &, int from = -1) const; + inline QBool contains(QRegExp &rx) const { return QBool(indexOf(rx) != -1); } +#endif + + enum SectionFlag { + SectionDefault = 0x00, + SectionSkipEmpty = 0x01, + SectionIncludeLeadingSep = 0x02, + SectionIncludeTrailingSep = 0x04, + SectionCaseInsensitiveSeps = 0x08 + }; + Q_DECLARE_FLAGS(SectionFlags, SectionFlag) + + QString section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const; + QString section(const QString &in_sep, int start, int end = -1, SectionFlags flags = SectionDefault) const; +#ifndef QT_NO_REGEXP + QString section(const QRegExp ®, int start, int end = -1, SectionFlags flags = SectionDefault) const; +#endif + + QString left(int n) const Q_REQUIRED_RESULT; + QString right(int n) const Q_REQUIRED_RESULT; + QString mid(int position, int n = -1) const Q_REQUIRED_RESULT; + QStringRef leftRef(int n) const Q_REQUIRED_RESULT; + QStringRef rightRef(int n) const Q_REQUIRED_RESULT; + QStringRef midRef(int position, int n = -1) const Q_REQUIRED_RESULT; + + bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool startsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool startsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool endsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool endsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; + QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; + + QString toLower() const Q_REQUIRED_RESULT; + QString toUpper() const Q_REQUIRED_RESULT; + QString toCaseFolded() const Q_REQUIRED_RESULT; + + QString trimmed() const Q_REQUIRED_RESULT; + QString simplified() const Q_REQUIRED_RESULT; + + QString &insert(int i, QChar c); + QString &insert(int i, const QChar *uc, int len); + inline QString &insert(int i, const QString &s) { return insert(i, s.constData(), s.length()); } + QString &insert(int i, const QLatin1String &s); + QString &append(QChar c); + QString &append(const QString &s); + QString &append(const QStringRef &s); + QString &append(const QLatin1String &s); + inline QString &prepend(QChar c) { return insert(0, c); } + inline QString &prepend(const QString &s) { return insert(0, s); } + inline QString &prepend(const QLatin1String &s) { return insert(0, s); } + + inline QString &operator+=(QChar c) { + if (d->ref != 1 || d->size + 1 > d->alloc) + realloc(grow(d->size + 1)); + d->data[d->size++] = c.unicode(); + d->data[d->size] = '\0'; + return *this; + } + + inline QString &operator+=(QChar::SpecialCharacter c) { return append(QChar(c)); } + inline QString &operator+=(const QString &s) { return append(s); } + inline QString &operator+=(const QStringRef &s) { return append(s); } + inline QString &operator+=(const QLatin1String &s) { return append(s); } + + QString &remove(int i, int len); + QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(int i, int len, QChar after); + QString &replace(int i, int len, const QChar *s, int slen); + QString &replace(int i, int len, const QString &after); + QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QLatin1String &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QLatin1String &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QString &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QString &before, const QString &after, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(QChar c, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); +#ifndef QT_NO_REGEXP + QString &replace(const QRegExp &rx, const QString &after); + inline QString &remove(const QRegExp &rx) + { return replace(rx, QString()); } +#endif + + enum SplitBehavior { KeepEmptyParts, SkipEmptyParts }; + + QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; + QStringList split(const QChar &sep, SplitBehavior behavior = KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; +#ifndef QT_NO_REGEXP + QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; +#endif + + enum NormalizationForm { + NormalizationForm_D, + NormalizationForm_C, + NormalizationForm_KD, + NormalizationForm_KC + }; + QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT; + QString normalized(NormalizationForm mode, QChar::UnicodeVersion version) const Q_REQUIRED_RESULT; + + QString repeated(int times) const; + + const ushort *utf16() const; + + QByteArray toAscii() const Q_REQUIRED_RESULT; + QByteArray toLatin1() const Q_REQUIRED_RESULT; + QByteArray toUtf8() const Q_REQUIRED_RESULT; + 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); + static QString fromUtf16(const ushort *, int size = -1); + static QString fromUcs4(const uint *, int size = -1); + static QString fromRawData(const QChar *, int size); + + int toWCharArray(wchar_t *array) const; + static QString fromWCharArray(const wchar_t *, int size = -1); + + QString &setUnicode(const QChar *unicode, int size); + inline QString &setUtf16(const ushort *utf16, int size); + + // ### Qt 5: merge these two functions + int compare(const QString &s) const; + int compare(const QString &s, Qt::CaseSensitivity cs) const; + + int compare(const QLatin1String &other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + // ### Qt 5: merge these two functions + static inline int compare(const QString &s1, const QString &s2) + { return s1.compare(s2); } + static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs) + { return s1.compare(s2, cs); } + + static inline int compare(const QString& s1, const QLatin1String &s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) + { return s1.compare(s2, cs); } + static inline int compare(const QLatin1String& s1, const QString &s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) + { return -s2.compare(s1, cs); } + + int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + static int compare(const QString &s1, const QStringRef &s2, + Qt::CaseSensitivity = Qt::CaseSensitive); + + int localeAwareCompare(const QString& s) const; + static int localeAwareCompare(const QString& s1, const QString& s2) + { return s1.localeAwareCompare(s2); } + + int localeAwareCompare(const QStringRef &s) const; + static int localeAwareCompare(const QString& s1, const QStringRef& s2); + + short toShort(bool *ok=0, int base=10) const; + ushort toUShort(bool *ok=0, int base=10) const; + int toInt(bool *ok=0, int base=10) const; + uint toUInt(bool *ok=0, int base=10) const; + long toLong(bool *ok=0, int base=10) const; + ulong toULong(bool *ok=0, int base=10) const; + qlonglong toLongLong(bool *ok=0, int base=10) const; + qulonglong toULongLong(bool *ok=0, int base=10) const; + float toFloat(bool *ok=0) const; + double toDouble(bool *ok=0) const; + + QString &setNum(short, int base=10); + QString &setNum(ushort, int base=10); + QString &setNum(int, int base=10); + QString &setNum(uint, int base=10); + QString &setNum(long, int base=10); + QString &setNum(ulong, int base=10); + QString &setNum(qlonglong, int base=10); + QString &setNum(qulonglong, int base=10); + QString &setNum(float, char f='g', int prec=6); + QString &setNum(double, char f='g', int prec=6); + + static QString number(int, int base=10); + static QString number(uint, int base=10); + static QString number(long, int base=10); + static QString number(ulong, int base=10); + static QString number(qlonglong, int base=10); + static QString number(qulonglong, int base=10); + static QString number(double, char f='g', int prec=6); + + bool operator==(const QString &s) const; + bool operator<(const QString &s) const; + inline bool operator>(const QString &s) const { return s < *this; } + inline bool operator!=(const QString &s) const { return !operator==(s); } + inline bool operator<=(const QString &s) const { return !operator>(s); } + inline bool operator>=(const QString &s) const { return !operator<(s); } + + bool operator==(const QLatin1String &s) const; + bool operator<(const QLatin1String &s) const; + bool operator>(const QLatin1String &s) const; + inline bool operator!=(const QLatin1String &s) const { return !operator==(s); } + inline bool operator<=(const QLatin1String &s) const { return !operator>(s); } + inline bool operator>=(const QLatin1String &s) const { return !operator<(s); } + + // 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 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)); } + 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) + { return (*this = QChar::fromAscii(c)); } + + // 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)); } + 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)); } + 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)); } + 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) + { return append(QChar::fromAscii(c)); } + + inline QT_ASCII_CAST_WARN bool operator==(const char *s) const; + inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const; + inline QT_ASCII_CAST_WARN bool operator<(const char *s) const; + inline QT_ASCII_CAST_WARN bool operator<=(const char *s2) const; + inline QT_ASCII_CAST_WARN bool operator>(const char *s2) const; + inline QT_ASCII_CAST_WARN bool operator>=(const char *s2) const; + + inline QT_ASCII_CAST_WARN bool operator==(const QByteArray &s) const; + inline QT_ASCII_CAST_WARN bool operator!=(const QByteArray &s) const; + inline QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const + { return *this < QString::fromAscii(s.constData(), s.size()); } + inline QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const + { return *this > QString::fromAscii(s.constData(), s.size()); } + inline QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const + { return *this <= QString::fromAscii(s.constData(), s.size()); } + inline QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const + { return *this >= QString::fromAscii(s.constData(), s.size()); } +#endif + + typedef QChar *iterator; + typedef const QChar *const_iterator; + typedef iterator Iterator; + typedef const_iterator ConstIterator; + iterator begin(); + const_iterator begin() const; + const_iterator constBegin() const; + iterator end(); + const_iterator end() const; + const_iterator constEnd() const; + + // STL compatibility + inline void push_back(QChar c) { append(c); } + inline void push_back(const QString &s) { append(s); } + inline void push_front(QChar c) { prepend(c); } + inline void push_front(const QString &s) { prepend(s); } + +#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 + struct Null { }; + static const Null null; + inline QString(const Null &): d(&shared_null) { d->ref.ref(); } + inline QString &operator=(const Null &) { *this = QString(); return *this; } + inline bool isNull() const { return d == &shared_null; } + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT const char *ascii() const { return ascii_helper(); } + inline QT3_SUPPORT const char *latin1() const { return latin1_helper(); } + inline QT3_SUPPORT QByteArray utf8() const { return toUtf8(); } + inline QT3_SUPPORT QByteArray local8Bit() const{ return toLocal8Bit(); } + inline QT3_SUPPORT void setLength(int nl) { resize(nl); } + inline QT3_SUPPORT QString copy() const { return *this; } + inline QT3_SUPPORT QString &remove(QChar c, bool cs) + { return remove(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT QString &remove(const QString &s, bool cs) + { return remove(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT QString &replace(QChar c, const QString &after, bool cs) + { return replace(c, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT QString &replace(const QString &before, const QString &after, bool cs) + { return replace(before, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } +#ifndef QT_NO_CAST_FROM_ASCII + inline QT3_SUPPORT QString &replace(char c, const QString &after, bool cs) + { return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); } + // strange overload, required to avoid GCC 3.3 error + inline QT3_SUPPORT QString &replace(char c, const QString &after, Qt::CaseSensitivity cs) + { return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); } +#endif + inline QT3_SUPPORT int find(QChar c, int i = 0, bool cs = true) const + { return indexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT int find(const QString &s, int i = 0, bool cs = true) const + { return indexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT int findRev(QChar c, int i = -1, bool cs = true) const + { return lastIndexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT int findRev(const QString &s, int i = -1, bool cs = true) const + { return lastIndexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } +#ifndef QT_NO_REGEXP + inline QT3_SUPPORT int find(const QRegExp &rx, int i=0) const + { return indexOf(rx, i); } + inline QT3_SUPPORT int findRev(const QRegExp &rx, int i=-1) const + { return lastIndexOf(rx, i); } + inline QT3_SUPPORT int find(QRegExp &rx, int i=0) const + { return indexOf(rx, i); } + inline QT3_SUPPORT int findRev(QRegExp &rx, int i=-1) const + { return lastIndexOf(rx, i); } +#endif + inline QT3_SUPPORT QBool contains(QChar c, bool cs) const + { return contains(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT QBool contains(const QString &s, bool cs) const + { return contains(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT bool startsWith(const QString &s, bool cs) const + { return startsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT bool endsWith(const QString &s, bool cs) const + { return endsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); } + inline QT3_SUPPORT QChar constref(uint i) const + { return at(i); } + QT3_SUPPORT QChar &ref(uint i); + inline QT3_SUPPORT QString leftJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const + { return leftJustified(width, aFill, trunc); } + inline QT3_SUPPORT QString rightJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const + { return rightJustified(width, aFill, trunc); } + inline QT3_SUPPORT QString lower() const { return toLower(); } + inline QT3_SUPPORT QString upper() const { return toUpper(); } + inline QT3_SUPPORT QString stripWhiteSpace() const { return trimmed(); } + inline QT3_SUPPORT QString simplifyWhiteSpace() const { return simplified(); } + inline QT3_SUPPORT QString &setUnicodeCodes(const ushort *unicode_as_ushorts, int aSize) + { return setUtf16(unicode_as_ushorts, aSize); } + inline QT3_SUPPORT const ushort *ucs2() const { return utf16(); } + inline static QT3_SUPPORT QString fromUcs2(const ushort *unicode, int size = -1) + { return fromUtf16(unicode, size); } + inline QT3_SUPPORT QString &setAscii(const char *str, int len = -1) + { *this = fromAscii(str, len); return *this; } + inline QT3_SUPPORT QString &setLatin1(const char *str, int len = -1) + { *this = fromLatin1(str, len); return *this; } +protected: + friend class QObject; + const char *ascii_helper() const; + const char *latin1_helper() const; +public: +#ifndef QT_NO_CAST_TO_ASCII + inline QT3_SUPPORT operator const char *() const { return ascii_helper(); } +private: + QT3_SUPPORT operator QNoImplicitBoolCast() const; +public: +#endif +#endif + + bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; } + bool isRightToLeft() const { if (!d->clean) updateProperties(); return d->righttoleft; } + + QString(int size, Qt::Initialization); + +private: +#if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED) + QString &operator+=(const char *s); + QString &operator+=(const QByteArray &s); + QString(const char *ch); + QString(const QByteArray &a); + QString &operator=(const char *ch); + QString &operator=(const QByteArray &a); +#endif + + struct Data { + QBasicAtomicInt ref; + int alloc, size; + ushort *data; + ushort clean : 1; + ushort simpletext : 1; + ushort righttoleft : 1; + ushort asciiCache : 1; + ushort capacity : 1; + ushort reserved : 11; + ushort array[1]; + }; + static Data shared_null; + static Data shared_empty; + Data *d; + QString(Data *dd, int /*dummy*/) : d(dd) {} +#ifndef QT_NO_TEXTCODEC + static QTextCodec *codecForCStrings; +#endif + static int grow(int); + static void free(Data *); + void realloc(); + void realloc(int alloc); + void expand(int i); + void updateProperties() const; + QString multiArg(int numArgs, const QString **args) const; + static int compare_helper(const QChar *data1, int length1, + const QChar *data2, int length2, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + static int compare_helper(const QChar *data1, int length1, + QLatin1String s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + static int localeAwareCompare_helper(const QChar *data1, int length1, + 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); + void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen); + friend class QCharRef; + friend class QTextCodec; + friend class QStringRef; + friend struct QAbstractConcatenable; + friend inline bool qStringComparisonHelper(const QString &s1, const char *s2); + friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2); +public: + typedef Data * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + + +class Q_CORE_EXPORT QLatin1String +{ +public: + inline explicit QLatin1String(const char *s) : chars(s) {} + inline QLatin1String &operator=(const QLatin1String &other) + { chars = other.chars; return *this; } + + inline const char *latin1() const { return chars; } + + inline bool operator==(const QString &s) const + { return s == *this; } + inline bool operator!=(const QString &s) const + { return s != *this; } + inline bool operator>(const QString &s) const + { return s < *this; } + inline bool operator<(const QString &s) const + { return s > *this; } + inline bool operator>=(const QString &s) const + { return s <= *this; } + inline bool operator<=(const QString &s) const + { return s >= *this; } + + inline QT_ASCII_CAST_WARN bool operator==(const char *s) const + { return QString::fromAscii(s) == *this; } + inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const + { return QString::fromAscii(s) != *this; } + inline QT_ASCII_CAST_WARN bool operator<(const char *s) const + { return QString::fromAscii(s) > *this; } + inline QT_ASCII_CAST_WARN bool operator>(const char *s) const + { return QString::fromAscii(s) < *this; } + inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const + { return QString::fromAscii(s) >= *this; } + inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const + { return QString::fromAscii(s) <= *this; } +private: + const char *chars; +}; + + + +inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1())) +{ } +inline int QString::length() const +{ return d->size; } +inline const QChar QString::at(int i) const +{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } +inline const QChar QString::operator[](int i) const +{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } +inline const QChar QString::operator[](uint i) const +{ Q_ASSERT(i < uint(size())); return d->data[i]; } +inline bool QString::isEmpty() const +{ return d->size == 0; } +inline const QChar *QString::unicode() const +{ return reinterpret_cast<const QChar*>(d->data); } +inline const QChar *QString::data() const +{ return reinterpret_cast<const QChar*>(d->data); } +inline QChar *QString::data() +{ detach(); return reinterpret_cast<QChar*>(d->data); } +inline const QChar *QString::constData() const +{ return reinterpret_cast<const QChar*>(d->data); } +inline void QString::detach() +{ if (d->ref != 1 || d->data != d->array) realloc(); } +inline bool QString::isDetached() const +{ return d->ref == 1; } +inline QString &QString::operator=(const QLatin1String &s) +{ + *this = fromLatin1(s.latin1()); + return *this; +} +inline void QString::clear() +{ if (!isNull()) *this = QString(); } +inline QString::QString(const QString &other) : d(other.d) +{ Q_ASSERT(&other != this); d->ref.ref(); } +inline int QString::capacity() const +{ return d->alloc; } +inline QString &QString::setNum(short n, int base) +{ return setNum(qlonglong(n), base); } +inline QString &QString::setNum(ushort n, int base) +{ return setNum(qulonglong(n), base); } +inline QString &QString::setNum(int n, int base) +{ return setNum(qlonglong(n), base); } +inline QString &QString::setNum(uint n, int base) +{ return setNum(qulonglong(n), base); } +inline QString &QString::setNum(long n, int base) +{ return setNum(qlonglong(n), base); } +inline QString &QString::setNum(ulong n, int base) +{ return setNum(qulonglong(n), base); } +inline QString &QString::setNum(float n, char f, int prec) +{ return setNum(double(n),f,prec); } +inline QString QString::arg(int a, int fieldWidth, int base, const QChar &fillChar) const +{ return arg(qlonglong(a), fieldWidth, base, fillChar); } +inline QString QString::arg(uint a, int fieldWidth, int base, const QChar &fillChar) const +{ return arg(qulonglong(a), fieldWidth, base, fillChar); } +inline QString QString::arg(long a, int fieldWidth, int base, const QChar &fillChar) const +{ return arg(qlonglong(a), fieldWidth, base, fillChar); } +inline QString QString::arg(ulong a, int fieldWidth, int base, const QChar &fillChar) const +{ return arg(qulonglong(a), fieldWidth, base, fillChar); } +inline QString QString::arg(short a, int fieldWidth, int base, const QChar &fillChar) const +{ return arg(qlonglong(a), fieldWidth, base, fillChar); } +inline QString QString::arg(ushort a, int fieldWidth, int base, const QChar &fillChar) const +{ return arg(qulonglong(a), fieldWidth, base, fillChar); } +inline QString QString::arg(const QString &a1, const QString &a2) const +{ const QString *args[2] = { &a1, &a2 }; return multiArg(2, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3) const +{ const QString *args[3] = { &a1, &a2, &a3 }; return multiArg(3, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4) const +{ const QString *args[4] = { &a1, &a2, &a3, &a4 }; return multiArg(4, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5) const +{ const QString *args[5] = { &a1, &a2, &a3, &a4, &a5 }; return multiArg(5, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6) const +{ const QString *args[6] = { &a1, &a2, &a3, &a4, &a5, &a6 }; return multiArg(6, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6, + const QString &a7) const +{ const QString *args[7] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7 }; return multiArg(7, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6, + const QString &a7, const QString &a8) const +{ const QString *args[8] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8 }; return multiArg(8, args); } +inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6, + const QString &a7, const QString &a8, const QString &a9) const +{ const QString *args[9] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9 }; return multiArg(9, args); } + +inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const +{ return section(QString(asep), astart, aend, aflags); } + + +class Q_CORE_EXPORT QCharRef { + QString &s; + int i; + inline QCharRef(QString &str, int idx) + : s(str),i(idx) {} + friend class QString; +public: + + // most QChar operations repeated here + + // all this is not documented: We just say "like QChar" and let it be. + inline operator QChar() const + { return i < s.d->size ? s.d->data[i] : 0; } + inline QCharRef &operator=(const QChar &c) + { if (i >= s.d->size) s.expand(i); else s.detach(); + s.d->data[i] = c.unicode(); return *this; } + + // An operator= for each QChar cast constructors +#ifndef QT_NO_CAST_FROM_ASCII + inline QT_ASCII_CAST_WARN QCharRef &operator=(char c) + { return operator=(QChar::fromAscii(c)); } + inline QT_ASCII_CAST_WARN QCharRef &operator=(uchar c) + { return operator=(QChar::fromAscii(c)); } +#endif + inline QCharRef &operator=(const QCharRef &c) { return operator=(QChar(c)); } + inline QCharRef &operator=(ushort rc) { return operator=(QChar(rc)); } + inline QCharRef &operator=(short rc) { return operator=(QChar(rc)); } + inline QCharRef &operator=(uint rc) { return operator=(QChar(rc)); } + inline QCharRef &operator=(int rc) { return operator=(QChar(rc)); } + + // each function... + inline bool isNull() const { return QChar(*this).isNull(); } + inline bool isPrint() const { return QChar(*this).isPrint(); } + inline bool isPunct() const { return QChar(*this).isPunct(); } + inline bool isSpace() const { return QChar(*this).isSpace(); } + inline bool isMark() const { return QChar(*this).isMark(); } + inline bool isLetter() const { return QChar(*this).isLetter(); } + inline bool isNumber() const { return QChar(*this).isNumber(); } + inline bool isLetterOrNumber() { return QChar(*this).isLetterOrNumber(); } + inline bool isDigit() const { return QChar(*this).isDigit(); } + inline bool isLower() const { return QChar(*this).isLower(); } + inline bool isUpper() const { return QChar(*this).isUpper(); } + inline bool isTitleCase() const { return QChar(*this).isTitleCase(); } + + inline int digitValue() const { return QChar(*this).digitValue(); } + QChar toLower() const { return QChar(*this).toLower(); } + QChar toUpper() const { return QChar(*this).toUpper(); } + QChar toTitleCase () const { return QChar(*this).toTitleCase(); } + + QChar::Category category() const { return QChar(*this).category(); } + QChar::Direction direction() const { return QChar(*this).direction(); } + QChar::Joining joining() const { return QChar(*this).joining(); } + bool hasMirrored() const { return QChar(*this).hasMirrored(); } + QChar mirroredChar() const { return QChar(*this).mirroredChar(); } + QString decomposition() const { return QChar(*this).decomposition(); } + QChar::Decomposition decompositionTag() const { return QChar(*this).decompositionTag(); } + uchar combiningClass() const { return QChar(*this).combiningClass(); } + + QChar::UnicodeVersion unicodeVersion() const { return QChar(*this).unicodeVersion(); } + + inline uchar cell() const { return QChar(*this).cell(); } + inline uchar row() const { return QChar(*this).row(); } + inline void setCell(uchar cell); + inline void setRow(uchar row); + +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + const char toAscii() const { return QChar(*this).toAscii(); } + const char toLatin1() const { return QChar(*this).toLatin1(); } + const ushort unicode() const { return QChar(*this).unicode(); } +#else + char toAscii() const { return QChar(*this).toAscii(); } + char toLatin1() const { return QChar(*this).toLatin1(); } + ushort unicode() const { return QChar(*this).unicode(); } +#endif + ushort& unicode() { return s.data()[i].unicode(); } + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool mirrored() const { return hasMirrored(); } + inline QT3_SUPPORT QChar lower() const { return QChar(*this).toLower(); } + inline QT3_SUPPORT QChar upper() const { return QChar(*this).toUpper(); } +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE + const QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); } + const QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); } +#else + QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); } + QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); } +#endif +#endif +}; + +inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); } +inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); } + + +inline QString::QString() : d(&shared_null) { d->ref.ref(); } +inline QString::~QString() { if (!d->ref.deref()) free(d); } +inline void QString::reserve(int asize) { if (d->ref != 1 || asize > d->alloc) realloc(asize); d->capacity = 1;} +inline QString &QString::setUtf16(const ushort *autf16, int asize) +{ return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); } +inline QCharRef QString::operator[](int i) +{ Q_ASSERT(i >= 0); return QCharRef(*this, i); } +inline QCharRef QString::operator[](uint i) +{ return QCharRef(*this, i); } +inline QString::iterator QString::begin() +{ detach(); return reinterpret_cast<QChar*>(d->data); } +inline QString::const_iterator QString::begin() const +{ return reinterpret_cast<const QChar*>(d->data); } +inline QString::const_iterator QString::constBegin() const +{ return reinterpret_cast<const QChar*>(d->data); } +inline QString::iterator QString::end() +{ detach(); return reinterpret_cast<QChar*>(d->data + d->size); } +inline QString::const_iterator QString::end() const +{ return reinterpret_cast<const QChar*>(d->data + d->size); } +inline QString::const_iterator QString::constEnd() const +{ return reinterpret_cast<const QChar*>(d->data + d->size); } +inline QBool QString::contains(const QString &s, Qt::CaseSensitivity cs) const +{ return QBool(indexOf(s, 0, cs) != -1); } +inline QBool QString::contains(QChar c, Qt::CaseSensitivity cs) const +{ return QBool(indexOf(c, 0, cs) != -1); } + + +inline bool operator==(QString::Null, QString::Null) { return true; } +inline bool operator==(QString::Null, const QString &s) { return s.isNull(); } +inline bool operator==(const QString &s, QString::Null) { return s.isNull(); } +inline bool operator!=(QString::Null, QString::Null) { return false; } +inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); } +inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); } + +#ifndef QT_NO_CAST_FROM_ASCII +inline bool qStringComparisonHelper(const QString &s1, const char *s2) +{ +# ifndef QT_NO_TEXTCODEC + if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2)); +# endif + return (s1 == QLatin1String(s2)); +} +inline bool QString::operator==(const char *s) const +{ return qStringComparisonHelper(*this, s); } +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); } +inline bool QString::operator>(const char *s) const +{ return *this > QString::fromAscii(s); } +inline bool QString::operator<=(const char *s) const +{ return *this <= QString::fromAscii(s); } +inline bool QString::operator>=(const char *s) const +{ return *this >= QString::fromAscii(s); } + +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); } +inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2) +{ return (QString::fromAscii(s1) > s2); } +inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2) +{ return (QString::fromAscii(s1) <= s2); } +inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2) +{ return (QString::fromAscii(s1) >= s2); } + +inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QLatin1String &s2) +{ return QString::fromAscii(s1) == s2; } +inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QLatin1String &s2) +{ return QString::fromAscii(s1) != s2; } +inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QLatin1String &s2) +{ return (QString::fromAscii(s1) < s2); } +inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QLatin1String &s2) +{ return (QString::fromAscii(s1) > s2); } +inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QLatin1String &s2) +{ return (QString::fromAscii(s1) <= s2); } +inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QLatin1String &s2) +{ return (QString::fromAscii(s1) >= s2); } + +inline bool operator==(const QLatin1String &s1, const QLatin1String &s2) +{ return (qstrcmp(s1.latin1(), s2.latin1()) == 0); } +inline bool operator!=(const QLatin1String &s1, const QLatin1String &s2) +{ return (qstrcmp(s1.latin1(), s2.latin1()) != 0); } +inline bool operator<(const QLatin1String &s1, const QLatin1String &s2) +{ return (qstrcmp(s1.latin1(), s2.latin1()) < 0); } +inline bool operator<=(const QLatin1String &s1, const QLatin1String &s2) +{ return (qstrcmp(s1.latin1(), s2.latin1()) <= 0); } +inline bool operator>(const QLatin1String &s1, const QLatin1String &s2) +{ return (qstrcmp(s1.latin1(), s2.latin1()) > 0); } +inline bool operator>=(const QLatin1String &s1, const QLatin1String &s2) +{ return (qstrcmp(s1.latin1(), s2.latin1()) >= 0); } + + +inline bool QString::operator==(const QByteArray &s) const +{ return qStringComparisonHelper(*this, s.constData()); } +inline bool QString::operator!=(const QByteArray &s) const +{ return !qStringComparisonHelper(*this, s.constData()); } + +inline bool QByteArray::operator==(const QString &s) const +{ return qStringComparisonHelper(s, constData()); } +inline bool QByteArray::operator!=(const QString &s) const +{ return !qStringComparisonHelper(s, constData()); } +inline bool QByteArray::operator<(const QString &s) const +{ return QString::fromAscii(constData(), size()) < s; } +inline bool QByteArray::operator>(const QString &s) const +{ return QString::fromAscii(constData(), size()) > s; } +inline bool QByteArray::operator<=(const QString &s) const +{ return QString::fromAscii(constData(), size()) <= s; } +inline bool QByteArray::operator>=(const QString &s) const +{ return QString::fromAscii(constData(), size()) >= s; } +#endif // QT_NO_CAST_FROM_ASCII + +#ifndef QT_NO_CAST_TO_ASCII +inline QByteArray &QByteArray::append(const QString &s) +{ return append(s.toAscii()); } +inline QByteArray &QByteArray::insert(int i, const QString &s) +{ return insert(i, s.toAscii()); } +inline QByteArray &QByteArray::replace(char c, const QString &after) +{ return replace(c, after.toAscii()); } +inline QByteArray &QByteArray::replace(const QString &before, const char *after) +{ return replace(before.toAscii(), after); } +inline QByteArray &QByteArray::replace(const QString &before, const QByteArray &after) +{ return replace(before.toAscii(), after); } +inline QByteArray &QByteArray::operator+=(const QString &s) +{ return operator+=(s.toAscii()); } +inline int QByteArray::indexOf(const QString &s, int from) const +{ return indexOf(s.toAscii(), from); } +inline int QByteArray::lastIndexOf(const QString &s, int from) const +{ return lastIndexOf(s.toAscii(), from); } +# ifdef QT3_SUPPORT +inline int QByteArray::find(const QString &s, int from) const +{ return indexOf(s.toAscii(), from); } +inline int QByteArray::findRev(const QString &s, int from) const +{ return lastIndexOf(s.toAscii(), from); } +# endif // QT3_SUPPORT +#endif // QT_NO_CAST_TO_ASCII + +#ifndef QT_USE_FAST_OPERATOR_PLUS +# ifndef QT_USE_FAST_CONCATENATION +inline const QString operator+(const QString &s1, const QString &s2) +{ QString t(s1); t += s2; return t; } +inline const QString operator+(const QString &s1, QChar s2) +{ QString t(s1); t += s2; return t; } +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; } +inline QT_ASCII_CAST_WARN const QString operator+(const char *s1, const QString &s2) +{ QString t = QString::fromAscii(s1); 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) +{ QString t = s; t += QChar::fromAscii(c); return t; } +inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QString &s) +{ QString t = QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); t += s; return t; } +inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba) +{ QString t(s); t += QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); return t; } +# endif // QT_NO_CAST_FROM_ASCII +# endif // QT_USE_FAST_CONCATENATION +#endif // QT_USE_FAST_OPERATOR_PLUS + +#ifndef QT_NO_STL +inline std::string QString::toStdString() const +{ const QByteArray asc = toAscii(); return std::string(asc.constData(), asc.length()); } + +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 +{ + QStdWString str; + str.resize(length()); + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + // VS2005 crashes if the string is empty + if (!length()) + return str; +#endif + + str.resize(toWCharArray(&(*str.begin()))); + return str; +} +inline QString QString::fromStdWString(const QStdWString &s) +{ return fromWCharArray(s.data(), int(s.size())); } +# endif +#endif + +#ifdef QT3_SUPPORT +inline QChar &QString::ref(uint i) +{ + if (int(i) > d->size || d->ref != 1) + resize(qMax(int(i), d->size)); + return reinterpret_cast<QChar&>(d->data[i]); +} +#endif + +#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &); +#endif + +#ifdef QT3_SUPPORT +class QConstString : public QString +{ +public: + inline QT3_SUPPORT_CONSTRUCTOR QConstString(const QChar *aUnicode, int aSize) + :QString(aUnicode, aSize){} // cannot use fromRawData() due to changed semantics + inline QT3_SUPPORT const QString &string() const { return *this; } +}; +#endif + +Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QString) +Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags) + +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +extern Q_CORE_EXPORT QByteArray qt_winQString2MB(const QString& s, int len=-1); +extern Q_CORE_EXPORT QByteArray qt_winQString2MB(const QChar *ch, int len); +extern Q_CORE_EXPORT QString qt_winMB2QString(const char* mb, int len=-1); +#endif + + +class Q_CORE_EXPORT QStringRef { + const QString *m_string; + int m_position; + int m_size; +public: + inline QStringRef():m_string(0), m_position(0), m_size(0){} + inline QStringRef(const QString *string, int position, int size); + inline QStringRef(const QString *string); + inline QStringRef(const QStringRef &other) + :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) + {} + + inline ~QStringRef(){} + inline const QString *string() const { return m_string; } + inline int position() const { return m_position; } + inline int size() const { return m_size; } + inline int count() const { return m_size; } + inline int length() const { return m_size; } + + inline QStringRef &operator=(const QStringRef &other) { + m_string = other.m_string; m_position = other.m_position; + m_size = other.m_size; return *this; + } + + inline QStringRef &operator=(const QString *string); + + inline const QChar *unicode() const { + if (!m_string) + return reinterpret_cast<const QChar *>(QString::shared_null.data); + return m_string->unicode() + m_position; + } + inline const QChar *data() const { return unicode(); } + inline const QChar *constData() const { return unicode(); } + + inline void clear() { m_string = 0; m_position = m_size = 0; } + QString toString() const; + inline bool isEmpty() const { return m_size == 0; } + inline bool isNull() const { return m_string == 0 || m_string->isNull(); } + + QStringRef appendTo(QString *string) const; + + inline const QChar at(int i) const + { Q_ASSERT(i >= 0 && i < size()); return m_string->at(i + m_position); } + + int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + static int compare(const QStringRef &s1, const QString &s2, + Qt::CaseSensitivity = Qt::CaseSensitive); + static int compare(const QStringRef &s1, const QStringRef &s2, + Qt::CaseSensitivity = Qt::CaseSensitive); + static int compare(const QStringRef &s1, QLatin1String s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + + int localeAwareCompare(const QString &s) const; + int localeAwareCompare(const QStringRef &s) const; + static int localeAwareCompare(const QStringRef &s1, const QString &s2); + static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2); +}; + +inline QStringRef &QStringRef::operator=(const QString *aString) +{ m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; } + +inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize) + :m_string(aString), m_position(aPosition), m_size(aSize){} + +inline QStringRef::QStringRef(const QString *aString) + :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){} + +Q_CORE_EXPORT bool operator==(const QStringRef &s1,const QStringRef &s2); +inline bool operator!=(const QStringRef &s1,const QStringRef &s2) +{ return !(s1 == s2); } +Q_CORE_EXPORT bool operator==(const QString &s1,const QStringRef &s2); +inline bool operator!=(const QString &s1,const QStringRef &s2) +{ return !(s1 == s2); } +inline bool operator==(const QStringRef &s1,const QString &s2) +{ return s2 == s1; } +inline bool operator!=(const QStringRef &s1,const QString &s2) +{ return s2 != s1; } +Q_CORE_EXPORT bool operator==(const QLatin1String &s1, const QStringRef &s2); +inline bool operator!=(const QLatin1String &s1,const QStringRef &s2) +{ return !(s1 == s2); } +inline bool operator==(const QStringRef &s1,const QLatin1String &s2) +{ return s2 == s1; } +inline bool operator!=(const QStringRef &s1,const QLatin1String &s2) +{ return s2 != s1; } + +Q_CORE_EXPORT bool operator<(const QStringRef &s1,const QStringRef &s2); +inline bool operator>(const QStringRef &s1, const QStringRef &s2) +{ return s2 < s1; } +inline bool operator<=(const QStringRef &s1, const QStringRef &s2) +{ return !(s1 > s2); } +inline bool operator>=(const QStringRef &s1, const QStringRef &s2) +{ return !(s1 < s2); } + +inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2) +{ +# ifndef QT_NO_TEXTCODEC + if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2)); +# endif + return (s1 == QLatin1String(s2)); +} + +inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2) +{ return qStringComparisonHelper(s2, s1); } +inline QT_ASCII_CAST_WARN bool operator==(const QStringRef &s1, const char *s2) +{ return qStringComparisonHelper(s1, s2); } +inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2) +{ return !qStringComparisonHelper(s2, s1); } +inline QT_ASCII_CAST_WARN bool operator!=(const QStringRef &s1, const char *s2) +{ return !qStringComparisonHelper(s1, s2); } + +inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const +{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } +inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const +{ return QString::compare_helper(constData(), length(), s, cs); } +inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) +{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } +inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) +{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } + +inline int QString::localeAwareCompare(const QStringRef &s) const +{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } +inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2) +{ return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } +inline int QStringRef::localeAwareCompare(const QString &s) const +{ return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } +inline int QStringRef::localeAwareCompare(const QStringRef &s) const +{ return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } +inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QString &s2) +{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } +inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef &s2) +{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } + + +QT_END_NAMESPACE + +QT_END_HEADER + +#ifdef QT_USE_FAST_CONCATENATION +#include <QtCore/qstringbuilder.h> +#endif + +#endif // QSTRING_H diff --git a/qtinterface/qt4/Qt/qstringbuilder.h b/qtinterface/qt4/Qt/qstringbuilder.h new file mode 100644 index 0000000..2e9fe81 --- /dev/null +++ b/qtinterface/qt4/Qt/qstringbuilder.h @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTRINGBUILDER_H +#define QSTRINGBUILDER_H + +#include <QtCore/qstring.h> + +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) +# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) +# include <QtCore/qmap.h> +# endif +#endif + +#include <string.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// ### Qt 5: merge with QLatin1String +class QLatin1Literal +{ +public: + int size() const { return m_size; } + const char *data() const { return m_data; } + + template <int N> + QLatin1Literal(const char (&str)[N]) + : m_size(N - 1), m_data(str) {} + +private: + const int m_size; + const char *m_data; +}; + +struct Q_CORE_EXPORT QAbstractConcatenable +{ +protected: + static void convertFromAscii(const char *a, int len, QChar *&out); + + static inline void convertFromAscii(char a, QChar *&out) + { +#ifndef QT_NO_TEXTCODEC + if (QString::codecForCStrings) + *out++ = QChar::fromAscii(a); + else +#endif + *out++ = QLatin1Char(a); + } +}; + +template <typename T> struct QConcatenable {}; + +template <typename A, typename B> +class QStringBuilder +{ +public: + QStringBuilder(const A &a_, const B &b_) : a(a_), b(b_) {} + + operator QString() const + { + QString s(QConcatenable< QStringBuilder<A, B> >::size(*this), + Qt::Uninitialized); + + QChar *d = s.data(); + QConcatenable< QStringBuilder<A, B> >::appendTo(*this, d); + // this resize is necessary since we allocate a bit too much + // when dealing with variable sized 8-bit encodings + s.resize(d - s.data()); + return s; + } + QByteArray toLatin1() const { return QString(*this).toLatin1(); } + + const A &a; + const B &b; +}; + + +template <> struct QConcatenable<char> : private QAbstractConcatenable +{ + typedef char type; + static int size(const char) { return 1; } + static inline void appendTo(const char c, QChar *&out) + { + QAbstractConcatenable::convertFromAscii(c, out); + } +}; + +template <> struct QConcatenable<QLatin1Char> +{ + typedef QLatin1Char type; + static int size(const QLatin1Char) { return 1; } + static inline void appendTo(const QLatin1Char c, QChar *&out) + { + *out++ = c; + } +}; + +template <> struct QConcatenable<QChar> +{ + typedef QChar type; + static int size(const QChar) { return 1; } + static inline void appendTo(const QChar c, QChar *&out) + { + *out++ = c; + } +}; + +template <> struct QConcatenable<QCharRef> +{ + typedef QCharRef type; + static int size(const QCharRef &) { return 1; } + static inline void appendTo(const QCharRef &c, QChar *&out) + { + *out++ = QChar(c); + } +}; + +template <> struct QConcatenable<QLatin1String> +{ + typedef QLatin1String type; + static int size(const QLatin1String &a) { return qstrlen(a.latin1()); } + static inline void appendTo(const QLatin1String &a, QChar *&out) + { + for (const char *s = a.latin1(); *s; ) + *out++ = QLatin1Char(*s++); + } + +}; + +template <> struct QConcatenable<QLatin1Literal> +{ + typedef QLatin1Literal type; + static int size(const QLatin1Literal &a) { return a.size(); } + static inline void appendTo(const QLatin1Literal &a, QChar *&out) + { + for (const char *s = a.data(); *s; ) + *out++ = QLatin1Char(*s++); + } +}; + +template <> struct QConcatenable<QString> +{ + typedef QString type; + static int size(const QString &a) { return a.size(); } + static inline void appendTo(const QString &a, QChar *&out) + { + const int n = a.size(); + memcpy(out, reinterpret_cast<const char*>(a.constData()), sizeof(QChar) * n); + out += n; + } +}; + +template <> struct QConcatenable<QStringRef> +{ + typedef QStringRef type; + static int size(const QStringRef &a) { return a.size(); } + static inline void appendTo(QStringRef a, QChar *&out) + { + const int n = a.size(); + memcpy(out, reinterpret_cast<const char*>(a.constData()), sizeof(QChar) * n); + out += n; + } +}; + +#ifndef QT_NO_CAST_FROM_ASCII +template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable +{ + typedef char type[N]; + static int size(const char[N]) + { + return N - 1; + } + static inline void appendTo(const char a[N], QChar *&out) + { + QAbstractConcatenable::convertFromAscii(a, N, out); + } +}; + +template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable +{ + typedef const char type[N]; + static int size(const char[N]) { return N - 1; } + static inline void appendTo(const char a[N], QChar *&out) + { + QAbstractConcatenable::convertFromAscii(a, N, out); + } +}; + +template <> struct QConcatenable<const char *> : private QAbstractConcatenable +{ + typedef char const *type; + static int size(const char *a) { return qstrlen(a); } + static inline void appendTo(const char *a, QChar *&out) + { + QAbstractConcatenable::convertFromAscii(a, -1, out); + } +}; + +template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable +{ + typedef QByteArray type; + static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } + static inline void appendTo(const QByteArray &ba, QChar *&out) + { + QAbstractConcatenable::convertFromAscii(ba.constData(), -1, out); + } +}; +#endif + +template <typename A, typename B> +struct QConcatenable< QStringBuilder<A, B> > +{ + typedef QStringBuilder<A, B> type; + static int size(const type &p) + { + return QConcatenable<A>::size(p.a) + QConcatenable<B>::size(p.b); + } + static inline void appendTo(const QStringBuilder<A, B> &p, QChar *&out) + { + QConcatenable<A>::appendTo(p.a, out); + QConcatenable<B>::appendTo(p.b, out); + } +}; + +template <typename A, typename B> +QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type> +operator%(const A &a, const B &b) +{ + return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b); +} + +#ifdef QT_USE_FAST_OPERATOR_PLUS +template <typename A, typename B> +QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type> +operator+(const A &a, const B &b) +{ + return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b); +} +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTRINGBUILDER_H diff --git a/qtinterface/qt4/Qt/qstringlist.h b/qtinterface/qt4/Qt/qstringlist.h new file mode 100644 index 0000000..14a11a5 --- /dev/null +++ b/qtinterface/qt4/Qt/qstringlist.h @@ -0,0 +1,259 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTRINGLIST_H +#define QSTRINGLIST_H + +#include <QtCore/qalgorithms.h> +#include <QtCore/qdatastream.h> +#include <QtCore/qlist.h> +#include <QtCore/qregexp.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringmatcher.h> +#ifdef QT_INCLUDE_COMPAT +#include <Qt3Support/q3valuelist.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QRegExp; + +typedef QListIterator<QString> QStringListIterator; +typedef QMutableListIterator<QString> QMutableStringListIterator; + +class QStringList : public QList<QString> +{ +public: + inline QStringList() { } + inline explicit QStringList(const QString &i) { append(i); } + inline QStringList(const QStringList &l) : QList<QString>(l) { } + inline QStringList(const QList<QString> &l) : QList<QString>(l) { } + + inline void sort(); + inline int removeDuplicates(); + + inline QString join(const QString &sep) const; + + inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + inline QBool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + + inline QStringList operator+(const QStringList &other) const + { QStringList n = *this; n += other; return n; } + inline QStringList &operator<<(const QString &str) + { append(str); return *this; } + inline QStringList &operator<<(const QStringList &l) + { *this += l; return *this; } + +#ifndef QT_NO_REGEXP + inline QStringList filter(const QRegExp &rx) const; + inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after); + inline int indexOf(const QRegExp &rx, int from = 0) const; + inline int lastIndexOf(const QRegExp &rx, int from = -1) const; + inline int indexOf(QRegExp &rx, int from = 0) const; + inline int lastIndexOf(QRegExp &rx, int from = -1) const; +#endif +#if !defined(Q_NO_USING_KEYWORD) + using QList<QString>::indexOf; + using QList<QString>::lastIndexOf; +#else + inline int indexOf(const QString &str, int from = 0) const + { return QList<QString>::indexOf(str, from); } + inline int lastIndexOf(const QString &str, int from = -1) const + { return QList<QString>::lastIndexOf(str, from); } +#endif +#ifdef QT3_SUPPORT + static inline QT3_SUPPORT QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries = false); + static inline QT3_SUPPORT QStringList split(const QChar &sep, const QString &str, bool allowEmptyEntries = false); + inline QT3_SUPPORT QStringList grep(const QString &str, bool cs = true) const + { return filter(str, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); } + +#ifndef QT_NO_REGEXP + static inline QT3_SUPPORT QStringList split(const QRegExp &sep, const QString &str, bool allowEmptyEntries = false); + inline QT3_SUPPORT QStringList grep(const QRegExp &rx) const { return filter(rx); } + inline QT3_SUPPORT QStringList &gres(const QRegExp &rx, const QString &after) + { return replaceInStrings(rx, after); } +#endif + inline QT3_SUPPORT QStringList &gres(const QString &before, const QString &after, bool cs = true) + { return replaceInStrings(before, after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); } + + inline Iterator QT3_SUPPORT fromLast() { return (isEmpty() ? end() : --end()); } + inline ConstIterator QT3_SUPPORT fromLast() const { return (isEmpty() ? end() : --end()); } +#endif +}; + +namespace QtPrivate { + void Q_CORE_EXPORT QStringList_sort(QStringList *that); + int Q_CORE_EXPORT QStringList_removeDuplicates(QStringList *that); + QString Q_CORE_EXPORT QStringList_join(const QStringList *that, const QString &sep); + QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QString &str, + Qt::CaseSensitivity cs); + + QBool Q_CORE_EXPORT QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs); + void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QString &before, const QString &after, + Qt::CaseSensitivity cs); + +#ifndef QT_NO_REGEXP + void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegExp &rx, const QString &after); + QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegExp &re); + int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegExp &rx, int from); + int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegExp &rx, int from); + int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, QRegExp &rx, int from); + int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from); +#endif +} + +inline void QStringList::sort() +{ + QtPrivate::QStringList_sort(this); +} + +inline int QStringList::removeDuplicates() +{ + return QtPrivate::QStringList_removeDuplicates(this); +} + +inline QString QStringList::join(const QString &sep) const +{ + return QtPrivate::QStringList_join(this, sep); +} + +inline QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const +{ + return QtPrivate::QStringList_filter(this, str, cs); +} + +inline QBool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const +{ + return QtPrivate::QStringList_contains(this, str, cs); +} + +inline QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) +{ + QtPrivate::QStringList_replaceInStrings(this, before, after, cs); + return *this; +} + +#ifndef QT_NO_REGEXP +inline QStringList &QStringList::replaceInStrings(const QRegExp &rx, const QString &after) +{ + QtPrivate::QStringList_replaceInStrings(this, rx, after); + return *this; +} + +inline QStringList QStringList::filter(const QRegExp &rx) const +{ + return QtPrivate::QStringList_filter(this, rx); +} + +inline int QStringList::indexOf(const QRegExp &rx, int from) const +{ + return QtPrivate::QStringList_indexOf(this, rx, from); +} + +inline int QStringList::lastIndexOf(const QRegExp &rx, int from) const +{ + return QtPrivate::QStringList_lastIndexOf(this, rx, from); +} + +inline int QStringList::indexOf(QRegExp &rx, int from) const +{ + return QtPrivate::QStringList_indexOf(this, rx, from); +} + +inline int QStringList::lastIndexOf(QRegExp &rx, int from) const +{ + return QtPrivate::QStringList_lastIndexOf(this, rx, from); +} +#endif + + +#ifdef QT3_SUPPORT +inline QStringList QStringList::split(const QChar &sep, const QString &str, bool allowEmptyEntries) +{ + if (str.isEmpty()) + return QStringList(); + return str.split(sep, allowEmptyEntries ? QString::KeepEmptyParts + : QString::SkipEmptyParts); +} + +inline QStringList QStringList::split(const QString &sep, const QString &str, bool allowEmptyEntries) +{ + if (str.isEmpty()) + return QStringList(); + return str.split(sep, allowEmptyEntries ? QString::KeepEmptyParts + : QString::SkipEmptyParts); +} + +#ifndef QT_NO_REGEXP +inline QStringList QStringList::split(const QRegExp &sep, const QString &str, bool allowEmptyEntries) +{ + if (str.isEmpty()) + return QStringList(); + return str.split(sep, allowEmptyEntries ? QString::KeepEmptyParts + : QString::SkipEmptyParts); +} +#endif // QT_NO_REGEXP + +#endif // QT3_SUPPORT + + +#ifndef QT_NO_DATASTREAM +inline QDataStream &operator>>(QDataStream &in, QStringList &list) +{ + return operator>>(in, static_cast<QList<QString> &>(list)); +} +inline QDataStream &operator<<(QDataStream &out, const QStringList &list) +{ + return operator<<(out, static_cast<const QList<QString> &>(list)); +} +#endif // QT_NO_DATASTREAM + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTRINGLIST_H diff --git a/qtinterface/qt4/Qt/qstringlistmodel.h b/qtinterface/qt4/Qt/qstringlistmodel.h new file mode 100644 index 0000000..00a5ab2 --- /dev/null +++ b/qtinterface/qt4/Qt/qstringlistmodel.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTRINGLISTMODEL_H +#define QSTRINGLISTMODEL_H + +#include <QtCore/qstringlist.h> +#include <QtGui/qabstractitemview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_STRINGLISTMODEL + +class Q_GUI_EXPORT QStringListModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit QStringListModel(QObject *parent = 0); + QStringListModel(const QStringList &strings, QObject *parent = 0); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + + Qt::ItemFlags flags(const QModelIndex &index) const; + + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + + QStringList stringList() const; + void setStringList(const QStringList &strings); + + Qt::DropActions supportedDropActions() const; + +private: + Q_DISABLE_COPY(QStringListModel) + QStringList lst; +}; + +#endif // QT_NO_STRINGLISTMODEL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTRINGLISTMODEL_H diff --git a/qtinterface/qt4/Qt/qstringmatcher.h b/qtinterface/qt4/Qt/qstringmatcher.h new file mode 100644 index 0000000..bc7784f --- /dev/null +++ b/qtinterface/qt4/Qt/qstringmatcher.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTRINGMATCHER_H +#define QSTRINGMATCHER_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QStringMatcherPrivate; + +class Q_CORE_EXPORT QStringMatcher +{ +public: + QStringMatcher(); + QStringMatcher(const QString &pattern, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + QStringMatcher(const QChar *uc, int len, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + QStringMatcher(const QStringMatcher &other); + ~QStringMatcher(); + + QStringMatcher &operator=(const QStringMatcher &other); + + void setPattern(const QString &pattern); + void setCaseSensitivity(Qt::CaseSensitivity cs); + + int indexIn(const QString &str, int from = 0) const; + int indexIn(const QChar *str, int length, int from = 0) const; + QString pattern() const; + inline Qt::CaseSensitivity caseSensitivity() const { return q_cs; } + +private: + QStringMatcherPrivate *d_ptr; + QString q_pattern; + Qt::CaseSensitivity q_cs; +#ifdef Q_CC_RVCT +// explicitely allow anonymous unions for RVCT to prevent compiler warnings +# pragma push +# pragma anon_unions +#endif + struct Data { + uchar q_skiptable[256]; + const QChar *uc; + int len; + }; + union { + uint q_data[256]; + Data p; + }; +#ifdef Q_CC_RVCT +# pragma pop +#endif +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTRINGMATCHER_H diff --git a/qtinterface/qt4/Qt/qstyle.h b/qtinterface/qt4/Qt/qstyle.h new file mode 100644 index 0000000..96c4075 --- /dev/null +++ b/qtinterface/qt4/Qt/qstyle.h @@ -0,0 +1,887 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLE_H +#define QSTYLE_H + +#include <QtCore/qobject.h> +#include <QtCore/qrect.h> +#include <QtCore/qsize.h> +#include <QtGui/qicon.h> +#include <QtGui/qpixmap.h> +#include <QtGui/qpalette.h> +#include <QtGui/qsizepolicy.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAction; +class QDebug; +class QTab; +class QFontMetrics; +class QStyleHintReturn; +class QStyleOption; +class QStyleOptionComplex; +class QStylePrivate; + +class Q_GUI_EXPORT QStyle : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QStyle) + +protected: + QStyle(QStylePrivate &dd); + +public: + QStyle(); + virtual ~QStyle(); + + virtual void polish(QWidget *); + virtual void unpolish(QWidget *); + + virtual void polish(QApplication *); + virtual void unpolish(QApplication *); + + virtual void polish(QPalette &); + + virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, + int flags, bool enabled, + const QString &text) const; + + virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + + virtual void drawItemText(QPainter *painter, const QRect &rect, + int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + + virtual void drawItemPixmap(QPainter *painter, const QRect &rect, + int alignment, const QPixmap &pixmap) const; + + virtual QPalette standardPalette() const; + + enum StateFlag { + State_None = 0x00000000, +#ifdef QT3_SUPPORT + State_Default = State_None, +#endif + State_Enabled = 0x00000001, + State_Raised = 0x00000002, + State_Sunken = 0x00000004, + State_Off = 0x00000008, + State_NoChange = 0x00000010, + State_On = 0x00000020, + State_DownArrow = 0x00000040, + State_Horizontal = 0x00000080, + State_HasFocus = 0x00000100, + State_Top = 0x00000200, + State_Bottom = 0x00000400, + State_FocusAtBorder = 0x00000800, + State_AutoRaise = 0x00001000, + State_MouseOver = 0x00002000, + State_UpArrow = 0x00004000, + State_Selected = 0x00008000, + State_Active = 0x00010000, + State_Window = 0x00020000, + State_Open = 0x00040000, + State_Children = 0x00080000, + State_Item = 0x00100000, + State_Sibling = 0x00200000, + State_Editing = 0x00400000, + State_KeyboardFocusChange = 0x00800000, +#ifdef QT_KEYPAD_NAVIGATION + State_HasEditFocus = 0x01000000, +#endif + State_ReadOnly = 0x02000000, + State_Small = 0x04000000, + State_Mini = 0x08000000 + }; + Q_DECLARE_FLAGS(State, StateFlag) + +#ifdef QT3_SUPPORT + typedef State SFlags; +#endif + + enum PrimitiveElement { + PE_Q3CheckListController, + PE_Q3CheckListExclusiveIndicator, + PE_Q3CheckListIndicator, + PE_Q3DockWindowSeparator, + PE_Q3Separator, + + PE_Frame, + PE_FrameDefaultButton, + PE_FrameDockWidget, + PE_FrameFocusRect, + PE_FrameGroupBox, + PE_FrameLineEdit, + PE_FrameMenu, + PE_FrameStatusBar, // obsolete + PE_FrameStatusBarItem = PE_FrameStatusBar, + PE_FrameTabWidget, + PE_FrameWindow, + PE_FrameButtonBevel, + PE_FrameButtonTool, + PE_FrameTabBarBase, + + PE_PanelButtonCommand, + PE_PanelButtonBevel, + PE_PanelButtonTool, + PE_PanelMenuBar, + PE_PanelToolBar, + PE_PanelLineEdit, + + PE_IndicatorArrowDown, + PE_IndicatorArrowLeft, + PE_IndicatorArrowRight, + PE_IndicatorArrowUp, + PE_IndicatorBranch, + PE_IndicatorButtonDropDown, + PE_IndicatorViewItemCheck, + PE_IndicatorItemViewItemCheck = PE_IndicatorViewItemCheck, + PE_IndicatorCheckBox, + PE_IndicatorDockWidgetResizeHandle, + PE_IndicatorHeaderArrow, + PE_IndicatorMenuCheckMark, + PE_IndicatorProgressChunk, + PE_IndicatorRadioButton, + PE_IndicatorSpinDown, + PE_IndicatorSpinMinus, + PE_IndicatorSpinPlus, + PE_IndicatorSpinUp, + PE_IndicatorToolBarHandle, + PE_IndicatorToolBarSeparator, + PE_PanelTipLabel, + PE_IndicatorTabTear, + PE_PanelScrollAreaCorner, + + PE_Widget, + + PE_IndicatorColumnViewArrow, + PE_IndicatorItemViewItemDrop, + + PE_PanelItemViewItem, + PE_PanelItemViewRow, // ### Qt 5: remove + + PE_PanelStatusBar, + + PE_IndicatorTabClose, + PE_PanelMenu, + + // do not add any values below/greater this + PE_CustomBase = 0xf000000 + }; + + virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const = 0; + enum ControlElement { + CE_PushButton, + CE_PushButtonBevel, + CE_PushButtonLabel, + + CE_CheckBox, + CE_CheckBoxLabel, + + CE_RadioButton, + CE_RadioButtonLabel, + + CE_TabBarTab, + CE_TabBarTabShape, + CE_TabBarTabLabel, + + CE_ProgressBar, + CE_ProgressBarGroove, + CE_ProgressBarContents, + CE_ProgressBarLabel, + + CE_MenuItem, + CE_MenuScroller, + CE_MenuVMargin, + CE_MenuHMargin, + CE_MenuTearoff, + CE_MenuEmptyArea, + + CE_MenuBarItem, + CE_MenuBarEmptyArea, + + CE_ToolButtonLabel, + + CE_Header, + CE_HeaderSection, + CE_HeaderLabel, + + CE_Q3DockWindowEmptyArea, + CE_ToolBoxTab, + CE_SizeGrip, + CE_Splitter, + CE_RubberBand, + CE_DockWidgetTitle, + + CE_ScrollBarAddLine, + CE_ScrollBarSubLine, + CE_ScrollBarAddPage, + CE_ScrollBarSubPage, + CE_ScrollBarSlider, + CE_ScrollBarFirst, + CE_ScrollBarLast, + + CE_FocusFrame, + CE_ComboBoxLabel, + + CE_ToolBar, + CE_ToolBoxTabShape, + CE_ToolBoxTabLabel, + CE_HeaderEmptyArea, + + CE_ColumnViewGrip, + + CE_ItemViewItem, + + CE_ShapedFrame, + + // do not add any values below/greater than this + CE_CustomBase = 0xf0000000 + }; + + virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const = 0; + + enum SubElement { + SE_PushButtonContents, + SE_PushButtonFocusRect, + + SE_CheckBoxIndicator, + SE_CheckBoxContents, + SE_CheckBoxFocusRect, + SE_CheckBoxClickRect, + + SE_RadioButtonIndicator, + SE_RadioButtonContents, + SE_RadioButtonFocusRect, + SE_RadioButtonClickRect, + + SE_ComboBoxFocusRect, + + SE_SliderFocusRect, + + SE_Q3DockWindowHandleRect, + + SE_ProgressBarGroove, + SE_ProgressBarContents, + SE_ProgressBarLabel, + + // ### Qt 5: These values are unused; eliminate them + SE_DialogButtonAccept, + SE_DialogButtonReject, + SE_DialogButtonApply, + SE_DialogButtonHelp, + SE_DialogButtonAll, + SE_DialogButtonAbort, + SE_DialogButtonIgnore, + SE_DialogButtonRetry, + SE_DialogButtonCustom, + + SE_ToolBoxTabContents, + + SE_HeaderLabel, + SE_HeaderArrow, + + SE_TabWidgetTabBar, + SE_TabWidgetTabPane, + SE_TabWidgetTabContents, + SE_TabWidgetLeftCorner, + SE_TabWidgetRightCorner, + + SE_ViewItemCheckIndicator, + SE_ItemViewItemCheckIndicator = SE_ViewItemCheckIndicator, + + SE_TabBarTearIndicator, + + SE_TreeViewDisclosureItem, + + SE_LineEditContents, + SE_FrameContents, + + SE_DockWidgetCloseButton, + SE_DockWidgetFloatButton, + SE_DockWidgetTitleBarText, + SE_DockWidgetIcon, + + SE_CheckBoxLayoutItem, + SE_ComboBoxLayoutItem, + SE_DateTimeEditLayoutItem, + SE_DialogButtonBoxLayoutItem, // ### remove + SE_LabelLayoutItem, + SE_ProgressBarLayoutItem, + SE_PushButtonLayoutItem, + SE_RadioButtonLayoutItem, + SE_SliderLayoutItem, + SE_SpinBoxLayoutItem, + SE_ToolButtonLayoutItem, + + SE_FrameLayoutItem, + SE_GroupBoxLayoutItem, + SE_TabWidgetLayoutItem, + + SE_ItemViewItemDecoration, + SE_ItemViewItemText, + SE_ItemViewItemFocusRect, + + SE_TabBarTabLeftButton, + SE_TabBarTabRightButton, + SE_TabBarTabText, + + SE_ShapedFrameContents, + + SE_ToolBarHandle, + + // do not add any values below/greater than this + SE_CustomBase = 0xf0000000 + }; + + virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, + const QWidget *widget = 0) const = 0; + + + enum ComplexControl { + CC_SpinBox, + CC_ComboBox, + CC_ScrollBar, + CC_Slider, + CC_ToolButton, + CC_TitleBar, + CC_Q3ListView, + CC_Dial, + CC_GroupBox, + CC_MdiControls, + + // do not add any values below/greater than this + CC_CustomBase = 0xf0000000 + }; + + enum SubControl { + SC_None = 0x00000000, + + SC_ScrollBarAddLine = 0x00000001, + SC_ScrollBarSubLine = 0x00000002, + SC_ScrollBarAddPage = 0x00000004, + SC_ScrollBarSubPage = 0x00000008, + SC_ScrollBarFirst = 0x00000010, + SC_ScrollBarLast = 0x00000020, + SC_ScrollBarSlider = 0x00000040, + SC_ScrollBarGroove = 0x00000080, + + SC_SpinBoxUp = 0x00000001, + SC_SpinBoxDown = 0x00000002, + SC_SpinBoxFrame = 0x00000004, + SC_SpinBoxEditField = 0x00000008, + + SC_ComboBoxFrame = 0x00000001, + SC_ComboBoxEditField = 0x00000002, + SC_ComboBoxArrow = 0x00000004, + SC_ComboBoxListBoxPopup = 0x00000008, + + SC_SliderGroove = 0x00000001, + SC_SliderHandle = 0x00000002, + SC_SliderTickmarks = 0x00000004, + + SC_ToolButton = 0x00000001, + SC_ToolButtonMenu = 0x00000002, + + SC_TitleBarSysMenu = 0x00000001, + SC_TitleBarMinButton = 0x00000002, + SC_TitleBarMaxButton = 0x00000004, + SC_TitleBarCloseButton = 0x00000008, + SC_TitleBarNormalButton = 0x00000010, + SC_TitleBarShadeButton = 0x00000020, + SC_TitleBarUnshadeButton = 0x00000040, + SC_TitleBarContextHelpButton = 0x00000080, + SC_TitleBarLabel = 0x00000100, + + SC_Q3ListView = 0x00000001, + SC_Q3ListViewBranch = 0x00000002, + SC_Q3ListViewExpand = 0x00000004, + + SC_DialGroove = 0x00000001, + SC_DialHandle = 0x00000002, + SC_DialTickmarks = 0x00000004, + + SC_GroupBoxCheckBox = 0x00000001, + SC_GroupBoxLabel = 0x00000002, + SC_GroupBoxContents = 0x00000004, + SC_GroupBoxFrame = 0x00000008, + + SC_MdiMinButton = 0x00000001, + SC_MdiNormalButton = 0x00000002, + SC_MdiCloseButton = 0x00000004, + + SC_CustomBase = 0xf0000000, + SC_All = 0xffffffff + }; + Q_DECLARE_FLAGS(SubControls, SubControl) + +#ifdef QT3_SUPPORT + typedef SubControls SCFlags; +#endif + + virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, + const QWidget *widget = 0) const = 0; + virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, + const QPoint &pt, const QWidget *widget = 0) const = 0; + virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget = 0) const = 0; + + enum PixelMetric { + PM_ButtonMargin, + PM_ButtonDefaultIndicator, + PM_MenuButtonIndicator, + PM_ButtonShiftHorizontal, + PM_ButtonShiftVertical, + + PM_DefaultFrameWidth, + PM_SpinBoxFrameWidth, + PM_ComboBoxFrameWidth, + + PM_MaximumDragDistance, + + PM_ScrollBarExtent, + PM_ScrollBarSliderMin, + + PM_SliderThickness, // total slider thickness + PM_SliderControlThickness, // thickness of the business part + PM_SliderLength, // total length of slider + PM_SliderTickmarkOffset, // + PM_SliderSpaceAvailable, // available space for slider to move + + PM_DockWidgetSeparatorExtent, + PM_DockWidgetHandleExtent, + PM_DockWidgetFrameWidth, + + PM_TabBarTabOverlap, + PM_TabBarTabHSpace, + PM_TabBarTabVSpace, + PM_TabBarBaseHeight, + PM_TabBarBaseOverlap, + + PM_ProgressBarChunkWidth, + + PM_SplitterWidth, + PM_TitleBarHeight, + + PM_MenuScrollerHeight, + PM_MenuHMargin, + PM_MenuVMargin, + PM_MenuPanelWidth, + PM_MenuTearoffHeight, + PM_MenuDesktopFrameWidth, + + PM_MenuBarPanelWidth, + PM_MenuBarItemSpacing, + PM_MenuBarVMargin, + PM_MenuBarHMargin, + + PM_IndicatorWidth, + PM_IndicatorHeight, + PM_ExclusiveIndicatorWidth, + PM_ExclusiveIndicatorHeight, + PM_CheckListButtonSize, + PM_CheckListControllerSize, + + PM_DialogButtonsSeparator, + PM_DialogButtonsButtonWidth, + PM_DialogButtonsButtonHeight, + + PM_MdiSubWindowFrameWidth, + PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, //obsolete + PM_MdiSubWindowMinimizedWidth, + PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, //obsolete + + PM_HeaderMargin, + PM_HeaderMarkSize, + PM_HeaderGripMargin, + PM_TabBarTabShiftHorizontal, + PM_TabBarTabShiftVertical, + PM_TabBarScrollButtonWidth, + + PM_ToolBarFrameWidth, + PM_ToolBarHandleExtent, + PM_ToolBarItemSpacing, + PM_ToolBarItemMargin, + PM_ToolBarSeparatorExtent, + PM_ToolBarExtensionExtent, + + PM_SpinBoxSliderHeight, + + PM_DefaultTopLevelMargin, + PM_DefaultChildMargin, + PM_DefaultLayoutSpacing, + + PM_ToolBarIconSize, + PM_ListViewIconSize, + PM_IconViewIconSize, + PM_SmallIconSize, + PM_LargeIconSize, + + PM_FocusFrameVMargin, + PM_FocusFrameHMargin, + + PM_ToolTipLabelFrameWidth, + PM_CheckBoxLabelSpacing, + PM_TabBarIconSize, + PM_SizeGripSize, + PM_DockWidgetTitleMargin, + PM_MessageBoxIconSize, + PM_ButtonIconSize, + + PM_DockWidgetTitleBarButtonMargin, + + PM_RadioButtonLabelSpacing, + PM_LayoutLeftMargin, + PM_LayoutTopMargin, + PM_LayoutRightMargin, + PM_LayoutBottomMargin, + PM_LayoutHorizontalSpacing, + PM_LayoutVerticalSpacing, + PM_TabBar_ScrollButtonOverlap, + + PM_TextCursorWidth, + + PM_TabCloseIndicatorWidth, + PM_TabCloseIndicatorHeight, + + PM_ScrollView_ScrollBarSpacing, + PM_SubMenuOverlap, + + // do not add any values below/greater than this + PM_CustomBase = 0xf0000000 + }; + + virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, + const QWidget *widget = 0) const = 0; + + enum ContentsType { + CT_PushButton, + CT_CheckBox, + CT_RadioButton, + CT_ToolButton, + CT_ComboBox, + CT_Splitter, + CT_Q3DockWindow, + CT_ProgressBar, + CT_MenuItem, + CT_MenuBarItem, + CT_MenuBar, + CT_Menu, + CT_TabBarTab, + CT_Slider, + CT_ScrollBar, + CT_Q3Header, + CT_LineEdit, + CT_SpinBox, + CT_SizeGrip, + CT_TabWidget, + CT_DialogButtons, + CT_HeaderSection, + CT_GroupBox, + CT_MdiControls, + CT_ItemViewItem, + // do not add any values below/greater than this + CT_CustomBase = 0xf0000000 + }; + + virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, + const QSize &contentsSize, const QWidget *w = 0) const = 0; + + enum RequestSoftwareInputPanel { + RSIP_OnMouseClickAndAlreadyFocused, + RSIP_OnMouseClick + }; + + enum StyleHint { + SH_EtchDisabledText, + SH_DitherDisabledText, + SH_ScrollBar_MiddleClickAbsolutePosition, + SH_ScrollBar_ScrollWhenPointerLeavesControl, + SH_TabBar_SelectMouseType, + SH_TabBar_Alignment, + SH_Header_ArrowAlignment, + SH_Slider_SnapToValue, + SH_Slider_SloppyKeyEvents, + SH_ProgressDialog_CenterCancelButton, + SH_ProgressDialog_TextLabelAlignment, + SH_PrintDialog_RightAlignButtons, + SH_MainWindow_SpaceBelowMenuBar, + SH_FontDialog_SelectAssociatedText, + SH_Menu_AllowActiveAndDisabled, + SH_Menu_SpaceActivatesItem, + SH_Menu_SubMenuPopupDelay, + SH_ScrollView_FrameOnlyAroundContents, + SH_MenuBar_AltKeyNavigation, + SH_ComboBox_ListMouseTracking, + SH_Menu_MouseTracking, + SH_MenuBar_MouseTracking, + SH_ItemView_ChangeHighlightOnFocus, + SH_Widget_ShareActivation, + SH_Workspace_FillSpaceOnMaximize, + SH_ComboBox_Popup, + SH_TitleBar_NoBorder, + SH_Slider_StopMouseOverSlider, + SH_ScrollBar_StopMouseOverSlider = SH_Slider_StopMouseOverSlider, // obsolete + SH_BlinkCursorWhenTextSelected, + SH_RichText_FullWidthSelection, + SH_Menu_Scrollable, + SH_GroupBox_TextLabelVerticalAlignment, + SH_GroupBox_TextLabelColor, + SH_Menu_SloppySubMenus, + SH_Table_GridLineColor, + SH_LineEdit_PasswordCharacter, + SH_DialogButtons_DefaultButton, + SH_ToolBox_SelectedPageTitleBold, + SH_TabBar_PreferNoArrows, + SH_ScrollBar_LeftClickAbsolutePosition, + SH_Q3ListViewExpand_SelectMouseType, + SH_UnderlineShortcut, + SH_SpinBox_AnimateButton, + SH_SpinBox_KeyPressAutoRepeatRate, + SH_SpinBox_ClickAutoRepeatRate, + SH_Menu_FillScreenWithScroll, + SH_ToolTipLabel_Opacity, + SH_DrawMenuBarSeparator, + SH_TitleBar_ModifyNotification, + SH_Button_FocusPolicy, + SH_MenuBar_DismissOnSecondClick, + SH_MessageBox_UseBorderForButtonSpacing, + SH_TitleBar_AutoRaise, + SH_ToolButton_PopupDelay, + SH_FocusFrame_Mask, + SH_RubberBand_Mask, + SH_WindowFrame_Mask, + SH_SpinControls_DisableOnBounds, + SH_Dial_BackgroundRole, + SH_ComboBox_LayoutDirection, + SH_ItemView_EllipsisLocation, + SH_ItemView_ShowDecorationSelected, + SH_ItemView_ActivateItemOnSingleClick, + SH_ScrollBar_ContextMenu, + SH_ScrollBar_RollBetweenButtons, + SH_Slider_AbsoluteSetButtons, + SH_Slider_PageSetButtons, + SH_Menu_KeyboardSearch, + SH_TabBar_ElideMode, + SH_DialogButtonLayout, + SH_ComboBox_PopupFrameStyle, + SH_MessageBox_TextInteractionFlags, + SH_DialogButtonBox_ButtonsHaveIcons, + SH_SpellCheckUnderlineStyle, + SH_MessageBox_CenterButtons, + SH_Menu_SelectionWrap, + SH_ItemView_MovementWithoutUpdatingSelection, + SH_ToolTip_Mask, + SH_FocusFrame_AboveWidget, + SH_TextControl_FocusIndicatorTextCharFormat, + SH_WizardStyle, + SH_ItemView_ArrowKeysNavigateIntoChildren, + SH_Menu_Mask, + SH_Menu_FlashTriggeredItem, + SH_Menu_FadeOutOnHide, + SH_SpinBox_ClickAutoRepeatThreshold, + SH_ItemView_PaintAlternatingRowColorsForEmptyArea, + SH_FormLayoutWrapPolicy, + SH_TabWidget_DefaultTabPosition, + SH_ToolBar_Movable, + SH_FormLayoutFieldGrowthPolicy, + SH_FormLayoutFormAlignment, + SH_FormLayoutLabelAlignment, + SH_ItemView_DrawDelegateFrame, + SH_TabBar_CloseButtonPosition, + SH_DockWidget_ButtonsHaveFrame, + SH_ToolButtonStyle, + SH_RequestSoftwareInputPanel, + // Add new style hint values here + +#ifdef QT3_SUPPORT + SH_GUIStyle = 0x00000100, + SH_ScrollBar_BackgroundMode, + // Add other compat values here + + SH_UnderlineAccelerator = SH_UnderlineShortcut, +#endif + SH_CustomBase = 0xf0000000 + }; + + virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = 0, + const QWidget *widget = 0, QStyleHintReturn* returnData = 0) const = 0; + + enum StandardPixmap { + SP_TitleBarMenuButton, + SP_TitleBarMinButton, + SP_TitleBarMaxButton, + SP_TitleBarCloseButton, + SP_TitleBarNormalButton, + SP_TitleBarShadeButton, + SP_TitleBarUnshadeButton, + SP_TitleBarContextHelpButton, + SP_DockWidgetCloseButton, + SP_MessageBoxInformation, + SP_MessageBoxWarning, + SP_MessageBoxCritical, + SP_MessageBoxQuestion, + SP_DesktopIcon, + SP_TrashIcon, + SP_ComputerIcon, + SP_DriveFDIcon, + SP_DriveHDIcon, + SP_DriveCDIcon, + SP_DriveDVDIcon, + SP_DriveNetIcon, + SP_DirOpenIcon, + SP_DirClosedIcon, + SP_DirLinkIcon, + SP_FileIcon, + SP_FileLinkIcon, + SP_ToolBarHorizontalExtensionButton, + SP_ToolBarVerticalExtensionButton, + SP_FileDialogStart, + SP_FileDialogEnd, + SP_FileDialogToParent, + SP_FileDialogNewFolder, + SP_FileDialogDetailedView, + SP_FileDialogInfoView, + SP_FileDialogContentsView, + SP_FileDialogListView, + SP_FileDialogBack, + SP_DirIcon, + SP_DialogOkButton, + SP_DialogCancelButton, + SP_DialogHelpButton, + SP_DialogOpenButton, + SP_DialogSaveButton, + SP_DialogCloseButton, + SP_DialogApplyButton, + SP_DialogResetButton, + SP_DialogDiscardButton, + SP_DialogYesButton, + SP_DialogNoButton, + SP_ArrowUp, + SP_ArrowDown, + SP_ArrowLeft, + SP_ArrowRight, + SP_ArrowBack, + SP_ArrowForward, + SP_DirHomeIcon, + SP_CommandLink, + SP_VistaShield, + SP_BrowserReload, + SP_BrowserStop, + SP_MediaPlay, + SP_MediaStop, + SP_MediaPause, + SP_MediaSkipForward, + SP_MediaSkipBackward, + SP_MediaSeekForward, + SP_MediaSeekBackward, + SP_MediaVolume, + SP_MediaVolumeMuted, + // do not add any values below/greater than this + SP_CustomBase = 0xf0000000 + }; + + virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0, + const QWidget *widget = 0) const = 0; + + QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, + const QWidget *widget = 0) const; + + virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, + const QStyleOption *opt) const = 0; + + static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, + const QRect &logicalRect); + static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, + const QPoint &logicalPos); + static int sliderPositionFromValue(int min, int max, int val, int space, + bool upsideDown = false); + static int sliderValueFromPosition(int min, int max, int pos, int space, + bool upsideDown = false); + static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment); + static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, + const QSize &size, const QRect &rectangle); + + int layoutSpacing(QSizePolicy::ControlType control1, + QSizePolicy::ControlType control2, Qt::Orientation orientation, + const QStyleOption *option = 0, const QWidget *widget = 0) const; + int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, + QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, + QStyleOption *option = 0, QWidget *widget = 0) const; + + const QStyle * proxy() const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, + const QWidget *widget = 0) const; + int layoutSpacingImplementation(QSizePolicy::ControlType control1, + QSizePolicy::ControlType control2, + Qt::Orientation orientation, + const QStyleOption *option = 0, + const QWidget *widget = 0) const; + +private: + Q_DISABLE_COPY(QStyle) + friend class QWidget; + friend class QWidgetPrivate; + friend class QApplication; + friend class QProxyStyle; + friend class QProxyStylePrivate; + void setProxy(QStyle *style); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) + +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTYLE_H diff --git a/qtinterface/qt4/Qt/qstyleditemdelegate.h b/qtinterface/qt4/Qt/qstyleditemdelegate.h new file mode 100644 index 0000000..8c0acd4 --- /dev/null +++ b/qtinterface/qt4/Qt/qstyleditemdelegate.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLEDITEMDELEGATE_H +#define QSTYLEDITEMDELEGATE_H + +#include <QtGui/qabstractitemdelegate.h> +#include <QtCore/qstring.h> +#include <QtGui/qpixmap.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ITEMVIEWS + +class QStyledItemDelegatePrivate; +class QItemEditorFactory; + +class Q_GUI_EXPORT QStyledItemDelegate : public QAbstractItemDelegate +{ + Q_OBJECT + +public: + explicit QStyledItemDelegate(QObject *parent = 0); + ~QStyledItemDelegate(); + + // painting + void paint(QPainter *painter, + const QStyleOptionViewItem &option, const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + // editing + QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, + QAbstractItemModel *model, + const QModelIndex &index) const; + + void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + // editor factory + QItemEditorFactory *itemEditorFactory() const; + void setItemEditorFactory(QItemEditorFactory *factory); + + virtual QString displayText(const QVariant &value, const QLocale &locale) const; + +protected: + virtual void initStyleOption(QStyleOptionViewItem *option, + const QModelIndex &index) const; + + bool eventFilter(QObject *object, QEvent *event); + bool editorEvent(QEvent *event, QAbstractItemModel *model, + const QStyleOptionViewItem &option, const QModelIndex &index); + +private: + Q_DECLARE_PRIVATE(QStyledItemDelegate) + Q_DISABLE_COPY(QStyledItemDelegate) + + Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) +}; + +#endif // QT_NO_ITEMVIEWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTYLEDITEMDELEGATE_H diff --git a/qtinterface/qt4/Qt/qstylefactory.h b/qtinterface/qt4/Qt/qstylefactory.h new file mode 100644 index 0000000..42348cb --- /dev/null +++ b/qtinterface/qt4/Qt/qstylefactory.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLEFACTORY_H +#define QSTYLEFACTORY_H + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyle; + +class Q_GUI_EXPORT QStyleFactory +{ +public: + static QStringList keys(); + static QStyle *create(const QString&); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTYLEFACTORY_H diff --git a/qtinterface/qt4/Qt/qstyleoption.h b/qtinterface/qt4/Qt/qstyleoption.h new file mode 100644 index 0000000..8bb9715 --- /dev/null +++ b/qtinterface/qt4/Qt/qstyleoption.h @@ -0,0 +1,968 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLEOPTION_H +#define QSTYLEOPTION_H + +#include <QtCore/qvariant.h> +#include <QtGui/qabstractspinbox.h> +#include <QtGui/qicon.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qslider.h> +#include <QtGui/qstyle.h> +#include <QtGui/qtabbar.h> +#include <QtGui/qtabwidget.h> +#include <QtGui/qrubberband.h> +#include <QtGui/qframe.h> +#ifndef QT_NO_ITEMVIEWS +# include <QtCore/qabstractitemmodel.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QDebug; + +class Q_GUI_EXPORT QStyleOption +{ +public: + enum OptionType { + SO_Default, SO_FocusRect, SO_Button, SO_Tab, SO_MenuItem, + SO_Frame, SO_ProgressBar, SO_ToolBox, SO_Header, SO_Q3DockWindow, + SO_DockWidget, SO_Q3ListViewItem, SO_ViewItem, SO_TabWidgetFrame, + SO_TabBarBase, SO_RubberBand, SO_ToolBar, SO_GraphicsItem, + + SO_Complex = 0xf0000, SO_Slider, SO_SpinBox, SO_ToolButton, SO_ComboBox, + SO_Q3ListView, SO_TitleBar, SO_GroupBox, SO_SizeGrip, + + SO_CustomBase = 0xf00, + SO_ComplexCustomBase = 0xf000000 + }; + + enum StyleOptionType { Type = SO_Default }; + enum StyleOptionVersion { Version = 1 }; + + int version; + int type; + QStyle::State state; + Qt::LayoutDirection direction; + QRect rect; + QFontMetrics fontMetrics; + QPalette palette; + + QStyleOption(int version = QStyleOption::Version, int type = SO_Default); + QStyleOption(const QStyleOption &other); + ~QStyleOption(); + + void init(const QWidget *w); + inline void initFrom(const QWidget *w) { init(w); } + QStyleOption &operator=(const QStyleOption &other); +}; + +class Q_GUI_EXPORT QStyleOptionFocusRect : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_FocusRect }; + enum StyleOptionVersion { Version = 1 }; + + QColor backgroundColor; + + QStyleOptionFocusRect(); + QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionFocusRect(int version); +}; + +class Q_GUI_EXPORT QStyleOptionFrame : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Frame }; + enum StyleOptionVersion { Version = 1 }; + + int lineWidth; + int midLineWidth; + + QStyleOptionFrame(); + QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionFrame(int version); +}; + +class Q_GUI_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame +{ +public: + enum StyleOptionVersion { Version = 2 }; + enum FrameFeature { + None = 0x00, + Flat = 0x01 + }; + Q_DECLARE_FLAGS(FrameFeatures, FrameFeature) + FrameFeatures features; + + QStyleOptionFrameV2(); + QStyleOptionFrameV2(const QStyleOptionFrameV2 &other) : QStyleOptionFrame(Version) { *this = other; } + QStyleOptionFrameV2(const QStyleOptionFrame &other); + QStyleOptionFrameV2 &operator=(const QStyleOptionFrame &other); + +protected: + QStyleOptionFrameV2(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrameV2::FrameFeatures) + + +class Q_GUI_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2 +{ +public: + enum StyleOptionVersion { Version = 3 }; + QFrame::Shape frameShape : 4; + uint unused : 28; + + QStyleOptionFrameV3(); + QStyleOptionFrameV3(const QStyleOptionFrameV3 &other) : QStyleOptionFrameV2(Version) { *this = other; } + QStyleOptionFrameV3(const QStyleOptionFrame &other); + QStyleOptionFrameV3 &operator=(const QStyleOptionFrame &other); + +protected: + QStyleOptionFrameV3(int version); +}; + + +#ifndef QT_NO_TABWIDGET +class Q_GUI_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_TabWidgetFrame }; + enum StyleOptionVersion { Version = 1 }; + + int lineWidth; + int midLineWidth; + QTabBar::Shape shape; + QSize tabBarSize; + QSize rightCornerWidgetSize; + QSize leftCornerWidgetSize; + + QStyleOptionTabWidgetFrame(); + inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other) + : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionTabWidgetFrame(int version); +}; + +class Q_GUI_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame +{ +public: + enum StyleOptionVersion { Version = 2 }; + + QRect tabBarRect; + QRect selectedTabRect; + + QStyleOptionTabWidgetFrameV2(); + QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) : + QStyleOptionTabWidgetFrame(Version) { *this = other; } + QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other); + QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other); + +protected: + QStyleOptionTabWidgetFrameV2(int version); +}; + +#endif + + +#ifndef QT_NO_TABBAR +class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_TabBarBase }; + enum StyleOptionVersion { Version = 1 }; + + QTabBar::Shape shape; + QRect tabBarRect; + QRect selectedTabRect; + + QStyleOptionTabBarBase(); + QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionTabBarBase(int version); +}; + +class Q_GUI_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase +{ +public: + enum StyleOptionVersion { Version = 2 }; + bool documentMode; + QStyleOptionTabBarBaseV2(); + QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other) : QStyleOptionTabBarBase(Version) { *this = other; } + QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other); + QStyleOptionTabBarBaseV2 &operator=(const QStyleOptionTabBarBase &other); + +protected: + QStyleOptionTabBarBaseV2(int version); +}; + +#endif + +class Q_GUI_EXPORT QStyleOptionHeader : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Header }; + enum StyleOptionVersion { Version = 1 }; + + enum SectionPosition { Beginning, Middle, End, OnlyOneSection }; + enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected, + NextAndPreviousAreSelected }; + enum SortIndicator { None, SortUp, SortDown }; + + int section; + QString text; + Qt::Alignment textAlignment; + QIcon icon; + Qt::Alignment iconAlignment; + SectionPosition position; + SelectedPosition selectedPosition; + SortIndicator sortIndicator; + Qt::Orientation orientation; + + QStyleOptionHeader(); + QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionHeader(int version); +}; + +class Q_GUI_EXPORT QStyleOptionButton : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Button }; + enum StyleOptionVersion { Version = 1 }; + + enum ButtonFeature { None = 0x00, Flat = 0x01, HasMenu = 0x02, DefaultButton = 0x04, + AutoDefaultButton = 0x08, CommandLinkButton = 0x10 }; + Q_DECLARE_FLAGS(ButtonFeatures, ButtonFeature) + + ButtonFeatures features; + QString text; + QIcon icon; + QSize iconSize; + + QStyleOptionButton(); + QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionButton(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures) + +#ifndef QT_NO_TABBAR +class Q_GUI_EXPORT QStyleOptionTab : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Tab }; + enum StyleOptionVersion { Version = 1 }; + + enum TabPosition { Beginning, Middle, End, OnlyOneTab }; + enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected }; + enum CornerWidget { NoCornerWidgets = 0x00, LeftCornerWidget = 0x01, + RightCornerWidget = 0x02 }; + Q_DECLARE_FLAGS(CornerWidgets, CornerWidget) + + QTabBar::Shape shape; + QString text; + QIcon icon; + int row; + TabPosition position; + SelectedPosition selectedPosition; + CornerWidgets cornerWidgets; + + QStyleOptionTab(); + QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionTab(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets) + +class Q_GUI_EXPORT QStyleOptionTabV2 : public QStyleOptionTab +{ +public: + enum StyleOptionVersion { Version = 2 }; + QSize iconSize; + QStyleOptionTabV2(); + QStyleOptionTabV2(const QStyleOptionTabV2 &other) : QStyleOptionTab(Version) { *this = other; } + QStyleOptionTabV2(const QStyleOptionTab &other); + QStyleOptionTabV2 &operator=(const QStyleOptionTab &other); + +protected: + QStyleOptionTabV2(int version); +}; + +class Q_GUI_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2 +{ +public: + enum StyleOptionVersion { Version = 3 }; + bool documentMode; + QSize leftButtonSize; + QSize rightButtonSize; + QStyleOptionTabV3(); + QStyleOptionTabV3(const QStyleOptionTabV3 &other) : QStyleOptionTabV2(Version) { *this = other; } + QStyleOptionTabV3(const QStyleOptionTabV2 &other) : QStyleOptionTabV2(Version) { *this = other; } + QStyleOptionTabV3(const QStyleOptionTab &other); + QStyleOptionTabV3 &operator=(const QStyleOptionTab &other); + +protected: + QStyleOptionTabV3(int version); +}; + +#endif + + +#ifndef QT_NO_TOOLBAR + +class Q_GUI_EXPORT QStyleOptionToolBar : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_ToolBar }; + enum StyleOptionVersion { Version = 1 }; + enum ToolBarPosition { Beginning, Middle, End, OnlyOne }; + enum ToolBarFeature { None = 0x0, Movable = 0x1 }; + Q_DECLARE_FLAGS(ToolBarFeatures, ToolBarFeature) + ToolBarPosition positionOfLine; // The toolbar line position + ToolBarPosition positionWithinLine; // The position within a toolbar + Qt::ToolBarArea toolBarArea; // The toolbar docking area + ToolBarFeatures features; + int lineWidth; + int midLineWidth; + QStyleOptionToolBar(); + QStyleOptionToolBar(const QStyleOptionToolBar &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionToolBar(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures) + +#endif + + + +class Q_GUI_EXPORT QStyleOptionProgressBar : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_ProgressBar }; + enum StyleOptionVersion { Version = 1 }; + + int minimum; + int maximum; + int progress; + QString text; + Qt::Alignment textAlignment; + bool textVisible; + + QStyleOptionProgressBar(); + QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionProgressBar(int version); +}; + +// Adds style info for vertical progress bars +class Q_GUI_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar +{ +public: + enum StyleOptionType { Type = SO_ProgressBar }; + enum StyleOptionVersion { Version = 2 }; + Qt::Orientation orientation; + bool invertedAppearance; + bool bottomToTop; + + QStyleOptionProgressBarV2(); + QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other); + QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other); + QStyleOptionProgressBarV2 &operator=(const QStyleOptionProgressBar &other); + +protected: + QStyleOptionProgressBarV2(int version); +}; + +class Q_GUI_EXPORT QStyleOptionMenuItem : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_MenuItem }; + enum StyleOptionVersion { Version = 1 }; + + enum MenuItemType { Normal, DefaultItem, Separator, SubMenu, Scroller, TearOff, Margin, + EmptyArea }; + enum CheckType { NotCheckable, Exclusive, NonExclusive }; + + MenuItemType menuItemType; + CheckType checkType; + bool checked; + bool menuHasCheckableItems; + QRect menuRect; + QString text; + QIcon icon; + int maxIconWidth; + int tabWidth; + QFont font; + + QStyleOptionMenuItem(); + QStyleOptionMenuItem(const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionMenuItem(int version); +}; + +class Q_GUI_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Q3ListViewItem }; + enum StyleOptionVersion { Version = 1 }; + + enum Q3ListViewItemFeature { None = 0x00, Expandable = 0x01, MultiLine = 0x02, Visible = 0x04, + ParentControl = 0x08 }; + Q_DECLARE_FLAGS(Q3ListViewItemFeatures, Q3ListViewItemFeature) + + Q3ListViewItemFeatures features; + int height; + int totalHeight; + int itemY; + int childCount; + + QStyleOptionQ3ListViewItem(); + QStyleOptionQ3ListViewItem(const QStyleOptionQ3ListViewItem &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionQ3ListViewItem(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionQ3ListViewItem::Q3ListViewItemFeatures) + +class Q_GUI_EXPORT QStyleOptionQ3DockWindow : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Q3DockWindow }; + enum StyleOptionVersion { Version = 1 }; + + bool docked; + bool closeEnabled; + + QStyleOptionQ3DockWindow(); + QStyleOptionQ3DockWindow(const QStyleOptionQ3DockWindow &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionQ3DockWindow(int version); +}; + +class Q_GUI_EXPORT QStyleOptionDockWidget : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_DockWidget }; + enum StyleOptionVersion { Version = 1 }; + + QString title; + bool closable; + bool movable; + bool floatable; + + QStyleOptionDockWidget(); + QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionDockWidget(int version); +}; + +class Q_GUI_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget +{ +public: + enum StyleOptionVersion { Version = 2 }; + + bool verticalTitleBar; + + QStyleOptionDockWidgetV2(); + QStyleOptionDockWidgetV2(const QStyleOptionDockWidgetV2 &other) + : QStyleOptionDockWidget(Version) { *this = other; } + QStyleOptionDockWidgetV2(const QStyleOptionDockWidget &other); + QStyleOptionDockWidgetV2 &operator = (const QStyleOptionDockWidget &other); + +protected: + QStyleOptionDockWidgetV2(int version); +}; + +class Q_GUI_EXPORT QStyleOptionViewItem : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_ViewItem }; + enum StyleOptionVersion { Version = 1 }; + + enum Position { Left, Right, Top, Bottom }; + + Qt::Alignment displayAlignment; + Qt::Alignment decorationAlignment; + Qt::TextElideMode textElideMode; + Position decorationPosition; + QSize decorationSize; + QFont font; + bool showDecorationSelected; + + QStyleOptionViewItem(); + QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionViewItem(int version); +}; + +class Q_GUI_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem +{ +public: + enum StyleOptionVersion { Version = 2 }; + + enum ViewItemFeature { + None = 0x00, + WrapText = 0x01, + Alternate = 0x02, + HasCheckIndicator = 0x04, + HasDisplay = 0x08, + HasDecoration = 0x10 + }; + Q_DECLARE_FLAGS(ViewItemFeatures, ViewItemFeature) + + ViewItemFeatures features; + + QStyleOptionViewItemV2(); + QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other) : QStyleOptionViewItem(Version) { *this = other; } + QStyleOptionViewItemV2(const QStyleOptionViewItem &other); + QStyleOptionViewItemV2 &operator=(const QStyleOptionViewItem &other); + +protected: + QStyleOptionViewItemV2(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItemV2::ViewItemFeatures) + +class Q_GUI_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2 +{ +public: + enum StyleOptionVersion { Version = 3 }; + + QLocale locale; + const QWidget *widget; + + QStyleOptionViewItemV3(); + QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other) + : QStyleOptionViewItemV2(Version) { *this = other; } + QStyleOptionViewItemV3(const QStyleOptionViewItem &other); + QStyleOptionViewItemV3 &operator = (const QStyleOptionViewItem &other); + +protected: + QStyleOptionViewItemV3(int version); +}; + +#ifndef QT_NO_ITEMVIEWS +class Q_GUI_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3 +{ +public: + enum StyleOptionVersion { Version = 4 }; + enum ViewItemPosition { Invalid, Beginning, Middle, End, OnlyOne }; + + QModelIndex index; + Qt::CheckState checkState; + QIcon icon; + QString text; + ViewItemPosition viewItemPosition; + QBrush backgroundBrush; + + QStyleOptionViewItemV4(); + QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other) + : QStyleOptionViewItemV3(Version) { *this = other; } + QStyleOptionViewItemV4(const QStyleOptionViewItem &other); + QStyleOptionViewItemV4 &operator = (const QStyleOptionViewItem &other); + +protected: + QStyleOptionViewItemV4(int version); +}; +#endif + +class Q_GUI_EXPORT QStyleOptionToolBox : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_ToolBox }; + enum StyleOptionVersion { Version = 1 }; + + QString text; + QIcon icon; + + QStyleOptionToolBox(); + QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionToolBox(int version); +}; + +class Q_GUI_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox +{ +public: + enum StyleOptionVersion { Version = 2 }; + enum TabPosition { Beginning, Middle, End, OnlyOneTab }; + enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected }; + + TabPosition position; + SelectedPosition selectedPosition; + + QStyleOptionToolBoxV2(); + QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other) : QStyleOptionToolBox(Version) { *this = other; } + QStyleOptionToolBoxV2(const QStyleOptionToolBox &other); + QStyleOptionToolBoxV2 &operator=(const QStyleOptionToolBox &other); + +protected: + QStyleOptionToolBoxV2(int version); +}; + +#ifndef QT_NO_RUBBERBAND +class Q_GUI_EXPORT QStyleOptionRubberBand : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_RubberBand }; + enum StyleOptionVersion { Version = 1 }; + + QRubberBand::Shape shape; + bool opaque; + + QStyleOptionRubberBand(); + QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; } + +protected: + QStyleOptionRubberBand(int version); +}; +#endif // QT_NO_RUBBERBAND + +// -------------------------- Complex style options ------------------------------- +class Q_GUI_EXPORT QStyleOptionComplex : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_Complex }; + enum StyleOptionVersion { Version = 1 }; + + QStyle::SubControls subControls; + QStyle::SubControls activeSubControls; + + QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex); + QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; } +}; + +#ifndef QT_NO_SLIDER +class Q_GUI_EXPORT QStyleOptionSlider : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_Slider }; + enum StyleOptionVersion { Version = 1 }; + + Qt::Orientation orientation; + int minimum; + int maximum; + QSlider::TickPosition tickPosition; + int tickInterval; + bool upsideDown; + int sliderPosition; + int sliderValue; + int singleStep; + int pageStep; + qreal notchTarget; + bool dialWrapping; + + QStyleOptionSlider(); + QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; } + +protected: + QStyleOptionSlider(int version); +}; +#endif // QT_NO_SLIDER + +#ifndef QT_NO_SPINBOX +class Q_GUI_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_SpinBox }; + enum StyleOptionVersion { Version = 1 }; + + QAbstractSpinBox::ButtonSymbols buttonSymbols; + QAbstractSpinBox::StepEnabled stepEnabled; + bool frame; + + QStyleOptionSpinBox(); + QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } + +protected: + QStyleOptionSpinBox(int version); +}; +#endif // QT_NO_SPINBOX + +class Q_GUI_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_Q3ListView }; + enum StyleOptionVersion { Version = 1 }; + + QList<QStyleOptionQ3ListViewItem> items; + QPalette viewportPalette; + QPalette::ColorRole viewportBGRole; + int sortColumn; + int itemMargin; + int treeStepSize; + bool rootIsDecorated; + + QStyleOptionQ3ListView(); + QStyleOptionQ3ListView(const QStyleOptionQ3ListView &other) : QStyleOptionComplex(Version, Type) { *this = other; } + +protected: + QStyleOptionQ3ListView(int version); +}; + +class Q_GUI_EXPORT QStyleOptionToolButton : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_ToolButton }; + enum StyleOptionVersion { Version = 1 }; + + enum ToolButtonFeature { None = 0x00, Arrow = 0x01, Menu = 0x04, MenuButtonPopup = Menu, PopupDelay = 0x08, + HasMenu = 0x10 }; + Q_DECLARE_FLAGS(ToolButtonFeatures, ToolButtonFeature) + + ToolButtonFeatures features; + QIcon icon; + QSize iconSize; + QString text; + Qt::ArrowType arrowType; + Qt::ToolButtonStyle toolButtonStyle; + QPoint pos; + QFont font; + + QStyleOptionToolButton(); + QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; } + +protected: + QStyleOptionToolButton(int version); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolButton::ToolButtonFeatures) + +class Q_GUI_EXPORT QStyleOptionComboBox : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_ComboBox }; + enum StyleOptionVersion { Version = 1 }; + + bool editable; + QRect popupRect; + bool frame; + QString currentText; + QIcon currentIcon; + QSize iconSize; + + QStyleOptionComboBox(); + QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } + +protected: + QStyleOptionComboBox(int version); +}; + +class Q_GUI_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_TitleBar }; + enum StyleOptionVersion { Version = 1 }; + + QString text; + QIcon icon; + int titleBarState; + Qt::WindowFlags titleBarFlags; + + QStyleOptionTitleBar(); + QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; } + +protected: + QStyleOptionTitleBar(int version); +}; + +class Q_GUI_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_GroupBox }; + enum StyleOptionVersion { Version = 1 }; + + QStyleOptionFrameV2::FrameFeatures features; + QString text; + Qt::Alignment textAlignment; + QColor textColor; + int lineWidth; + int midLineWidth; + + QStyleOptionGroupBox(); + QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } +protected: + QStyleOptionGroupBox(int version); +}; + +class Q_GUI_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex +{ +public: + enum StyleOptionType { Type = SO_SizeGrip }; + enum StyleOptionVersion { Version = 1 }; + + Qt::Corner corner; + + QStyleOptionSizeGrip(); + QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; } +protected: + QStyleOptionSizeGrip(int version); +}; + +class Q_GUI_EXPORT QStyleOptionGraphicsItem : public QStyleOption +{ +public: + enum StyleOptionType { Type = SO_GraphicsItem }; + enum StyleOptionVersion { Version = 1 }; + + QRectF exposedRect; + QMatrix matrix; + qreal levelOfDetail; + + QStyleOptionGraphicsItem(); + QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; } + static qreal levelOfDetailFromTransform(const QTransform &worldTransform); +protected: + QStyleOptionGraphicsItem(int version); +}; + +template <typename T> +T qstyleoption_cast(const QStyleOption *opt) +{ + if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type + || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default + || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex + && opt->type > QStyleOption::SO_Complex))) + return static_cast<T>(opt); + return 0; +} + +template <typename T> +T qstyleoption_cast(QStyleOption *opt) +{ + if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type + || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default + || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex + && opt->type > QStyleOption::SO_Complex))) + return static_cast<T>(opt); + return 0; +} + +// -------------------------- QStyleHintReturn ------------------------------- +class Q_GUI_EXPORT QStyleHintReturn { +public: + enum HintReturnType { + SH_Default=0xf000, SH_Mask, SH_Variant + }; + + enum StyleOptionType { Type = SH_Default }; + enum StyleOptionVersion { Version = 1 }; + + QStyleHintReturn(int version = QStyleOption::Version, int type = SH_Default); + ~QStyleHintReturn(); + + int version; + int type; +}; + +class Q_GUI_EXPORT QStyleHintReturnMask : public QStyleHintReturn { +public: + enum StyleOptionType { Type = SH_Mask }; + enum StyleOptionVersion { Version = 1 }; + + QStyleHintReturnMask(); + + QRegion region; +}; + +class Q_GUI_EXPORT QStyleHintReturnVariant : public QStyleHintReturn { +public: + enum StyleOptionType { Type = SH_Variant }; + enum StyleOptionVersion { Version = 1 }; + + QStyleHintReturnVariant(); + + QVariant variant; +}; + +template <typename T> +T qstyleoption_cast(const QStyleHintReturn *hint) +{ + if (hint && hint->version <= static_cast<T>(0)->Version && + (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default)) + return static_cast<T>(hint); + return 0; +} + +template <typename T> +T qstyleoption_cast(QStyleHintReturn *hint) +{ + if (hint && hint->version <= static_cast<T>(0)->Version && + (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default)) + return static_cast<T>(hint); + return 0; +} + +Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTYLEOPTION_H diff --git a/qtinterface/qt4/Qt/qstylepainter.h b/qtinterface/qt4/Qt/qstylepainter.h new file mode 100644 index 0000000..5eb4c3c --- /dev/null +++ b/qtinterface/qt4/Qt/qstylepainter.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLEPAINTER_H +#define QSTYLEPAINTER_H + +#include <QtGui/qpainter.h> +#include <QtGui/qstyle.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStylePainter : public QPainter +{ +public: + inline QStylePainter() : QPainter(), widget(0), wstyle(0) {} + inline explicit QStylePainter(QWidget *w) { begin(w, w); } + inline QStylePainter(QPaintDevice *pd, QWidget *w) { begin(pd, w); } + inline bool begin(QWidget *w) { return begin(w, w); } + inline bool begin(QPaintDevice *pd, QWidget *w) { + Q_ASSERT_X(w, "QStylePainter::QStylePainter", "Widget must be non-zero"); + widget = w; + wstyle = w->style(); + return QPainter::begin(pd); + }; + inline void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption &opt); + inline void drawControl(QStyle::ControlElement ce, const QStyleOption &opt); + inline void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &opt); + inline void drawItemText(const QRect &r, int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole = QPalette::NoRole); + inline void drawItemPixmap(const QRect &r, int flags, const QPixmap &pixmap); + inline QStyle *style() const { return wstyle; } + +private: + QWidget *widget; + QStyle *wstyle; + Q_DISABLE_COPY(QStylePainter) +}; + +void QStylePainter::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption &opt) +{ + wstyle->drawPrimitive(pe, &opt, this, widget); +} + +void QStylePainter::drawControl(QStyle::ControlElement ce, const QStyleOption &opt) +{ + wstyle->drawControl(ce, &opt, this, widget); +} + +void QStylePainter::drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &opt) +{ + wstyle->drawComplexControl(cc, &opt, this, widget); +} + +void QStylePainter::drawItemText(const QRect &r, int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole) +{ + wstyle->drawItemText(this, r, flags, pal, enabled, text, textRole); +} + +void QStylePainter::drawItemPixmap(const QRect &r, int flags, const QPixmap &pixmap) +{ + wstyle->drawItemPixmap(this, r, flags, pixmap); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTYLEPAINTER_H diff --git a/qtinterface/qt4/Qt/qstyleplugin.h b/qtinterface/qt4/Qt/qstyleplugin.h new file mode 100644 index 0000000..f03e2c8 --- /dev/null +++ b/qtinterface/qt4/Qt/qstyleplugin.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLEPLUGIN_H +#define QSTYLEPLUGIN_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyle; + +struct Q_GUI_EXPORT QStyleFactoryInterface : public QFactoryInterface +{ + virtual QStyle *create(const QString &key) = 0; +}; + +#define QStyleFactoryInterface_iid "com.trolltech.Qt.QStyleFactoryInterface" + +Q_DECLARE_INTERFACE(QStyleFactoryInterface, QStyleFactoryInterface_iid) + +class Q_GUI_EXPORT QStylePlugin : public QObject, public QStyleFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QStyleFactoryInterface:QFactoryInterface) +public: + explicit QStylePlugin(QObject *parent = 0); + ~QStylePlugin(); + + virtual QStringList keys() const = 0; + virtual QStyle *create(const QString &key) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTYLEPLUGIN_H diff --git a/qtinterface/qt4/Qt/qsvggenerator.h b/qtinterface/qt4/Qt/qsvggenerator.h new file mode 100644 index 0000000..21dcfe5 --- /dev/null +++ b/qtinterface/qt4/Qt/qsvggenerator.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSvg module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSVGGENERATOR_H +#define QSVGGENERATOR_H + +#include <QtGui/qpaintdevice.h> + +#ifndef QT_NO_SVGGENERATOR + +#include <QtCore/qnamespace.h> +#include <QtCore/qiodevice.h> +#include <QtCore/qobjectdefs.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Svg) + +class QSvgGeneratorPrivate; + +class Q_SVG_EXPORT QSvgGenerator : public QPaintDevice +{ + Q_DECLARE_PRIVATE(QSvgGenerator) + + Q_PROPERTY(QSize size READ size WRITE setSize) + Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox) + Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(QString description READ description WRITE setDescription) + Q_PROPERTY(QString fileName READ fileName WRITE setFileName) + Q_PROPERTY(QIODevice* outputDevice READ outputDevice WRITE setOutputDevice) + Q_PROPERTY(int resolution READ resolution WRITE setResolution) +public: + QSvgGenerator(); + ~QSvgGenerator(); + + QString title() const; + void setTitle(const QString &title); + + QString description() const; + void setDescription(const QString &description); + + QSize size() const; + void setSize(const QSize &size); + + QRect viewBox() const; + QRectF viewBoxF() const; + void setViewBox(const QRect &viewBox); + void setViewBox(const QRectF &viewBox); + + QString fileName() const; + void setFileName(const QString &fileName); + + QIODevice *outputDevice() const; + void setOutputDevice(QIODevice *outputDevice); + + void setResolution(int dpi); + int resolution() const; +protected: + QPaintEngine *paintEngine() const; + int metric(QPaintDevice::PaintDeviceMetric metric) const; + +private: + QScopedPointer<QSvgGeneratorPrivate> d_ptr; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SVGGENERATOR +#endif // QSVGGENERATOR_H diff --git a/qtinterface/qt4/Qt/qsvgrenderer.h b/qtinterface/qt4/Qt/qsvgrenderer.h new file mode 100644 index 0000000..314d1df --- /dev/null +++ b/qtinterface/qt4/Qt/qsvgrenderer.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSvg module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSVGRENDERER_H +#define QSVGRENDERER_H + +#include <QtGui/qmatrix.h> + +#ifndef QT_NO_SVGRENDERER + +#include <QtCore/qobject.h> +#include <QtCore/qsize.h> +#include <QtCore/qrect.h> +#include <QtCore/qxmlstream.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Svg) + +class QSvgRendererPrivate; +class QPainter; +class QByteArray; + +class Q_SVG_EXPORT QSvgRenderer : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox) + Q_PROPERTY(int framesPerSecond READ framesPerSecond WRITE setFramesPerSecond) + Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame) +public: + QSvgRenderer(QObject *parent=0); + QSvgRenderer(const QString &filename, QObject *parent=0); + QSvgRenderer(const QByteArray &contents, QObject *parent=0); + QSvgRenderer(QXmlStreamReader *contents, QObject *parent=0); + ~QSvgRenderer(); + + bool isValid() const; + + QSize defaultSize() const; + + QRect viewBox() const; + QRectF viewBoxF() const; + void setViewBox(const QRect &viewbox); + void setViewBox(const QRectF &viewbox); + + bool animated() const; + int framesPerSecond() const; + void setFramesPerSecond(int num); + int currentFrame() const; + void setCurrentFrame(int); + int animationDuration() const;//in seconds + + QRectF boundsOnElement(const QString &id) const; + bool elementExists(const QString &id) const; + QMatrix matrixForElement(const QString &id) const; + +public Q_SLOTS: + bool load(const QString &filename); + bool load(const QByteArray &contents); + bool load(QXmlStreamReader *contents); + void render(QPainter *p); + void render(QPainter *p, const QRectF &bounds); + + void render(QPainter *p, const QString &elementId, + const QRectF &bounds=QRectF()); + +Q_SIGNALS: + void repaintNeeded(); + +private: + Q_DECLARE_PRIVATE(QSvgRenderer) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SVGRENDERER +#endif // QSVGRENDERER_H diff --git a/qtinterface/qt4/Qt/qsvgwidget.h b/qtinterface/qt4/Qt/qsvgwidget.h new file mode 100644 index 0000000..8a271b4 --- /dev/null +++ b/qtinterface/qt4/Qt/qsvgwidget.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtSvg module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSVGWIDGET_H +#define QSVGWIDGET_H + +#include <QtGui/qwidget.h> + +#ifndef QT_NO_SVGWIDGET + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Svg) + +class QSvgWidgetPrivate; +class QPaintEvent; +class QSvgRenderer; + +class Q_SVG_EXPORT QSvgWidget : public QWidget +{ + Q_OBJECT +public: + QSvgWidget(QWidget *parent=0); + QSvgWidget(const QString &file, QWidget *parent=0); + ~QSvgWidget(); + + QSvgRenderer *renderer() const; + + QSize sizeHint() const; +public Q_SLOTS: + void load(const QString &file); + void load(const QByteArray &contents); +protected: + void paintEvent(QPaintEvent *event); +private: + Q_DISABLE_COPY(QSvgWidget) + Q_DECLARE_PRIVATE(QSvgWidget) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SVGWIDGET +#endif // QSVGWIDGET_H diff --git a/qtinterface/qt4/Qt/qsymbianevent.h b/qtinterface/qt4/Qt/qsymbianevent.h new file mode 100644 index 0000000..9357e49 --- /dev/null +++ b/qtinterface/qt4/Qt/qsymbianevent.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYMBIANEVENT_H +#define QSYMBIANEVENT_H + +#include <QtCore/qglobal.h> + +#ifdef Q_OS_SYMBIAN + +class TWsEvent; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QSymbianEvent +{ +public: + enum Type { + InvalidEvent, + WindowServerEvent, + CommandEvent, + ResourceChangeEvent + }; + + QSymbianEvent(const TWsEvent *windowServerEvent); + QSymbianEvent(Type eventType, int value); + ~QSymbianEvent(); + + Type type() const; + bool isValid() const; + + const TWsEvent *windowServerEvent() const; + int command() const; + int resourceChangeType() const; + +private: + Type m_type; + union { + const void *m_eventPtr; + int m_eventValue; + + qint64 m_reserved; + }; +}; + +inline QSymbianEvent::Type QSymbianEvent::type() const +{ + return m_type; +} + +inline bool QSymbianEvent::isValid() const +{ + return m_type != InvalidEvent; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_OS_SYMBIAN + +#endif // QSYMBIANEVENT_H diff --git a/qtinterface/qt4/Qt/qsyntaxhighlighter.h b/qtinterface/qt4/Qt/qsyntaxhighlighter.h new file mode 100644 index 0000000..1a8f695 --- /dev/null +++ b/qtinterface/qt4/Qt/qsyntaxhighlighter.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYNTAXHIGHLIGHTER_H +#define QSYNTAXHIGHLIGHTER_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_SYNTAXHIGHLIGHTER + +#include <QtCore/qobject.h> +#include <QtGui/qtextobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextDocument; +class QSyntaxHighlighterPrivate; +class QTextCharFormat; +class QFont; +class QColor; +class QTextBlockUserData; +class QTextEdit; + +class Q_GUI_EXPORT QSyntaxHighlighter : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSyntaxHighlighter) +public: + QSyntaxHighlighter(QObject *parent); + QSyntaxHighlighter(QTextDocument *parent); + QSyntaxHighlighter(QTextEdit *parent); + virtual ~QSyntaxHighlighter(); + + void setDocument(QTextDocument *doc); + QTextDocument *document() const; + +public Q_SLOTS: + void rehighlight(); + void rehighlightBlock(const QTextBlock &block); + +protected: + virtual void highlightBlock(const QString &text) = 0; + + void setFormat(int start, int count, const QTextCharFormat &format); + void setFormat(int start, int count, const QColor &color); + void setFormat(int start, int count, const QFont &font); + QTextCharFormat format(int pos) const; + + int previousBlockState() const; + int currentBlockState() const; + void setCurrentBlockState(int newState); + + void setCurrentBlockUserData(QTextBlockUserData *data); + QTextBlockUserData *currentBlockUserData() const; + + QTextBlock currentBlock() const; + +private: + Q_DISABLE_COPY(QSyntaxHighlighter) + Q_PRIVATE_SLOT(d_func(), void _q_reformatBlocks(int from, int charsRemoved, int charsAdded)) + Q_PRIVATE_SLOT(d_func(), void _q_delayedRehighlight()) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SYNTAXHIGHLIGHTER + +#endif // QSYNTAXHIGHLIGHTER_H diff --git a/qtinterface/qt4/Qt/qsystemsemaphore.h b/qtinterface/qt4/Qt/qsystemsemaphore.h new file mode 100644 index 0000000..3daa813 --- /dev/null +++ b/qtinterface/qt4/Qt/qsystemsemaphore.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYSTEMSEMAPHORE_H +#define QSYSTEMSEMAPHORE_H + +#include <QtCore/qstring.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_SYSTEMSEMAPHORE + +class QSystemSemaphorePrivate; + +class Q_CORE_EXPORT QSystemSemaphore +{ + +public: + enum AccessMode + { + Open, + Create + }; + + enum SystemSemaphoreError + { + NoError, + PermissionDenied, + KeyError, + AlreadyExists, + NotFound, + OutOfResources, + UnknownError + }; + + QSystemSemaphore(const QString &key, int initialValue = 0, AccessMode mode = Open); + ~QSystemSemaphore(); + + void setKey(const QString &key, int initialValue = 0, AccessMode mode = Open); + QString key() const; + + bool acquire(); + bool release(int n = 1); + + SystemSemaphoreError error() const; + QString errorString() const; + +private: + Q_DISABLE_COPY(QSystemSemaphore) + QScopedPointer<QSystemSemaphorePrivate> d; +}; + +#endif // QT_NO_SYSTEMSEMAPHORE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSYSTEMSEMAPHORE_H + diff --git a/qtinterface/qt4/Qt/qsystemtrayicon.h b/qtinterface/qt4/Qt/qsystemtrayicon.h new file mode 100644 index 0000000..029a75a --- /dev/null +++ b/qtinterface/qt4/Qt/qsystemtrayicon.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYSTEMTRAYICON_H +#define QSYSTEMTRAYICON_H + +#include <QtCore/qobject.h> + +#ifndef QT_NO_SYSTEMTRAYICON + +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QSystemTrayIconPrivate; + +class QMenu; +class QEvent; +class QWheelEvent; +class QMouseEvent; +class QPoint; + +class Q_GUI_EXPORT QSystemTrayIcon : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false) + +public: + QSystemTrayIcon(QObject *parent = 0); + QSystemTrayIcon(const QIcon &icon, QObject *parent = 0); + ~QSystemTrayIcon(); + + enum ActivationReason { + Unknown, + Context, + DoubleClick, + Trigger, + MiddleClick + }; + +#ifndef QT_NO_MENU + void setContextMenu(QMenu *menu); + QMenu *contextMenu() const; +#endif + + QIcon icon() const; + void setIcon(const QIcon &icon); + + QString toolTip() const; + void setToolTip(const QString &tip); + + static bool isSystemTrayAvailable(); + static bool supportsMessages(); + + enum MessageIcon { NoIcon, Information, Warning, Critical }; + void showMessage(const QString &title, const QString &msg, + MessageIcon icon = Information, int msecs = 10000); + + QRect geometry() const; + bool isVisible() const; + +public Q_SLOTS: + void setVisible(bool visible); + inline void show() { setVisible(true); } + inline void hide() { setVisible(false); } + +Q_SIGNALS: + void activated(QSystemTrayIcon::ActivationReason reason); + void messageClicked(); + +protected: + bool event(QEvent *event); + +private: + Q_DISABLE_COPY(QSystemTrayIcon) + Q_DECLARE_PRIVATE(QSystemTrayIcon) + + friend class QSystemTrayIconSys; + friend class QBalloonTip; + friend void qtsystray_sendActivated(QSystemTrayIcon *, int); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SYSTEMTRAYICON +#endif // QSYSTEMTRAYICON_H diff --git a/qtinterface/qt4/Qt/qt_windows.h b/qtinterface/qt4/Qt/qt_windows.h new file mode 100644 index 0000000..e7acc70 --- /dev/null +++ b/qtinterface/qt4/Qt/qt_windows.h @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_WINDOWS_H +#define QT_WINDOWS_H + +#if defined(Q_CC_BOR) +// Borland's windows.h does not set these correctly, resulting in +// unusable WinSDK standard dialogs +#ifndef WINVER +#define WINVER 0x400 +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x400 +#endif +#endif + +#if defined(Q_CC_MINGW) +// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation +#ifndef WINVER +#define WINVER 0x500 +#endif +#endif + +#include <windows.h> + +#ifdef _WIN32_WCE +#include <ceconfig.h> +#endif + +// already defined when compiled with WINVER >= 0x0500 +#ifndef SPI_SETMENUANIMATION +#define SPI_SETMENUANIMATION 0x1003 +#endif +#ifndef SPI_SETMENUFADE +#define SPI_SETMENUFADE 0x1013 +#endif +#ifndef SPI_SETCOMBOBOXANIMATION +#define SPI_SETCOMBOBOXANIMATION 0x1005 +#endif +#ifndef SPI_SETTOOLTIPANIMATION +#define SPI_SETTOOLTIPANIMATION 0x1017 +#endif +#ifndef SPI_SETTOOLTIPFADE +#define SPI_SETTOOLTIPFADE 0x1019 +#endif +#ifndef SPI_SETUIEFFECTS +#define SPI_SETUIEFFECTS 0x103F +#endif +#ifndef SPI_GETMENUANIMATION +#define SPI_GETMENUANIMATION 0x1002 +#endif +#ifndef SPI_GETMENUFADE +#define SPI_GETMENUFADE 0x1012 +#endif +#ifndef SPI_GETCOMBOBOXANIMATION +#define SPI_GETCOMBOBOXANIMATION 0x1004 +#endif +#ifndef SPI_GETTOOLTIPANIMATION +#define SPI_GETTOOLTIPANIMATION 0x1016 +#endif +#ifndef SPI_GETTOOLTIPFADE +#define SPI_GETTOOLTIPFADE 0x1018 +#endif +#ifndef SPI_GETUIEFFECTS +#define SPI_GETUIEFFECTS 0x103E +#endif +#ifndef SPI_GETKEYBOARDCUES +#define SPI_GETKEYBOARDCUES 0x100A +#endif +#ifndef SPI_GETGRADIENTCAPTIONS +#define SPI_GETGRADIENTCAPTIONS 0x1008 +#endif +#ifndef IDC_HAND +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif +#ifndef WM_MOUSEWHEEL +#define WM_MOUSEWHEEL 0x020A +#endif +#ifndef WM_MOUSEHWHEEL +#define WM_MOUSEHWHEEL 0x020E +#endif +#ifndef ETO_PDY +#define ETO_PDY 0x2000 +#endif +#ifndef COLOR_GRADIENTACTIVECAPTION +#define COLOR_GRADIENTACTIVECAPTION 27 +#endif +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +// already defined when compiled with WINVER >= 0x0600 +#ifndef SPI_GETFLATMENU +#define SPI_GETFLATMENU 0x1022 +#endif +#ifndef CS_DROPSHADOW +#define CS_DROPSHADOW 0x00020000 +#endif +#ifndef CLEARTYPE_QUALITY +#define CLEARTYPE_QUALITY 5 +#endif + +#ifdef Q_WS_WINCE +#ifndef LR_DEFAULTSIZE +#define LR_DEFAULTSIZE 0 +#endif +#ifndef LR_SHARED +#define LR_SHARED 0 +#endif +#endif // Q_WS_WINCE + +#endif // QT_WINDOWS_H diff --git a/qtinterface/qt4/Qt/qtabbar.h b/qtinterface/qt4/Qt/qtabbar.h new file mode 100644 index 0000000..cf7d0e6 --- /dev/null +++ b/qtinterface/qt4/Qt/qtabbar.h @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTABBAR_H +#define QTABBAR_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TABBAR + +class QIcon; +class QTabBarPrivate; +class QStyleOptionTab; + +class Q_GUI_EXPORT QTabBar: public QWidget +{ + Q_OBJECT + + Q_ENUMS(Shape) + Q_PROPERTY(Shape shape READ shape WRITE setShape) + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) + Q_PROPERTY(int count READ count) + Q_PROPERTY(bool drawBase READ drawBase WRITE setDrawBase) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode) + Q_PROPERTY(bool usesScrollButtons READ usesScrollButtons WRITE setUsesScrollButtons) + Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable) + Q_PROPERTY(SelectionBehavior selectionBehaviorOnRemove READ selectionBehaviorOnRemove WRITE setSelectionBehaviorOnRemove) + Q_PROPERTY(bool expanding READ expanding WRITE setExpanding) + Q_PROPERTY(bool movable READ isMovable WRITE setMovable) + Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode) + +public: + explicit QTabBar(QWidget* parent=0); + ~QTabBar(); + + enum Shape { RoundedNorth, RoundedSouth, RoundedWest, RoundedEast, + TriangularNorth, TriangularSouth, TriangularWest, TriangularEast +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , RoundedAbove = RoundedNorth, RoundedBelow = RoundedSouth, + TriangularAbove = TriangularNorth, TriangularBelow = TriangularSouth +#endif + }; + + enum ButtonPosition { + LeftSide, + RightSide + }; + + enum SelectionBehavior { + SelectLeftTab, + SelectRightTab, + SelectPreviousTab + }; + + Shape shape() const; + void setShape(Shape shape); + + int addTab(const QString &text); + int addTab(const QIcon &icon, const QString &text); + + int insertTab(int index, const QString &text); + int insertTab(int index, const QIcon&icon, const QString &text); + + void removeTab(int index); + void moveTab(int from, int to); + + bool isTabEnabled(int index) const; + void setTabEnabled(int index, bool); + + QString tabText(int index) const; + void setTabText(int index, const QString &text); + + QColor tabTextColor(int index) const; + void setTabTextColor(int index, const QColor &color); + + QIcon tabIcon(int index) const; + void setTabIcon(int index, const QIcon &icon); + + Qt::TextElideMode elideMode() const; + void setElideMode(Qt::TextElideMode); + +#ifndef QT_NO_TOOLTIP + void setTabToolTip(int index, const QString &tip); + QString tabToolTip(int index) const; +#endif + +#ifndef QT_NO_WHATSTHIS + void setTabWhatsThis(int index, const QString &text); + QString tabWhatsThis(int index) const; +#endif + + void setTabData(int index, const QVariant &data); + QVariant tabData(int index) const; + + QRect tabRect(int index) const; + int tabAt(const QPoint &pos) const; + + int currentIndex() const; + int count() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setDrawBase(bool drawTheBase); + bool drawBase() const; + + QSize iconSize() const; + void setIconSize(const QSize &size); + + bool usesScrollButtons() const; + void setUsesScrollButtons(bool useButtons); + + bool tabsClosable() const; + void setTabsClosable(bool closable); + + void setTabButton(int index, ButtonPosition position, QWidget *widget); + QWidget *tabButton(int index, ButtonPosition position) const; + + SelectionBehavior selectionBehaviorOnRemove() const; + void setSelectionBehaviorOnRemove(SelectionBehavior behavior); + + bool expanding() const; + void setExpanding(bool enabled); + + bool isMovable() const; + void setMovable(bool movable); + + bool documentMode() const; + void setDocumentMode(bool set); + +public Q_SLOTS: + void setCurrentIndex(int index); + +Q_SIGNALS: + void currentChanged(int index); + void tabCloseRequested(int index); + void tabMoved(int from, int to); + +protected: + virtual QSize tabSizeHint(int index) const; + virtual void tabInserted(int index); + virtual void tabRemoved(int index); + virtual void tabLayoutChange(); + + bool event(QEvent *); + void resizeEvent(QResizeEvent *); + void showEvent(QShowEvent *); + void hideEvent(QHideEvent *); + void paintEvent(QPaintEvent *); + void mousePressEvent (QMouseEvent *); + void mouseMoveEvent (QMouseEvent *); + void mouseReleaseEvent (QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *event); +#endif + void keyPressEvent(QKeyEvent *); + void changeEvent(QEvent *); + void initStyleOption(QStyleOptionTab *option, int tabIndex) const; + +#ifdef QT3_SUPPORT +public Q_SLOTS: + QT_MOC_COMPAT void setCurrentTab(int index) { setCurrentIndex(index); } +Q_SIGNALS: + QT_MOC_COMPAT void selected(int); +#endif + + friend class QAccessibleTabBar; +private: + Q_DISABLE_COPY(QTabBar) + Q_DECLARE_PRIVATE(QTabBar) + Q_PRIVATE_SLOT(d_func(), void _q_scrollTabs()) + Q_PRIVATE_SLOT(d_func(), void _q_closeTab()) +}; + +#endif // QT_NO_TABBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTABBAR_H diff --git a/qtinterface/qt4/Qt/qtableview.h b/qtinterface/qt4/Qt/qtableview.h new file mode 100644 index 0000000..f3d292f --- /dev/null +++ b/qtinterface/qt4/Qt/qtableview.h @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTABLEVIEW_H +#define QTABLEVIEW_H + +#include <QtGui/qabstractitemview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TABLEVIEW + +class QHeaderView; +class QTableViewPrivate; + +class Q_GUI_EXPORT QTableView : public QAbstractItemView +{ + Q_OBJECT + Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid) + Q_PROPERTY(Qt::PenStyle gridStyle READ gridStyle WRITE setGridStyle) + Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled) + Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) + Q_PROPERTY(bool cornerButtonEnabled READ isCornerButtonEnabled WRITE setCornerButtonEnabled) + +public: + explicit QTableView(QWidget *parent = 0); + ~QTableView(); + + void setModel(QAbstractItemModel *model); + void setRootIndex(const QModelIndex &index); + void setSelectionModel(QItemSelectionModel *selectionModel); + + QHeaderView *horizontalHeader() const; + QHeaderView *verticalHeader() const; + void setHorizontalHeader(QHeaderView *header); + void setVerticalHeader(QHeaderView *header); + + int rowViewportPosition(int row) const; + int rowAt(int y) const; + + void setRowHeight(int row, int height); + int rowHeight(int row) const; + + int columnViewportPosition(int column) const; + int columnAt(int x) const; + + void setColumnWidth(int column, int width); + int columnWidth(int column) const; + + bool isRowHidden(int row) const; + void setRowHidden(int row, bool hide); + + bool isColumnHidden(int column) const; + void setColumnHidden(int column, bool hide); + + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + + bool showGrid() const; + + Qt::PenStyle gridStyle() const; + void setGridStyle(Qt::PenStyle style); + + void setWordWrap(bool on); + bool wordWrap() const; + + void setCornerButtonEnabled(bool enable); + bool isCornerButtonEnabled() const; + + QRect visualRect(const QModelIndex &index) const; + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); + QModelIndex indexAt(const QPoint &p) const; + + void setSpan(int row, int column, int rowSpan, int columnSpan); + int rowSpan(int row, int column) const; + int columnSpan(int row, int column) const; + void clearSpans(); + + void sortByColumn(int column, Qt::SortOrder order); + +public Q_SLOTS: + void selectRow(int row); + void selectColumn(int column); + void hideRow(int row); + void hideColumn(int column); + void showRow(int row); + void showColumn(int column); + void resizeRowToContents(int row); + void resizeRowsToContents(); + void resizeColumnToContents(int column); + void resizeColumnsToContents(); + void sortByColumn(int column); + void setShowGrid(bool show); + +protected Q_SLOTS: + void rowMoved(int row, int oldIndex, int newIndex); + void columnMoved(int column, int oldIndex, int newIndex); + void rowResized(int row, int oldHeight, int newHeight); + void columnResized(int column, int oldWidth, int newWidth); + void rowCountChanged(int oldCount, int newCount); + void columnCountChanged(int oldCount, int newCount); + +protected: + QTableView(QTableViewPrivate &, QWidget *parent); + void scrollContentsBy(int dx, int dy); + + QStyleOptionViewItem viewOptions() const; + void paintEvent(QPaintEvent *e); + + void timerEvent(QTimerEvent *event); + + int horizontalOffset() const; + int verticalOffset() const; + QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + + void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + QRegion visualRegionForSelection(const QItemSelection &selection) const; + QModelIndexList selectedIndexes() const; + + void updateGeometries(); + + int sizeHintForRow(int row) const; + int sizeHintForColumn(int column) const; + + void verticalScrollbarAction(int action); + void horizontalScrollbarAction(int action); + + bool isIndexHidden(const QModelIndex &index) const; + + void selectionChanged(const QItemSelection &selected, + const QItemSelection &deselected); + void currentChanged(const QModelIndex ¤t, + const QModelIndex &previous); + +private: + friend class QAccessibleItemView; + int visualIndex(const QModelIndex &index) const; + + Q_DECLARE_PRIVATE(QTableView) + Q_DISABLE_COPY(QTableView) + Q_PRIVATE_SLOT(d_func(), void _q_selectRow(int)) + Q_PRIVATE_SLOT(d_func(), void _q_selectColumn(int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanInsertedRows(QModelIndex,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanInsertedColumns(QModelIndex,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanRemovedRows(QModelIndex,int,int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateSpanRemovedColumns(QModelIndex,int,int)) +}; + +#endif // QT_NO_TABLEVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTABLEVIEW_H diff --git a/qtinterface/qt4/Qt/qtablewidget.h b/qtinterface/qt4/Qt/qtablewidget.h new file mode 100644 index 0000000..feb6313 --- /dev/null +++ b/qtinterface/qt4/Qt/qtablewidget.h @@ -0,0 +1,377 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTABLEWIDGET_H +#define QTABLEWIDGET_H + +#include <QtGui/qtableview.h> +#include <QtCore/qvariant.h> +#include <QtCore/qvector.h> +//#include <QtGui/qitemselectionmodel.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TABLEWIDGET + +class Q_GUI_EXPORT QTableWidgetSelectionRange +{ +public: + QTableWidgetSelectionRange(); + QTableWidgetSelectionRange(int top, int left, int bottom, int right); + QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other); + ~QTableWidgetSelectionRange(); + + inline int topRow() const { return top; } + inline int bottomRow() const { return bottom; } + inline int leftColumn() const { return left; } + inline int rightColumn() const { return right; } + inline int rowCount() const { return bottom - top + 1; } + inline int columnCount() const { return right - left + 1; } + +private: + int top, left, bottom, right; +}; + +class QTableWidget; +class QTableModel; +class QWidgetItemData; +class QTableWidgetItemPrivate; + +class Q_GUI_EXPORT QTableWidgetItem +{ + friend class QTableWidget; + friend class QTableModel; +public: + enum ItemType { Type = 0, UserType = 1000 }; + QTableWidgetItem(int type = Type); + explicit QTableWidgetItem(const QString &text, int type = Type); + explicit QTableWidgetItem(const QIcon &icon, const QString &text, int type = Type); + QTableWidgetItem(const QTableWidgetItem &other); + virtual ~QTableWidgetItem(); + + virtual QTableWidgetItem *clone() const; + + inline QTableWidget *tableWidget() const { return view; } + + inline int row() const; + inline int column() const; + + inline void setSelected(bool select); + inline bool isSelected() const; + + inline Qt::ItemFlags flags() const { return itemFlags; } + void setFlags(Qt::ItemFlags flags); + + inline QString text() const + { return data(Qt::DisplayRole).toString(); } + inline void setText(const QString &text); + + inline QIcon icon() const + { return qvariant_cast<QIcon>(data(Qt::DecorationRole)); } + inline void setIcon(const QIcon &icon); + + inline QString statusTip() const + { return data(Qt::StatusTipRole).toString(); } + inline void setStatusTip(const QString &statusTip); + +#ifndef QT_NO_TOOLTIP + inline QString toolTip() const + { return data(Qt::ToolTipRole).toString(); } + inline void setToolTip(const QString &toolTip); +#endif + +#ifndef QT_NO_WHATSTHIS + inline QString whatsThis() const + { return data(Qt::WhatsThisRole).toString(); } + inline void setWhatsThis(const QString &whatsThis); +#endif + + inline QFont font() const + { return qvariant_cast<QFont>(data(Qt::FontRole)); } + inline void setFont(const QFont &font); + + inline int textAlignment() const + { return data(Qt::TextAlignmentRole).toInt(); } + inline void setTextAlignment(int alignment) + { setData(Qt::TextAlignmentRole, alignment); } + + inline QColor backgroundColor() const + { return qvariant_cast<QColor>(data(Qt::BackgroundColorRole)); } + inline void setBackgroundColor(const QColor &color) + { setData(Qt::BackgroundColorRole, color); } + + inline QBrush background() const + { return qvariant_cast<QBrush>(data(Qt::BackgroundRole)); } + inline void setBackground(const QBrush &brush) + { setData(Qt::BackgroundRole, brush); } + + inline QColor textColor() const + { return qvariant_cast<QColor>(data(Qt::TextColorRole)); } + inline void setTextColor(const QColor &color) + { setData(Qt::TextColorRole, color); } + + inline QBrush foreground() const + { return qvariant_cast<QBrush>(data(Qt::ForegroundRole)); } + inline void setForeground(const QBrush &brush) + { setData(Qt::ForegroundRole, brush); } + + inline Qt::CheckState checkState() const + { return static_cast<Qt::CheckState>(data(Qt::CheckStateRole).toInt()); } + inline void setCheckState(Qt::CheckState state) + { setData(Qt::CheckStateRole, state); } + + inline QSize sizeHint() const + { return qvariant_cast<QSize>(data(Qt::SizeHintRole)); } + inline void setSizeHint(const QSize &size) + { setData(Qt::SizeHintRole, size); } + + virtual QVariant data(int role) const; + virtual void setData(int role, const QVariant &value); + + virtual bool operator<(const QTableWidgetItem &other) const; + +#ifndef QT_NO_DATASTREAM + virtual void read(QDataStream &in); + virtual void write(QDataStream &out) const; +#endif + QTableWidgetItem &operator=(const QTableWidgetItem &other); + + inline int type() const { return rtti; } + +private: + int rtti; + QVector<QWidgetItemData> values; + QTableWidget *view; + QTableWidgetItemPrivate *d; + Qt::ItemFlags itemFlags; +}; + +inline void QTableWidgetItem::setText(const QString &atext) +{ setData(Qt::DisplayRole, atext); } + +inline void QTableWidgetItem::setIcon(const QIcon &aicon) +{ setData(Qt::DecorationRole, aicon); } + +inline void QTableWidgetItem::setStatusTip(const QString &astatusTip) +{ setData(Qt::StatusTipRole, astatusTip); } + +#ifndef QT_NO_TOOLTIP +inline void QTableWidgetItem::setToolTip(const QString &atoolTip) +{ setData(Qt::ToolTipRole, atoolTip); } +#endif + +#ifndef QT_NO_WHATSTHIS +inline void QTableWidgetItem::setWhatsThis(const QString &awhatsThis) +{ setData(Qt::WhatsThisRole, awhatsThis); } +#endif + +inline void QTableWidgetItem::setFont(const QFont &afont) +{ setData(Qt::FontRole, afont); } + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item); +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QTableWidgetItem &item); +#endif + +class QTableWidgetPrivate; + +class Q_GUI_EXPORT QTableWidget : public QTableView +{ + Q_OBJECT + Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount) + Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount) + + friend class QTableModel; +public: + explicit QTableWidget(QWidget *parent = 0); + QTableWidget(int rows, int columns, QWidget *parent = 0); + ~QTableWidget(); + + void setRowCount(int rows); + int rowCount() const; + + void setColumnCount(int columns); + int columnCount() const; + + int row(const QTableWidgetItem *item) const; + int column(const QTableWidgetItem *item) const; + + QTableWidgetItem *item(int row, int column) const; + void setItem(int row, int column, QTableWidgetItem *item); + QTableWidgetItem *takeItem(int row, int column); + + QTableWidgetItem *verticalHeaderItem(int row) const; + void setVerticalHeaderItem(int row, QTableWidgetItem *item); + QTableWidgetItem *takeVerticalHeaderItem(int row); + + QTableWidgetItem *horizontalHeaderItem(int column) const; + void setHorizontalHeaderItem(int column, QTableWidgetItem *item); + QTableWidgetItem *takeHorizontalHeaderItem(int column); + void setVerticalHeaderLabels(const QStringList &labels); + void setHorizontalHeaderLabels(const QStringList &labels); + + int currentRow() const; + int currentColumn() const; + QTableWidgetItem *currentItem() const; + void setCurrentItem(QTableWidgetItem *item); + void setCurrentItem(QTableWidgetItem *item, QItemSelectionModel::SelectionFlags command); + void setCurrentCell(int row, int column); + void setCurrentCell(int row, int column, QItemSelectionModel::SelectionFlags command); + + void sortItems(int column, Qt::SortOrder order = Qt::AscendingOrder); + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + + void editItem(QTableWidgetItem *item); + void openPersistentEditor(QTableWidgetItem *item); + void closePersistentEditor(QTableWidgetItem *item); + + QWidget *cellWidget(int row, int column) const; + void setCellWidget(int row, int column, QWidget *widget); + inline void removeCellWidget(int row, int column); + + bool isItemSelected(const QTableWidgetItem *item) const; + void setItemSelected(const QTableWidgetItem *item, bool select); + void setRangeSelected(const QTableWidgetSelectionRange &range, bool select); + + QList<QTableWidgetSelectionRange> selectedRanges() const; + QList<QTableWidgetItem*> selectedItems(); + QList<QTableWidgetItem*> findItems(const QString &text, Qt::MatchFlags flags) const; + + int visualRow(int logicalRow) const; + int visualColumn(int logicalColumn) const; + + QTableWidgetItem *itemAt(const QPoint &p) const; + inline QTableWidgetItem *itemAt(int x, int y) const; + QRect visualItemRect(const QTableWidgetItem *item) const; + + const QTableWidgetItem *itemPrototype() const; + void setItemPrototype(const QTableWidgetItem *item); + +public Q_SLOTS: + void scrollToItem(const QTableWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible); + void insertRow(int row); + void insertColumn(int column); + void removeRow(int row); + void removeColumn(int column); + void clear(); + void clearContents(); + +Q_SIGNALS: + void itemPressed(QTableWidgetItem *item); + void itemClicked(QTableWidgetItem *item); + void itemDoubleClicked(QTableWidgetItem *item); + + void itemActivated(QTableWidgetItem *item); + void itemEntered(QTableWidgetItem *item); + void itemChanged(QTableWidgetItem *item); + + void currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous); + void itemSelectionChanged(); + + void cellPressed(int row, int column); + void cellClicked(int row, int column); + void cellDoubleClicked(int row, int column); + + void cellActivated(int row, int column); + void cellEntered(int row, int column); + void cellChanged(int row, int column); + + void currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + +protected: + bool event(QEvent *e); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QList<QTableWidgetItem*> items) const; + virtual bool dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action); + virtual Qt::DropActions supportedDropActions() const; + QList<QTableWidgetItem*> items(const QMimeData *data) const; + + QModelIndex indexFromItem(QTableWidgetItem *item) const; + QTableWidgetItem *itemFromIndex(const QModelIndex &index) const; + void dropEvent(QDropEvent *event); + +private: + void setModel(QAbstractItemModel *model); + + Q_DECLARE_PRIVATE(QTableWidget) + Q_DISABLE_COPY(QTableWidget) + + Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemClicked(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemDoubleClicked(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemActivated(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemEntered(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex ¤t)) + Q_PRIVATE_SLOT(d_func(), void _q_sort()) + Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)) +}; + +inline void QTableWidget::removeCellWidget(int arow, int acolumn) +{ setCellWidget(arow, acolumn, 0); } + +inline QTableWidgetItem *QTableWidget::itemAt(int ax, int ay) const +{ return itemAt(QPoint(ax, ay)); } + +inline int QTableWidgetItem::row() const +{ return (view ? view->row(this) : -1); } + +inline int QTableWidgetItem::column() const +{ return (view ? view->column(this) : -1); } + +inline void QTableWidgetItem::setSelected(bool aselect) +{ if (view) view->setItemSelected(this, aselect); } + +inline bool QTableWidgetItem::isSelected() const +{ return (view ? view->isItemSelected(this) : false); } + +#endif // QT_NO_TABLEWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTABLEWIDGET_H diff --git a/qtinterface/qt4/Qt/qtabwidget.h b/qtinterface/qt4/Qt/qtabwidget.h new file mode 100644 index 0000000..65ec583 --- /dev/null +++ b/qtinterface/qt4/Qt/qtabwidget.h @@ -0,0 +1,252 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTABWIDGET_H +#define QTABWIDGET_H + +#include <QtGui/qwidget.h> +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TABWIDGET + +class QTabBar; +class QTabWidgetPrivate; +class QStyleOptionTabWidgetFrame; + +class Q_GUI_EXPORT QTabWidget : public QWidget +{ + Q_OBJECT + Q_ENUMS(TabPosition TabShape) + Q_PROPERTY(TabPosition tabPosition READ tabPosition WRITE setTabPosition) + Q_PROPERTY(TabShape tabShape READ tabShape WRITE setTabShape) + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) + Q_PROPERTY(int count READ count) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode) + Q_PROPERTY(bool usesScrollButtons READ usesScrollButtons WRITE setUsesScrollButtons) + Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode) + Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable) + Q_PROPERTY(bool movable READ isMovable WRITE setMovable) + +public: + explicit QTabWidget(QWidget *parent = 0); + ~QTabWidget(); + + int addTab(QWidget *widget, const QString &); + int addTab(QWidget *widget, const QIcon& icon, const QString &label); + + int insertTab(int index, QWidget *widget, const QString &); + int insertTab(int index, QWidget *widget, const QIcon& icon, const QString &label); + + void removeTab(int index); + + bool isTabEnabled(int index) const; + void setTabEnabled(int index, bool); + + QString tabText(int index) const; + void setTabText(int index, const QString &); + + QIcon tabIcon(int index) const; + void setTabIcon(int index, const QIcon & icon); + +#ifndef QT_NO_TOOLTIP + void setTabToolTip(int index, const QString & tip); + QString tabToolTip(int index) const; +#endif + +#ifndef QT_NO_WHATSTHIS + void setTabWhatsThis(int index, const QString &text); + QString tabWhatsThis(int index) const; +#endif + + int currentIndex() const; + QWidget *currentWidget() const; + QWidget *widget(int index) const; + int indexOf(QWidget *widget) const; + int count() const; + + enum TabPosition { North, South, West, East +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , Top = North, Bottom = South +#endif + }; + TabPosition tabPosition() const; + void setTabPosition(TabPosition); + + bool tabsClosable() const; + void setTabsClosable(bool closeable); + + bool isMovable() const; + void setMovable(bool movable); + + enum TabShape { Rounded, Triangular }; + TabShape tabShape() const; + void setTabShape(TabShape s); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner); + QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; + + Qt::TextElideMode elideMode() const; + void setElideMode(Qt::TextElideMode); + + QSize iconSize() const; + void setIconSize(const QSize &size); + + bool usesScrollButtons() const; + void setUsesScrollButtons(bool useButtons); + + bool documentMode() const; + void setDocumentMode(bool set); + + void clear(); + +public Q_SLOTS: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *widget); + +Q_SIGNALS: + void currentChanged(int index); + void tabCloseRequested(int index); + +protected: + virtual void tabInserted(int index); + virtual void tabRemoved(int index); + + void showEvent(QShowEvent *); + void resizeEvent(QResizeEvent *); + void keyPressEvent(QKeyEvent *); + void paintEvent(QPaintEvent *); + void setTabBar(QTabBar *); + QTabBar* tabBar() const; + void changeEvent(QEvent *); + bool event(QEvent *); + void initStyleOption(QStyleOptionTabWidgetFrame *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QTabWidget(QWidget *parent, const char *name, Qt::WindowFlags f = 0); + + inline QT3_SUPPORT void insertTab(QWidget * w, const QString &s, int index = -1) { insertTab(index, w, s); } + inline QT3_SUPPORT void insertTab(QWidget *child, const QIcon& icon, + const QString &label, int index = -1) { insertTab(index, child, icon, label); } + + inline QT3_SUPPORT void changeTab(QWidget *w, const QString &s) {setTabText(indexOf(w), s); } + inline QT3_SUPPORT void changeTab(QWidget *w, const QIcon& icon, + const QString &label) { int idx = indexOf(w); setTabText(idx, label); setTabIcon(idx, icon); } + + inline QT3_SUPPORT bool isTabEnabled( QWidget *w) const {return isTabEnabled(indexOf(w)); } + inline QT3_SUPPORT void setTabEnabled(QWidget *w, bool b) { setTabEnabled(indexOf(w), b); } + + inline QT3_SUPPORT QString tabLabel(QWidget *w) const {return tabText(indexOf(w)); } + inline QT3_SUPPORT void setTabLabel(QWidget *w, const QString &l) { setTabText(indexOf(w), l); } + + inline QT3_SUPPORT QIcon tabIconSet(QWidget * w) const {return tabIcon(indexOf(w)); } + inline QT3_SUPPORT void setTabIconSet(QWidget * w, const QIcon & icon) { setTabIcon(indexOf(w), icon); } + + inline QT3_SUPPORT void removeTabToolTip(QWidget * w) { +#ifndef QT_NO_TOOLTIP + setTabToolTip(indexOf(w), QString()); +#else + Q_UNUSED(w); +#endif + } + inline QT3_SUPPORT void setTabToolTip(QWidget * w, const QString & tip) { +#ifndef QT_NO_TOOLTIP + setTabToolTip(indexOf(w), tip); +#else + Q_UNUSED(w); + Q_UNUSED(tip); +#endif + } + + inline QT3_SUPPORT QString tabToolTip(QWidget * w) const { +#ifndef QT_NO_TOOLTIP + return tabToolTip(indexOf(w)); +#else + Q_UNUSED(w); + return QString(); +#endif + } + + inline QT3_SUPPORT QWidget * currentPage() const { return currentWidget(); } + inline QT3_SUPPORT QWidget *page(int index) const { return widget(index); } + inline QT3_SUPPORT QString label(int index) const { return tabText(index); } + inline QT3_SUPPORT int currentPageIndex() const { return currentIndex(); } + + inline QT3_SUPPORT int margin() const { return 0; } + inline QT3_SUPPORT void setMargin(int) {} + +public Q_SLOTS: + inline QT_MOC_COMPAT void setCurrentPage(int index) { setCurrentIndex(index); } + inline QT_MOC_COMPAT void showPage(QWidget *w) { setCurrentIndex(indexOf(w)); } + inline QT_MOC_COMPAT void removePage(QWidget *w) { removeTab(indexOf(w)); } + +Q_SIGNALS: + QT_MOC_COMPAT void currentChanged(QWidget *); + QT_MOC_COMPAT void selected(const QString&); +#endif // QT3_SUPPORT + +private: + Q_DECLARE_PRIVATE(QTabWidget) + Q_DISABLE_COPY(QTabWidget) + Q_PRIVATE_SLOT(d_func(), void _q_showTab(int)) + Q_PRIVATE_SLOT(d_func(), void _q_removeTab(int)) + Q_PRIVATE_SLOT(d_func(), void _q_tabMoved(int, int)) + void setUpLayout(bool = false); + friend class Q3TabDialog; +}; + +#endif // QT_NO_TABWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTABWIDGET_H diff --git a/qtinterface/qt4/Qt/qtconcurrentcompilertest.h b/qtinterface/qt4/Qt/qtconcurrentcompilertest.h new file mode 100644 index 0000000..ba0d9d3 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentcompilertest.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_COMPILERTEST_H +#define QTCONCURRENT_COMPILERTEST_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifdef Q_CC_MSVC +# if _MSC_VER < 1300 +# define QT_CONURRENT_NONSTANDARD_COMPILER +# endif +#endif + +#if defined (Q_CC_MSVC) && (_MSC_VER < 1300) +# define QT_TYPENAME +#else +# define QT_TYPENAME typename +#endif + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentexception.h b/qtinterface/qt4/Qt/qtconcurrentexception.h new file mode 100644 index 0000000..1c17943 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentexception.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_EXCEPTION_H +#define QTCONCURRENT_EXCEPTION_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_QFUTURE + +#include <QtCore/qatomic.h> + +#ifndef QT_NO_EXCEPTIONS +# include <exception> +#endif + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +namespace QtConcurrent +{ + +#ifndef QT_NO_EXCEPTIONS + +class Q_CORE_EXPORT Exception : public std::exception +{ +public: + virtual void raise() const; + virtual Exception *clone() const; +}; + +class Q_CORE_EXPORT UnhandledException : public Exception +{ +public: + void raise() const; + Exception *clone() const; +}; + +namespace internal { + +class Base; +class ExceptionHolder +{ +public: + ExceptionHolder(Exception *exception = 0); + ExceptionHolder(const ExceptionHolder &other); + void operator=(const ExceptionHolder &other); + ~ExceptionHolder(); + Exception *exception() const; + Base *base; +}; + +class Q_CORE_EXPORT ExceptionStore +{ +public: + void setException(const Exception &e); + bool hasException() const; + ExceptionHolder exception(); + void throwPossibleException(); + bool hasThrown() const; + ExceptionHolder exceptionHolder; +}; + +} // namespace internal + +#else // QT_NO_EXCEPTIONS + +namespace internal { + +class Q_CORE_EXPORT ExceptionStore +{ +public: + ExceptionStore() { } + inline void throwPossibleException() const {} +}; + +} // namespace internal + +#endif + +} // namespace QtConcurrent + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentfilter.h b/qtinterface/qt4/Qt/qtconcurrentfilter.h new file mode 100644 index 0000000..f84f3d8 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentfilter.h @@ -0,0 +1,736 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_FILTER_H +#define QTCONCURRENT_FILTER_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qtconcurrentfilterkernel.h> +#include <QtCore/qtconcurrentfunctionwrappers.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifdef qdoc + +namespace QtConcurrent { + + QFuture<void> filter(Sequence &sequence, FilterFunction filterFunction); + + template <typename T> + QFuture<T> filtered(const Sequence &sequence, FilterFunction filterFunction); + template <typename T> + QFuture<T> filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction); + + template <typename T> + QFuture<T> filteredReduced(const Sequence &sequence, + FilterFunction filterFunction, + ReduceFunction reduceFunction, + QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); + template <typename T> + QFuture<T> filteredReduced(ConstIterator begin, + ConstIterator end, + FilterFunction filterFunction, + ReduceFunction reduceFunction, + QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); + + void blockingFilter(Sequence &sequence, FilterFunction filterFunction); + + template <typename Sequence> + Sequence blockingFiltered(const Sequence &sequence, FilterFunction filterFunction); + template <typename Sequence> + Sequence blockingFiltered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction); + + template <typename T> + T blockingFilteredReduced(const Sequence &sequence, + FilterFunction filterFunction, + ReduceFunction reduceFunction, + QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); + template <typename T> + T blockingFilteredReduced(ConstIterator begin, + ConstIterator end, + FilterFunction filterFunction, + ReduceFunction reduceFunction, + QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); + +} // namespace QtConcurrent + +#else + +namespace QtConcurrent { + +template <typename Sequence, typename KeepFunctor, typename T, typename C, typename U> +ThreadEngineStarter<void> filterInternal(Sequence &sequence, KeepFunctor keep, T (C::*reduce)(U)) +{ + typedef MemberFunctionWrapper1<T, C, U> ReduceFunctor; + typedef typename Sequence::const_iterator Iterator; + typedef FilterKernel<Sequence, KeepFunctor, ReduceFunctor> KernelType; + return startThreadEngine(new KernelType(sequence, keep, reduce)); +} + +// filter() on sequences +template <typename Sequence, typename KeepFunctor> +QFuture<void> filter(Sequence &sequence, KeepFunctor keep) +{ + return filterInternal(sequence, keep, &Sequence::push_back); +} + +template <typename Sequence, typename T> +QFuture<void> filter(Sequence &sequence, bool (keep)(T)) +{ + return filterInternal(sequence, FunctionWrapper1<bool, T>(keep), &Sequence::push_back); +} + +template <typename Sequence, typename C> +QFuture<void> filter(Sequence &sequence, bool (C::*keep)() const) +{ + return filterInternal(sequence, ConstMemberFunctionWrapper<bool, C>(keep), &Sequence::push_back); +} + +// filteredReduced() on sequences +template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor> +QFuture<ResultType> filteredReduced(const Sequence &sequence, + KeepFunctor keep, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startFilteredReduced<ResultType>(sequence, keep, reduce, options); + } + +template <typename ResultType, typename Sequence, typename T, typename ReduceFunctor> +QFuture<ResultType> filteredReduced(const Sequence &sequence, + bool (filter)(T), + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<ResultType>(sequence, + FunctionWrapper1<bool, T>(filter), + reduce, + options); +} + +template <typename ResultType, typename Sequence, typename C, typename ReduceFunctor> +QFuture<ResultType> filteredReduced(const Sequence &sequence, + bool (C::*filter)() const, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<ResultType>(sequence, + ConstMemberFunctionWrapper<bool, C>(filter), + reduce, + options); +} + +template <typename Sequence, typename KeepFunctor, typename T, typename U, typename V> +QFuture<U> filteredReduced(const Sequence &sequence, + KeepFunctor keep, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<U>(sequence, + keep, + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Sequence, typename KeepFunctor, typename T, typename C, typename U> +QFuture<C> filteredReduced(const Sequence &sequence, + KeepFunctor keep, + T (C::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<C>(sequence, + keep, + MemberFunctionWrapper1<T, C, U>(reduce), + options); +} + +template <typename Sequence, typename T, typename U, typename V, typename W> +QFuture<V> filteredReduced(const Sequence &sequence, + bool (keep)(T), + U (reduce)(V &, W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<V>(sequence, + FunctionWrapper1<bool, T>(keep), + FunctionWrapper2<U, V &, W>(reduce), + options); +} + +template <typename Sequence, typename C, typename T, typename U, typename V> +QFuture<U> filteredReduced(const Sequence &sequence, + bool (C::*keep)() const, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<U>(sequence, + ConstMemberFunctionWrapper<bool, C>(keep), + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Sequence, typename T, typename U, typename C, typename V> +QFuture<C> filteredReduced(const Sequence &sequence, + bool (keep)(T), + U (C::*reduce)(V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<C>(sequence, + FunctionWrapper1<bool, T>(keep), + MemberFunctionWrapper1<U, C, V>(reduce), + options); +} + +template <typename Sequence, typename C, typename T, typename D, typename U> +QFuture<D> filteredReduced(const Sequence &sequence, + bool (C::*keep)() const, + T (D::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<D>(sequence, + ConstMemberFunctionWrapper<bool, C>(keep), + MemberFunctionWrapper1<T, D, U>(reduce), + options); +} + +// filteredReduced() on iterators +template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor> +QFuture<ResultType> filteredReduced(Iterator begin, + Iterator end, + KeepFunctor keep, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startFilteredReduced<ResultType>(begin, end, keep, reduce, options); +} + +template <typename ResultType, typename Iterator, typename T, typename ReduceFunctor> +QFuture<ResultType> filteredReduced(Iterator begin, + Iterator end, + bool (filter)(T), + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<ResultType>(begin, + end, + FunctionWrapper1<bool, T>(filter), + reduce, + options); +} + +template <typename ResultType, typename Iterator, typename C, typename ReduceFunctor> +QFuture<ResultType> filteredReduced(Iterator begin, + Iterator end, + bool (C::*filter)() const, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<ResultType>(begin, + end, + ConstMemberFunctionWrapper<bool, C>(filter), + reduce, + options); +} + +template <typename Iterator, typename KeepFunctor, typename T, typename U, typename V> +QFuture<U> filteredReduced(Iterator begin, + Iterator end, + KeepFunctor keep, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<U>(begin, + end, + keep, + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Iterator, typename KeepFunctor, typename T, typename C, typename U> +QFuture<C> filteredReduced(Iterator begin, + Iterator end, + KeepFunctor keep, + T (C::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<C>(begin, + end, + keep, + MemberFunctionWrapper1<T, C, U>(reduce), + options); +} + +template <typename Iterator, typename T, typename U, typename V, typename W> +QFuture<V> filteredReduced(Iterator begin, + Iterator end, + bool (keep)(T), + U (reduce)(V &, W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<V>(begin, + end, + FunctionWrapper1<bool, T>(keep), + FunctionWrapper2<U, V &, W>(reduce), + options); +} + +template <typename Iterator, typename C, typename T, typename U, typename V> +QFuture<U> filteredReduced(Iterator begin, + Iterator end, + bool (C::*keep)() const, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<U>(begin, + end, + ConstMemberFunctionWrapper<bool, C>(keep), + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Iterator, typename T, typename U, typename C, typename V> +QFuture<C> filteredReduced(Iterator begin, + Iterator end, + bool (keep)(T), + U (C::*reduce)(V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<C>(begin, + end, + FunctionWrapper1<bool, T>(keep), + MemberFunctionWrapper1<U, C, V>(reduce), + options); +} + +template <typename Iterator, typename C, typename T, typename D, typename U> +QFuture<D> filteredReduced(Iterator begin, + Iterator end, + bool (C::*keep)() const, + T (D::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return filteredReduced<D>(begin, + end, + ConstMemberFunctionWrapper<bool, C>(keep), + MemberFunctionWrapper1<T, D, U>(reduce), + options); +} + + +// filtered() on sequences +template <typename Sequence, typename KeepFunctor> +QFuture<typename Sequence::value_type> filtered(const Sequence &sequence, KeepFunctor keep) +{ + return startFiltered(sequence, keep); +} + +template <typename Sequence, typename T> +QFuture<typename Sequence::value_type> filtered(const Sequence &sequence, bool (keep)(T)) +{ + return startFiltered(sequence, FunctionWrapper1<bool, T>(keep)); +} + +template <typename Sequence, typename C> +QFuture<typename Sequence::value_type> filtered(const Sequence &sequence, bool (C::*keep)() const) +{ + return startFiltered(sequence, ConstMemberFunctionWrapper<bool, C>(keep)); +} + +// filtered() on iterators +template <typename Iterator, typename KeepFunctor> +QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, Iterator end, KeepFunctor keep) +{ + return startFiltered(begin, end, keep); +} + +template <typename Iterator, typename T> +QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, Iterator end, bool (keep)(T)) +{ + return startFiltered(begin, end, FunctionWrapper1<bool, T>(keep)); +} + +template <typename Iterator, typename C> +QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, + Iterator end, + bool (C::*keep)() const) +{ + return startFiltered(begin, end, ConstMemberFunctionWrapper<bool, C>(keep)); +} + + +// blocking filter() on sequences +template <typename Sequence, typename KeepFunctor> +void blockingFilter(Sequence &sequence, KeepFunctor keep) +{ + filterInternal(sequence, keep, &Sequence::push_back).startBlocking(); +} + +template <typename Sequence, typename T> +void blockingFilter(Sequence &sequence, bool (keep)(T)) +{ + filterInternal(sequence, FunctionWrapper1<bool, T>(keep), &Sequence::push_back) + .startBlocking(); +} + +template <typename Sequence, typename C> +void blockingFilter(Sequence &sequence, bool (C::*keep)() const) +{ + filterInternal(sequence, + ConstMemberFunctionWrapper<bool, C>(keep), + &Sequence::push_back) + .startBlocking(); +} + +// blocking filteredReduced() on sequences +template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor> +ResultType blockingFilteredReduced(const Sequence &sequence, + KeepFunctor keep, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startFilteredReduced<ResultType>(sequence, keep, reduce, options) + .startBlocking(); +} + +template <typename ResultType, typename Sequence, typename T, typename ReduceFunctor> +ResultType blockingFilteredReduced(const Sequence &sequence, + bool (filter)(T), + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<ResultType> + (sequence, + FunctionWrapper1<bool, T>(filter), + reduce, + options); +} + +template <typename ResultType, typename Sequence, typename C, typename ReduceFunctor> +ResultType blockingFilteredReduced(const Sequence &sequence, + bool (C::*filter)() const, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<ResultType> + (sequence, + ConstMemberFunctionWrapper<bool, C>(filter), + reduce, + options); +} + +template <typename Sequence, typename KeepFunctor, typename T, typename U, typename V> +U blockingFilteredReduced(const Sequence &sequence, + KeepFunctor keep, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<U> + (sequence, + keep, + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Sequence, typename KeepFunctor, typename T, typename C, typename U> +C blockingFilteredReduced(const Sequence &sequence, + KeepFunctor keep, + T (C::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<C> + (sequence, + keep, + MemberFunctionWrapper1<T, C, U>(reduce), + options); +} + +template <typename Sequence, typename T, typename U, typename V, typename W> +V blockingFilteredReduced(const Sequence &sequence, + bool (keep)(T), + U (reduce)(V &, W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<V> + (sequence, + FunctionWrapper1<bool, T>(keep), + FunctionWrapper2<U, V &, W>(reduce), + options); +} + +template <typename Sequence, typename C, typename T, typename U, typename V> +U blockingFilteredReduced(const Sequence &sequence, + bool (C::*keep)() const, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<U> + (sequence, + ConstMemberFunctionWrapper<bool, C>(keep), + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Sequence, typename T, typename U, typename C, typename V> +C blockingFilteredReduced(const Sequence &sequence, + bool (keep)(T), + U (C::*reduce)(V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<C> + (sequence, + FunctionWrapper1<bool, T>(keep), + MemberFunctionWrapper1<U, C, V>(reduce), + options); +} + +template <typename Sequence, typename C, typename T, typename D, typename U> +D blockingFilteredReduced(const Sequence &sequence, + bool (C::*keep)() const, + T (D::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<D> + (sequence, + ConstMemberFunctionWrapper<bool, C>(keep), + MemberFunctionWrapper1<T, D, U>(reduce), + options); +} + +// blocking filteredReduced() on iterators +template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor> +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor keep, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startFilteredReduced<ResultType>(begin, end, keep, reduce, options) + .startBlocking(); +} + +template <typename ResultType, typename Iterator, typename T, typename ReduceFunctor> +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + bool (filter)(T), + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<ResultType> + (begin, + end, + FunctionWrapper1<bool, T>(filter), + reduce, + options); +} + +template <typename ResultType, typename Iterator, typename C, typename ReduceFunctor> +ResultType blockingFilteredReduced(Iterator begin, + Iterator end, + bool (C::*filter)() const, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<ResultType> + (begin, + end, + ConstMemberFunctionWrapper<bool, C>(filter), + reduce, + options); +} + +template <typename Iterator, typename KeepFunctor, typename T, typename U, typename V> +U blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor keep, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<U> + (begin, + end, + keep, + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Iterator, typename KeepFunctor, typename T, typename C, typename U> +C blockingFilteredReduced(Iterator begin, + Iterator end, + KeepFunctor keep, + T (C::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<C> + (begin, + end, + keep, + MemberFunctionWrapper1<T, C, U>(reduce), + options); +} + +template <typename Iterator, typename T, typename U, typename V, typename W> +V blockingFilteredReduced(Iterator begin, + Iterator end, + bool (keep)(T), + U (reduce)(V &, W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<V> + (begin, + end, + FunctionWrapper1<bool, T>(keep), + FunctionWrapper2<U, V &, W>(reduce), + options); +} + +template <typename Iterator, typename C, typename T, typename U, typename V> +U blockingFilteredReduced(Iterator begin, + Iterator end, + bool (C::*keep)() const, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<U> + (begin, + end, + ConstMemberFunctionWrapper<bool, C>(keep), + FunctionWrapper2<T, U &, V>(reduce), + options); +} + +template <typename Iterator, typename T, typename U, typename C, typename V> +C blockingFilteredReduced(Iterator begin, + Iterator end, + bool (keep)(T), + U (C::*reduce)(V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<C> + (begin, + end, + FunctionWrapper1<bool, T>(keep), + MemberFunctionWrapper1<U, C, V>(reduce), + options); +} + +template <typename Iterator, typename C, typename T, typename D, typename U> +D blockingFilteredReduced(Iterator begin, + Iterator end, + bool (C::*keep)() const, + T (D::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return blockingFilteredReduced<D> + (begin, + end, + ConstMemberFunctionWrapper<bool, C>(keep), + MemberFunctionWrapper1<T, D, U>(reduce), + options); +} + +// blocking filtered() on sequences +template <typename Sequence, typename KeepFunctor> +Sequence blockingFiltered(const Sequence &sequence, KeepFunctor keep) +{ + return blockingFilteredReduced(sequence, keep, &Sequence::push_back, OrderedReduce); +} + +template <typename Sequence, typename T> +Sequence blockingFiltered(const Sequence &sequence, bool (keep)(T)) +{ + return blockingFilteredReduced(sequence, keep, &Sequence::push_back, OrderedReduce); +} + +template <typename Sequence, typename C> +Sequence blockingFiltered(const Sequence &sequence, bool (C::*filter)() const) +{ + return blockingFilteredReduced(sequence, + filter, + &Sequence::push_back, + OrderedReduce); +} + +// blocking filtered() on iterators +template <typename OutputSequence, typename Iterator, typename KeepFunctor> +OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor keep) +{ + return blockingFilteredReduced(begin, + end, + keep, + &OutputSequence::push_back, + OrderedReduce); +} + +template <typename OutputSequence, typename Iterator, typename T> +OutputSequence blockingFiltered(Iterator begin, Iterator end, bool (keep)(T)) +{ + return blockingFilteredReduced(begin, + end, + keep, + &OutputSequence::push_back, + OrderedReduce); +} + +template <typename OutputSequence, typename Iterator, typename C> +OutputSequence blockingFiltered(Iterator begin, Iterator end, bool (C::*filter)() const) +{ + return blockingFilteredReduced(begin, + end, + filter, + &OutputSequence::push_back, + OrderedReduce); +} + +} // namespace QtConcurrent + +#endif // qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentfilterkernel.h b/qtinterface/qt4/Qt/qtconcurrentfilterkernel.h new file mode 100644 index 0000000..1c1c4f5 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentfilterkernel.h @@ -0,0 +1,351 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_FILTERKERNEL_H +#define QTCONCURRENT_FILTERKERNEL_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qtconcurrentiteratekernel.h> +#include <QtCore/qtconcurrentmapkernel.h> +#include <QtCore/qtconcurrentreducekernel.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { + +template <typename T> +struct qValueType +{ + typedef typename T::value_type value_type; +}; + +template <typename T> +struct qValueType<const T*> +{ + typedef T value_type; +}; + +template <typename T> +struct qValueType<T*> +{ + typedef T value_type; +}; + +// Implementation of filter +template <typename Sequence, typename KeepFunctor, typename ReduceFunctor> +class FilterKernel : public IterateKernel<typename Sequence::const_iterator, void> +{ + typedef ReduceKernel<ReduceFunctor, Sequence, typename Sequence::value_type> Reducer; + typedef IterateKernel<typename Sequence::const_iterator, void> IterateKernelType; + typedef typename ReduceFunctor::result_type T; + + Sequence reducedResult; + Sequence &sequence; + KeepFunctor keep; + ReduceFunctor reduce; + Reducer reducer; + +public: + FilterKernel(Sequence &_sequence, KeepFunctor _keep, ReduceFunctor _reduce) + : IterateKernelType(const_cast<const Sequence &>(_sequence).begin(), const_cast<const Sequence &>(_sequence).end()), reducedResult(), + sequence(_sequence), + keep(_keep), + reduce(_reduce), + reducer(OrderedReduce) + { } + + bool runIteration(typename Sequence::const_iterator it, int index, T *) + { + IntermediateResults<typename Sequence::value_type> results; + results.begin = index; + results.end = index + 1; + + if (keep(*it)) + results.vector.append(*it); + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + bool runIterations(typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *) + { + IntermediateResults<typename Sequence::value_type> results; + results.begin = begin; + results.end = end; + results.vector.reserve(end - begin); + + + typename Sequence::const_iterator it = sequenceBeginIterator; + advance(it, begin); + for (int i = begin; i < end; ++i) { + if (keep(*it)) + results.vector.append(*it); + advance(it, 1); + } + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + void finish() + { + reducer.finish(reduce, reducedResult); + sequence = reducedResult; + } + + inline bool shouldThrottleThread() + { + return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle(); + } + + inline bool shouldStartThread() + { + return IterateKernelType::shouldStartThread() && reducer.shouldStartThread(); + } + + typedef void ReturnType; + typedef void ResultType; +}; + +// Implementation of filter-reduce +template <typename ReducedResultType, + typename Iterator, + typename KeepFunctor, + typename ReduceFunctor, + typename Reducer = ReduceKernel<ReduceFunctor, + ReducedResultType, + typename qValueType<Iterator>::value_type> > +class FilteredReducedKernel : public IterateKernel<Iterator, ReducedResultType> +{ + ReducedResultType reducedResult; + KeepFunctor keep; + ReduceFunctor reduce; + Reducer reducer; + typedef IterateKernel<Iterator, ReducedResultType> IterateKernelType; + +public: + FilteredReducedKernel(Iterator begin, + Iterator end, + KeepFunctor _keep, + ReduceFunctor _reduce, + ReduceOptions reduceOption) + : IterateKernelType(begin, end), reducedResult(), keep(_keep), reduce(_reduce), reducer(reduceOption) + { } + +#if 0 + FilteredReducedKernel(ReducedResultType initialValue, + KeepFunctor keep, + ReduceFunctor reduce, + ReduceOption reduceOption) + : reducedResult(initialValue), keep(keep), reduce(reduce), reducer(reduceOption) + { } +#endif + + bool runIteration(Iterator it, int index, ReducedResultType *) + { + IntermediateResults<typename qValueType<Iterator>::value_type> results; + results.begin = index; + results.end = index + 1; + + if (keep(*it)) + results.vector.append(*it); + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) + { + IntermediateResults<typename qValueType<Iterator>::value_type> results; + results.begin = begin; + results.end = end; + results.vector.reserve(end - begin); + + Iterator it = sequenceBeginIterator; + advance(it, begin); + for (int i = begin; i < end; ++i) { + if (keep(*it)) + results.vector.append(*it); + advance(it, 1); + } + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + void finish() + { + reducer.finish(reduce, reducedResult); + } + + inline bool shouldThrottleThread() + { + return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle(); + } + + inline bool shouldStartThread() + { + return IterateKernelType::shouldStartThread() && reducer.shouldStartThread(); + } + + typedef ReducedResultType ReturnType; + typedef ReducedResultType ResultType; + ReducedResultType *result() + { + return &reducedResult; + } +}; + +// Implementation of filter that reports individual results via QFutureInterface +template <typename Iterator, typename KeepFunctor> +class FilteredEachKernel : public IterateKernel<Iterator, typename qValueType<Iterator>::value_type> +{ + typedef typename qValueType<Iterator>::value_type T; + typedef IterateKernel<Iterator, T> IterateKernelType; + + KeepFunctor keep; + +public: + typedef T ReturnType; + typedef T ResultType; + + FilteredEachKernel(Iterator begin, Iterator end, KeepFunctor _keep) + : IterateKernelType(begin, end), keep(_keep) + { } + + void start() + { + if (this->futureInterface) + this->futureInterface->setFilterMode(true); + IterateKernelType::start(); + } + + bool runIteration(Iterator it, int index, T *) + { + if (keep(*it)) + this->reportResult(&(*it), index); + else + this->reportResult(0, index); + return false; + } + + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *) + { + const int count = end - begin; + IntermediateResults<typename qValueType<Iterator>::value_type> results; + results.begin = begin; + results.end = end; + results.vector.reserve(count); + + Iterator it = sequenceBeginIterator; + advance(it, begin); + for (int i = begin; i < end; ++i) { + if (keep(*it)) + results.vector.append(*it); + advance(it, 1); + } + + this->reportResults(results.vector, begin, count); + return false; + } +}; + +template <typename Iterator, typename KeepFunctor> +inline +ThreadEngineStarter<typename qValueType<Iterator>::value_type> +startFiltered(Iterator begin, Iterator end, KeepFunctor functor) +{ + return startThreadEngine(new FilteredEachKernel<Iterator, KeepFunctor>(begin, end, functor)); +} + +template <typename Sequence, typename KeepFunctor> +inline ThreadEngineStarter<typename Sequence::value_type> +startFiltered(const Sequence &sequence, KeepFunctor functor) +{ + typedef SequenceHolder1<Sequence, + FilteredEachKernel<typename Sequence::const_iterator, KeepFunctor>, + KeepFunctor> + SequenceHolderType; + return startThreadEngine(new SequenceHolderType(sequence, functor)); +} + +template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> +inline ThreadEngineStarter<ResultType> startFilteredReduced(const Sequence & sequence, + MapFunctor mapFunctor, ReduceFunctor reduceFunctor, + ReduceOptions options) +{ + typedef typename Sequence::const_iterator Iterator; + typedef ReduceKernel<ReduceFunctor, ResultType, typename qValueType<Iterator>::value_type > Reducer; + typedef FilteredReducedKernel<ResultType, Iterator, MapFunctor, ReduceFunctor, Reducer> FilteredReduceType; + typedef SequenceHolder2<Sequence, FilteredReduceType, MapFunctor, ReduceFunctor> SequenceHolderType; + return startThreadEngine(new SequenceHolderType(sequence, mapFunctor, reduceFunctor, options)); +} + + +template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor> +inline ThreadEngineStarter<ResultType> startFilteredReduced(Iterator begin, Iterator end, + MapFunctor mapFunctor, ReduceFunctor reduceFunctor, + ReduceOptions options) +{ + typedef ReduceKernel<ReduceFunctor, ResultType, typename qValueType<Iterator>::value_type> Reducer; + typedef FilteredReducedKernel<ResultType, Iterator, MapFunctor, ReduceFunctor, Reducer> FilteredReduceType; + return startThreadEngine(new FilteredReduceType(begin, end, mapFunctor, reduceFunctor, options)); +} + + +} // namespace QtConcurrent + +#endif // qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentfunctionwrappers.h b/qtinterface/qt4/Qt/qtconcurrentfunctionwrappers.h new file mode 100644 index 0000000..a73eae9 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentfunctionwrappers.h @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_FUNCTIONWRAPPERS_H +#define QTCONCURRENT_FUNCTIONWRAPPERS_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { + +template <typename T> +class FunctionWrapper0 +{ +public: + typedef T (*FunctionPointerType)(); + typedef T result_type; + inline FunctionWrapper0(FunctionPointerType _functionPointer) + :functionPointer(_functionPointer) { } + + inline T operator()() + { + return functionPointer(); + } +private: + FunctionPointerType functionPointer; +}; + +template <typename T, typename U> +class FunctionWrapper1 +{ +public: + typedef T (*FunctionPointerType)(U u); + typedef T result_type; + inline FunctionWrapper1(FunctionPointerType _functionPointer) + :functionPointer(_functionPointer) { } + + inline T operator()(U u) + { + return functionPointer(u); + } + +private: + FunctionPointerType functionPointer; +}; + +template <typename T, typename U, typename V> +class FunctionWrapper2 +{ +public: + typedef T (*FunctionPointerType)(U u, V v); + typedef T result_type; + inline FunctionWrapper2(FunctionPointerType _functionPointer) + :functionPointer(_functionPointer) { } + + inline T operator()(U u, V v) + { + return functionPointer(u, v); + } +private: + FunctionPointerType functionPointer; +}; + +template <typename T, typename C> +class MemberFunctionWrapper +{ +public: + typedef T (C::*FunctionPointerType)(); + typedef T result_type; + inline MemberFunctionWrapper(FunctionPointerType _functionPointer) + :functionPointer(_functionPointer) { } + + inline T operator()(C &c) + { + return (c.*functionPointer)(); + } +private: + FunctionPointerType functionPointer; +}; + +template <typename T, typename C, typename U> +class MemberFunctionWrapper1 +{ +public: + typedef T (C::*FunctionPointerType)(U); + typedef T result_type; + + inline MemberFunctionWrapper1(FunctionPointerType _functionPointer) + : functionPointer(_functionPointer) + { } + + inline T operator()(C &c, U u) + { + return (c.*functionPointer)(u); + } + +private: + FunctionPointerType functionPointer; +}; + +template <typename T, typename C> +class ConstMemberFunctionWrapper +{ +public: + typedef T (C::*FunctionPointerType)() const; + typedef T result_type; + inline ConstMemberFunctionWrapper(FunctionPointerType _functionPointer) + :functionPointer(_functionPointer) { } + + inline T operator()(const C &c) const + { + return (c.*functionPointer)(); + } +private: + FunctionPointerType functionPointer; +}; + +} // namespace QtConcurrent. + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentiteratekernel.h b/qtinterface/qt4/Qt/qtconcurrentiteratekernel.h new file mode 100644 index 0000000..7219f9e --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentiteratekernel.h @@ -0,0 +1,343 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_ITERATEKERNEL_H +#define QTCONCURRENT_ITERATEKERNEL_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qatomic.h> +#include <QtCore/qtconcurrentmedian.h> +#include <QtCore/qtconcurrentthreadengine.h> + +#ifndef QT_NO_STL +# include <iterator> +#endif + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { + +#ifndef QT_NO_STL + using std::advance; +#else + template <typename It, typename T> + void advance(It &it, T value) + { + it+=value; + } +#endif + +/* + The BlockSizeManager class manages how many iterations a thread should + reserve and process at a time. This is done by measuring the time spent + in the user code versus the control part code, and then increasing + the block size if the ratio between them is to small. The block size + management is done on the basis of the median of several timing measuremens, + and it is done induvidualy for each thread. +*/ +class Q_CORE_EXPORT BlockSizeManager +{ +public: + BlockSizeManager(int iterationCount); + void timeBeforeUser(); + void timeAfterUser(); + int blockSize(); +private: + inline bool blockSizeMaxed() + { + return (m_blockSize >= maxBlockSize); + } + + const int maxBlockSize; + qint64 beforeUser; + qint64 afterUser; + Median<double> controlPartElapsed; + Median<double> userPartElapsed; + int m_blockSize; +}; + +template <typename T> +class ResultReporter +{ +public: + ResultReporter(ThreadEngine<T> *_threadEngine) + :threadEngine(_threadEngine) + { + + } + + void reserveSpace(int resultCount) + { + currentResultCount = resultCount; + vector.resize(qMax(resultCount, vector.count())); + } + + void reportResults(int begin) + { + const int useVectorThreshold = 4; // Tunable parameter. + if (currentResultCount > useVectorThreshold) { + vector.resize(currentResultCount); + threadEngine->reportResults(vector, begin); + } else { + for (int i = 0; i < currentResultCount; ++i) + threadEngine->reportResult(&vector.at(i), begin + i); + } + } + + inline T * getPointer() + { + return vector.data(); + } + + int currentResultCount; + ThreadEngine<T> *threadEngine; + QVector<T> vector; +}; + +template <> +class ResultReporter<void> +{ +public: + inline ResultReporter(ThreadEngine<void> *) { } + inline void reserveSpace(int) { }; + inline void reportResults(int) { }; + inline void * getPointer() { return 0; } +}; + +#ifndef QT_NO_STL +inline bool selectIteration(std::bidirectional_iterator_tag) +{ + return false; // while +} + +inline bool selectIteration(std::forward_iterator_tag) +{ + return false; // while +} + +inline bool selectIteration(std::random_access_iterator_tag) +{ + return true; // for +} +#else +// no stl support, always use while iteration +template <typename T> +inline bool selectIteration(T) +{ + return false; // while +} +#endif + +template <typename Iterator, typename T> +class IterateKernel : public ThreadEngine<T> +{ +public: + typedef T ResultType; + + IterateKernel(Iterator _begin, Iterator _end) +#if defined (QT_NO_STL) + : begin(_begin), end(_end), current(_begin), currentIndex(0), + forIteration(false), progressReportingEnabled(true) +#elif !defined(QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION) + : begin(_begin), end(_end), current(_begin), currentIndex(0), + forIteration(selectIteration(typename std::iterator_traits<Iterator>::iterator_category())), progressReportingEnabled(true) +#else + : begin(_begin), end(_end), currentIndex(0), + forIteration(selectIteration(std::iterator_category(_begin))), progressReportingEnabled(true) +#endif + { +#if defined (QT_NO_STL) + iterationCount = 0; +#else + iterationCount = forIteration ? std::distance(_begin, _end) : 0; + +#endif + } + + virtual ~IterateKernel() { } + + virtual bool runIteration(Iterator it, int index , T *result) + { Q_UNUSED(it); Q_UNUSED(index); Q_UNUSED(result); return false; } + virtual bool runIterations(Iterator _begin, int beginIndex, int endIndex, T *results) + { Q_UNUSED(_begin); Q_UNUSED(beginIndex); Q_UNUSED(endIndex); Q_UNUSED(results); return false; } + + void start() + { + progressReportingEnabled = this->isProgressReportingEnabled(); + if (progressReportingEnabled && iterationCount > 0) + this->setProgressRange(0, iterationCount); + } + + bool shouldStartThread() + { + if (forIteration) + return (currentIndex < iterationCount) && !this->shouldThrottleThread(); + else // whileIteration + return (iteratorThreads == 0); + } + + ThreadFunctionResult threadFunction() + { + if (forIteration) + return this->forThreadFunction(); + else // whileIteration + return this->whileThreadFunction(); + } + + ThreadFunctionResult forThreadFunction() + { + BlockSizeManager blockSizeManager(iterationCount); + ResultReporter<T> resultReporter(this); + + for(;;) { + if (this->isCanceled()) + break; + + const int currentBlockSize = blockSizeManager.blockSize(); + + if (currentIndex >= iterationCount) + break; + + // Atomically reserve a block of iterationCount for this thread. + const int beginIndex = currentIndex.fetchAndAddRelease(currentBlockSize); + const int endIndex = qMin(beginIndex + currentBlockSize, iterationCount); + + if (beginIndex >= endIndex) { + // No more work + break; + } + + this->waitForResume(); // (only waits if the qfuture is paused.) + + if (shouldStartThread()) + this->startThread(); + + const int finalBlockSize = endIndex - beginIndex; // block size adjusted for possible end-of-range + resultReporter.reserveSpace(finalBlockSize); + + // Call user code with the current iteration range. + blockSizeManager.timeBeforeUser(); + const bool resultsAvailable = this->runIterations(begin, beginIndex, endIndex, resultReporter.getPointer()); + blockSizeManager.timeAfterUser(); + + if (resultsAvailable) + resultReporter.reportResults(beginIndex); + + // Report progress if progress reporting enabled. + if (progressReportingEnabled) { + completed.fetchAndAddAcquire(finalBlockSize); + this->setProgressValue(this->completed); + } + + if (this->shouldThrottleThread()) + return ThrottleThread; + } + return ThreadFinished; + } + + ThreadFunctionResult whileThreadFunction() + { + if (iteratorThreads.testAndSetAcquire(0, 1) == false) + return ThreadFinished; + + ResultReporter<T> resultReporter(this); + resultReporter.reserveSpace(1); + + while (current != end) { + // The following two lines breaks support for input iterators according to + // the sgi docs: dereferencing prev after calling ++current is not allowed + // on input iterators. (prev is dereferenced inside user.runIteration()) + Iterator prev = current; + ++current; + int index = currentIndex.fetchAndAddRelaxed(1); + iteratorThreads.testAndSetRelease(1, 0); + + this->waitForResume(); // (only waits if the qfuture is paused.) + + if (shouldStartThread()) + this->startThread(); + + const bool resultAavailable = this->runIteration(prev, index, resultReporter.getPointer()); + if (resultAavailable) + resultReporter.reportResults(index); + + if (this->shouldThrottleThread()) + return ThrottleThread; + + if (iteratorThreads.testAndSetAcquire(0, 1) == false) + return ThreadFinished; + } + + return ThreadFinished; + } + + +public: + const Iterator begin; + const Iterator end; + Iterator current; + QAtomicInt currentIndex; + bool forIteration; + QAtomicInt iteratorThreads; + int iterationCount; + + bool progressReportingEnabled; + QAtomicInt completed; +}; + +} // namespace QtConcurrent + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentmap.h b/qtinterface/qt4/Qt/qtconcurrentmap.h new file mode 100644 index 0000000..41953f6 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentmap.h @@ -0,0 +1,780 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_MAP_H +#define QTCONCURRENT_MAP_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qtconcurrentmapkernel.h> +#include <QtCore/qtconcurrentreducekernel.h> +#include <QtCore/qtconcurrentfunctionwrappers.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifdef qdoc + +namespace QtConcurrent { + + QFuture<void> map(Sequence &sequence, MapFunction function); + QFuture<void> map(Iterator begin, Iterator end, MapFunction function); + + template <typename T> + QFuture<T> mapped(const Sequence &sequence, MapFunction function); + template <typename T> + QFuture<T> mapped(ConstIterator begin, ConstIterator end, MapFunction function); + + template <typename T> + QFuture<T> mappedReduced(const Sequence &sequence, + MapFunction function, + ReduceFunction function, + QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); + template <typename T> + QFuture<T> mappedReduced(ConstIterator begin, + ConstIterator end, + MapFunction function, + ReduceFunction function, + QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); + + void blockingMap(Sequence &sequence, MapFunction function); + void blockingMap(Iterator begin, Iterator end, MapFunction function); + + template <typename T> + T blockingMapped(const Sequence &sequence, MapFunction function); + template <typename T> + T blockingMapped(ConstIterator begin, ConstIterator end, MapFunction function); + + template <typename T> + T blockingMappedReduced(const Sequence &sequence, + MapFunction function, + ReduceFunction function, + QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); + template <typename T> + T blockingMappedReduced(ConstIterator begin, + ConstIterator end, + MapFunction function, + ReduceFunction function, + QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); + +} // namespace QtConcurrent + +#else + +namespace QtConcurrent { + +// map() on sequences +template <typename Sequence, typename MapFunctor> +QFuture<void> map(Sequence &sequence, MapFunctor map) +{ + return startMap(sequence.begin(), sequence.end(), map); +} + +template <typename Sequence, typename T, typename U> +QFuture<void> map(Sequence &sequence, T (map)(U)) +{ + return startMap(sequence.begin(), sequence.end(), FunctionWrapper1<T, U>(map)); +} + +template <typename Sequence, typename T, typename C> +QFuture<void> map(Sequence &sequence, T (C::*map)()) +{ + return startMap(sequence.begin(), sequence.end(), MemberFunctionWrapper<T, C>(map)); +} + +// map() on iterators +template <typename Iterator, typename MapFunctor> +QFuture<void> map(Iterator begin, Iterator end, MapFunctor map) +{ + return startMap(begin, end, map); +} + +template <typename Iterator, typename T, typename U> +QFuture<void> map(Iterator begin, Iterator end, T (map)(U)) +{ + return startMap(begin, end, FunctionWrapper1<T, U>(map)); +} + +template <typename Iterator, typename T, typename C> +QFuture<void> map(Iterator begin, Iterator end, T (C::*map)()) +{ + return startMap(begin, end, MemberFunctionWrapper<T, C>(map)); +} + +// mappedReduced() for sequences. +template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> +QFuture<ResultType> mappedReduced(const Sequence &sequence, + MapFunctor map, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<typename MapFunctor::result_type, ResultType> + (sequence, map, reduce, options); +} + +template <typename Sequence, typename MapFunctor, typename T, typename U, typename V> +QFuture<U> mappedReduced(const Sequence &sequence, + MapFunctor map, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<typename MapFunctor::result_type, U> + (sequence, map, FunctionWrapper2<T, U &, V>(reduce), options); +} + +template <typename Sequence, typename MapFunctor, typename T, typename C, typename U> +QFuture<C> mappedReduced(const Sequence &sequence, + MapFunctor map, + T (C::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<typename MapFunctor::result_type, C> + (sequence, map, MemberFunctionWrapper1<T, C, U>(reduce), options); +} + +template <typename ResultType, typename Sequence, typename T, typename U, typename ReduceFunctor> +QFuture<ResultType> mappedReduced(const Sequence &sequence, + T (map)(U), + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, ResultType> + (sequence, FunctionWrapper1<T, U>(map), reduce, options); +} + +template <typename ResultType, typename Sequence, typename T, typename C, typename ReduceFunctor> +QFuture<ResultType> mappedReduced(const Sequence &sequence, + T (C::*map)() const, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, ResultType> + (sequence, ConstMemberFunctionWrapper<T, C>(map), reduce, options); +} + +template <typename Sequence, typename T, typename U, typename V, typename W, typename X> +QFuture<W> mappedReduced(const Sequence &sequence, + T (map)(U), + V (reduce)(W &, X), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, W> + (sequence, FunctionWrapper1<T, U>(map), FunctionWrapper2<V, W &, X>(reduce), options); +} + +template <typename Sequence, typename T, typename C, typename U, typename V, typename W> +QFuture<V> mappedReduced(const Sequence &sequence, + T (C::*map)() const, + U (reduce)(V &, W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, V> (sequence, ConstMemberFunctionWrapper<T, C>(map), + FunctionWrapper2<U, V &, W>(reduce), options); +} + +template <typename Sequence, typename T, typename U, typename V, typename C, typename W> +QFuture<C> mappedReduced(const Sequence &sequence, + T (map)(U), + V (C::*reduce)(W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, C> (sequence, FunctionWrapper1<T, U>(map), + MemberFunctionWrapper1<V, C, W>(reduce), options); +} + +template <typename Sequence, typename T, typename C, typename U,typename D, typename V> +QFuture<D> mappedReduced(const Sequence &sequence, + T (C::*map)() const, + U (D::*reduce)(V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, D>(sequence, ConstMemberFunctionWrapper<T, C>(map), + MemberFunctionWrapper1<U, D, V>(reduce), options); +} + +// mappedReduced() for iterators +template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor> +QFuture<ResultType> mappedReduced(Iterator begin, + Iterator end, + MapFunctor map, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<ResultType, typename MapFunctor::result_type> + (begin, end, map, reduce, options); +} + +template <typename Iterator, typename MapFunctor, typename T, typename U, typename V> +QFuture<U> mappedReduced(Iterator begin, + Iterator end, + MapFunctor map, + T (reduce)(U &, V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<typename MapFunctor::result_type, U> + (begin, end, map, FunctionWrapper2<T, U &, V>(reduce), options); +} + +template <typename Iterator, typename MapFunctor, typename T, typename C, typename U> +QFuture<C> mappedReduced(Iterator begin, + Iterator end, + MapFunctor map, + T (C::*reduce)(U), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<typename MapFunctor::result_type, C> + (begin, end, map, MemberFunctionWrapper1<T, C, U>(reduce), options); +} + +template <typename ResultType, typename Iterator, typename T, typename U, typename ReduceFunctor> +QFuture<ResultType> mappedReduced(Iterator begin, + Iterator end, + T (map)(U), + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, ResultType> + (begin, end, FunctionWrapper1<T, U>(map), reduce, options); +} + +template <typename ResultType, typename Iterator, typename T, typename C, typename ReduceFunctor> +QFuture<ResultType> mappedReduced(Iterator begin, + Iterator end, + T (C::*map)() const, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, ResultType> + (begin, end, ConstMemberFunctionWrapper<T, C>(map), reduce, options); +} + +template <typename Iterator, typename T, typename U, typename V, typename W, typename X> +QFuture<W> mappedReduced(Iterator begin, + Iterator end, + T (map)(U), + V (reduce)(W &, X), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, W> + (begin, end, FunctionWrapper1<T, U>(map), FunctionWrapper2<V, W &, X>(reduce), options); +} + +template <typename Iterator, typename T, typename C, typename U, typename V, typename W> +QFuture<V> mappedReduced(Iterator begin, + Iterator end, + T (C::*map)() const, + U (reduce)(V &, W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, V>(begin, end, ConstMemberFunctionWrapper<T, C>(map), + FunctionWrapper2<U, V &, W>(reduce), options); +} + +template <typename Iterator, typename T, typename U, typename V, typename C, typename W> +QFuture<C> mappedReduced(Iterator begin, + Iterator end, + T (map)(U), + V (C::*reduce)(W), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, C> + (begin, end, FunctionWrapper1<T, U>(map), MemberFunctionWrapper1<V, C, W>(reduce), options); +} + +template <typename Iterator, typename T, typename C, typename U,typename D, typename V> +QFuture<D> mappedReduced(Iterator begin, + Iterator end, + T (C::*map)() const, + U (D::*reduce)(V), + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return startMappedReduced<T, D>(begin, end, ConstMemberFunctionWrapper<T, C>(map), + MemberFunctionWrapper1<U, D, V>(reduce), options); +} + +// mapped() for sequences +template <typename Sequence, typename MapFunctor> +QFuture<typename MapFunctor::result_type> mapped(const Sequence &sequence, MapFunctor map) +{ + return startMapped<typename MapFunctor::result_type>(sequence, map); +} + +template <typename Sequence, typename T, typename U> +QFuture<T> mapped(const Sequence &sequence, T (map)(U)) +{ + return startMapped<T>(sequence, FunctionWrapper1<T, U>(map)); +} + +template <typename Sequence, typename T, typename C> +QFuture<T> mapped(const Sequence &sequence, T (C::*map)() const) +{ + return startMapped<T>(sequence, ConstMemberFunctionWrapper<T, C>(map)); +} + +// mapped() for iterator ranges. +template <typename Iterator, typename MapFunctor> +QFuture<typename MapFunctor::result_type> mapped(Iterator begin, Iterator end, MapFunctor map) +{ + return startMapped<Q_TYPENAME MapFunctor::result_type>(begin, end, map); +} + +template <typename Iterator, typename T, typename U> +QFuture<T> mapped(Iterator begin, Iterator end, T (map)(U)) +{ + return startMapped<T>(begin, end, FunctionWrapper1<T, U>(map)); +} + +template <typename Iterator, typename T, typename C> +QFuture<T> mapped(Iterator begin, Iterator end, T (C::*map)() const) +{ + return startMapped<T>(begin, end, ConstMemberFunctionWrapper<T, C>(map)); +} + + +template <typename Sequence, typename MapFunctor> +void blockingMap(Sequence &sequence, MapFunctor map) +{ + startMap(sequence.begin(), sequence.end(), map).startBlocking(); +} + +template <typename Sequence, typename T, typename U> +void blockingMap(Sequence &sequence, T (map)(U)) +{ + startMap(sequence.begin(), sequence.end(), QtConcurrent::FunctionWrapper1<T, U>(map)).startBlocking(); +} + +template <typename Sequence, typename T, typename C> +void blockingMap(Sequence &sequence, T (C::*map)()) +{ + startMap(sequence.begin(), sequence.end(), QtConcurrent::MemberFunctionWrapper<T, C>(map)).startBlocking(); +} + +template <typename Iterator, typename MapFunctor> +void blockingMap(Iterator begin, Iterator end, MapFunctor map) +{ + startMap(begin, end, map).startBlocking(); +} + +template <typename Iterator, typename T, typename U> +void blockingMap(Iterator begin, Iterator end, T (map)(U)) +{ + startMap(begin, end, QtConcurrent::FunctionWrapper1<T, U>(map)).startBlocking(); +} + +template <typename Iterator, typename T, typename C> +void blockingMap(Iterator begin, Iterator end, T (C::*map)()) +{ + startMap(begin, end, QtConcurrent::MemberFunctionWrapper<T, C>(map)).startBlocking(); +} + +template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> +ResultType blockingMappedReduced(const Sequence &sequence, + MapFunctor map, + ReduceFunctor reduce, + ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, ResultType> + (sequence, map, reduce, options).startBlocking(); +} + +template <typename Sequence, typename MapFunctor, typename T, typename U, typename V> +U blockingMappedReduced(const Sequence &sequence, + MapFunctor map, + T (reduce)(U &, V), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, U> + (sequence, + map, + QtConcurrent::FunctionWrapper2<T, U &, V>(reduce), + options) + .startBlocking(); +} + +template <typename Sequence, typename MapFunctor, typename T, typename C, typename U> +C blockingMappedReduced(const Sequence &sequence, + MapFunctor map, + T (C::*reduce)(U), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, C> + (sequence, + map, + QtConcurrent::MemberFunctionWrapper1<T, C, U>(reduce), + options) + .startBlocking(); +} + +template <typename ResultType, typename Sequence, typename T, typename U, typename ReduceFunctor> +ResultType blockingMappedReduced(const Sequence &sequence, + T (map)(U), + ReduceFunctor reduce, + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, ResultType> + (sequence, + QtConcurrent::FunctionWrapper1<T, U>(map), + reduce, + options) + .startBlocking(); +} + +template <typename ResultType, typename Sequence, typename T, typename C, typename ReduceFunctor> +ResultType blockingMappedReduced(const Sequence &sequence, + T (C::*map)() const, + ReduceFunctor reduce, + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, ResultType> + (sequence, + QtConcurrent::ConstMemberFunctionWrapper<T, C>(map), + reduce, + options) + .startBlocking(); +} + +template <typename Sequence, typename T, typename U, typename V, typename W, typename X> +W blockingMappedReduced(const Sequence &sequence, + T (map)(U), + V (reduce)(W &, X), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, W> + (sequence, + QtConcurrent::FunctionWrapper1<T, U>(map), + QtConcurrent::FunctionWrapper2<V, W &, X>(reduce), + options) + .startBlocking(); +} + +template <typename Sequence, typename T, typename C, typename U, typename V, typename W> +V blockingMappedReduced(const Sequence &sequence, + T (C::*map)() const, + U (reduce)(V &, W), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, V> + (sequence, + QtConcurrent::ConstMemberFunctionWrapper<T, C>(map), + QtConcurrent::FunctionWrapper2<U, V &, W>(reduce), + options) + .startBlocking(); +} + +template <typename Sequence, typename T, typename U, typename V, typename C, typename W> +C blockingMappedReduced(const Sequence &sequence, + T (map)(U), + V (C::*reduce)(W), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, C> + (sequence, + QtConcurrent::FunctionWrapper1<T, U>(map), + QtConcurrent::MemberFunctionWrapper1<V, C, W>(reduce), + options) + .startBlocking(); +} + +template <typename Sequence, typename T, typename C, typename U,typename D, typename V> +D blockingMappedReduced(const Sequence &sequence, + T (C::*map)() const, + U (D::*reduce)(V), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, D> + (sequence, + QtConcurrent::ConstMemberFunctionWrapper<T, C>(map), + QtConcurrent::MemberFunctionWrapper1<U, D, V>(reduce), + options) + .startBlocking(); +} + +template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor> +ResultType blockingMappedReduced(Iterator begin, + Iterator end, + MapFunctor map, + ReduceFunctor reduce, + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, ResultType> + (begin, end, map, reduce, options).startBlocking(); +} + +template <typename Iterator, typename MapFunctor, typename T, typename U, typename V> +U blockingMappedReduced(Iterator begin, + Iterator end, + MapFunctor map, + T (reduce)(U &, V), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, U> + (begin, + end, + map, + QtConcurrent::FunctionWrapper2<T, U &, V>(reduce), + options) + .startBlocking(); +} + +template <typename Iterator, typename MapFunctor, typename T, typename C, typename U> +C blockingMappedReduced(Iterator begin, + Iterator end, + MapFunctor map, + T (C::*reduce)(U), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, C> + (begin, + end, + map, + QtConcurrent::MemberFunctionWrapper1<T, C, U>(reduce), + options) + .startBlocking(); +} + +template <typename ResultType, typename Iterator, typename T, typename U, typename ReduceFunctor> +ResultType blockingMappedReduced(Iterator begin, + Iterator end, + T (map)(U), + ReduceFunctor reduce, + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, ResultType> + (begin, + end, + QtConcurrent::FunctionWrapper1<T, U>(map), + reduce, + options) + .startBlocking(); +} + +template <typename ResultType, typename Iterator, typename T, typename C, typename ReduceFunctor> +ResultType blockingMappedReduced(Iterator begin, + Iterator end, + T (C::*map)() const, + ReduceFunctor reduce, + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, ResultType> + (begin, + end, + QtConcurrent::ConstMemberFunctionWrapper<T, C>(map), + reduce, + options) + .startBlocking(); +} + +template <typename Iterator, typename T, typename U, typename V, typename W, typename X> +W blockingMappedReduced(Iterator begin, + Iterator end, + T (map)(U), + V (reduce)(W &, X), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, W> + (begin, + end, + QtConcurrent::FunctionWrapper1<T, U>(map), + QtConcurrent::FunctionWrapper2<V, W &, X>(reduce), + options) + .startBlocking(); +} + +template <typename Iterator, typename T, typename C, typename U, typename V, typename W> +V blockingMappedReduced(Iterator begin, + Iterator end, + T (C::*map)() const, + U (reduce)(V &, W), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, V> + (begin, + end, + QtConcurrent::ConstMemberFunctionWrapper<T, C>(map), + QtConcurrent::FunctionWrapper2<U, V &, W>(reduce), + options) + .startBlocking(); +} + +template <typename Iterator, typename T, typename U, typename V, typename C, typename W> +C blockingMappedReduced(Iterator begin, + Iterator end, + T (map)(U), + V (C::*reduce)(W), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, C> + (begin, + end, + QtConcurrent::FunctionWrapper1<T, U>(map), + QtConcurrent::MemberFunctionWrapper1<V, C, W>(reduce), + options) + .startBlocking(); +} + +template <typename Iterator, typename T, typename C, typename U,typename D, typename V> +D blockingMappedReduced(Iterator begin, + Iterator end, + T (C::*map)() const, + U (D::*reduce)(V), + QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce)) +{ + return QtConcurrent::startMappedReduced<T, D> + (begin, + end, + QtConcurrent::ConstMemberFunctionWrapper<T, C>(map), + QtConcurrent::MemberFunctionWrapper1<U, D, V>(reduce), + options) + .startBlocking(); +} + +// mapped() for sequences with a different putput sequence type. +template <typename OutputSequence, typename InputSequence, typename MapFunctor> +OutputSequence blockingMapped(const InputSequence &sequence, MapFunctor map) +{ + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <typename OutputSequence, typename InputSequence, typename T, typename U> +OutputSequence blockingMapped(const InputSequence &sequence, T (map)(U)) +{ + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <typename OutputSequence, typename InputSequence, typename T, typename C> +OutputSequence blockingMapped(const InputSequence &sequence, T (C::*map)() const) +{ + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} +#ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS + +// overloads for changing the container value type: +template <template <typename> class Sequence, typename MapFunctor, typename T> +Sequence<typename MapFunctor::result_type> blockingMapped(const Sequence<T> &sequence, MapFunctor map) +{ + typedef Sequence<typename MapFunctor::result_type> OutputSequence; + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <template <typename> class Sequence, typename T, typename U, typename V> +Sequence<U> blockingMapped(const Sequence<T> &sequence, U (map)(V)) +{ + typedef Sequence<U> OutputSequence; + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <template <typename> class Sequence, typename T, typename U, typename C> +Sequence<U> blockingMapped(const Sequence<T> &sequence, U (C::*map)() const) +{ + typedef Sequence<U> OutputSequence; + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +#endif // QT_NO_TEMPLATE_TEMPLATE_PARAMETER + +// overloads for changing the container value type from a QStringList: +template <typename MapFunctor> +QList<typename MapFunctor::result_type> blockingMapped(const QStringList &sequence, MapFunctor map) +{ + typedef QList<typename MapFunctor::result_type> OutputSequence; + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <typename U, typename V> +QList<U> blockingMapped(const QStringList &sequence, U (map)(V)) +{ + typedef QList<U> OutputSequence; + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <typename U, typename C> +QList<U> blockingMapped(const QStringList &sequence, U (C::*map)() const) +{ + typedef QList<U> OutputSequence; + return blockingMappedReduced(sequence, map, &OutputSequence::push_back, + QtConcurrent::OrderedReduce); +} + +// mapped() for iterator ranges +template <typename Sequence, typename Iterator, typename MapFunctor> +Sequence blockingMapped(Iterator begin, Iterator end, MapFunctor map) +{ + return blockingMappedReduced(begin, end, map, &Sequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <typename Sequence, typename Iterator, typename T, typename U> +Sequence blockingMapped(Iterator begin, Iterator end, T (map)(U)) +{ + return blockingMappedReduced(begin, end, map, &Sequence::push_back, + QtConcurrent::OrderedReduce); +} + +template <typename Sequence, typename Iterator, typename T, typename C> +Sequence blockingMapped(Iterator begin, Iterator end, T (C::*map)() const) +{ + return blockingMappedReduced(begin, end, map, &Sequence::push_back, + QtConcurrent::OrderedReduce); +} + +} // namespace QtConcurrent + +#endif // qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentmapkernel.h b/qtinterface/qt4/Qt/qtconcurrentmapkernel.h new file mode 100644 index 0000000..f11327d --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentmapkernel.h @@ -0,0 +1,273 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_MAPKERNEL_H +#define QTCONCURRENT_MAPKERNEL_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qtconcurrentiteratekernel.h> +#include <QtCore/qtconcurrentreducekernel.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc +namespace QtConcurrent { + +// map kernel, works with both parallel-for and parallel-while +template <typename Iterator, typename MapFunctor> +class MapKernel : public IterateKernel<Iterator, void> +{ + MapFunctor map; +public: + typedef void ReturnType; + MapKernel(Iterator begin, Iterator end, MapFunctor _map) + : IterateKernel<Iterator, void>(begin, end), map(_map) + { } + + bool runIteration(Iterator it, int, void *) + { + map(*it); + return false; + } + + bool runIterations(Iterator sequenceBeginIterator, int beginIndex, int endIndex, void *) + { + Iterator it = sequenceBeginIterator; + advance(it, beginIndex); + for (int i = beginIndex; i < endIndex; ++i) { + runIteration(it, i, 0); + advance(it, 1); + } + + return false; + } +}; + +template <typename ReducedResultType, + typename Iterator, + typename MapFunctor, + typename ReduceFunctor, + typename Reducer = ReduceKernel<ReduceFunctor, + ReducedResultType, + typename MapFunctor::result_type> > +class MappedReducedKernel : public IterateKernel<Iterator, ReducedResultType> +{ + ReducedResultType reducedResult; + MapFunctor map; + ReduceFunctor reduce; + Reducer reducer; +public: + typedef ReducedResultType ReturnType; + MappedReducedKernel(Iterator begin, Iterator end, MapFunctor _map, ReduceFunctor _reduce, ReduceOptions reduceOptions) + : IterateKernel<Iterator, ReducedResultType>(begin, end), reducedResult(), map(_map), reduce(_reduce), reducer(reduceOptions) + { } + + MappedReducedKernel(ReducedResultType initialValue, + MapFunctor _map, + ReduceFunctor _reduce) + : reducedResult(initialValue), map(_map), reduce(_reduce) + { } + + bool runIteration(Iterator it, int index, ReducedResultType *) + { + IntermediateResults<typename MapFunctor::result_type> results; + results.begin = index; + results.end = index + 1; + + results.vector.append(map(*it)); + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) + { + IntermediateResults<typename MapFunctor::result_type> results; + results.begin = begin; + results.end = end; + results.vector.reserve(end - begin); + + Iterator it = sequenceBeginIterator; + advance(it, begin); + for (int i = begin; i < end; ++i) { + results.vector.append(map(*(it))); + advance(it, 1); + } + + reducer.runReduce(reduce, reducedResult, results); + return false; + } + + void finish() + { + reducer.finish(reduce, reducedResult); + } + + bool shouldThrottleThread() + { + return IterateKernel<Iterator, ReducedResultType>::shouldThrottleThread() || reducer.shouldThrottle(); + } + + bool shouldStartThread() + { + return IterateKernel<Iterator, ReducedResultType>::shouldStartThread() && reducer.shouldStartThread(); + } + + typedef ReducedResultType ResultType; + ReducedResultType *result() + { + return &reducedResult; + } +}; + +template <typename Iterator, typename MapFunctor> +class MappedEachKernel : public IterateKernel<Iterator, typename MapFunctor::result_type> +{ + MapFunctor map; + typedef typename MapFunctor::result_type T; +public: + typedef T ReturnType; + typedef T ResultType; + + MappedEachKernel(Iterator begin, Iterator end, MapFunctor _map) + : IterateKernel<Iterator, T>(begin, end), map(_map) { } + + bool runIteration(Iterator it, int, T *result) + { + *result = map(*it); + return true; + } + + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *results) + { + + Iterator it = sequenceBeginIterator; + advance(it, begin); + for (int i = begin; i < end; ++i) { + runIteration(it, i, results + (i - begin)); + advance(it, 1); + } + + return true; + } +}; + +template <typename Iterator, typename Functor> +inline ThreadEngineStarter<void> startMap(Iterator begin, Iterator end, Functor functor) +{ + return startThreadEngine(new MapKernel<Iterator, Functor>(begin, end, functor)); +} + +template <typename T, typename Iterator, typename Functor> +inline ThreadEngineStarter<T> startMapped(Iterator begin, Iterator end, Functor functor) +{ + return startThreadEngine(new MappedEachKernel<Iterator, Functor>(begin, end, functor)); +} + +/* + The SequnceHolder class is used to hold a reference to the + sequence we are working on. +*/ +template <typename Sequence, typename Base, typename Functor> +struct SequenceHolder1 : public Base +{ + SequenceHolder1(const Sequence &_sequence, Functor functor) + : Base(_sequence.begin(), _sequence.end(), functor), sequence(_sequence) + { } + + Sequence sequence; + + void finish() + { + Base::finish(); + // Clear the sequence to make sure all temporaries are destroyed + // before finished is signaled. + sequence = Sequence(); + } +}; + +template <typename T, typename Sequence, typename Functor> +inline ThreadEngineStarter<T> startMapped(const Sequence &sequence, Functor functor) +{ + typedef SequenceHolder1<Sequence, + MappedEachKernel<typename Sequence::const_iterator , Functor>, Functor> + SequenceHolderType; + + return startThreadEngine(new SequenceHolderType(sequence, functor)); +} + +template <typename IntermediateType, typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> +inline ThreadEngineStarter<ResultType> startMappedReduced(const Sequence & sequence, + MapFunctor mapFunctor, ReduceFunctor reduceFunctor, + ReduceOptions options) +{ + typedef typename Sequence::const_iterator Iterator; + typedef ReduceKernel<ReduceFunctor, ResultType, IntermediateType> Reducer; + typedef MappedReducedKernel<ResultType, Iterator, MapFunctor, ReduceFunctor, Reducer> MappedReduceType; + typedef SequenceHolder2<Sequence, MappedReduceType, MapFunctor, ReduceFunctor> SequenceHolderType; + return startThreadEngine(new SequenceHolderType(sequence, mapFunctor, reduceFunctor, options)); +} + +template <typename IntermediateType, typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor> +inline ThreadEngineStarter<ResultType> startMappedReduced(Iterator begin, Iterator end, + MapFunctor mapFunctor, ReduceFunctor reduceFunctor, + ReduceOptions options) +{ + typedef ReduceKernel<ReduceFunctor, ResultType, IntermediateType> Reducer; + typedef MappedReducedKernel<ResultType, Iterator, MapFunctor, ReduceFunctor, Reducer> MappedReduceType; + return startThreadEngine(new MappedReduceType(begin, end, mapFunctor, reduceFunctor, options)); +} + +} // namespace QtConcurrent + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentmedian.h b/qtinterface/qt4/Qt/qtconcurrentmedian.h new file mode 100644 index 0000000..54a87fa --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentmedian.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_MEDIAN_H +#define QTCONCURRENT_MEDIAN_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qvector.h> +#include <QtCore/qalgorithms.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { + +template <typename T> +class Median +{ +public: + Median(int _bufferSize) + : currentMedian(), bufferSize(_bufferSize), currentIndex(0), valid(false), dirty(true) + { + values.resize(bufferSize); + } + + void reset() + { + values.fill(0); + currentIndex = 0; + valid = false; + dirty = true; + } + + void addValue(T value) + { + currentIndex = ((currentIndex + 1) % bufferSize); + if (valid == false && currentIndex % bufferSize == 0) + valid = true; + + // Only update the cached median value when we have to, that + // is when the new value is on then other side of the median + // compared to the current value at the index. + const T currentIndexValue = values[currentIndex]; + if ((currentIndexValue > currentMedian && currentMedian > value) + || (currentMedian > currentIndexValue && value > currentMedian)) { + dirty = true; + } + + values[currentIndex] = value; + } + + bool isMedianValid() const + { + return valid; + } + + T median() + { + if (dirty) { + dirty = false; + QVector<T> sorted = values; + qSort(sorted); + currentMedian = sorted.at(bufferSize / 2 + 1); + } + return currentMedian; + } +private: + QVector<T> values; + T currentMedian; + int bufferSize; + int currentIndex; + bool valid; + bool dirty; +}; + +} // namespace QtConcurrent + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentreducekernel.h b/qtinterface/qt4/Qt/qtconcurrentreducekernel.h new file mode 100644 index 0000000..f82b495 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentreducekernel.h @@ -0,0 +1,255 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_REDUCEKERNEL_H +#define QTCONCURRENT_REDUCEKERNEL_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qatomic.h> +#include <QtCore/qlist.h> +#include <QtCore/qmap.h> +#include <QtCore/qmutex.h> +#include <QtCore/qthread.h> +#include <QtCore/qthreadpool.h> +#include <QtCore/qvector.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +namespace QtConcurrent { + +#ifndef qdoc + +/* + The ReduceQueueStartLimit and ReduceQueueThrottleLimit constants + limit the reduce queue size for MapReduce. When the number of + reduce blocks in the queue exceeds ReduceQueueStartLimit, + MapReduce won't start any new threads, and when it exceeds + ReduceQueueThrottleLimit running threads will be stopped. +*/ +enum { + ReduceQueueStartLimit = 20, + ReduceQueueThrottleLimit = 30 +}; + +// IntermediateResults holds a block of intermediate results from a +// map or filter functor. The begin/end offsets indicates the origin +// and range of the block. +template <typename T> +class IntermediateResults +{ +public: + int begin, end; + QVector<T> vector; +}; + +#endif // qdoc + +enum ReduceOption { + UnorderedReduce = 0x1, + OrderedReduce = 0x2, + SequentialReduce = 0x4 + // ParallelReduce = 0x8 +}; +Q_DECLARE_FLAGS(ReduceOptions, ReduceOption) +Q_DECLARE_OPERATORS_FOR_FLAGS(ReduceOptions) + +#ifndef qdoc + +// supports both ordered and out-of-order reduction +template <typename ReduceFunctor, typename ReduceResultType, typename T> +class ReduceKernel +{ + typedef QMap<int, IntermediateResults<T> > ResultsMap; + + const ReduceOptions reduceOptions; + + QMutex mutex; + int progress, resultsMapSize, threadCount; + ResultsMap resultsMap; + + bool canReduce(int begin) const + { + return (((reduceOptions & UnorderedReduce) + && progress == 0) + || ((reduceOptions & OrderedReduce) + && progress == begin)); + } + + void reduceResult(ReduceFunctor &reduce, + ReduceResultType &r, + const IntermediateResults<T> &result) + { + for (int i = 0; i < result.vector.size(); ++i) { + reduce(r, result.vector.at(i)); + } + } + + void reduceResults(ReduceFunctor &reduce, + ReduceResultType &r, + ResultsMap &map) + { + typename ResultsMap::iterator it = map.begin(); + while (it != map.end()) { + reduceResult(reduce, r, it.value()); + ++it; + } + } + +public: + ReduceKernel(ReduceOptions _reduceOptions) + : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0), + threadCount(QThreadPool::globalInstance()->maxThreadCount()) + { } + + void runReduce(ReduceFunctor &reduce, + ReduceResultType &r, + const IntermediateResults<T> &result) + { + QMutexLocker locker(&mutex); + if (!canReduce(result.begin)) { + ++resultsMapSize; + resultsMap.insert(result.begin, result); + return; + } + + if (reduceOptions & UnorderedReduce) { + // UnorderedReduce + progress = -1; + + // reduce this result + locker.unlock(); + reduceResult(reduce, r, result); + locker.relock(); + + // reduce all stored results as well + while (!resultsMap.isEmpty()) { + ResultsMap resultsMapCopy = resultsMap; + resultsMap.clear(); + + locker.unlock(); + reduceResults(reduce, r, resultsMapCopy); + locker.relock(); + + resultsMapSize -= resultsMapCopy.size(); + } + + progress = 0; + } else { + // reduce this result + locker.unlock(); + reduceResult(reduce, r, result); + locker.relock(); + + // OrderedReduce + progress += result.end - result.begin; + + // reduce as many other results as possible + typename ResultsMap::iterator it = resultsMap.begin(); + while (it != resultsMap.end()) { + if (it.value().begin != progress) + break; + + locker.unlock(); + reduceResult(reduce, r, it.value()); + locker.relock(); + + --resultsMapSize; + progress += it.value().end - it.value().begin; + it = resultsMap.erase(it); + } + } + } + + // final reduction + void finish(ReduceFunctor &reduce, ReduceResultType &r) + { + reduceResults(reduce, r, resultsMap); + } + + inline bool shouldThrottle() + { + return (resultsMapSize > (ReduceQueueThrottleLimit * threadCount)); + } + + inline bool shouldStartThread() + { + return (resultsMapSize <= (ReduceQueueStartLimit * threadCount)); + } +}; + +template <typename Sequence, typename Base, typename Functor1, typename Functor2> +struct SequenceHolder2 : public Base +{ + SequenceHolder2(const Sequence &_sequence, + Functor1 functor1, + Functor2 functor2, + ReduceOptions reduceOptions) + : Base(_sequence.begin(), _sequence.end(), functor1, functor2, reduceOptions), + sequence(_sequence) + { } + + Sequence sequence; + + void finish() + { + Base::finish(); + // Clear the sequence to make sure all temporaries are destroyed + // before finished is signaled. + sequence = Sequence(); + } +}; + +#endif //qdoc + +} // namespace QtConcurrent + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentresultstore.h b/qtinterface/qt4/Qt/qtconcurrentresultstore.h new file mode 100644 index 0000000..a9363eb --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentresultstore.h @@ -0,0 +1,239 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_RESULTSTORE_H +#define QTCONCURRENT_RESULTSTORE_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_QFUTURE + +#include <QtCore/qmap.h> +#include <QtCore/qdebug.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +/* + ResultStore stores indexed results. Results can be added and retrieved + either individually batched in a QVector. Retriveing results and checking + which indexes are in the store can be done either by iterating or by random + accees. In addition results kan be removed from the front of the store, + either individually or in batches. +*/ + +#ifndef qdoc + +namespace QtConcurrent { + +class ResultItem +{ +public: + ResultItem(const void *_result, int _count) : m_count(_count), result(_result) { } // contruct with vector of results + ResultItem(const void *_result) : m_count(0), result(_result) { } // construct with result + ResultItem() : m_count(0), result(0) { } + bool isValid() const { return result != 0; } + bool isVector() const { return m_count != 0; } + int count() const { return (m_count == 0) ? 1 : m_count; } + int m_count; // result is either a pointer to a result or to a vector of results, + const void *result; // if count is 0 it's a result, otherwise it's a vector. +}; + +class Q_CORE_EXPORT ResultIteratorBase +{ +public: + ResultIteratorBase(); + ResultIteratorBase(QMap<int, ResultItem>::const_iterator _mapIterator, int _vectorIndex = 0); + int vectorIndex() const; + int resultIndex() const; + + ResultIteratorBase operator++(); + int batchSize() const; + void batchedAdvance(); + bool operator==(const ResultIteratorBase &other) const; + bool operator!=(const ResultIteratorBase &other) const; + bool isVector() const; + bool canIncrementVectorIndex() const; +protected: + QMap<int, ResultItem>::const_iterator mapIterator; + int m_vectorIndex; +}; + +template <typename T> +class ResultIterator : public ResultIteratorBase +{ +public: + ResultIterator(const ResultIteratorBase &base) + : ResultIteratorBase(base) { } + + const T &value() const + { + return *pointer(); + } + + const T *pointer() const + { + if (mapIterator.value().isVector()) + return &(reinterpret_cast<const QVector<T> *>(mapIterator.value().result)->at(m_vectorIndex)); + else + return reinterpret_cast<const T *>(mapIterator.value().result); + } +}; + +class Q_CORE_EXPORT ResultStoreBase +{ +public: + ResultStoreBase(); + void setFilterMode(bool enable); + bool filterMode() const; + int addResult(int index, const void *result); + int addResults(int index, const void *results, int vectorSize, int logicalCount); + ResultIteratorBase begin() const; + ResultIteratorBase end() const; + bool hasNextResult() const; + ResultIteratorBase resultAt(int index) const; + bool contains(int index) const; + int count() const; + virtual ~ResultStoreBase() { }; + +protected: + int insertResultItem(int index, ResultItem &resultItem); + void insertResultItemIfValid(int index, ResultItem &resultItem); + void syncPendingResults(); + void syncResultCount(); + int updateInsertIndex(int index, int _count); + + QMap<int, ResultItem> m_results; + int insertIndex; // The index where the next results(s) will be inserted. + int resultCount; // The number of consecutive results stored, starting at index 0. + + bool m_filterMode; + QMap<int, ResultItem> pendingResults; + int filteredResults; + +}; + +template <typename T> +class ResultStore : public ResultStoreBase +{ +public: + ResultStore() { } + + ResultStore(const ResultStoreBase &base) + : ResultStoreBase(base) { } + + int addResult(int index, const T *result) + { + if (result == 0) + return ResultStoreBase::addResult(index, result); + else + return ResultStoreBase::addResult(index, new T(*result)); + } + + int addResults(int index, const QVector<T> *results) + { + return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), results->count()); + } + + int addResults(int index, const QVector<T> *results, int totalCount) + { + return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount); + } + + int addCanceledResult(int index) + { + return addResult(index, 0); + } + + int addCanceledResults(int index, int _count) + { + QVector<T> empty; + return addResults(index, &empty, _count); + } + + ResultIterator<T> begin() const + { + return static_cast<ResultIterator<T> >(ResultStoreBase::begin()); + } + + ResultIterator<T> end() const + { + return static_cast<ResultIterator<T> >(ResultStoreBase::end()); + } + + ResultIterator<T> resultAt(int index) const + { + return static_cast<ResultIterator<T> >(ResultStoreBase::resultAt(index)); + } + + void clear() + { + QMap<int, ResultItem>::const_iterator mapIterator = m_results.constBegin(); + while (mapIterator != m_results.constEnd()) { + if (mapIterator.value().isVector()) + delete reinterpret_cast<const QVector<T> *>(mapIterator.value().result); + else + delete reinterpret_cast<const T *>(mapIterator.value().result); + ++mapIterator; + } + resultCount = 0; + m_results.clear(); + } + + ~ResultStore() + { + clear(); + } + +}; + +} // namespace QtConcurrent + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentrun.h b/qtinterface/qt4/Qt/qtconcurrentrun.h new file mode 100644 index 0000000..48cba77 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentrun.h @@ -0,0 +1,297 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Generated code, do not edit! Use generator at tools/qtconcurrent/generaterun/ +#ifndef QTCONCURRENT_RUN_H +#define QTCONCURRENT_RUN_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qtconcurrentrunbase.h> +#include <QtCore/qtconcurrentstoredfunctioncall.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifdef qdoc + +namespace QtConcurrent { + + template <typename T> + QFuture<T> run(Function function, ...); + +} // namespace QtConcurrent + +#else + +namespace QtConcurrent { + +template <typename T> +QFuture<T> run(T (*functionPointer)()) +{ + return (new QT_TYPENAME SelectStoredFunctorCall0<T, T (*)()>::type(functionPointer))->start(); +} +template <typename T, typename Param1, typename Arg1> +QFuture<T> run(T (*functionPointer)(Param1), const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredFunctorCall1<T, T (*)(Param1), Arg1>::type(functionPointer, arg1))->start(); +} +template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2> +QFuture<T> run(T (*functionPointer)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>::type(functionPointer, arg1, arg2))->start(); +} +template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>::type(functionPointer, arg1, arg2, arg3))->start(); +} +template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>::type(functionPointer, arg1, arg2, arg3, arg4))->start(); +} +template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template <typename FunctionObject> +QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject) +{ + return (new QT_TYPENAME SelectStoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>::type(functionObject))->start(); +} +template <typename FunctionObject, typename Arg1> +QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2> +QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3> +QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template <typename FunctionObject> +QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>::type(functionObject))->start(); +} +template <typename FunctionObject, typename Arg1> +QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2> +QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3> +QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start(); +} +template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template <typename T, typename Class> +QFuture<T> run(const Class &object, T (Class::*fn)()) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall0<T, Class>::type(fn, object))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1), const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template <typename T, typename Class> +QFuture<T> run(const Class &object, T (Class::*fn)() const) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall0<T, Class>::type(fn, object))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1) const, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2) const, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template <typename T, typename Class> +QFuture<T> run(Class *object, T (Class::*fn)()) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall0<T, Class>::type(fn, object))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1> +QFuture<T> run(Class *object, T (Class::*fn)(Param1), const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template <typename T, typename Class> +QFuture<T> run(const Class *object, T (Class::*fn)() const) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall0<T, Class>::type(fn, object))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1> +QFuture<T> run(const Class *object, T (Class::*fn)(Param1) const, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2) const, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2, Param3) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +} //namespace QtConcurrent + +#endif // qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentrunbase.h b/qtinterface/qt4/Qt/qtconcurrentrunbase.h new file mode 100644 index 0000000..0b7429c --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentrunbase.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_RUNBASE_H +#define QTCONCURRENT_RUNBASE_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qfuture.h> +#include <QtCore/qrunnable.h> +#include <QtCore/qthreadpool.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { + +template <typename T> +struct SelectSpecialization +{ + template <class Normal, class Void> + struct Type { typedef Normal type; }; +}; + +template <> +struct SelectSpecialization<void> +{ + template <class Normal, class Void> + struct Type { typedef Void type; }; +}; + +template <typename T> +class RunFunctionTaskBase : public QFutureInterface<T> , public QRunnable +{ +public: + QFuture<T> start() + { + this->setRunnable(this); + this->reportStarted(); + QFuture<T> future = this->future(); + QThreadPool::globalInstance()->start(this, /*m_priority*/ 0); + return future; + } + + void run() {} + virtual void runFunctor() = 0; +}; + +template <typename T> +class RunFunctionTask : public RunFunctionTaskBase<T> +{ +public: + void run() + { + if (this->isCanceled()) { + this->reportFinished(); + return; + } + this->runFunctor(); + this->reportResult(result); + this->reportFinished(); + } + T result; +}; + +template <> +class RunFunctionTask<void> : public RunFunctionTaskBase<void> +{ +public: + void run() + { + if (this->isCanceled()) { + this->reportFinished(); + return; + } + this->runFunctor(); + this->reportFinished(); + } +}; + +} //namespace QtConcurrent + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentstoredfunctioncall.h b/qtinterface/qt4/Qt/qtconcurrentstoredfunctioncall.h new file mode 100644 index 0000000..182f1ff --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentstoredfunctioncall.h @@ -0,0 +1,1328 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Generated code, do not edit! Use generator at tools/qtconcurrent/generaterun/ +#ifndef QTCONCURRENT_STOREDFUNCTIONCALL_H +#define QTCONCURRENT_STOREDFUNCTIONCALL_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT +#include <QtCore/qtconcurrentrunbase.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { +template <typename T, typename FunctionPointer> +struct StoredFunctorCall0: public RunFunctionTask<T> +{ + inline StoredFunctorCall0(FunctionPointer _function) + : function(_function) {} + void runFunctor() { this->result = function(); } + FunctionPointer function; + +}; + +template <typename T, typename FunctionPointer> +struct VoidStoredFunctorCall0: public RunFunctionTask<T> +{ + inline VoidStoredFunctorCall0(FunctionPointer _function) + : function(_function) {} + void runFunctor() { function(); } + FunctionPointer function; + +}; + +template <typename T, typename FunctionPointer> +struct SelectStoredFunctorCall0 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorCall0 <T, FunctionPointer>, + VoidStoredFunctorCall0<T, FunctionPointer> >::type type; +}; +template <typename T, typename FunctionPointer> +struct StoredFunctorPointerCall0: public RunFunctionTask<T> +{ + inline StoredFunctorPointerCall0(FunctionPointer * _function) + : function(_function) {} + void runFunctor() { this->result =(*function)(); } + FunctionPointer * function; + +}; + +template <typename T, typename FunctionPointer> +struct VoidStoredFunctorPointerCall0: public RunFunctionTask<T> +{ + inline VoidStoredFunctorPointerCall0(FunctionPointer * _function) + : function(_function) {} + void runFunctor() {(*function)(); } + FunctionPointer * function; + +}; + +template <typename T, typename FunctionPointer> +struct SelectStoredFunctorPointerCall0 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorPointerCall0 <T, FunctionPointer>, + VoidStoredFunctorPointerCall0<T, FunctionPointer> >::type type; +}; +template <typename T, typename Class> +class StoredMemberFunctionCall0 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + this->result = (object.*fn)(); + } +private: + T (Class::*fn)(); + Class object; + +}; +template <typename T, typename Class> +class VoidStoredMemberFunctionCall0 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + (object.*fn)(); + } +private: + T (Class::*fn)(); + Class object; + +}; +template <typename T, typename Class> +struct SelectStoredMemberFunctionCall0 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionCall0 <T, Class>, + VoidStoredMemberFunctionCall0<T, Class> >::type type; +}; +template <typename T, typename Class> +class StoredConstMemberFunctionCall0 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionCall0(T (Class::*_fn)() const, const Class &_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + this->result = (object.*fn)(); + } +private: + T (Class::*fn)()const; + const Class object; + +}; +template <typename T, typename Class> +class VoidStoredConstMemberFunctionCall0 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionCall0(T (Class::*_fn)() const, const Class &_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + (object.*fn)(); + } +private: + T (Class::*fn)()const; + const Class object; + +}; +template <typename T, typename Class> +struct SelectStoredConstMemberFunctionCall0 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionCall0 <T, Class>, + VoidStoredConstMemberFunctionCall0<T, Class> >::type type; +}; +template <typename T, typename Class> +class StoredMemberFunctionPointerCall0 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + this->result = (object->*fn)(); + } +private: + T (Class::*fn)(); + Class *object; + +}; +template <typename T, typename Class> +class VoidStoredMemberFunctionPointerCall0 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + (object->*fn)(); + } +private: + T (Class::*fn)(); + Class *object; + +}; +template <typename T, typename Class> +struct SelectStoredMemberFunctionPointerCall0 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionPointerCall0 <T, Class>, + VoidStoredMemberFunctionPointerCall0<T, Class> >::type type; +}; +template <typename T, typename Class> +class StoredConstMemberFunctionPointerCall0 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionPointerCall0(T (Class::*_fn)() const, Class const *_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + this->result = (object->*fn)(); + } +private: + T (Class::*fn)()const; + Class const *object; + +}; +template <typename T, typename Class> +class VoidStoredConstMemberFunctionPointerCall0 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionPointerCall0(T (Class::*_fn)() const, Class const *_object) + : fn(_fn), object(_object){ } + + void runFunctor() + { + (object->*fn)(); + } +private: + T (Class::*fn)()const; + Class const *object; + +}; +template <typename T, typename Class> +struct SelectStoredConstMemberFunctionPointerCall0 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionPointerCall0 <T, Class>, + VoidStoredConstMemberFunctionPointerCall0<T, Class> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1> +struct StoredFunctorCall1: public RunFunctionTask<T> +{ + inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) + : function(_function), arg1(_arg1) {} + void runFunctor() { this->result = function(arg1); } + FunctionPointer function; + Arg1 arg1; +}; + +template <typename T, typename FunctionPointer, typename Arg1> +struct VoidStoredFunctorCall1: public RunFunctionTask<T> +{ + inline VoidStoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) + : function(_function), arg1(_arg1) {} + void runFunctor() { function(arg1); } + FunctionPointer function; + Arg1 arg1; +}; + +template <typename T, typename FunctionPointer, typename Arg1> +struct SelectStoredFunctorCall1 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorCall1 <T, FunctionPointer, Arg1>, + VoidStoredFunctorCall1<T, FunctionPointer, Arg1> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1> +struct StoredFunctorPointerCall1: public RunFunctionTask<T> +{ + inline StoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1) + : function(_function), arg1(_arg1) {} + void runFunctor() { this->result =(*function)(arg1); } + FunctionPointer * function; + Arg1 arg1; +}; + +template <typename T, typename FunctionPointer, typename Arg1> +struct VoidStoredFunctorPointerCall1: public RunFunctionTask<T> +{ + inline VoidStoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1) + : function(_function), arg1(_arg1) {} + void runFunctor() {(*function)(arg1); } + FunctionPointer * function; + Arg1 arg1; +}; + +template <typename T, typename FunctionPointer, typename Arg1> +struct SelectStoredFunctorPointerCall1 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorPointerCall1 <T, FunctionPointer, Arg1>, + VoidStoredFunctorPointerCall1<T, FunctionPointer, Arg1> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class StoredMemberFunctionCall1 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1); + } +private: + T (Class::*fn)(Param1); + Class object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class VoidStoredMemberFunctionCall1 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + (object.*fn)(arg1); + } +private: + T (Class::*fn)(Param1); + Class object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +struct SelectStoredMemberFunctionCall1 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionCall1 <T, Class, Param1, Arg1>, + VoidStoredMemberFunctionCall1<T, Class, Param1, Arg1> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class StoredConstMemberFunctionCall1 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionCall1(T (Class::*_fn)(Param1) const, const Class &_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1); + } +private: + T (Class::*fn)(Param1)const; + const Class object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class VoidStoredConstMemberFunctionCall1 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionCall1(T (Class::*_fn)(Param1) const, const Class &_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + (object.*fn)(arg1); + } +private: + T (Class::*fn)(Param1)const; + const Class object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +struct SelectStoredConstMemberFunctionCall1 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionCall1 <T, Class, Param1, Arg1>, + VoidStoredConstMemberFunctionCall1<T, Class, Param1, Arg1> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class StoredMemberFunctionPointerCall1 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1); + } +private: + T (Class::*fn)(Param1); + Class *object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class VoidStoredMemberFunctionPointerCall1 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + (object->*fn)(arg1); + } +private: + T (Class::*fn)(Param1); + Class *object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +struct SelectStoredMemberFunctionPointerCall1 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionPointerCall1 <T, Class, Param1, Arg1>, + VoidStoredMemberFunctionPointerCall1<T, Class, Param1, Arg1> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class StoredConstMemberFunctionPointerCall1 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionPointerCall1(T (Class::*_fn)(Param1) const, Class const *_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1); + } +private: + T (Class::*fn)(Param1)const; + Class const *object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +class VoidStoredConstMemberFunctionPointerCall1 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionPointerCall1(T (Class::*_fn)(Param1) const, Class const *_object, const Arg1 &_arg1) + : fn(_fn), object(_object), arg1(_arg1){ } + + void runFunctor() + { + (object->*fn)(arg1); + } +private: + T (Class::*fn)(Param1)const; + Class const *object; + Arg1 arg1; +}; +template <typename T, typename Class, typename Param1, typename Arg1> +struct SelectStoredConstMemberFunctionPointerCall1 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionPointerCall1 <T, Class, Param1, Arg1>, + VoidStoredConstMemberFunctionPointerCall1<T, Class, Param1, Arg1> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> +struct StoredFunctorCall2: public RunFunctionTask<T> +{ + inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) + : function(_function), arg1(_arg1), arg2(_arg2) {} + void runFunctor() { this->result = function(arg1, arg2); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> +struct VoidStoredFunctorCall2: public RunFunctionTask<T> +{ + inline VoidStoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) + : function(_function), arg1(_arg1), arg2(_arg2) {} + void runFunctor() { function(arg1, arg2); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> +struct SelectStoredFunctorCall2 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorCall2 <T, FunctionPointer, Arg1, Arg2>, + VoidStoredFunctorCall2<T, FunctionPointer, Arg1, Arg2> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> +struct StoredFunctorPointerCall2: public RunFunctionTask<T> +{ + inline StoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2) + : function(_function), arg1(_arg1), arg2(_arg2) {} + void runFunctor() { this->result =(*function)(arg1, arg2); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> +struct VoidStoredFunctorPointerCall2: public RunFunctionTask<T> +{ + inline VoidStoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2) + : function(_function), arg1(_arg1), arg2(_arg2) {} + void runFunctor() {(*function)(arg1, arg2); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> +struct SelectStoredFunctorPointerCall2 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorPointerCall2 <T, FunctionPointer, Arg1, Arg2>, + VoidStoredFunctorPointerCall2<T, FunctionPointer, Arg1, Arg2> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class StoredMemberFunctionCall2 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2); + Class object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class VoidStoredMemberFunctionCall2 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2); + Class object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +struct SelectStoredMemberFunctionCall2 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionCall2 <T, Class, Param1, Arg1, Param2, Arg2>, + VoidStoredMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class StoredConstMemberFunctionCall2 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2)const; + const Class object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class VoidStoredConstMemberFunctionCall2 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2)const; + const Class object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +struct SelectStoredConstMemberFunctionCall2 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionCall2 <T, Class, Param1, Arg1, Param2, Arg2>, + VoidStoredConstMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class StoredMemberFunctionPointerCall2 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2); + Class *object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class VoidStoredMemberFunctionPointerCall2 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2); + Class *object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +struct SelectStoredMemberFunctionPointerCall2 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionPointerCall2 <T, Class, Param1, Arg1, Param2, Arg2>, + VoidStoredMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class StoredConstMemberFunctionPointerCall2 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2)const; + Class const *object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +class VoidStoredConstMemberFunctionPointerCall2 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2); + } +private: + T (Class::*fn)(Param1, Param2)const; + Class const *object; + Arg1 arg1; Arg2 arg2; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2> +struct SelectStoredConstMemberFunctionPointerCall2 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionPointerCall2 <T, Class, Param1, Arg1, Param2, Arg2>, + VoidStoredConstMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct StoredFunctorCall3: public RunFunctionTask<T> +{ + inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} + void runFunctor() { this->result = function(arg1, arg2, arg3); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct VoidStoredFunctorCall3: public RunFunctionTask<T> +{ + inline VoidStoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} + void runFunctor() { function(arg1, arg2, arg3); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct SelectStoredFunctorCall3 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorCall3 <T, FunctionPointer, Arg1, Arg2, Arg3>, + VoidStoredFunctorCall3<T, FunctionPointer, Arg1, Arg2, Arg3> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct StoredFunctorPointerCall3: public RunFunctionTask<T> +{ + inline StoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} + void runFunctor() { this->result =(*function)(arg1, arg2, arg3); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct VoidStoredFunctorPointerCall3: public RunFunctionTask<T> +{ + inline VoidStoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} + void runFunctor() {(*function)(arg1, arg2, arg3); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct SelectStoredFunctorPointerCall3 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorPointerCall3 <T, FunctionPointer, Arg1, Arg2, Arg3>, + VoidStoredFunctorPointerCall3<T, FunctionPointer, Arg1, Arg2, Arg3> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class StoredMemberFunctionCall3 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3); + Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class VoidStoredMemberFunctionCall3 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3); + Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +struct SelectStoredMemberFunctionCall3 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionCall3 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>, + VoidStoredMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class StoredConstMemberFunctionCall3 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3)const; + const Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class VoidStoredConstMemberFunctionCall3 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3)const; + const Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +struct SelectStoredConstMemberFunctionCall3 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionCall3 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>, + VoidStoredConstMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class StoredMemberFunctionPointerCall3 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3); + Class *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class VoidStoredMemberFunctionPointerCall3 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3); + Class *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +struct SelectStoredMemberFunctionPointerCall3 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionPointerCall3 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>, + VoidStoredMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class StoredConstMemberFunctionPointerCall3 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3)const; + Class const *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +class VoidStoredConstMemberFunctionPointerCall3 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2, arg3); + } +private: + T (Class::*fn)(Param1, Param2, Param3)const; + Class const *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> +struct SelectStoredConstMemberFunctionPointerCall3 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionPointerCall3 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>, + VoidStoredConstMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct StoredFunctorCall4: public RunFunctionTask<T> +{ + inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} + void runFunctor() { this->result = function(arg1, arg2, arg3, arg4); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct VoidStoredFunctorCall4: public RunFunctionTask<T> +{ + inline VoidStoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} + void runFunctor() { function(arg1, arg2, arg3, arg4); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct SelectStoredFunctorCall4 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorCall4 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4>, + VoidStoredFunctorCall4<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct StoredFunctorPointerCall4: public RunFunctionTask<T> +{ + inline StoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} + void runFunctor() { this->result =(*function)(arg1, arg2, arg3, arg4); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct VoidStoredFunctorPointerCall4: public RunFunctionTask<T> +{ + inline VoidStoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} + void runFunctor() {(*function)(arg1, arg2, arg3, arg4); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct SelectStoredFunctorPointerCall4 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorPointerCall4 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4>, + VoidStoredFunctorPointerCall4<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class StoredMemberFunctionCall4 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4); + Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class VoidStoredMemberFunctionCall4 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4); + Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +struct SelectStoredMemberFunctionCall4 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionCall4 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>, + VoidStoredMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class StoredConstMemberFunctionCall4 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4)const; + const Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class VoidStoredConstMemberFunctionCall4 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4)const; + const Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +struct SelectStoredConstMemberFunctionCall4 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionCall4 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>, + VoidStoredConstMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class StoredMemberFunctionPointerCall4 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4); + Class *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class VoidStoredMemberFunctionPointerCall4 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4); + Class *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +struct SelectStoredMemberFunctionPointerCall4 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionPointerCall4 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>, + VoidStoredMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class StoredConstMemberFunctionPointerCall4 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4)const; + Class const *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +class VoidStoredConstMemberFunctionPointerCall4 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2, arg3, arg4); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4)const; + Class const *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> +struct SelectStoredConstMemberFunctionPointerCall4 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionPointerCall4 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>, + VoidStoredConstMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct StoredFunctorCall5: public RunFunctionTask<T> +{ + inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} + void runFunctor() { this->result = function(arg1, arg2, arg3, arg4, arg5); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct VoidStoredFunctorCall5: public RunFunctionTask<T> +{ + inline VoidStoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} + void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); } + FunctionPointer function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct SelectStoredFunctorCall5 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorCall5 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>, + VoidStoredFunctorCall5<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5> >::type type; +}; +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct StoredFunctorPointerCall5: public RunFunctionTask<T> +{ + inline StoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} + void runFunctor() { this->result =(*function)(arg1, arg2, arg3, arg4, arg5); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct VoidStoredFunctorPointerCall5: public RunFunctionTask<T> +{ + inline VoidStoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} + void runFunctor() {(*function)(arg1, arg2, arg3, arg4, arg5); } + FunctionPointer * function; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; + +template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct SelectStoredFunctorPointerCall5 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredFunctorPointerCall5 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>, + VoidStoredFunctorPointerCall5<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class StoredMemberFunctionCall5 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5); + Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class VoidStoredMemberFunctionCall5 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5); + Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +struct SelectStoredMemberFunctionCall5 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>, + VoidStoredMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class StoredConstMemberFunctionCall5 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const; + const Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class VoidStoredConstMemberFunctionCall5 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + (object.*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const; + const Class object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +struct SelectStoredConstMemberFunctionCall5 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>, + VoidStoredConstMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class StoredMemberFunctionPointerCall5 : public RunFunctionTask<T> +{ +public: + StoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5); + Class *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class VoidStoredMemberFunctionPointerCall5 : public RunFunctionTask<T> +{ +public: + VoidStoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5); + Class *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +struct SelectStoredMemberFunctionPointerCall5 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredMemberFunctionPointerCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>, + VoidStoredMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class StoredConstMemberFunctionPointerCall5 : public RunFunctionTask<T> +{ +public: + StoredConstMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const; + Class const *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +class VoidStoredConstMemberFunctionPointerCall5 : public RunFunctionTask<T> +{ +public: + VoidStoredConstMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } + + void runFunctor() + { + (object->*fn)(arg1, arg2, arg3, arg4, arg5); + } +private: + T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const; + Class const *object; + Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; +}; +template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> +struct SelectStoredConstMemberFunctionPointerCall5 +{ + typedef typename SelectSpecialization<T>::template + Type<StoredConstMemberFunctionPointerCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>, + VoidStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type; +}; +} //namespace QtConcurrent + +#endif // qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtconcurrentthreadengine.h b/qtinterface/qt4/Qt/qtconcurrentthreadengine.h new file mode 100644 index 0000000..e4d2e67 --- /dev/null +++ b/qtinterface/qt4/Qt/qtconcurrentthreadengine.h @@ -0,0 +1,285 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCONCURRENT_THREADENGINE_H +#define QTCONCURRENT_THREADENGINE_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_CONCURRENT + +#include <QtCore/qthreadpool.h> +#include <QtCore/qfuture.h> +#include <QtCore/qdebug.h> +#include <QtCore/qtconcurrentexception.h> +#include <QtCore/qwaitcondition.h> +#include <QtCore/qatomic.h> +#include <QtCore/qsemaphore.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef qdoc + +namespace QtConcurrent { + +// The ThreadEngineBarrier counts worker threads, and allows one +// thread to wait for all others to finish. Tested for its use in +// QtConcurrent, requires more testing for use as a general class. +class ThreadEngineBarrier +{ +private: + // The thread count is maintained as an integer in the count atomic + // variable. The count can be either positive or negative - a negative + // count signals that a thread is waiting on the barrier. + + // BC note: inlined code from Qt < 4.6 will expect to find the QMutex + // and QAtomicInt here. ### Qt 5: remove. + QMutex mutex; + QAtomicInt count; + + QSemaphore semaphore; +public: + ThreadEngineBarrier(); + void acquire(); + int release(); + void wait(); + int currentCount(); + bool releaseUnlessLast(); +}; + +enum ThreadFunctionResult { ThrottleThread, ThreadFinished }; + +// The ThreadEngine controls the threads used in the computation. +// Can be run in three modes: single threaded, multi-threaded blocking +// and multi-threaded asynchronous. +// The code for the single threaded mode is +class Q_CORE_EXPORT ThreadEngineBase: public QRunnable +{ +public: + // Public API: + ThreadEngineBase(); + virtual ~ThreadEngineBase(); + void startSingleThreaded(); + void startBlocking(); + void startThread(); + bool isCanceled(); + void waitForResume(); + bool isProgressReportingEnabled(); + void setProgressValue(int progress); + void setProgressRange(int minimum, int maximum); + void acquireBarrierSemaphore(); + +protected: // The user overrides these: + virtual void start() {} + virtual void finish() {} + virtual ThreadFunctionResult threadFunction() { return ThreadFinished; } + virtual bool shouldStartThread() { return futureInterface ? !futureInterface->isPaused() : true; } + virtual bool shouldThrottleThread() { return futureInterface ? futureInterface->isPaused() : false; } +private: + bool startThreadInternal(); + void startThreads(); + void threadExit(); + bool threadThrottleExit(); + void run(); + virtual void asynchronousFinish() = 0; +#ifndef QT_NO_EXCEPTIONS + void handleException(const QtConcurrent::Exception &exception); +#endif +protected: + QFutureInterfaceBase *futureInterface; + QThreadPool *threadPool; + ThreadEngineBarrier barrier; + QtConcurrent::internal::ExceptionStore exceptionStore; +}; + + +template <typename T> +class ThreadEngine : public virtual ThreadEngineBase +{ +public: + typedef T ResultType; + + virtual T *result() { return 0; } + + QFutureInterface<T> *futureInterfaceTyped() + { + return static_cast<QFutureInterface<T> *>(futureInterface); + } + + // Runs the user algorithm using a single thread. + T *startSingleThreaded() + { + ThreadEngineBase::startSingleThreaded(); + return result(); + } + + // Runs the user algorithm using multiple threads. + // This function blocks until the algorithm is finished, + // and then returns the result. + T *startBlocking() + { + ThreadEngineBase::startBlocking(); + return result(); + } + + // Runs the user algorithm using multiple threads. + // Does not block, returns a future. + QFuture<T> startAsynchronously() + { + futureInterface = new QFutureInterface<T>(); + + // reportStart() must be called before starting threads, otherwise the + // user algorithm might finish while reportStart() is running, which + // is very bad. + futureInterface->reportStarted(); + QFuture<T> future = QFuture<T>(futureInterfaceTyped()); + start(); + + acquireBarrierSemaphore(); + threadPool->start(this); + return future; + } + + void asynchronousFinish() + { + finish(); + futureInterfaceTyped()->reportFinished(result()); + delete futureInterfaceTyped(); + delete this; + } + + + void reportResult(const T *_result, int index = -1) + { + if (futureInterface) + futureInterfaceTyped()->reportResult(_result, index); + } + + void reportResults(const QVector<T> &_result, int index = -1, int count = -1) + { + if (futureInterface) + futureInterfaceTyped()->reportResults(_result, index, count); + } +}; + +// The ThreadEngineStarter class ecapsulates the return type +// from the thread engine. +// Depending on how the it is used, it will run +// the engine in either blocking mode or asynchronous mode. +template <typename T> +class ThreadEngineStarterBase +{ +public: + ThreadEngineStarterBase(ThreadEngine<T> *_threadEngine) + : threadEngine(_threadEngine) { } + + inline ThreadEngineStarterBase(const ThreadEngineStarterBase &other) + : threadEngine(other.threadEngine) { } + + QFuture<T> startAsynchronously() + { + return threadEngine->startAsynchronously(); + } + + operator QFuture<T>() + { + return startAsynchronously(); + } + +protected: + ThreadEngine<T> *threadEngine; +}; + + +// We need to factor out the code that dereferences the T pointer, +// with a specialization where T is void. (code that dereferences a void * +// won't compile) +template <typename T> +class ThreadEngineStarter : public ThreadEngineStarterBase<T> +{ + typedef ThreadEngineStarterBase<T> Base; + typedef ThreadEngine<T> TypedThreadEngine; +public: + ThreadEngineStarter(TypedThreadEngine *eng) + : Base(eng) { } + + T startBlocking() + { + T t = *this->threadEngine->startBlocking(); + delete this->threadEngine; + return t; + } +}; + +// Full template specialization where T is void. +template <> +class ThreadEngineStarter<void> : public ThreadEngineStarterBase<void> +{ +public: + ThreadEngineStarter<void>(ThreadEngine<void> *_threadEngine) + :ThreadEngineStarterBase<void>(_threadEngine) {} + + void startBlocking() + { + this->threadEngine->startBlocking(); + delete this->threadEngine; + } +}; + +template <typename ThreadEngine> +inline ThreadEngineStarter<typename ThreadEngine::ResultType> startThreadEngine(ThreadEngine *threadEngine) +{ + return ThreadEngineStarter<typename ThreadEngine::ResultType>(threadEngine); +} + +} // namespace QtConcurrent + +#endif //qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif diff --git a/qtinterface/qt4/Qt/qtcpserver.h b/qtinterface/qt4/Qt/qtcpserver.h new file mode 100644 index 0000000..d36b42a --- /dev/null +++ b/qtinterface/qt4/Qt/qtcpserver.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCPSERVER_H +#define QTCPSERVER_H + +#include <QtCore/qobject.h> +#include <QtNetwork/qabstractsocket.h> +#include <QtNetwork/qhostaddress.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QTcpServerPrivate; +#ifndef QT_NO_NETWORKPROXY +class QNetworkProxy; +#endif +class QTcpSocket; + +class Q_NETWORK_EXPORT QTcpServer : public QObject +{ + Q_OBJECT +public: + explicit QTcpServer(QObject *parent = 0); + virtual ~QTcpServer(); + + bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); + void close(); + + bool isListening() const; + + void setMaxPendingConnections(int numConnections); + int maxPendingConnections() const; + + quint16 serverPort() const; + QHostAddress serverAddress() const; + + int socketDescriptor() const; + bool setSocketDescriptor(int socketDescriptor); + + bool waitForNewConnection(int msec = 0, bool *timedOut = 0); + virtual bool hasPendingConnections() const; + virtual QTcpSocket *nextPendingConnection(); + + QAbstractSocket::SocketError serverError() const; + QString errorString() const; + +#ifndef QT_NO_NETWORKPROXY + void setProxy(const QNetworkProxy &networkProxy); + QNetworkProxy proxy() const; +#endif + +protected: + virtual void incomingConnection(int handle); + +Q_SIGNALS: + void newConnection(); + +private: + Q_DISABLE_COPY(QTcpServer) + Q_DECLARE_PRIVATE(QTcpServer) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTCPSERVER_H diff --git a/qtinterface/qt4/Qt/qtcpsocket.h b/qtinterface/qt4/Qt/qtcpsocket.h new file mode 100644 index 0000000..2747a37 --- /dev/null +++ b/qtinterface/qt4/Qt/qtcpsocket.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCPSOCKET_H +#define QTCPSOCKET_H + +#include <QtNetwork/qabstractsocket.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +class QTcpSocketPrivate; + +class Q_NETWORK_EXPORT QTcpSocket : public QAbstractSocket +{ + Q_OBJECT +public: + explicit QTcpSocket(QObject *parent = 0); + virtual ~QTcpSocket(); + +protected: + QTcpSocket(QTcpSocketPrivate &dd, QObject *parent = 0); + +private: + Q_DISABLE_COPY(QTcpSocket) + Q_DECLARE_PRIVATE(QTcpSocket) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTCPSOCKET_H diff --git a/qtinterface/qt4/Qt/qtemporaryfile.h b/qtinterface/qt4/Qt/qtemporaryfile.h new file mode 100644 index 0000000..ac652a5 --- /dev/null +++ b/qtinterface/qt4/Qt/qtemporaryfile.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEMPORARYFILE_H +#define QTEMPORARYFILE_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qfile.h> + +#ifdef open +#error qtemporaryfile.h must be included before any header file that defines open +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_TEMPORARYFILE + +class QTemporaryFilePrivate; + +class Q_CORE_EXPORT QTemporaryFile : public QFile +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + Q_DECLARE_PRIVATE(QTemporaryFile) + +public: + QTemporaryFile(); + explicit QTemporaryFile(const QString &templateName); +#ifndef QT_NO_QOBJECT + explicit QTemporaryFile(QObject *parent); + QTemporaryFile(const QString &templateName, QObject *parent); +#endif + ~QTemporaryFile(); + + bool autoRemove() const; + void setAutoRemove(bool b); + + // ### Hides open(flags) + bool open() { return open(QIODevice::ReadWrite); } + + QString fileName() const; + QString fileTemplate() const; + void setFileTemplate(const QString &name); + + inline static QTemporaryFile *createLocalFile(const QString &fileName) + { QFile file(fileName); return createLocalFile(file); } + static QTemporaryFile *createLocalFile(QFile &file); + + virtual QAbstractFileEngine *fileEngine() const; + +protected: + bool open(OpenMode flags); + +private: + friend class QFile; + Q_DISABLE_COPY(QTemporaryFile) +}; + +#endif // QT_NO_TEMPORARYFILE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEMPORARYFILE_H diff --git a/qtinterface/qt4/Qt/qtest.h b/qtinterface/qt4/Qt/qtest.h new file mode 100644 index 0000000..e1ce276 --- /dev/null +++ b/qtinterface/qt4/Qt/qtest.h @@ -0,0 +1,283 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEST_H +#define QTEST_H + +#include <QtTest/qtest_global.h> +#include <QtTest/qtestcase.h> +#include <QtTest/qtestdata.h> +#include <QtTest/qtestdata.h> +#include <QtTest/qbenchmark.h> + +#include <QtCore/qbytearray.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qdatetime.h> +#include <QtCore/qobject.h> +#include <QtCore/qvariant.h> +#include <QtCore/qurl.h> + +#include <QtCore/qpoint.h> +#include <QtCore/qsize.h> +#include <QtCore/qrect.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +namespace QTest +{ + +template<> inline char *toString(const QLatin1String &str) +{ + return qstrdup(str.latin1()); +} + +template<> inline char *toString(const QString &str) +{ + return qstrdup(str.toLatin1().constData()); +} + +template<> inline char *toString(const QByteArray &ba) +{ + return QTest::toHexRepresentation(ba.constData(), ba.length()); +} + +template<> inline char *toString(const QTime &time) +{ + return time.isValid() + ? qstrdup(time.toString(QLatin1String("hh:mm:ss.zzz")).toLatin1().constData()) + : qstrdup("Invalid QTime"); +} + +template<> inline char *toString(const QDate &date) +{ + return date.isValid() + ? qstrdup(date.toString(QLatin1String("yyyy/MM/dd")).toLatin1().constData()) + : qstrdup("Invalid QDate"); +} + +template<> inline char *toString(const QDateTime &dateTime) +{ + return dateTime.isValid() + ? qstrdup((dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) + + (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))).toLatin1().constData()) + : qstrdup("Invalid QDateTime"); +} + +template<> inline char *toString(const QChar &c) +{ + return qstrdup(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16)).toLatin1().constData()); +} + +template<> inline char *toString(const QPoint &p) +{ + return qstrdup(QString::fromLatin1("QPoint(%1,%2)").arg(p.x()).arg(p.y()).toLatin1().constData()); +} + +template<> inline char *toString(const QSize &s) +{ + return qstrdup(QString::fromLatin1("QSize(%1x%2)").arg(s.width()).arg(s.height()).toLatin1().constData()); +} + +template<> inline char *toString(const QRect &s) +{ + return qstrdup(QString::fromLatin1("QRect(%1,%2 %5x%6) (bottomright %3,%4)").arg(s.left()).arg(s.top()).arg(s.right()).arg(s.bottom()).arg(s.width()).arg(s.height()).toLatin1().constData()); +} + +template<> inline char *toString(const QPointF &p) +{ + return qstrdup(QString::fromLatin1("QPointF(%1,%2)").arg(p.x()).arg(p.y()).toLatin1().constData()); +} + +template<> inline char *toString(const QSizeF &s) +{ + return qstrdup(QString::fromLatin1("QSizeF(%1x%2)").arg(s.width()).arg(s.height()).toLatin1().constData()); +} + +template<> inline char *toString(const QRectF &s) +{ + return qstrdup(QString::fromLatin1("QRectF(%1,%2 %5x%6) (bottomright %3,%4)").arg(s.left()).arg(s.top()).arg(s.right()).arg(s.bottom()).arg(s.width()).arg(s.height()).toLatin1().constData()); +} + +template<> inline char *toString(const QUrl &uri) +{ + return qstrdup(uri.toEncoded().constData()); +} + +template<> inline char *toString(const QVariant &v) +{ + QByteArray vstring("QVariant("); + if (v.isValid()) { + QByteArray type(v.typeName()); + if (type.isEmpty()) { + type = QByteArray::number(v.userType()); + } + vstring.append(type); + if (!v.isNull()) { + vstring.append(','); + if (v.canConvert(QVariant::String)) { + vstring.append(qVariantValue<QString>(v).toLatin1()); + } + else { + vstring.append("<value not representable as string>"); + } + } + } + vstring.append(')'); + + return qstrdup(vstring.constData()); +} + +#ifndef QTEST_NO_SPECIALIZATIONS +template<> +#endif +inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual, + const char *expected, const char *file, int line) +{ + return qCompare<QString>(t1, QString(t2), actual, expected, file, line); +} +#ifndef QTEST_NO_SPECIALIZATIONS +template<> +#endif +inline bool qCompare(QLatin1String const &t1, QString const &t2, const char *actual, + const char *expected, const char *file, int line) +{ + return qCompare<QString>(QString(t1), t2, actual, expected, file, line); +} + +template<> +inline bool qCompare(QStringList const &t1, QStringList const &t2, + const char *actual, const char *expected, const char *file, int line) +{ + 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()); + isOk = false; + } + const int min = qMin(t1.count(), t2.count()); + for (int i = 0; isOk && i < min; ++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()); + isOk = false; + } + } + return compare_helper(isOk, msg, file, line); +} + +template <typename T> +inline bool qCompare(QFlags<T> const &t1, T const &t2, const char *actual, const char *expected, + const char *file, int line) +{ + return qCompare(int(t1), int(t2), actual, expected, file, line); +} + +template <typename T> +inline bool qCompare(QFlags<T> const &t1, int const &t2, const char *actual, const char *expected, + const char *file, int line) +{ + return qCompare(int(t1), t2, actual, expected, file, line); +} + +} +QT_END_NAMESPACE + +#define QTEST_APPLESS_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + TestObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} + +#define QTEST_NOOP_MAIN \ +int main(int argc, char *argv[]) \ +{ \ + QObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} + +#include <QtTest/qtestsystem.h> + +#ifdef QT_GUI_LIB + +#include <QtTest/qtest_gui.h> + +#ifdef QT_KEYPAD_NAVIGATION +# define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeNone); +#else +# define QTEST_DISABLE_KEYPAD_NAVIGATION +#endif + +#define QTEST_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + QApplication app(argc, argv); \ + QTEST_DISABLE_KEYPAD_NAVIGATION \ + TestObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} + +#else + +#define QTEST_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + QCoreApplication app(argc, argv); \ + TestObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} + +#endif // QT_GUI_LIB + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtest_global.h b/qtinterface/qt4/Qt/qtest_global.h new file mode 100644 index 0000000..d8962a8 --- /dev/null +++ b/qtinterface/qt4/Qt/qtest_global.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEST_GLOBAL_H +#define QTEST_GLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +#ifdef QTEST_EMBED +# define Q_TESTLIB_EXPORT +#elif !defined(QT_SHARED) && !(defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) +# define Q_TESTLIB_EXPORT +#else +# ifdef QTESTLIB_MAKEDLL +# define Q_TESTLIB_EXPORT Q_DECL_EXPORT +# else +# define Q_TESTLIB_EXPORT Q_DECL_IMPORT +# endif +#endif + +#if (defined (Q_CC_MSVC) && _MSC_VER < 1310) || defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) || defined (Q_CC_NOKIAX86) +# define QTEST_NO_SPECIALIZATIONS +#endif + + +#if (defined Q_CC_HPACC) && (defined __ia64) +# ifdef Q_TESTLIB_EXPORT +# undef Q_TESTLIB_EXPORT +# endif +# define Q_TESTLIB_EXPORT +#endif + +#define QTEST_VERSION QT_VERSION +#define QTEST_VERSION_STR QT_VERSION_STR + +namespace QTest +{ + enum SkipMode { SkipSingle = 1, SkipAll = 2 }; + enum TestFailMode { Abort = 1, Continue = 2 }; + + int Q_TESTLIB_EXPORT qt_snprintf(char *str, int size, const char *format, ...); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtest_gui.h b/qtinterface/qt4/Qt/qtest_gui.h new file mode 100644 index 0000000..94df0b0 --- /dev/null +++ b/qtinterface/qt4/Qt/qtest_gui.h @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEST_GUI_H +#define QTEST_GUI_H + +// enable GUI features +#ifndef QT_GUI_LIB +#define QT_GUI_LIB +#endif +#if 0 +#pragma qt_class(QtTestGui) +#endif + +#include <QtTest/qtestassert.h> +#include <QtTest/qtest.h> +#include <QtTest/qtestevent.h> +#include <QtTest/qtestmouse.h> +#include <QtTest/qtesttouch.h> +#include <QtTest/qtestkeyboard.h> + +#include <QtGui/qicon.h> +#include <QtGui/qpixmap.h> + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +namespace QTest +{ + +template<> +inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, + const char *file, int line) +{ + QTEST_ASSERT(sizeof(QIcon) == sizeof(void *)); + return qCompare<void *>(*reinterpret_cast<void * const *>(&t1), + *reinterpret_cast<void * const *>(&t2), actual, expected, file, line); +} + +template<> +inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected, + const char *file, int 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 + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestaccessible.h b/qtinterface/qt4/Qt/qtestaccessible.h new file mode 100644 index 0000000..e9ad6fb --- /dev/null +++ b/qtinterface/qt4/Qt/qtestaccessible.h @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTACCESSIBLE_H +#define QTESTACCESSIBLE_H + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +#ifndef QT_NO_ACCESSIBILITY + +#define QTEST_ACCESSIBILITY + +#define QVERIFY_EVENT(object, child, event) \ + QVERIFY(QTestAccessibility::verifyEvent(object, child, (int)event)) + +#include <QtCore/qlist.h> +#include <QtGui/qaccessible.h> +#include <QtGui/qapplication.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QObject; + +struct QTestAccessibilityEvent +{ + QTestAccessibilityEvent(QObject* o = 0, int c = 0, int e = 0) + : object(o), child(c), event(e) {} + + bool operator==(const QTestAccessibilityEvent &o) const + { + return o.object == object && o.child == child && o.event == event; + } + + QObject* object; + int child; + int event; +}; + +typedef QList<QTestAccessibilityEvent> EventList; + +class QTestAccessibility +{ +public: + static void initialize() + { + if (!instance()) { + instance() = new QTestAccessibility; + qAddPostRoutine(cleanup); + } + } + static void cleanup() + { + delete instance(); + instance() = 0; + } + static void clearEvents() { eventList().clear(); } + static EventList events() { return eventList(); } + static bool verifyEvent(const QTestAccessibilityEvent& ev) + { + if (eventList().isEmpty()) + return FALSE; + return eventList().takeFirst() == ev; + } + + static bool verifyEvent(QObject *o, int c, int e) + { + return verifyEvent(QTestAccessibilityEvent(o, c, e)); + } + +private: + QTestAccessibility() + { + QAccessible::installUpdateHandler(updateHandler); + QAccessible::installRootObjectHandler(rootObjectHandler); + } + + ~QTestAccessibility() + { + QAccessible::installUpdateHandler(0); + QAccessible::installRootObjectHandler(0); + } + + static void rootObjectHandler(QObject *object) + { + // qDebug("rootObjectHandler called %p", object); + if (object) { + QApplication* app = qobject_cast<QApplication*>(object); + if ( !app ) + qWarning("QTEST_ACCESSIBILITY: root Object is not a QApplication!"); + } else { + qWarning("QTEST_ACCESSIBILITY: root Object called with 0 pointer"); + } + } + + static void updateHandler(QObject *o, int c, QAccessible::Event e) + { + // qDebug("updateHandler called: %p %d %d", o, c, (int)e); + eventList().append(QTestAccessibilityEvent(o, c, (int)e)); + } + + static EventList &eventList() + { + static EventList list; + return list; + } + + static QTestAccessibility *&instance() + { + static QTestAccessibility *ta = 0; + return ta; + } +}; + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestassert.h b/qtinterface/qt4/Qt/qtestassert.h new file mode 100644 index 0000000..b5c3be3 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestassert.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTASSERT_H +#define QTESTASSERT_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +#define QTEST_ASSERT(cond) do {if(!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0) + +#define QTEST_ASSERT_X(cond, where, what) do {if(!(cond))qt_assert_x(where, what,__FILE__,__LINE__);} while (0) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestbasicstreamer.h b/qtinterface/qt4/Qt/qtestbasicstreamer.h new file mode 100644 index 0000000..538f39f --- /dev/null +++ b/qtinterface/qt4/Qt/qtestbasicstreamer.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTBASICSTREAMER_H +#define QTESTBASICSTREAMER_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestElement; +class QTestElementAttribute; +class QTestLogger; +struct QTestCharBuffer; + +class QTestBasicStreamer +{ + public: + QTestBasicStreamer(); + virtual ~QTestBasicStreamer(); + + virtual void output(QTestElement *element) const; + + void outputString(const char *msg) const; + bool isTtyOutput(); + void startStreaming(); + void stopStreaming(); + + void setLogger(const QTestLogger *tstLogger); + const QTestLogger *logger() const; + + protected: + virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const; + virtual void outputElements(QTestElement *element, bool isChildElement = false) const; + virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const; + + private: + const QTestLogger *testLogger; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestcase.h b/qtinterface/qt4/Qt/qtestcase.h new file mode 100644 index 0000000..dc6af07 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestcase.h @@ -0,0 +1,375 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTCASE_H +#define QTESTCASE_H + +#include <QtTest/qtest_global.h> + +#include <QtCore/qnamespace.h> +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +#define QVERIFY(statement) \ +do {\ + if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ + return;\ +} while (0) + +#define QFAIL(message) \ +do {\ + QTest::qFail(message, __FILE__, __LINE__);\ + return;\ +} while (0) + +#define QVERIFY2(statement, description) \ +do {\ + if (statement) {\ + if (!QTest::qVerify(true, #statement, (description), __FILE__, __LINE__))\ + return;\ + } else {\ + if (!QTest::qVerify(false, #statement, (description), __FILE__, __LINE__))\ + return;\ + }\ +} while (0) + +#define QCOMPARE(actual, expected) \ +do {\ + if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ + return;\ +} while (0) + +#define QSKIP(statement, mode) \ +do {\ + QTest::qSkip(statement, QTest::mode, __FILE__, __LINE__);\ + return;\ +} while (0) + +#define QEXPECT_FAIL(dataIndex, comment, mode)\ +do {\ + if (!QTest::qExpectFail(dataIndex, comment, QTest::mode, __FILE__, __LINE__))\ + return;\ +} while (0) + +#define QFETCH(type, name)\ + type name = *static_cast<type *>(QTest::qData(#name, ::qMetaTypeId<type >())) + +#define QFETCH_GLOBAL(type, name)\ + type name = *static_cast<type *>(QTest::qGlobalData(#name, ::qMetaTypeId<type >())) + +#define DEPENDS_ON(funcName) + +#define QTEST(actual, testElement)\ +do {\ + if (!QTest::qTest(actual, testElement, #actual, #testElement, __FILE__, __LINE__))\ + return;\ +} while (0) + +#define QWARN(msg)\ + QTest::qWarn(msg) + +class QObject; +class QTestData; + +#define QTEST_COMPARE_DECL(KLASS)\ + template<> Q_TESTLIB_EXPORT char *toString<KLASS >(const KLASS &); + +namespace QTest +{ + template <typename T> + inline char *toString(const T &) + { + return 0; + } + + + Q_TESTLIB_EXPORT char *toHexRepresentation(const char *ba, int length); + Q_TESTLIB_EXPORT char *toString(const char *); + 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); + Q_TESTLIB_EXPORT void qFail(const char *statementStr, const char *file, int line); + Q_TESTLIB_EXPORT void qSkip(const char *message, SkipMode mode, const char *file, int line); + Q_TESTLIB_EXPORT bool qExpectFail(const char *dataIndex, const char *comment, TestFailMode mode, + const char *file, int line); + Q_TESTLIB_EXPORT void qWarn(const char *message); + Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message); + + Q_TESTLIB_EXPORT void *qData(const char *tagName, int typeId); + Q_TESTLIB_EXPORT void *qGlobalData(const char *tagName, int typeId); + Q_TESTLIB_EXPORT void *qElementData(const char *elementName, int metaTypeId); + Q_TESTLIB_EXPORT QObject *testObject(); + + Q_TESTLIB_EXPORT const char *currentTestFunction(); + Q_TESTLIB_EXPORT const char *currentDataTag(); + Q_TESTLIB_EXPORT bool currentTestFailed(); + + Q_TESTLIB_EXPORT Qt::Key asciiToKey(char ascii); + Q_TESTLIB_EXPORT char keyToAscii(Qt::Key key); + + 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 *file, int line); + Q_TESTLIB_EXPORT void qSleep(int ms); + Q_TESTLIB_EXPORT void addColumnInternal(int id, const char *name); + + template <typename T> + inline void addColumn(const char *name, T * = 0) + { + addColumnInternal(qMetaTypeId<T>(), name); + } + Q_TESTLIB_EXPORT QTestData &newRow(const char *dataTag); + + template <typename T> + inline bool qCompare(T const &t1, T const &t2, const char *actual, const char *expected, + const char *file, int line) + { + return (t1 == t2) + ? compare_helper(true, "COMPARE()", file, line) + : compare_helper(false, "Compared values are not the same", + toString<T>(t1), toString<T>(t2), actual, expected, file, line); + } + + + template <> + Q_TESTLIB_EXPORT bool qCompare<float>(float const &t1, float const &t2, + const char *actual, const char *expected, const char *file, int line); + + template <> + Q_TESTLIB_EXPORT bool qCompare<double>(double const &t1, double const &t2, + const char *actual, const char *expected, const char *file, int line); + + inline bool compare_ptr_helper(const void *t1, const void *t2, const char *actual, + const char *expected, const char *file, int line) + { + return (t1 == t2) + ? compare_helper(true, "COMPARE()", file, line) + : compare_helper(false, "Compared pointers are not the same", + toString(t1), toString(t2), actual, expected, file, line); + } + + Q_TESTLIB_EXPORT bool compare_string_helper(const char *t1, const char *t2, const char *actual, + const char *expected, const char *file, int line); + +#ifndef qdoc + QTEST_COMPARE_DECL(short) + QTEST_COMPARE_DECL(ushort) + QTEST_COMPARE_DECL(int) + QTEST_COMPARE_DECL(uint) + QTEST_COMPARE_DECL(long) + QTEST_COMPARE_DECL(ulong) + QTEST_COMPARE_DECL(qint64) + QTEST_COMPARE_DECL(quint64) + + QTEST_COMPARE_DECL(float) + QTEST_COMPARE_DECL(double) + QTEST_COMPARE_DECL(char) + QTEST_COMPARE_DECL(bool) +#endif + +#ifndef QTEST_NO_SPECIALIZATIONS + template <typename T1, typename T2> + bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int); + +#if defined(QT_COORD_TYPE) && (defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE)) + template <> + inline bool qCompare<qreal, float>(qreal const &t1, float const &t2, const char *actual, + const char *expected, const char *file, int line) + { + return qCompare<qreal>(t1, qreal(t2), actual, expected, file, line); + } + + template <> + inline bool qCompare<float, qreal>(float const &t1, qreal const &t2, const char *actual, + const char *expected, const char *file, int line) + { + return qCompare<qreal>(qreal(t1), t2, actual, expected, file, line); + } + +#elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) + template <> + inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual, + const char *expected, const char *file, int line) + { + return qCompare<float>(float(t1), float(t2), actual, expected, file, line); + } + + template <> + inline bool qCompare<double, qreal>(double const &t1, qreal const &t2, const char *actual, + const char *expected, const char *file, int line) + { + return qCompare<float>(float(t1), float(t2), actual, expected, file, line); + } + +#endif + + template <typename T> + inline bool qCompare(const T *t1, const T *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_ptr_helper(t1, t2, actual, expected, file, line); + } + template <typename T> + inline bool qCompare(T *t1, T *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_ptr_helper(t1, t2, actual, expected, file, line); + } + + template <typename T1, typename T2> + inline bool qCompare(const T1 *t1, const T2 *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_ptr_helper(t1, static_cast<const T1 *>(t2), actual, expected, file, line); + } + template <typename T1, typename T2> + inline bool qCompare(T1 *t1, T2 *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_ptr_helper(const_cast<const T1 *>(t1), + static_cast<const T1 *>(const_cast<const T2 *>(t2)), actual, expected, file, line); + } + template<> + inline bool qCompare<char>(const char *t1, const char *t2, const char *actual, + const char *expected, const char *file, int line) + { + return compare_string_helper(t1, t2, actual, expected, file, line); + } + template<> + inline bool qCompare<char>(char *t1, char *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_string_helper(t1, t2, actual, expected, file, line); + } +#else /* QTEST_NO_SPECIALIZATIONS */ + +// In Symbian we have QTEST_NO_SPECIALIZATIONS defined, but still float related specialization +// should be used. If QTEST_NO_SPECIALIZATIONS is enabled we get ambiguous overload errors. +#if defined(QT_ARCH_SYMBIAN) + template <typename T1, typename T2> + bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int); + + template <> + inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual, + const char *expected, const char *file, int line) + { + return qCompare<float>(float(t1), float(t2), actual, expected, file, line); + } + + template <> + inline bool qCompare<double, qreal>(double const &t1, qreal const &t2, const char *actual, + const char *expected, const char *file, int line) + { + return qCompare<float>(float(t1), float(t2), actual, expected, file, line); + } +#endif + + inline bool qCompare(const char *t1, const char *t2, const char *actual, + const char *expected, const char *file, int line) + { + return compare_string_helper(t1, t2, actual, expected, file, line); + } + + inline bool qCompare(char *t1, char *t2, const char *actual, const char *expected, + const char *file, int line) + { + return compare_string_helper(t1, t2, actual, expected, file, line); + } +#endif + + /* The next two specializations are for MSVC that shows problems with implicit + conversions + */ +#ifndef QTEST_NO_SPECIALIZATIONS + template<> +#endif + inline bool qCompare(char *t1, const char *t2, const char *actual, + const char *expected, const char *file, int line) + { + return compare_string_helper(t1, t2, actual, expected, file, line); + } +#ifndef QTEST_NO_SPECIALIZATIONS + template<> +#endif + inline bool qCompare(const char *t1, char *t2, const char *actual, + const char *expected, const char *file, int line) + { + return compare_string_helper(t1, t2, actual, expected, file, line); + } + + // NokiaX86 and RVCT do not like implicitly comparing bool with int +#ifndef QTEST_NO_SPECIALIZATIONS + template <> +#endif + inline bool qCompare(bool const &t1, int const &t2, + const char *actual, const char *expected, const char *file, int line) + { + return qCompare<int>(int(t1), t2, actual, expected, file, line); + } + + + template <class T> + inline bool qTest(const T& actual, const char *elementName, const char *actualStr, + const char *expected, const char *file, int line) + { + return qCompare(actual, *static_cast<const T *>(QTest::qElementData(elementName, + qMetaTypeId<T>())), actualStr, expected, file, line); + } +} + +#undef QTEST_COMPARE_DECL + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestcoreelement.h b/qtinterface/qt4/Qt/qtestcoreelement.h new file mode 100644 index 0000000..d9e74f3 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestcoreelement.h @@ -0,0 +1,172 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTCOREELEMENT_H +#define QTESTCOREELEMENT_H + +#include <QtTest/qtestcorelist.h> +#include <QtTest/qtestelementattribute.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +template <class ElementType> +class QTestCoreElement: public QTestCoreList<ElementType> +{ + public: + QTestCoreElement( int type = -1 ); + virtual ~QTestCoreElement(); + + void addAttribute(const QTest::AttributeIndex index, const char *value); + QTestElementAttribute *attributes() const; + const char *attributeValue(QTest::AttributeIndex index) const; + const char *attributeName(QTest::AttributeIndex index) const; + const QTestElementAttribute *attribute(QTest::AttributeIndex index) const; + + const char *elementName() const; + QTest::LogElementType elementType() const; + + private: + QTestElementAttribute *listOfAttributes; + QTest::LogElementType type; +}; + +template<class ElementType> +QTestCoreElement<ElementType>::QTestCoreElement(int t) + :listOfAttributes(0), type(QTest::LogElementType(t)) +{ +} + +template<class ElementType> +QTestCoreElement<ElementType>::~QTestCoreElement() +{ + delete listOfAttributes; +} + +template <class ElementType> +void QTestCoreElement<ElementType>::addAttribute(const QTest::AttributeIndex attributeIndex, const char *value) +{ + if(attributeIndex == -1) + return; + + if (attribute(attributeIndex)) + return; + + QTestElementAttribute *testAttribute = new QTestElementAttribute; + testAttribute->setPair(attributeIndex, value); + testAttribute->addToList(&listOfAttributes); +} + +template <class ElementType> +QTestElementAttribute *QTestCoreElement<ElementType>::attributes() const +{ + return listOfAttributes; +} + +template <class ElementType> +const char *QTestCoreElement<ElementType>::attributeValue(QTest::AttributeIndex index) const +{ + const QTestElementAttribute *attrb = attribute(index); + if(attrb) + return attrb->value(); + + return 0; +} + +template <class ElementType> +const char *QTestCoreElement<ElementType>::attributeName(QTest::AttributeIndex index) const +{ + const QTestElementAttribute *attrb = attribute(index); + if(attrb) + return attrb->name(); + + return 0; +} + +template <class ElementType> +const char *QTestCoreElement<ElementType>::elementName() const +{ + const char *xmlElementNames[] = + { + "property", + "properties", + "failure", + "error", + "testcase", + "testsuite", + "benchmark", + "system-err" + }; + + if(type != QTest::LET_Undefined) + return xmlElementNames[type]; + + return 0; +} + +template <class ElementType> +QTest::LogElementType QTestCoreElement<ElementType>::elementType() const +{ + return type; +} + +template <class ElementType> +const QTestElementAttribute *QTestCoreElement<ElementType>::attribute(QTest::AttributeIndex index) const +{ + QTestElementAttribute *iterator = listOfAttributes; + while(iterator){ + if(iterator->index() == index) + return iterator; + + iterator = iterator->nextElement(); + } + + return 0; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestcorelist.h b/qtinterface/qt4/Qt/qtestcorelist.h new file mode 100644 index 0000000..3ddc989 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestcorelist.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTCORELIST_H +#define QTESTCORELIST_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +template <class T> +class QTestCoreList +{ + public: + QTestCoreList(); + virtual ~QTestCoreList(); + + void addToList(T **list); + T *nextElement(); + T *previousElement(); + int count(T *list); + int count(); + + private: + T *next; + T *prev; +}; + +template <class T> +QTestCoreList<T>::QTestCoreList() +:next(0) +,prev(0) +{ +} + +template <class T> +QTestCoreList<T>::~QTestCoreList() +{ + if (prev) { + prev->next = 0; + } + delete prev; + + if (next) { + next->prev = 0; + } + delete next; +} + +template <class T> +void QTestCoreList<T>::addToList(T **list) +{ + if (next) + next->addToList(list); + else { + next = *list; + if (next) + next->prev = static_cast<T*>(this); + } + + *list = static_cast<T*>(this); +} + +template <class T> +T *QTestCoreList<T>::nextElement() +{ + return next; +} + +template <class T> +T *QTestCoreList<T>::previousElement() +{ + return prev; +} + +template <class T> +int QTestCoreList<T>::count() +{ + int numOfElements = 0; + T *it = next; + + while(it){ + ++numOfElements; + it = it->nextElement(); + } + + return numOfElements; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestdata.h b/qtinterface/qt4/Qt/qtestdata.h new file mode 100644 index 0000000..fa8972f --- /dev/null +++ b/qtinterface/qt4/Qt/qtestdata.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTDATA_H +#define QTESTDATA_H + +#include <QtTest/qtest_global.h> + +#include <QtCore/qmetatype.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestTable; +class QTestDataPrivate; + +class Q_TESTLIB_EXPORT QTestData +{ +public: + ~QTestData(); + + void append(int type, const void *data); + void *data(int index) const; + const char *dataTag() const; + QTestTable *parent() const; + int dataCount() const; + +private: + friend class QTestTable; + QTestData(const char *tag = 0, QTestTable *parent = 0); + + Q_DISABLE_COPY(QTestData) + + QTestDataPrivate *d; +}; + +template<typename T> +QTestData &operator<<(QTestData &data, const T &value) +{ + data.append(qMetaTypeId<T>(), &value); + return data; +} + +inline QTestData &operator<<(QTestData &data, const char * value) +{ + QString str = QString::fromAscii(value); + data.append(QMetaType::QString, &str); + return data; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestelement.h b/qtinterface/qt4/Qt/qtestelement.h new file mode 100644 index 0000000..7126c35 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestelement.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTELEMENT_H +#define QTESTELEMENT_H + +#include <QtTest/qtestcoreelement.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestElement: public QTestCoreElement<QTestElement> +{ + public: + QTestElement(int type = -1); + ~QTestElement(); + + bool addLogElement(QTestElement *element); + QTestElement *childElements() const; + + const QTestElement *parentElement() const; + void setParent(const QTestElement *p); + + private: + QTestElement *listOfChildren; + const QTestElement * parent; + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestelementattribute.h b/qtinterface/qt4/Qt/qtestelementattribute.h new file mode 100644 index 0000000..7bd5477 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestelementattribute.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTELEMENTATTRIBUTE_H +#define QTESTELEMENTATTRIBUTE_H + +#include <QtTest/qtestcorelist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +namespace QTest { + + enum AttributeIndex + { + AI_Undefined = -1, + AI_Name = 0, + AI_Result = 1, + AI_Tests = 2, + AI_Failures = 3, + AI_Errors = 4, + AI_Type = 5, + AI_Description = 6, + AI_PropertyValue = 7, + AI_QTestVersion = 8, + AI_QtVersion = 9, + AI_File = 10, + AI_Line = 11, + AI_Metric = 12, + AI_Tag = 13, + AI_Value = 14, + AI_Iterations = 15 + }; + + enum LogElementType + { + LET_Undefined = -1, + LET_Property = 0, + LET_Properties = 1, + LET_Failure = 2, + LET_Error = 3, + LET_TestCase = 4, + LET_TestSuite = 5, + LET_Benchmark = 6, + LET_SystemError = 7 + }; +} + +class QTestElementAttribute: public QTestCoreList<QTestElementAttribute> +{ + public: + QTestElementAttribute(); + ~QTestElementAttribute(); + + const char *value() const; + const char *name() const; + QTest::AttributeIndex index() const; + bool isNull() const; + bool setPair(QTest::AttributeIndex attributeIndex, const char *value); + + private: + char *attributeValue; + QTest::AttributeIndex attributeIndex; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestevent.h b/qtinterface/qt4/Qt/qtestevent.h new file mode 100644 index 0000000..095ce6c --- /dev/null +++ b/qtinterface/qt4/Qt/qtestevent.h @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTEVENT_H +#define QTESTEVENT_H + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +#include <QtTest/qtest_global.h> +#ifdef QT_GUI_LIB +#include <QtTest/qtestkeyboard.h> +#include <QtTest/qtestmouse.h> +#endif +#include <QtTest/qtestsystem.h> + +#include <QtCore/qlist.h> + +#include <stdlib.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestEvent +{ +public: + virtual void simulate(QWidget *w) = 0; + virtual QTestEvent *clone() const = 0; + + virtual ~QTestEvent() {} +}; + +#ifdef QT_GUI_LIB +class QTestKeyEvent: public QTestEvent +{ +public: + inline QTestKeyEvent(QTest::KeyAction action, Qt::Key key, Qt::KeyboardModifiers modifiers, int delay) + : _action(action), _delay(delay), _modifiers(modifiers), _ascii(0), _key(key) {} + inline QTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay) + : _action(action), _delay(delay), _modifiers(modifiers), + _ascii(ascii), _key(Qt::Key_unknown) {} + inline QTestEvent *clone() const { return new QTestKeyEvent(*this); } + + inline void simulate(QWidget *w) + { + if (_ascii == 0) + QTest::keyEvent(_action, w, _key, _modifiers, _delay); + else + QTest::keyEvent(_action, w, _ascii, _modifiers, _delay); + } + +protected: + QTest::KeyAction _action; + int _delay; + Qt::KeyboardModifiers _modifiers; + char _ascii; + Qt::Key _key; +}; + +class QTestKeyClicksEvent: public QTestEvent +{ +public: + inline QTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay) + : _keys(keys), _modifiers(modifiers), _delay(delay) {} + inline QTestEvent *clone() const { return new QTestKeyClicksEvent(*this); } + + inline void simulate(QWidget *w) + { + QTest::keyClicks(w, _keys, _modifiers, _delay); + } + +private: + QString _keys; + Qt::KeyboardModifiers _modifiers; + int _delay; +}; + +class QTestMouseEvent: public QTestEvent +{ +public: + inline QTestMouseEvent(QTest::MouseAction action, Qt::MouseButton button, + Qt::KeyboardModifiers modifiers, QPoint position, int delay) + : _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {} + inline QTestEvent *clone() const { return new QTestMouseEvent(*this); } + + inline void simulate(QWidget *w) + { + QTest::mouseEvent(_action, w, _button, _modifiers, _pos, _delay); + } + +private: + QTest::MouseAction _action; + Qt::MouseButton _button; + Qt::KeyboardModifiers _modifiers; + QPoint _pos; + int _delay; +}; +#endif //QT_GUI_LIB + + +class QTestDelayEvent: public QTestEvent +{ +public: + inline QTestDelayEvent(int msecs): _delay(msecs) {} + inline QTestEvent *clone() const { return new QTestDelayEvent(*this); } + + inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } + +private: + int _delay; +}; + +class QTestEventList: public QList<QTestEvent *> +{ +public: + inline QTestEventList() {} + inline QTestEventList(const QTestEventList &other): QList<QTestEvent *>() + { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); } + inline ~QTestEventList() + { clear(); } + inline void clear() + { qDeleteAll(*this); QList<QTestEvent *>::clear(); } + +#ifdef QT_GUI_LIB + inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Click, qtKey, modifiers, msecs); } + inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Press, qtKey, modifiers, msecs); } + inline void addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Release, qtKey, modifiers, msecs); } + inline void addKeyEvent(QTest::KeyAction action, Qt::Key qtKey, + Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new QTestKeyEvent(action, qtKey, modifiers, msecs)); } + + inline void addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Click, ascii, modifiers, msecs); } + inline void addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Press, ascii, modifiers, msecs); } + inline void addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Release, ascii, modifiers, msecs); } + inline void addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new QTestKeyClicksEvent(keys, modifiers, msecs)); } + inline void addKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new QTestKeyEvent(action, ascii, modifiers, msecs)); } + + inline void addMousePress(Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { append(new QTestMouseEvent(QTest::MousePress, button, stateKey, pos, delay)); } + inline void addMouseRelease(Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { append(new QTestMouseEvent(QTest::MouseRelease, button, stateKey, pos, delay)); } + inline void addMouseClick(Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { append(new QTestMouseEvent(QTest::MouseClick, button, stateKey, pos, delay)); } + inline void addMouseDClick(Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { append(new QTestMouseEvent(QTest::MouseDClick, button, stateKey, pos, delay)); } + inline void addMouseMove(QPoint pos = QPoint(), int delay=-1) + { append(new QTestMouseEvent(QTest::MouseMove, Qt::NoButton, 0, pos, delay)); } +#endif //QT_GUI_LIB + + inline void addDelay(int msecs) + { append(new QTestDelayEvent(msecs)); } + + inline void simulate(QWidget *w) + { + for (int i = 0; i < count(); ++i) + at(i)->simulate(w); + } +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QTestEventList) + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtesteventloop.h b/qtinterface/qt4/Qt/qtesteventloop.h new file mode 100644 index 0000000..faa10fa --- /dev/null +++ b/qtinterface/qt4/Qt/qtesteventloop.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTEVENTLOOP_H +#define QTESTEVENTLOOP_H + +#include <QtTest/qtest_global.h> + +#include <QtCore/qcoreapplication.h> +#include <QtCore/qeventloop.h> +#include <QtCore/qobject.h> +#include <QtCore/qpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class Q_TESTLIB_EXPORT QTestEventLoop : public QObject +{ + Q_OBJECT + +public: + inline QTestEventLoop(QObject *aParent = 0) + : QObject(aParent), inLoop(false), _timeout(false), timerId(-1), loop(0) {} + inline void enterLoop(int secs); + + + inline void changeInterval(int secs) + { killTimer(timerId); timerId = startTimer(secs * 1000); } + + inline bool timeout() const + { return _timeout; } + + inline static QTestEventLoop &instance() + { + static QPointer<QTestEventLoop> testLoop; + if (testLoop.isNull()) + testLoop = new QTestEventLoop(QCoreApplication::instance()); + return *static_cast<QTestEventLoop *>(testLoop); + } + +public Q_SLOTS: + inline void exitLoop(); + +protected: + inline void timerEvent(QTimerEvent *e); + +private: + bool inLoop; + bool _timeout; + int timerId; + + QEventLoop *loop; +}; + +inline void QTestEventLoop::enterLoop(int secs) +{ + Q_ASSERT(!loop); + + QEventLoop l; + + inLoop = true; + _timeout = false; + + timerId = startTimer(secs * 1000); + + loop = &l; + l.exec(); + loop = 0; +} + +inline void QTestEventLoop::exitLoop() +{ + if (timerId != -1) + killTimer(timerId); + timerId = -1; + + if (loop) + loop->exit(); + + inLoop = false; +} + +inline void QTestEventLoop::timerEvent(QTimerEvent *e) +{ + if (e->timerId() != timerId) + return; + _timeout = true; + exitLoop(); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestfilelogger.h b/qtinterface/qt4/Qt/qtestfilelogger.h new file mode 100644 index 0000000..4f93dce --- /dev/null +++ b/qtinterface/qt4/Qt/qtestfilelogger.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTFILELOGGER_H +#define QTESTFILELOGGER_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestFileLogger +{ + public: + QTestFileLogger(); + ~QTestFileLogger(); + + void init(); + void flush(const char *msg); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTESTFILELOGGER_H diff --git a/qtinterface/qt4/Qt/qtestkeyboard.h b/qtinterface/qt4/Qt/qtestkeyboard.h new file mode 100644 index 0000000..c629750 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestkeyboard.h @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if !defined(QTESTKEYBOARD_H) +#define QTESTKEYBOARD_H + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +#include <QtTest/qtestassert.h> +#include <QtTest/qtest_global.h> +#include <QtTest/qtestsystem.h> +#include <QtTest/qtestspontaneevent.h> + +#include <QtCore/qpointer.h> +#include <QtGui/qapplication.h> +#include <QtGui/qevent.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +namespace QTest +{ + enum KeyAction { Press, Release, Click }; + + static void simulateEvent(QWidget *widget, bool press, int code, + Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1) + { + QTEST_ASSERT(widget); + extern int Q_TESTLIB_EXPORT defaultKeyDelay(); + + if (delay == -1 || delay < defaultKeyDelay()) + delay = defaultKeyDelay(); + if(delay > 0) + QTest::qWait(delay); + + QKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat); + QSpontaneKeyEvent::setSpontaneous(&a); + if (!qApp->notify(widget, &a)) + QTest::qWarn("Keyboard event not accepted by receiving widget"); + } + + static void sendKeyEvent(KeyAction action, QWidget *widget, Qt::Key code, + QString text, Qt::KeyboardModifiers modifier, int delay=-1) + { + QTEST_ASSERT(qApp); + + if (!widget) + widget = QWidget::keyboardGrabber(); + if (!widget) { + if (QWidget *apw = QApplication::activePopupWidget()) + widget = apw->focusWidget() ? apw->focusWidget() : apw; + else + widget = QApplication::focusWidget(); + } + if (!widget) + widget = QApplication::activeWindow(); + + QTEST_ASSERT(widget); + + if (action == Click) { + QPointer<QWidget> ptr(widget); + sendKeyEvent(Press, widget, code, text, modifier, delay); + if (!ptr) { + // if we send key-events to embedded widgets, they might be destroyed + // when the user presses Return + return; + } + sendKeyEvent(Release, widget, code, text, modifier, delay); + return; + } + + bool repeat = false; + + if (action == Press) { + if (modifier & Qt::ShiftModifier) + simulateEvent(widget, true, Qt::Key_Shift, 0, QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(widget, true, Qt::Key_Control, modifier & Qt::ShiftModifier, QString(), false, delay); + + if (modifier & Qt::AltModifier) + simulateEvent(widget, true, Qt::Key_Alt, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + if (modifier & Qt::MetaModifier) + simulateEvent(widget, true, Qt::Key_Meta, modifier & (Qt::ShiftModifier + | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + simulateEvent(widget, true, code, modifier, text, repeat, delay); + } else if (action == Release) { + simulateEvent(widget, false, code, modifier, text, repeat, delay); + + if (modifier & Qt::MetaModifier) + simulateEvent(widget, false, Qt::Key_Meta, modifier, QString(), false, delay); + if (modifier & Qt::AltModifier) + simulateEvent(widget, false, Qt::Key_Alt, modifier & + (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(widget, false, Qt::Key_Control, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + + if (modifier & Qt::ShiftModifier) + simulateEvent(widget, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay); + } + } + + // Convenience function + static void sendKeyEvent(KeyAction action, QWidget *widget, Qt::Key code, + char ascii, Qt::KeyboardModifiers modifier, int delay=-1) + { + QString text; + if (ascii) + text = QString(QChar::fromLatin1(ascii)); + sendKeyEvent(action, widget, code, text, modifier, delay); + } + + inline static void keyEvent(KeyAction action, QWidget *widget, char ascii, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { sendKeyEvent(action, widget, asciiToKey(ascii), ascii, modifier, delay); } + inline static void keyEvent(KeyAction action, QWidget *widget, Qt::Key key, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { sendKeyEvent(action, widget, key, keyToAscii(key), modifier, delay); } + + inline static void keyClicks(QWidget *widget, const QString &sequence, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { + for (int i=0; i < sequence.length(); i++) + keyEvent(Click, widget, sequence.at(i).toLatin1(), modifier, delay); + } + + inline static void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Press, widget, key, modifier, delay); } + inline static void keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Release, widget, key, modifier, delay); } + inline static void keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Click, widget, key, modifier, delay); } + inline static void keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Press, widget, key, modifier, delay); } + inline static void keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Release, widget, key, modifier, delay); } + inline static void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Click, widget, key, modifier, delay); } + +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTESTKEYBOARD_H diff --git a/qtinterface/qt4/Qt/qtestlightxmlstreamer.h b/qtinterface/qt4/Qt/qtestlightxmlstreamer.h new file mode 100644 index 0000000..99b35ca --- /dev/null +++ b/qtinterface/qt4/Qt/qtestlightxmlstreamer.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLIGHTXMLSTREAMER_H +#define QTESTLIGHTXMLSTREAMER_H + +#include <QtTest/qtestbasicstreamer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestElement; +class QTestElementAttribute; + +class QTestLightXmlStreamer: public QTestBasicStreamer +{ + public: + QTestLightXmlStreamer(); + ~QTestLightXmlStreamer(); + + void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + void output(QTestElement *element) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestmouse.h b/qtinterface/qt4/Qt/qtestmouse.h new file mode 100644 index 0000000..2e903f2 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestmouse.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if !defined(QTESTMOUSE_H) +#define QTESTMOUSE_H + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +#include <QtTest/qtest_global.h> +#include <QtTest/qtestassert.h> +#include <QtTest/qtestsystem.h> +#include <QtTest/qtestspontaneevent.h> + +#include <QtCore/qpoint.h> +#include <QtCore/qstring.h> +#include <QtGui/qapplication.h> +#include <QtGui/qevent.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +namespace QTest +{ + enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDClick, MouseMove }; + + static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, + Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1) + { + QTEST_ASSERT(widget); + extern int Q_TESTLIB_EXPORT defaultMouseDelay(); + + if (delay == -1 || delay < defaultMouseDelay()) + delay = defaultMouseDelay(); + if(delay > 0) + QTest::qWait(delay); + + if (pos.isNull()) + pos = widget->rect().center(); + + if (action == MouseClick) { + mouseEvent(MousePress, widget, button, stateKey, pos); + mouseEvent(MouseRelease, widget, button, stateKey, pos); + return; + } + + QTEST_ASSERT(button == Qt::NoButton || button & Qt::MouseButtonMask); + QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); + + stateKey &= static_cast<unsigned int>(Qt::KeyboardModifierMask); + + QMouseEvent me(QEvent::User, QPoint(), Qt::LeftButton, button, stateKey); + switch (action) + { + case MousePress: + me = QMouseEvent(QEvent::MouseButtonPress, pos, widget->mapToGlobal(pos), button, button, stateKey); + break; + case MouseRelease: + me = QMouseEvent(QEvent::MouseButtonRelease, pos, widget->mapToGlobal(pos), button, 0, stateKey); + break; + case MouseDClick: + me = QMouseEvent(QEvent::MouseButtonDblClick, pos, widget->mapToGlobal(pos), button, button, stateKey); + break; + case MouseMove: + QCursor::setPos(widget->mapToGlobal(pos)); + qApp->processEvents(); + return; + default: + QTEST_ASSERT(false); + } + QSpontaneKeyEvent::setSpontaneous(&me); + if (!qApp->notify(widget, &me)) { + static const char *mouseActionNames[] = + { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; + QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget"); + QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toAscii().data()); + } + + } + + inline void mousePress(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MousePress, widget, button, stateKey, pos, delay); } + inline void mouseRelease(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseRelease, widget, button, stateKey, pos, delay); } + inline void mouseClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseClick, widget, button, stateKey, pos, delay); } + inline void mouseDClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseDClick, widget, button, stateKey, pos, delay); } + inline void mouseMove(QWidget *widget, QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseMove, widget, Qt::NoButton, 0, pos, delay); } + +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTESTMOUSE_H diff --git a/qtinterface/qt4/Qt/qtestspontaneevent.h b/qtinterface/qt4/Qt/qtestspontaneevent.h new file mode 100644 index 0000000..3d5fe36 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestspontaneevent.h @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTSPONTANEEVENT_H +#define QTESTSPONTANEEVENT_H + +#include <QtCore/qcoreevent.h> + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +#ifndef QTEST_NO_SIZEOF_CHECK +template <int> +class QEventSizeOfChecker +{ +private: + QEventSizeOfChecker() {} +}; + +template <> +class QEventSizeOfChecker<sizeof(QEvent)> +{ +public: + QEventSizeOfChecker() {} +}; +#endif + +class QSpontaneKeyEvent +{ +public: + void setSpontaneous() { spont = 1; } + bool spontaneous() { return spont; } + virtual void dummyFunc() {} + virtual ~QSpontaneKeyEvent() {} + +#ifndef QTEST_NO_SIZEOF_CHECK + inline void ifYouGetCompileErrorHereYouUseWrongQt() + { + // this is a static assert in case QEvent changed in Qt + QEventSizeOfChecker<sizeof(QSpontaneKeyEvent)> dummy; + } +#endif + + static inline void setSpontaneous(QEvent *ev) + { + // use a union instead of a reinterpret_cast to prevent alignment warnings + union + { + QSpontaneKeyEvent *skePtr; + QEvent *evPtr; + } helper; + + helper.evPtr = ev; + helper.skePtr->setSpontaneous(); + } + +protected: + void *d; + ushort t; + +private: + ushort posted : 1; + ushort spont : 1; + ushort m_accept : 1; + ushort reserved : 13; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestsystem.h b/qtinterface/qt4/Qt/qtestsystem.h new file mode 100644 index 0000000..2b48846 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestsystem.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTSYSTEM_H +#define QTESTSYSTEM_H + +#include <QtTest/qtestcase.h> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qdatetime.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QWidget; +#ifdef Q_WS_X11 +extern void qt_x11_wait_for_window_manager(QWidget *w); +#endif + +namespace QTest +{ + inline static void qWait(int ms) + { + Q_ASSERT(QCoreApplication::instance()); + + QTime timer; + timer.start(); + do { + QCoreApplication::processEvents(QEventLoop::AllEvents, ms); + QTest::qSleep(10); + } while (timer.elapsed() < ms); + } + + inline static bool qWaitForWindowShown(QWidget *window) + { +#if defined(Q_WS_X11) + qt_x11_wait_for_window_manager(window); + QCoreApplication::processEvents(); +#elif defined(Q_WS_QWS) + Q_UNUSED(window); + qWait(100); +#else + Q_UNUSED(window); + qWait(50); +#endif + return true; + } + +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtesttouch.h b/qtinterface/qt4/Qt/qtesttouch.h new file mode 100644 index 0000000..712ac25 --- /dev/null +++ b/qtinterface/qt4/Qt/qtesttouch.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTTOUCH_H +#define QTESTTOUCH_H + +#if 0 +// inform syncqt +#pragma qt_no_master_include +#endif + +#include <QtTest/qtest_global.h> +#include <QtTest/qtestassert.h> +#include <QtTest/qtestsystem.h> +#include <QtTest/qtestspontaneevent.h> + +#include <QtCore/qmap.h> +#include <QtGui/qevent.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +extern Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, + QTouchEvent::DeviceType deviceType, + const QList<QTouchEvent::TouchPoint> &touchPoints); + +namespace QTest +{ + + class QTouchEventSequence + { + public: + ~QTouchEventSequence() + { + commit(); + points.clear(); + } + QTouchEventSequence& press(int touchId, const QPoint &pt, QWidget *widget = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(widget, pt)); + p.setState(Qt::TouchPointPressed); + return *this; + } + QTouchEventSequence& move(int touchId, const QPoint &pt, QWidget *widget = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(widget, pt)); + p.setState(Qt::TouchPointMoved); + return *this; + } + QTouchEventSequence& release(int touchId, const QPoint &pt, QWidget *widget = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(widget, pt)); + p.setState(Qt::TouchPointReleased); + return *this; + } + QTouchEventSequence& stationary(int touchId) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setState(Qt::TouchPointStationary); + return *this; + } + + private: + QTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType deviceType) + : targetWidget(widget), deviceType(deviceType) + { + } + QTouchEventSequence(const QTouchEventSequence &v); + void operator=(const QTouchEventSequence&); + + QTouchEvent::TouchPoint &point(int touchId) + { + if (!points.contains(touchId)) + points[touchId] = QTouchEvent::TouchPoint(touchId); + return points[touchId]; + } + QPoint mapToScreen(QWidget *widget, const QPoint &pt) + { + if (widget) + return widget->mapToGlobal(pt); + return targetWidget ? targetWidget->mapToGlobal(pt) : pt; + } + void commit() + { + qt_translateRawTouchEvent(targetWidget, deviceType, points.values()); + targetWidget = 0; + } + + QMap<int, QTouchEvent::TouchPoint> points; + QWidget *targetWidget; + QTouchEvent::DeviceType deviceType; + friend QTouchEventSequence touchEvent(QWidget *, QTouchEvent::DeviceType); + }; + + inline + QTouchEventSequence touchEvent(QWidget *widget = 0, + QTouchEvent::DeviceType deviceType = QTouchEvent::TouchScreen) + { + return QTouchEventSequence(widget, deviceType); + } + +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTESTTOUCH_H diff --git a/qtinterface/qt4/Qt/qtestxmlstreamer.h b/qtinterface/qt4/Qt/qtestxmlstreamer.h new file mode 100644 index 0000000..f51d784 --- /dev/null +++ b/qtinterface/qt4/Qt/qtestxmlstreamer.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTXMLSTREAMER_H +#define QTESXMLSTREAMER_H + +#include <QtTest/qtestbasicstreamer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestElement; +class QTestElementAttribute; + +class QTestXmlStreamer: public QTestBasicStreamer +{ + public: + QTestXmlStreamer(); + ~QTestXmlStreamer(); + + void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + void output(QTestElement *element) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtestxunitstreamer.h b/qtinterface/qt4/Qt/qtestxunitstreamer.h new file mode 100644 index 0000000..cd2b9bb --- /dev/null +++ b/qtinterface/qt4/Qt/qtestxunitstreamer.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTXUNITSTREAMER_H +#define QTESTXUNITSTREAMER_H + +#include <QtTest/qtestbasicstreamer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Test) + +class QTestLogger; + +class QTestXunitStreamer: public QTestBasicStreamer +{ + public: + QTestXunitStreamer(); + ~QTestXunitStreamer(); + + void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const; + void output(QTestElement *element) const; + void outputElements(QTestElement *element, bool isChildElement = false) const; + + private: + void displayXunitXmlHeader() const; + static void indentForElement(const QTestElement* element, char* buf, int size); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtextboundaryfinder.h b/qtinterface/qt4/Qt/qtextboundaryfinder.h new file mode 100644 index 0000000..7a880f6 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextboundaryfinder.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTBOUNDARYFINDER_H +#define QTEXTBOUNDARYFINDER_H + +#include <QtCore/qchar.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QTextBoundaryFinderPrivate; + +class Q_CORE_EXPORT QTextBoundaryFinder +{ +public: + QTextBoundaryFinder(); + QTextBoundaryFinder(const QTextBoundaryFinder &other); + QTextBoundaryFinder &operator=(const QTextBoundaryFinder &other); + ~QTextBoundaryFinder(); + + enum BoundaryType { + Grapheme, + Word, + Line, + Sentence + }; + + enum BoundaryReason { + NotAtBoundary = 0, + StartWord = 1, + EndWord = 2 + //Hyphen + }; + Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason ) + + QTextBoundaryFinder(BoundaryType type, const QString &string); + QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = 0, int bufferSize = 0); + + inline bool isValid() const { return d; } + + inline BoundaryType type() const { return t; } + QString string() const; + + void toStart(); + void toEnd(); + int position() const; + void setPosition(int position); + + int toNextBoundary(); + int toPreviousBoundary(); + + bool isAtBoundary() const; + BoundaryReasons boundaryReasons() const; + +private: + BoundaryType t; + QString s; + const QChar *chars; + int length; + int pos; + uint freePrivate : 1; + uint unused : 31; + QTextBoundaryFinderPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qtextbrowser.h b/qtinterface/qt4/Qt/qtextbrowser.h new file mode 100644 index 0000000..cca436e --- /dev/null +++ b/qtinterface/qt4/Qt/qtextbrowser.h @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTBROWSER_H +#define QTEXTBROWSER_H + +#include <QtGui/qtextedit.h> +#include <QtCore/qurl.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TEXTBROWSER + +class QTextBrowserPrivate; + +class Q_GUI_EXPORT QTextBrowser : public QTextEdit +{ + Q_OBJECT + + Q_PROPERTY(QUrl source READ source WRITE setSource) + Q_OVERRIDE(bool modified SCRIPTABLE false) + Q_OVERRIDE(bool readOnly DESIGNABLE false SCRIPTABLE false) + Q_OVERRIDE(bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false) + Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths) + Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) + Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks) + +public: + explicit QTextBrowser(QWidget* parent = 0); + virtual ~QTextBrowser(); + + QUrl source() const; + + QStringList searchPaths() const; + void setSearchPaths(const QStringList &paths); + + virtual QVariant loadResource(int type, const QUrl &name); + + bool isBackwardAvailable() const; + bool isForwardAvailable() const; + void clearHistory(); + QString historyTitle(int) const; + QUrl historyUrl(int) const; + int backwardHistoryCount() const; + int forwardHistoryCount() const; + + bool openExternalLinks() const; + void setOpenExternalLinks(bool open); + + bool openLinks() const; + void setOpenLinks(bool open); + +public Q_SLOTS: + virtual void setSource(const QUrl &name); + virtual void backward(); + virtual void forward(); + virtual void home(); + virtual void reload(); + +Q_SIGNALS: + void backwardAvailable(bool); + void forwardAvailable(bool); + void historyChanged(); + void sourceChanged(const QUrl &); + void highlighted(const QUrl &); + void highlighted(const QString &); + void anchorClicked(const QUrl &); + +protected: + bool event(QEvent *e); + virtual void keyPressEvent(QKeyEvent *ev); + virtual void mouseMoveEvent(QMouseEvent *ev); + virtual void mousePressEvent(QMouseEvent *ev); + virtual void mouseReleaseEvent(QMouseEvent *ev); + virtual void focusOutEvent(QFocusEvent *ev); + virtual bool focusNextPrevChild(bool next); + virtual void paintEvent(QPaintEvent *e); + +#if defined(QT3_SUPPORT) +public: + QT3_SUPPORT_CONSTRUCTOR QTextBrowser(QWidget *parent, const char *name); +#endif + +private: + Q_DISABLE_COPY(QTextBrowser) + Q_DECLARE_PRIVATE(QTextBrowser) + Q_PRIVATE_SLOT(d_func(), void _q_documentModified()) + Q_PRIVATE_SLOT(d_func(), void _q_activateAnchor(const QString &)) + Q_PRIVATE_SLOT(d_func(), void _q_highlightLink(const QString &)) +}; + +#endif // QT_NO_TEXTBROWSER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTBROWSER_H diff --git a/qtinterface/qt4/Qt/qtextcodec.h b/qtinterface/qt4/Qt/qtextcodec.h new file mode 100644 index 0000000..8d351f6 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextcodec.h @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTCODEC_H +#define QTEXTCODEC_H + +#include <QtCore/qstring.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_TEXTCODEC + +class QTextCodec; +class QIODevice; + +class QTextDecoder; +class QTextEncoder; + +class Q_CORE_EXPORT QTextCodec +{ + Q_DISABLE_COPY(QTextCodec) +public: + static QTextCodec* codecForName(const QByteArray &name); + static QTextCodec* codecForName(const char *name) { return codecForName(QByteArray(name)); } + static QTextCodec* codecForMib(int mib); + + static QList<QByteArray> availableCodecs(); + static QList<int> availableMibs(); + + static QTextCodec* codecForLocale(); + static void setCodecForLocale(QTextCodec *c); + + static QTextCodec* codecForTr(); + static void setCodecForTr(QTextCodec *c); + + static QTextCodec* codecForCStrings(); + static void setCodecForCStrings(QTextCodec *c); + + static QTextCodec *codecForHtml(const QByteArray &ba); + static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec); + + static QTextCodec *codecForUtfText(const QByteArray &ba); + static QTextCodec *codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec); + + QTextDecoder* makeDecoder() const; + QTextEncoder* makeEncoder() const; + + bool canEncode(QChar) const; + bool canEncode(const QString&) const; + + QString toUnicode(const QByteArray&) const; + QString toUnicode(const char* chars) const; + QByteArray fromUnicode(const QString& uc) const; + enum ConversionFlag { + DefaultConversion, + ConvertInvalidToNull = 0x80000000, + IgnoreHeader = 0x1, + FreeFunction = 0x2 + }; + Q_DECLARE_FLAGS(ConversionFlags, ConversionFlag) + + struct Q_CORE_EXPORT ConverterState { + ConverterState(ConversionFlags f = DefaultConversion) + : flags(f), remainingChars(0), invalidChars(0), d(0) { state_data[0] = state_data[1] = state_data[2] = 0; } + ~ConverterState(); + ConversionFlags flags; + int remainingChars; + int invalidChars; + uint state_data[3]; + void *d; + private: + Q_DISABLE_COPY(ConverterState) + }; + + QString toUnicode(const char *in, int length, ConverterState *state = 0) const + { return convertToUnicode(in, length, state); } + QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = 0) const + { return convertFromUnicode(in, length, state); } + + virtual QByteArray name() const = 0; + virtual QList<QByteArray> aliases() const; + virtual int mibEnum() const = 0; + +protected: + virtual QString convertToUnicode(const char *in, int length, ConverterState *state) const = 0; + virtual QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const = 0; + + QTextCodec(); + virtual ~QTextCodec(); + +public: +#ifdef QT3_SUPPORT + static QT3_SUPPORT QTextCodec* codecForContent(const char*, int) { return 0; } + static QT3_SUPPORT const char* locale(); + static QT3_SUPPORT QTextCodec* codecForName(const char* hint, int) { return codecForName(QByteArray(hint)); } + QT3_SUPPORT QByteArray fromUnicode(const QString& uc, int& lenInOut) const; + QT3_SUPPORT QString toUnicode(const QByteArray&, int len) const; + QT3_SUPPORT QByteArray mimeName() const { return name(); } + static QT3_SUPPORT QTextCodec *codecForIndex(int i) { return codecForName(availableCodecs().value(i)); } +#endif + +private: + friend class QTextCodecCleanup; + static QTextCodec *cftr; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags) + +inline QTextCodec* QTextCodec::codecForTr() { return cftr; } +inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; } +inline QTextCodec* QTextCodec::codecForCStrings() { return QString::codecForCStrings; } +inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; } + +class Q_CORE_EXPORT QTextEncoder { + Q_DISABLE_COPY(QTextEncoder) +public: + explicit QTextEncoder(const QTextCodec *codec) : c(codec), state() {} + ~QTextEncoder(); + QByteArray fromUnicode(const QString& str); + QByteArray fromUnicode(const QChar *uc, int len); +#ifdef QT3_SUPPORT + QT3_SUPPORT QByteArray fromUnicode(const QString& uc, int& lenInOut); +#endif + bool hasFailure() const; +private: + const QTextCodec *c; + QTextCodec::ConverterState state; + + friend class QXmlStreamWriter; + friend class QXmlStreamWriterPrivate; + friend class QCoreXmlStreamWriter; + friend class QCoreXmlStreamWriterPrivate; +}; + +class Q_CORE_EXPORT QTextDecoder { + Q_DISABLE_COPY(QTextDecoder) +public: + explicit QTextDecoder(const QTextCodec *codec) : c(codec), state() {} + ~QTextDecoder(); + QString toUnicode(const char* chars, int len); + QString toUnicode(const QByteArray &ba); + void toUnicode(QString *target, const char *chars, int len); + bool hasFailure() const; +private: + const QTextCodec *c; + QTextCodec::ConverterState state; +}; + +#endif // QT_NO_TEXTCODEC + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTCODEC_H diff --git a/qtinterface/qt4/Qt/qtextcodecplugin.h b/qtinterface/qt4/Qt/qtextcodecplugin.h new file mode 100644 index 0000000..984efb3 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextcodecplugin.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTCODECPLUGIN_H +#define QTEXTCODECPLUGIN_H + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> +#include <QtCore/qlist.h> +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_TEXTCODECPLUGIN + +class QTextCodec; + +struct Q_CORE_EXPORT QTextCodecFactoryInterface : public QFactoryInterface +{ + virtual QTextCodec *create(const QString &key) = 0; +}; + +#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface" + +Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid) + + +class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QTextCodecFactoryInterface:QFactoryInterface) +public: + explicit QTextCodecPlugin(QObject *parent = 0); + ~QTextCodecPlugin(); + + virtual QList<QByteArray> names() const = 0; + virtual QList<QByteArray> aliases() const = 0; + virtual QTextCodec *createForName(const QByteArray &name) = 0; + + virtual QList<int> mibEnums() const = 0; + virtual QTextCodec *createForMib(int mib) = 0; + +private: + QStringList keys() const; + QTextCodec *create(const QString &name); +}; + +#endif // QT_NO_TEXTCODECPLUGIN + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTCODECPLUGIN_H diff --git a/qtinterface/qt4/Qt/qtextcursor.h b/qtinterface/qt4/Qt/qtextcursor.h new file mode 100644 index 0000000..76aa9d5 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextcursor.h @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTCURSOR_H +#define QTEXTCURSOR_H + +#include <QtCore/qstring.h> +#include <QtCore/qshareddata.h> +#include <QtGui/qtextformat.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextDocument; +class QTextCursorPrivate; +class QTextDocumentFragment; +class QTextCharFormat; +class QTextBlockFormat; +class QTextListFormat; +class QTextTableFormat; +class QTextFrameFormat; +class QTextImageFormat; +class QTextDocumentPrivate; +class QTextList; +class QTextTable; +class QTextFrame; +class QTextBlock; + +class Q_GUI_EXPORT QTextCursor +{ +public: + QTextCursor(); + explicit QTextCursor(QTextDocument *document); + QTextCursor(QTextDocumentPrivate *p, int pos); + explicit QTextCursor(QTextFrame *frame); + explicit QTextCursor(const QTextBlock &block); + explicit QTextCursor(QTextCursorPrivate *d); + QTextCursor(const QTextCursor &cursor); + QTextCursor &operator=(const QTextCursor &other); + ~QTextCursor(); + + bool isNull() const; + + enum MoveMode { + MoveAnchor, + KeepAnchor + }; + + void setPosition(int pos, MoveMode mode = MoveAnchor); + int position() const; + + int anchor() const; + + void insertText(const QString &text); + void insertText(const QString &text, const QTextCharFormat &format); + + enum MoveOperation { + NoMove, + + Start, + Up, + StartOfLine, + StartOfBlock, + StartOfWord, + PreviousBlock, + PreviousCharacter, + PreviousWord, + Left, + WordLeft, + + End, + Down, + EndOfLine, + EndOfWord, + EndOfBlock, + NextBlock, + NextCharacter, + NextWord, + Right, + WordRight, + + NextCell, + PreviousCell, + NextRow, + PreviousRow + }; + + bool movePosition(MoveOperation op, MoveMode = MoveAnchor, int n = 1); + + bool visualNavigation() const; + void setVisualNavigation(bool b); + + void deleteChar(); + void deletePreviousChar(); + + enum SelectionType { + WordUnderCursor, + LineUnderCursor, + BlockUnderCursor, + Document + }; + void select(SelectionType selection); + + bool hasSelection() const; + bool hasComplexSelection() const; + void removeSelectedText(); + void clearSelection(); + int selectionStart() const; + int selectionEnd() const; + + QString selectedText() const; + QTextDocumentFragment selection() const; + void selectedTableCells(int *firstRow, int *numRows, int *firstColumn, int *numColumns) const; + + QTextBlock block() const; + + QTextCharFormat charFormat() const; + void setCharFormat(const QTextCharFormat &format); + void mergeCharFormat(const QTextCharFormat &modifier); + + QTextBlockFormat blockFormat() const; + void setBlockFormat(const QTextBlockFormat &format); + void mergeBlockFormat(const QTextBlockFormat &modifier); + + QTextCharFormat blockCharFormat() const; + void setBlockCharFormat(const QTextCharFormat &format); + void mergeBlockCharFormat(const QTextCharFormat &modifier); + + bool atBlockStart() const; + bool atBlockEnd() const; + bool atStart() const; + bool atEnd() const; + + void insertBlock(); + void insertBlock(const QTextBlockFormat &format); + void insertBlock(const QTextBlockFormat &format, const QTextCharFormat &charFormat); + + QTextList *insertList(const QTextListFormat &format); + QTextList *insertList(QTextListFormat::Style style); + + QTextList *createList(const QTextListFormat &format); + QTextList *createList(QTextListFormat::Style style); + QTextList *currentList() const; + + QTextTable *insertTable(int rows, int cols, const QTextTableFormat &format); + QTextTable *insertTable(int rows, int cols); + QTextTable *currentTable() const; + + QTextFrame *insertFrame(const QTextFrameFormat &format); + QTextFrame *currentFrame() const; + + void insertFragment(const QTextDocumentFragment &fragment); + +#ifndef QT_NO_TEXTHTMLPARSER + void insertHtml(const QString &html); +#endif // QT_NO_TEXTHTMLPARSER + + void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment); + void insertImage(const QTextImageFormat &format); + void insertImage(const QString &name); + void insertImage(const QImage &image, const QString &name = QString()); + + void beginEditBlock(); + void joinPreviousEditBlock(); + void endEditBlock(); + + bool operator!=(const QTextCursor &rhs) const; + bool operator<(const QTextCursor &rhs) const; + bool operator<=(const QTextCursor &rhs) const; + bool operator==(const QTextCursor &rhs) const; + bool operator>=(const QTextCursor &rhs) const; + bool operator>(const QTextCursor &rhs) const; + + bool isCopyOf(const QTextCursor &other) const; + + int blockNumber() const; + int columnNumber() const; + + QTextDocument *document() const; + +private: + QSharedDataPointer<QTextCursorPrivate> d; + friend class QTextDocumentFragmentPrivate; + friend class QTextCopyHelper; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTCURSOR_H diff --git a/qtinterface/qt4/Qt/qtextdocument.h b/qtinterface/qt4/Qt/qtextdocument.h new file mode 100644 index 0000000..a9ed801 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextdocument.h @@ -0,0 +1,302 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTDOCUMENT_H +#define QTEXTDOCUMENT_H + +#include <QtCore/qobject.h> +#include <QtCore/qsize.h> +#include <QtCore/qrect.h> +#include <QtGui/qfont.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextFormatCollection; +class QTextListFormat; +class QRect; +class QPainter; +class QPrinter; +class QAbstractTextDocumentLayout; +class QPoint; +class QTextCursor; +class QTextObject; +class QTextFormat; +class QTextFrame; +class QTextBlock; +class QTextCodec; +class QUrl; +class QVariant; +class QRectF; +class QTextOption; + +template<typename T> class QVector; + +namespace Qt +{ + enum HitTestAccuracy { ExactHit, FuzzyHit }; + enum WhiteSpaceMode { + WhiteSpaceNormal, + WhiteSpacePre, + WhiteSpaceNoWrap, + WhiteSpaceModeUndefined = -1 + }; + + Q_GUI_EXPORT bool mightBeRichText(const QString&); + Q_GUI_EXPORT QString escape(const QString& plain); + Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre); + +#ifndef QT_NO_TEXTCODEC + Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba); +#endif +} + +class Q_GUI_EXPORT QAbstractUndoItem +{ +public: + virtual ~QAbstractUndoItem() = 0; + virtual void undo() = 0; + virtual void redo() = 0; +}; + +inline QAbstractUndoItem::~QAbstractUndoItem() +{ +} + +class QTextDocumentPrivate; + +class Q_GUI_EXPORT QTextDocument : public QObject +{ + Q_OBJECT + + Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) + Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) + Q_PROPERTY(QSizeF pageSize READ pageSize WRITE setPageSize) + Q_PROPERTY(QFont defaultFont READ defaultFont WRITE setDefaultFont) + Q_PROPERTY(bool useDesignMetrics READ useDesignMetrics WRITE setUseDesignMetrics) + Q_PROPERTY(QSizeF size READ size) + Q_PROPERTY(qreal textWidth READ textWidth WRITE setTextWidth) + Q_PROPERTY(int blockCount READ blockCount) + Q_PROPERTY(qreal indentWidth READ indentWidth WRITE setIndentWidth) +#ifndef QT_NO_CSSPARSER + Q_PROPERTY(QString defaultStyleSheet READ defaultStyleSheet WRITE setDefaultStyleSheet) +#endif + Q_PROPERTY(int maximumBlockCount READ maximumBlockCount WRITE setMaximumBlockCount) + Q_PROPERTY(qreal documentMargin READ documentMargin WRITE setDocumentMargin) + QDOC_PROPERTY(QTextOption defaultTextOption READ defaultTextOption WRITE setDefaultTextOption) + +public: + explicit QTextDocument(QObject *parent = 0); + explicit QTextDocument(const QString &text, QObject *parent = 0); + ~QTextDocument(); + + QTextDocument *clone(QObject *parent = 0) const; + + bool isEmpty() const; + virtual void clear(); + + void setUndoRedoEnabled(bool enable); + bool isUndoRedoEnabled() const; + + bool isUndoAvailable() const; + bool isRedoAvailable() const; + + int availableUndoSteps() const; + int availableRedoSteps() const; + + int revision() const; + + void setDocumentLayout(QAbstractTextDocumentLayout *layout); + QAbstractTextDocumentLayout *documentLayout() const; + + enum MetaInformation { + DocumentTitle, + DocumentUrl + }; + void setMetaInformation(MetaInformation info, const QString &); + QString metaInformation(MetaInformation info) const; + +#ifndef QT_NO_TEXTHTMLPARSER + QString toHtml(const QByteArray &encoding = QByteArray()) const; + void setHtml(const QString &html); +#endif + + QString toPlainText() const; + void setPlainText(const QString &text); + + QChar characterAt(int pos) const; + + enum FindFlag + { + FindBackward = 0x00001, + FindCaseSensitively = 0x00002, + FindWholeWords = 0x00004 + }; + Q_DECLARE_FLAGS(FindFlags, FindFlag) + + QTextCursor find(const QString &subString, int from = 0, FindFlags options = 0) const; + QTextCursor find(const QString &subString, const QTextCursor &from, FindFlags options = 0) const; + + QTextCursor find(const QRegExp &expr, int from = 0, FindFlags options = 0) const; + QTextCursor find(const QRegExp &expr, const QTextCursor &from, FindFlags options = 0) const; + + QTextFrame *frameAt(int pos) const; + QTextFrame *rootFrame() const; + + QTextObject *object(int objectIndex) const; + QTextObject *objectForFormat(const QTextFormat &) const; + + QTextBlock findBlock(int pos) const; + QTextBlock findBlockByNumber(int blockNumber) const; + QTextBlock findBlockByLineNumber(int blockNumber) const; + QTextBlock begin() const; + QTextBlock end() const; + + QTextBlock firstBlock() const; + QTextBlock lastBlock() const; + + void setPageSize(const QSizeF &size); + QSizeF pageSize() const; + + void setDefaultFont(const QFont &font); + QFont defaultFont() const; + + int pageCount() const; + + bool isModified() const; + +#ifndef QT_NO_PRINTER + void print(QPrinter *printer) const; +#endif + + enum ResourceType { + HtmlResource = 1, + ImageResource = 2, + StyleSheetResource = 3, + + UserResource = 100 + }; + + QVariant resource(int type, const QUrl &name) const; + void addResource(int type, const QUrl &name, const QVariant &resource); + + QVector<QTextFormat> allFormats() const; + + void markContentsDirty(int from, int length); + + void setUseDesignMetrics(bool b); + bool useDesignMetrics() const; + + void drawContents(QPainter *painter, const QRectF &rect = QRectF()); + + void setTextWidth(qreal width); + qreal textWidth() const; + + qreal idealWidth() const; + + qreal indentWidth() const; + void setIndentWidth(qreal width); + + qreal documentMargin() const; + void setDocumentMargin(qreal margin); + + void adjustSize(); + QSizeF size() const; + + int blockCount() const; + int lineCount() const; + int characterCount() const; + +#ifndef QT_NO_CSSPARSER + void setDefaultStyleSheet(const QString &sheet); + QString defaultStyleSheet() const; +#endif + + void undo(QTextCursor *cursor); + void redo(QTextCursor *cursor); + + int maximumBlockCount() const; + void setMaximumBlockCount(int maximum); + + QTextOption defaultTextOption() const; + void setDefaultTextOption(const QTextOption &option); + +Q_SIGNALS: + void contentsChange(int from, int charsRemoves, int charsAdded); + void contentsChanged(); + void undoAvailable(bool); + void redoAvailable(bool); + void undoCommandAdded(); + void modificationChanged(bool m); + void cursorPositionChanged(const QTextCursor &cursor); + void blockCountChanged(int newBlockCount); + + void documentLayoutChanged(); + +public Q_SLOTS: + void undo(); + void redo(); + void appendUndoItem(QAbstractUndoItem *); + void setModified(bool m = true); + +protected: + virtual QTextObject *createObject(const QTextFormat &f); + virtual QVariant loadResource(int type, const QUrl &name); + + QTextDocument(QTextDocumentPrivate &dd, QObject *parent); +public: + QTextDocumentPrivate *docHandle() const; +private: + Q_DISABLE_COPY(QTextDocument) + Q_DECLARE_PRIVATE(QTextDocument) + friend class QTextObjectPrivate; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextDocument::FindFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTDOCUMENT_H diff --git a/qtinterface/qt4/Qt/qtextdocumentfragment.h b/qtinterface/qt4/Qt/qtextdocumentfragment.h new file mode 100644 index 0000000..6a51f3e --- /dev/null +++ b/qtinterface/qt4/Qt/qtextdocumentfragment.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTDOCUMENTFRAGMENT_H +#define QTEXTDOCUMENTFRAGMENT_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextStream; +class QTextDocument; +class QTextDocumentFragmentPrivate; +class QTextCursor; + +class Q_GUI_EXPORT QTextDocumentFragment +{ +public: + QTextDocumentFragment(); + explicit QTextDocumentFragment(const QTextDocument *document); + explicit QTextDocumentFragment(const QTextCursor &range); + QTextDocumentFragment(const QTextDocumentFragment &rhs); + QTextDocumentFragment &operator=(const QTextDocumentFragment &rhs); + ~QTextDocumentFragment(); + + bool isEmpty() const; + + QString toPlainText() const; +#ifndef QT_NO_TEXTHTMLPARSER + QString toHtml() const; + QString toHtml(const QByteArray &encoding) const; +#endif // QT_NO_TEXTHTMLPARSER + + static QTextDocumentFragment fromPlainText(const QString &plainText); +#ifndef QT_NO_TEXTHTMLPARSER + static QTextDocumentFragment fromHtml(const QString &html); + static QTextDocumentFragment fromHtml(const QString &html, const QTextDocument *resourceProvider); +#endif // QT_NO_TEXTHTMLPARSER + +private: + QTextDocumentFragmentPrivate *d; + friend class QTextCursor; + friend class QTextDocumentWriter; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTDOCUMENTFRAGMENT_H diff --git a/qtinterface/qt4/Qt/qtextdocumentwriter.h b/qtinterface/qt4/Qt/qtextdocumentwriter.h new file mode 100644 index 0000000..09cec6d --- /dev/null +++ b/qtinterface/qt4/Qt/qtextdocumentwriter.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QTEXTDOCUMENTWRITER_H +#define QTEXTDOCUMENTWRITER_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextDocumentWriterPrivate; +class QIODevice; +class QByteArray; +class QTextDocument; +class QTextDocumentFragment; + +class Q_GUI_EXPORT QTextDocumentWriter +{ +public: + QTextDocumentWriter(); + QTextDocumentWriter(QIODevice *device, const QByteArray &format); + QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray()); + ~QTextDocumentWriter(); + + void setFormat (const QByteArray &format); + QByteArray format () const; + + void setDevice (QIODevice *device); + QIODevice *device () const; + void setFileName (const QString &fileName); + QString fileName () const; + + bool write(const QTextDocument *document); + bool write(const QTextDocumentFragment &fragment); + +#ifndef QT_NO_TEXTCODEC + void setCodec(QTextCodec *codec); + QTextCodec *codec() const; +#endif + + static QList<QByteArray> supportedDocumentFormats(); + +private: + Q_DISABLE_COPY(QTextDocumentWriter) + QTextDocumentWriterPrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtextedit.h b/qtinterface/qt4/Qt/qtextedit.h new file mode 100644 index 0000000..f7470ca --- /dev/null +++ b/qtinterface/qt4/Qt/qtextedit.h @@ -0,0 +1,430 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTEDIT_H +#define QTEXTEDIT_H + +#include <QtGui/qabstractscrollarea.h> +#include <QtGui/qtextdocument.h> +#include <QtGui/qtextoption.h> +#include <QtGui/qtextcursor.h> +#include <QtGui/qtextformat.h> + +#ifndef QT_NO_TEXTEDIT + +#ifdef QT3_SUPPORT +#include <QtGui/qtextobject.h> +#include <QtGui/qtextlayout.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyleSheet; +class QTextDocument; +class QMenu; +class QTextEditPrivate; +class QMimeData; + +class Q_GUI_EXPORT QTextEdit : public QAbstractScrollArea +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTextEdit) + Q_FLAGS(AutoFormatting) + Q_ENUMS(LineWrapMode) + Q_PROPERTY(AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting) + Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) + Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) + Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) + Q_PROPERTY(LineWrapMode lineWrapMode READ lineWrapMode WRITE setLineWrapMode) + QDOC_PROPERTY(QTextOption::WrapMode wordWrapMode READ wordWrapMode WRITE setWordWrapMode) + Q_PROPERTY(int lineWrapColumnOrWidth READ lineWrapColumnOrWidth WRITE setLineWrapColumnOrWidth) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) +#ifndef QT_NO_TEXTHTMLPARSER + Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) +#endif + Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText DESIGNABLE false) + Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) + Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth) + Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) + Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) + Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) +public: + enum LineWrapMode { + NoWrap, + WidgetWidth, + FixedPixelWidth, + FixedColumnWidth + }; + + enum AutoFormattingFlag { + AutoNone = 0, + AutoBulletList = 0x00000001, + AutoAll = 0xffffffff + }; + + Q_DECLARE_FLAGS(AutoFormatting, AutoFormattingFlag) + +#if defined(QT3_SUPPORT) + enum CursorAction { + MoveBackward, + MoveForward, + MoveWordBackward, + MoveWordForward, + MoveUp, + MoveDown, + MoveLineStart, + MoveLineEnd, + MoveHome, + MoveEnd, + MovePageUp, + MovePageDown +#if !defined(Q_MOC_RUN) + , + MovePgUp = MovePageUp, + MovePgDown = MovePageDown +#endif + }; +#endif + + explicit QTextEdit(QWidget *parent = 0); + explicit QTextEdit(const QString &text, QWidget *parent = 0); + virtual ~QTextEdit(); + + void setDocument(QTextDocument *document); + QTextDocument *document() const; + + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + + bool isReadOnly() const; + void setReadOnly(bool ro); + + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + + qreal fontPointSize() const; + QString fontFamily() const; + int fontWeight() const; + bool fontUnderline() const; + bool fontItalic() const; + QColor textColor() const; + QColor textBackgroundColor() const; + QFont currentFont() const; + Qt::Alignment alignment() const; + + void mergeCurrentCharFormat(const QTextCharFormat &modifier); + + void setCurrentCharFormat(const QTextCharFormat &format); + QTextCharFormat currentCharFormat() const; + + AutoFormatting autoFormatting() const; + void setAutoFormatting(AutoFormatting features); + + bool tabChangesFocus() const; + void setTabChangesFocus(bool b); + + inline void setDocumentTitle(const QString &title) + { document()->setMetaInformation(QTextDocument::DocumentTitle, title); } + inline QString documentTitle() const + { return document()->metaInformation(QTextDocument::DocumentTitle); } + + inline bool isUndoRedoEnabled() const + { return document()->isUndoRedoEnabled(); } + inline void setUndoRedoEnabled(bool enable) + { document()->setUndoRedoEnabled(enable); } + + LineWrapMode lineWrapMode() const; + void setLineWrapMode(LineWrapMode mode); + + int lineWrapColumnOrWidth() const; + void setLineWrapColumnOrWidth(int w); + + QTextOption::WrapMode wordWrapMode() const; + void setWordWrapMode(QTextOption::WrapMode policy); + + bool find(const QString &exp, QTextDocument::FindFlags options = 0); + + inline QString toPlainText() const + { return document()->toPlainText(); } +#ifndef QT_NO_TEXTHTMLPARSER + inline QString toHtml() const + { return document()->toHtml(); } +#endif + + void ensureCursorVisible(); + + virtual QVariant loadResource(int type, const QUrl &name); +#ifndef QT_NO_CONTEXTMENU + QMenu *createStandardContextMenu(); + QMenu *createStandardContextMenu(const QPoint &position); +#endif + + QTextCursor cursorForPosition(const QPoint &pos) const; + QRect cursorRect(const QTextCursor &cursor) const; + QRect cursorRect() const; + + QString anchorAt(const QPoint& pos) const; + + bool overwriteMode() const; + void setOverwriteMode(bool overwrite); + + int tabStopWidth() const; + void setTabStopWidth(int width); + + int cursorWidth() const; + void setCursorWidth(int width); + + bool acceptRichText() const; + void setAcceptRichText(bool accept); + + struct ExtraSelection + { + QTextCursor cursor; + QTextCharFormat format; + }; + void setExtraSelections(const QList<ExtraSelection> &selections); + QList<ExtraSelection> extraSelections() const; + + void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + + bool canPaste() const; + +#ifndef QT_NO_PRINTER + void print(QPrinter *printer) const; +#endif + +public Q_SLOTS: + void setFontPointSize(qreal s); + void setFontFamily(const QString &fontFamily); + void setFontWeight(int w); + void setFontUnderline(bool b); + void setFontItalic(bool b); + void setTextColor(const QColor &c); + void setTextBackgroundColor(const QColor &c); + void setCurrentFont(const QFont &f); + void setAlignment(Qt::Alignment a); + + void setPlainText(const QString &text); +#ifndef QT_NO_TEXTHTMLPARSER + void setHtml(const QString &text); +#endif + void setText(const QString &text); + +#ifndef QT_NO_CLIPBOARD + void cut(); + void copy(); + void paste(); +#endif + + void undo(); + void redo(); + + void clear(); + void selectAll(); + + void insertPlainText(const QString &text); +#ifndef QT_NO_TEXTHTMLPARSER + void insertHtml(const QString &text); +#endif // QT_NO_TEXTHTMLPARSER + + void append(const QString &text); + + void scrollToAnchor(const QString &name); + + void zoomIn(int range = 1); + void zoomOut(int range = 1); + +Q_SIGNALS: + void textChanged(); + void undoAvailable(bool b); + void redoAvailable(bool b); + void currentCharFormatChanged(const QTextCharFormat &format); + void copyAvailable(bool b); + void selectionChanged(); + void cursorPositionChanged(); + +protected: + virtual bool event(QEvent *e); + virtual void timerEvent(QTimerEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void paintEvent(QPaintEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual bool focusNextPrevChild(bool next); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QContextMenuEvent *e); +#endif +#ifndef QT_NO_DRAGANDDROP + virtual void dragEnterEvent(QDragEnterEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dropEvent(QDropEvent *e); +#endif + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void showEvent(QShowEvent *); + virtual void changeEvent(QEvent *e); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *e); +#endif + + virtual QMimeData *createMimeDataFromSelection() const; + virtual bool canInsertFromMimeData(const QMimeData *source) const; + virtual void insertFromMimeData(const QMimeData *source); + + virtual void inputMethodEvent(QInputMethodEvent *); + QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + + QTextEdit(QTextEditPrivate &dd, QWidget *parent); + + virtual void scrollContentsBy(int dx, int dy); + +#ifdef QT3_SUPPORT +Q_SIGNALS: + QT_MOC_COMPAT void currentFontChanged(const QFont &f); + QT_MOC_COMPAT void currentColorChanged(const QColor &c); + +public: + QT3_SUPPORT_CONSTRUCTOR QTextEdit(QWidget *parent, const char *name); + inline QT3_SUPPORT bool find(const QString &exp, bool cs, bool wo) + { + QTextDocument::FindFlags flags = 0; + if (cs) + flags |= QTextDocument::FindCaseSensitively; + if (wo) + flags |= QTextDocument::FindWholeWords; + return find(exp, flags); + } + + inline QT3_SUPPORT void sync() {} + + QT3_SUPPORT void moveCursor(CursorAction action, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + QT3_SUPPORT void moveCursor(CursorAction action, bool select); + + enum KeyboardAction { + ActionBackspace, + ActionDelete, + ActionReturn, + ActionKill, + ActionWordBackspace, + ActionWordDelete + }; + + QT3_SUPPORT void doKeyboardAction(KeyboardAction action); + + QT3_SUPPORT QString text() const; + QT3_SUPPORT void setTextFormat(Qt::TextFormat); + QT3_SUPPORT Qt::TextFormat textFormat() const; + + inline QT3_SUPPORT void setBold(bool b) { setFontWeight(b ? QFont::Bold : QFont::Normal); } + inline QT3_SUPPORT void setUnderline(bool b) { setFontUnderline(b); } + inline QT3_SUPPORT void setItalic(bool i) { setFontItalic(i); } + inline QT3_SUPPORT void setFamily(const QString &family) { setFontFamily(family); } + inline QT3_SUPPORT void setPointSize(int size) { setFontPointSize(size); } + + inline QT3_SUPPORT bool italic() const { return fontItalic(); } + inline QT3_SUPPORT bool bold() const { return fontWeight() >= QFont::Bold; } + inline QT3_SUPPORT bool underline() const { return fontUnderline(); } + inline QT3_SUPPORT QString family() const { return fontFamily(); } + inline QT3_SUPPORT int pointSize() const { return (int)(fontPointSize()+0.5); } + + inline QT3_SUPPORT bool hasSelectedText() const + { return textCursor().hasSelection(); } + inline QT3_SUPPORT QString selectedText() const + { return textCursor().selectedText(); } + + inline QT3_SUPPORT bool isUndoAvailable() const + { return document()->isUndoAvailable(); } + inline QT3_SUPPORT bool isRedoAvailable() const + { return document()->isRedoAvailable(); } + + inline QT3_SUPPORT void insert(const QString &text) + { insertPlainText(text); } + + inline QT3_SUPPORT bool isModified() const + { return document()->isModified(); } + + inline QT3_SUPPORT QColor color() const + { return textColor(); } + +public Q_SLOTS: + inline QT_MOC_COMPAT void setModified(bool m = true) + { document()->setModified(m); } +public: + inline QT3_SUPPORT void undo() const + { document()->undo(); } + inline QT3_SUPPORT void redo() const + { document()->redo(); } + +public Q_SLOTS: + inline QT_MOC_COMPAT void setColor(const QColor &c) + { setTextColor(c); } + +#endif + +private: + Q_DISABLE_COPY(QTextEdit) + Q_PRIVATE_SLOT(d_func(), void _q_repaintContents(const QRectF &r)) + Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &)) + Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) + Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &)) + friend class QTextEditControl; + friend class QTextDocument; + friend class QTextControl; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_TEXTEDIT + +#endif // QTEXTEDIT_H diff --git a/qtinterface/qt4/Qt/qtextformat.h b/qtinterface/qt4/Qt/qtextformat.h new file mode 100644 index 0000000..a86451c --- /dev/null +++ b/qtinterface/qt4/Qt/qtextformat.h @@ -0,0 +1,914 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTFORMAT_H +#define QTEXTFORMAT_H + +#include <QtGui/qcolor.h> +#include <QtGui/qfont.h> +#include <QtCore/qshareddata.h> +#include <QtCore/qvector.h> +#include <QtCore/qvariant.h> +#include <QtGui/qpen.h> +#include <QtGui/qbrush.h> +#include <QtGui/qtextoption.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QString; +class QVariant; +class QFont; + +class QTextFormatCollection; +class QTextFormatPrivate; +class QTextBlockFormat; +class QTextCharFormat; +class QTextListFormat; +class QTextTableFormat; +class QTextFrameFormat; +class QTextImageFormat; +class QTextTableCellFormat; +class QTextFormat; +class QTextObject; +class QTextCursor; +class QTextDocument; +class QTextLength; + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); +#endif + +class Q_GUI_EXPORT QTextLength +{ +public: + enum Type { VariableLength = 0, FixedLength, PercentageLength }; + + inline QTextLength() : lengthType(VariableLength), fixedValueOrPercentage(0) {} + + inline explicit QTextLength(Type type, qreal value); + + inline Type type() const { return lengthType; } + inline qreal value(qreal maximumLength) const + { + switch (lengthType) { + case FixedLength: return fixedValueOrPercentage; + case VariableLength: return maximumLength; + case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100); + } + return -1; + } + + inline qreal rawValue() const { return fixedValueOrPercentage; } + + inline bool operator==(const QTextLength &other) const + { return lengthType == other.lengthType + && qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); } + inline bool operator!=(const QTextLength &other) const + { return lengthType != other.lengthType + || !qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); } + operator QVariant() const; + +private: + Type lengthType; + qreal fixedValueOrPercentage; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); +}; + +inline QTextLength::QTextLength(Type atype, qreal avalue) + : lengthType(atype), fixedValueOrPercentage(avalue) {} + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); +#endif + +class Q_GUI_EXPORT QTextFormat +{ + Q_GADGET + Q_ENUMS(FormatType Property ObjectTypes) +public: + enum FormatType { + InvalidFormat = -1, + BlockFormat = 1, + CharFormat = 2, + ListFormat = 3, + TableFormat = 4, + FrameFormat = 5, + + UserFormat = 100 + }; + + enum Property { + ObjectIndex = 0x0, + + // paragraph and char + CssFloat = 0x0800, + LayoutDirection = 0x0801, + + OutlinePen = 0x810, + BackgroundBrush = 0x820, + ForegroundBrush = 0x821, + // Internal to qtextlayout.cpp: ObjectSelectionBrush = 0x822 + BackgroundImageUrl = 0x823, + + // paragraph + BlockAlignment = 0x1010, + BlockTopMargin = 0x1030, + BlockBottomMargin = 0x1031, + BlockLeftMargin = 0x1032, + BlockRightMargin = 0x1033, + TextIndent = 0x1034, + TabPositions = 0x1035, + BlockIndent = 0x1040, + BlockNonBreakableLines = 0x1050, + BlockTrailingHorizontalRulerWidth = 0x1060, + + // character properties + FirstFontProperty = 0x1FE0, + FontCapitalization = FirstFontProperty, + FontLetterSpacing = 0x1FE1, + FontWordSpacing = 0x1FE2, + FontStyleHint = 0x1FE3, + FontStyleStrategy = 0x1FE4, + FontKerning = 0x1FE5, + FontFamily = 0x2000, + FontPointSize = 0x2001, + FontSizeAdjustment = 0x2002, + FontSizeIncrement = FontSizeAdjustment, // old name, compat + FontWeight = 0x2003, + FontItalic = 0x2004, + FontUnderline = 0x2005, // deprecated, use TextUnderlineStyle instead + FontOverline = 0x2006, + FontStrikeOut = 0x2007, + FontFixedPitch = 0x2008, + FontPixelSize = 0x2009, + LastFontProperty = FontPixelSize, + + TextUnderlineColor = 0x2010, + TextVerticalAlignment = 0x2021, + TextOutline = 0x2022, + TextUnderlineStyle = 0x2023, + TextToolTip = 0x2024, + + IsAnchor = 0x2030, + AnchorHref = 0x2031, + AnchorName = 0x2032, + ObjectType = 0x2f00, + + // list properties + ListStyle = 0x3000, + ListIndent = 0x3001, + + // table and frame properties + FrameBorder = 0x4000, + FrameMargin = 0x4001, + FramePadding = 0x4002, + FrameWidth = 0x4003, + FrameHeight = 0x4004, + FrameTopMargin = 0x4005, + FrameBottomMargin = 0x4006, + FrameLeftMargin = 0x4007, + FrameRightMargin = 0x4008, + FrameBorderBrush = 0x4009, + FrameBorderStyle = 0x4010, + + TableColumns = 0x4100, + TableColumnWidthConstraints = 0x4101, + TableCellSpacing = 0x4102, + TableCellPadding = 0x4103, + TableHeaderRowCount = 0x4104, + + // table cell properties + TableCellRowSpan = 0x4810, + TableCellColumnSpan = 0x4811, + + TableCellTopPadding = 0x4812, + TableCellBottomPadding = 0x4813, + TableCellLeftPadding = 0x4814, + TableCellRightPadding = 0x4815, + + // image properties + ImageName = 0x5000, + ImageWidth = 0x5010, + ImageHeight = 0x5011, + + // internal + /* + SuppressText = 0x5012, + SuppressBackground = 0x513 + */ + + // selection properties + FullWidthSelection = 0x06000, + + // page break properties + PageBreakPolicy = 0x7000, + + // -- + UserProperty = 0x100000 + }; + + enum ObjectTypes { + NoObject, + ImageObject, + TableObject, + TableCellObject, + + UserObject = 0x1000 + }; + + enum PageBreakFlag { + PageBreak_Auto = 0, + PageBreak_AlwaysBefore = 0x001, + PageBreak_AlwaysAfter = 0x010 + // PageBreak_AlwaysInside = 0x100 + }; + Q_DECLARE_FLAGS(PageBreakFlags, PageBreakFlag) + + QTextFormat(); + + explicit QTextFormat(int type); + + QTextFormat(const QTextFormat &rhs); + QTextFormat &operator=(const QTextFormat &rhs); + ~QTextFormat(); + + void merge(const QTextFormat &other); + + inline bool isValid() const { return type() != InvalidFormat; } + + int type() const; + + int objectIndex() const; + void setObjectIndex(int object); + + QVariant property(int propertyId) const; + void setProperty(int propertyId, const QVariant &value); + void clearProperty(int propertyId); + bool hasProperty(int propertyId) const; + + bool boolProperty(int propertyId) const; + int intProperty(int propertyId) const; + qreal doubleProperty(int propertyId) const; + QString stringProperty(int propertyId) const; + QColor colorProperty(int propertyId) const; + QPen penProperty(int propertyId) const; + QBrush brushProperty(int propertyId) const; + QTextLength lengthProperty(int propertyId) const; + QVector<QTextLength> lengthVectorProperty(int propertyId) const; + + void setProperty(int propertyId, const QVector<QTextLength> &lengths); + + QMap<int, QVariant> properties() const; + int propertyCount() const; + + inline void setObjectType(int type); + inline int objectType() const + { return intProperty(ObjectType); } + + inline bool isCharFormat() const { return type() == CharFormat; } + inline bool isBlockFormat() const { return type() == BlockFormat; } + inline bool isListFormat() const { return type() == ListFormat; } + inline bool isFrameFormat() const { return type() == FrameFormat; } + inline bool isImageFormat() const { return type() == CharFormat && objectType() == ImageObject; } + inline bool isTableFormat() const { return type() == FrameFormat && objectType() == TableObject; } + inline bool isTableCellFormat() const { return type() == CharFormat && objectType() == TableCellObject; } + + QTextBlockFormat toBlockFormat() const; + QTextCharFormat toCharFormat() const; + QTextListFormat toListFormat() const; + QTextTableFormat toTableFormat() const; + QTextFrameFormat toFrameFormat() const; + QTextImageFormat toImageFormat() const; + QTextTableCellFormat toTableCellFormat() const; + + bool operator==(const QTextFormat &rhs) const; + inline bool operator!=(const QTextFormat &rhs) const { return !operator==(rhs); } + operator QVariant() const; + + inline void setLayoutDirection(Qt::LayoutDirection direction) + { setProperty(QTextFormat::LayoutDirection, direction); } + inline Qt::LayoutDirection layoutDirection() const + { return Qt::LayoutDirection(intProperty(QTextFormat::LayoutDirection)); } + + inline void setBackground(const QBrush &brush) + { setProperty(BackgroundBrush, brush); } + inline QBrush background() const + { return brushProperty(BackgroundBrush); } + inline void clearBackground() + { clearProperty(BackgroundBrush); } + + inline void setForeground(const QBrush &brush) + { setProperty(ForegroundBrush, brush); } + inline QBrush foreground() const + { return brushProperty(ForegroundBrush); } + inline void clearForeground() + { clearProperty(ForegroundBrush); } + +private: + QSharedDataPointer<QTextFormatPrivate> d; + qint32 format_type; + + friend class QTextFormatCollection; + friend class QTextCharFormat; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); +}; + +inline void QTextFormat::setObjectType(int atype) +{ setProperty(ObjectType, atype); } + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextFormat::PageBreakFlags) + +class Q_GUI_EXPORT QTextCharFormat : public QTextFormat +{ +public: + enum VerticalAlignment { + AlignNormal = 0, + AlignSuperScript, + AlignSubScript, + AlignMiddle, + AlignTop, + AlignBottom + }; + enum UnderlineStyle { // keep in sync with Qt::PenStyle! + NoUnderline, + SingleUnderline, + DashUnderline, + DotLine, + DashDotLine, + DashDotDotLine, + WaveUnderline, + SpellCheckUnderline + }; + + QTextCharFormat(); + + bool isValid() const { return isCharFormat(); } + void setFont(const QFont &font); + QFont font() const; + + inline void setFontFamily(const QString &family) + { setProperty(FontFamily, family); } + inline QString fontFamily() const + { return stringProperty(FontFamily); } + + inline void setFontPointSize(qreal size) + { setProperty(FontPointSize, size); } + inline qreal fontPointSize() const + { return doubleProperty(FontPointSize); } + + inline void setFontWeight(int weight) + { if (weight == QFont::Normal) weight = 0; setProperty(FontWeight, weight); } + inline int fontWeight() const + { int weight = intProperty(FontWeight); if (weight == 0) weight = QFont::Normal; return weight; } + inline void setFontItalic(bool italic) + { setProperty(FontItalic, italic); } + inline bool fontItalic() const + { return boolProperty(FontItalic); } + inline void setFontCapitalization(QFont::Capitalization capitalization) + { setProperty(FontCapitalization, capitalization); } + inline QFont::Capitalization fontCapitalization() const + { return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); } + inline void setFontLetterSpacing(qreal spacing) + { setProperty(FontLetterSpacing, spacing); } + inline qreal fontLetterSpacing() const + { return doubleProperty(FontLetterSpacing); } + inline void setFontWordSpacing(qreal spacing) + { setProperty(FontWordSpacing, spacing); } + inline qreal fontWordSpacing() const + { return doubleProperty(FontWordSpacing); } + + inline void setFontUnderline(bool underline) + { setProperty(TextUnderlineStyle, underline ? SingleUnderline : NoUnderline); } + bool fontUnderline() const; + + inline void setFontOverline(bool overline) + { setProperty(FontOverline, overline); } + inline bool fontOverline() const + { return boolProperty(FontOverline); } + + inline void setFontStrikeOut(bool strikeOut) + { setProperty(FontStrikeOut, strikeOut); } + inline bool fontStrikeOut() const + { return boolProperty(FontStrikeOut); } + + inline void setUnderlineColor(const QColor &color) + { setProperty(TextUnderlineColor, color); } + inline QColor underlineColor() const + { return colorProperty(TextUnderlineColor); } + + inline void setFontFixedPitch(bool fixedPitch) + { setProperty(FontFixedPitch, fixedPitch); } + inline bool fontFixedPitch() const + { return boolProperty(FontFixedPitch); } + + inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault) + { setProperty(FontStyleHint, hint); setProperty(FontStyleStrategy, strategy); } + inline void setFontStyleStrategy(QFont::StyleStrategy strategy) + { setProperty(FontStyleStrategy, strategy); } + QFont::StyleHint fontStyleHint() const + { return static_cast<QFont::StyleHint>(intProperty(FontStyleHint)); } + QFont::StyleStrategy fontStyleStrategy() const + { return static_cast<QFont::StyleStrategy>(intProperty(FontStyleStrategy)); } + + inline void setFontKerning(bool enable) + { setProperty(FontKerning, enable); } + inline bool fontKerning() const + { return boolProperty(FontKerning); } + + void setUnderlineStyle(UnderlineStyle style); + inline UnderlineStyle underlineStyle() const + { return static_cast<UnderlineStyle>(intProperty(TextUnderlineStyle)); } + + inline void setVerticalAlignment(VerticalAlignment alignment) + { setProperty(TextVerticalAlignment, alignment); } + inline VerticalAlignment verticalAlignment() const + { return static_cast<VerticalAlignment>(intProperty(TextVerticalAlignment)); } + + inline void setTextOutline(const QPen &pen) + { setProperty(TextOutline, pen); } + inline QPen textOutline() const + { return penProperty(TextOutline); } + + inline void setToolTip(const QString &tip) + { setProperty(TextToolTip, tip); } + inline QString toolTip() const + { return stringProperty(TextToolTip); } + + inline void setAnchor(bool anchor) + { setProperty(IsAnchor, anchor); } + inline bool isAnchor() const + { return boolProperty(IsAnchor); } + + inline void setAnchorHref(const QString &value) + { setProperty(AnchorHref, value); } + inline QString anchorHref() const + { return stringProperty(AnchorHref); } + + inline void setAnchorName(const QString &name) + { setAnchorNames(QStringList(name)); } + QString anchorName() const; + + inline void setAnchorNames(const QStringList &names) + { setProperty(AnchorName, names); } + QStringList anchorNames() const; + + inline void setTableCellRowSpan(int tableCellRowSpan); + inline int tableCellRowSpan() const + { int s = intProperty(TableCellRowSpan); if (s == 0) s = 1; return s; } + inline void setTableCellColumnSpan(int tableCellColumnSpan); + inline int tableCellColumnSpan() const + { int s = intProperty(TableCellColumnSpan); if (s == 0) s = 1; return s; } + +protected: + explicit QTextCharFormat(const QTextFormat &fmt); + friend class QTextFormat; +}; + +inline void QTextCharFormat::setTableCellRowSpan(int _tableCellRowSpan) +{ + if (_tableCellRowSpan <= 1) + clearProperty(TableCellRowSpan); // the getter will return 1 here. + else + setProperty(TableCellRowSpan, _tableCellRowSpan); +} + +inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan) +{ + if (_tableCellColumnSpan <= 1) + clearProperty(TableCellColumnSpan); // the getter will return 1 here. + else + setProperty(TableCellColumnSpan, _tableCellColumnSpan); +} + +class Q_GUI_EXPORT QTextBlockFormat : public QTextFormat +{ +public: + QTextBlockFormat(); + + bool isValid() const { return isBlockFormat(); } + + inline void setAlignment(Qt::Alignment alignment); + inline Qt::Alignment alignment() const + { int a = intProperty(BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); } + + inline void setTopMargin(qreal margin) + { setProperty(BlockTopMargin, margin); } + inline qreal topMargin() const + { return doubleProperty(BlockTopMargin); } + + inline void setBottomMargin(qreal margin) + { setProperty(BlockBottomMargin, margin); } + inline qreal bottomMargin() const + { return doubleProperty(BlockBottomMargin); } + + inline void setLeftMargin(qreal margin) + { setProperty(BlockLeftMargin, margin); } + inline qreal leftMargin() const + { return doubleProperty(BlockLeftMargin); } + + inline void setRightMargin(qreal margin) + { setProperty(BlockRightMargin, margin); } + inline qreal rightMargin() const + { return doubleProperty(BlockRightMargin); } + + inline void setTextIndent(qreal aindent) + { setProperty(TextIndent, aindent); } + inline qreal textIndent() const + { return doubleProperty(TextIndent); } + + inline void setIndent(int indent); + inline int indent() const + { return intProperty(BlockIndent); } + + inline void setNonBreakableLines(bool b) + { setProperty(BlockNonBreakableLines, b); } + inline bool nonBreakableLines() const + { return boolProperty(BlockNonBreakableLines); } + + inline void setPageBreakPolicy(PageBreakFlags flags) + { setProperty(PageBreakPolicy, int(flags)); } + inline PageBreakFlags pageBreakPolicy() const + { return PageBreakFlags(intProperty(PageBreakPolicy)); } + + void setTabPositions(const QList<QTextOption::Tab> &tabs); + QList<QTextOption::Tab> tabPositions() const; + +protected: + explicit QTextBlockFormat(const QTextFormat &fmt); + friend class QTextFormat; +}; + +inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment) +{ setProperty(BlockAlignment, int(aalignment)); } + +inline void QTextBlockFormat::setIndent(int aindent) +{ setProperty(BlockIndent, aindent); } + +class Q_GUI_EXPORT QTextListFormat : public QTextFormat +{ +public: + QTextListFormat(); + + bool isValid() const { return isListFormat(); } + + enum Style { + ListDisc = -1, + ListCircle = -2, + ListSquare = -3, + ListDecimal = -4, + ListLowerAlpha = -5, + ListUpperAlpha = -6, + ListLowerRoman = -7, + ListUpperRoman = -8, + ListStyleUndefined = 0 + }; + + inline void setStyle(Style style); + inline Style style() const + { return static_cast<Style>(intProperty(ListStyle)); } + + inline void setIndent(int indent); + inline int indent() const + { return intProperty(ListIndent); } + +protected: + explicit QTextListFormat(const QTextFormat &fmt); + friend class QTextFormat; +}; + +inline void QTextListFormat::setStyle(Style astyle) +{ setProperty(ListStyle, astyle); } + +inline void QTextListFormat::setIndent(int aindent) +{ setProperty(ListIndent, aindent); } + +class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat +{ +public: + QTextImageFormat(); + + bool isValid() const { return isImageFormat(); } + + inline void setName(const QString &name); + inline QString name() const + { return stringProperty(ImageName); } + + inline void setWidth(qreal width); + inline qreal width() const + { return doubleProperty(ImageWidth); } + + inline void setHeight(qreal height); + inline qreal height() const + { return doubleProperty(ImageHeight); } + +protected: + explicit QTextImageFormat(const QTextFormat &format); + friend class QTextFormat; +}; + +inline void QTextImageFormat::setName(const QString &aname) +{ setProperty(ImageName, aname); } + +inline void QTextImageFormat::setWidth(qreal awidth) +{ setProperty(ImageWidth, awidth); } + +inline void QTextImageFormat::setHeight(qreal aheight) +{ setProperty(ImageHeight, aheight); } + +class Q_GUI_EXPORT QTextFrameFormat : public QTextFormat +{ +public: + QTextFrameFormat(); + + bool isValid() const { return isFrameFormat(); } + + enum Position { + InFlow, + FloatLeft, + FloatRight + // ###### +// Absolute + }; + + enum BorderStyle { + BorderStyle_None, + BorderStyle_Dotted, + BorderStyle_Dashed, + BorderStyle_Solid, + BorderStyle_Double, + BorderStyle_DotDash, + BorderStyle_DotDotDash, + BorderStyle_Groove, + BorderStyle_Ridge, + BorderStyle_Inset, + BorderStyle_Outset + }; + + inline void setPosition(Position f) + { setProperty(CssFloat, f); } + inline Position position() const + { return static_cast<Position>(intProperty(CssFloat)); } + + inline void setBorder(qreal border); + inline qreal border() const + { return doubleProperty(FrameBorder); } + + inline void setBorderBrush(const QBrush &brush) + { setProperty(FrameBorderBrush, brush); } + inline QBrush borderBrush() const + { return brushProperty(FrameBorderBrush); } + + inline void setBorderStyle(BorderStyle style) + { setProperty(FrameBorderStyle, style); } + inline BorderStyle borderStyle() const + { return static_cast<BorderStyle>(intProperty(FrameBorderStyle)); } + + void setMargin(qreal margin); + inline qreal margin() const + { return doubleProperty(FrameMargin); } + + inline void setTopMargin(qreal margin); + qreal topMargin() const; + + inline void setBottomMargin(qreal margin); + qreal bottomMargin() const; + + inline void setLeftMargin(qreal margin); + qreal leftMargin() const; + + inline void setRightMargin(qreal margin); + qreal rightMargin() const; + + inline void setPadding(qreal padding); + inline qreal padding() const + { return doubleProperty(FramePadding); } + + inline void setWidth(qreal width); + inline void setWidth(const QTextLength &length) + { setProperty(FrameWidth, length); } + inline QTextLength width() const + { return lengthProperty(FrameWidth); } + + inline void setHeight(qreal height); + inline void setHeight(const QTextLength &height); + inline QTextLength height() const + { return lengthProperty(FrameHeight); } + + inline void setPageBreakPolicy(PageBreakFlags flags) + { setProperty(PageBreakPolicy, int(flags)); } + inline PageBreakFlags pageBreakPolicy() const + { return PageBreakFlags(intProperty(PageBreakPolicy)); } + +protected: + explicit QTextFrameFormat(const QTextFormat &fmt); + friend class QTextFormat; +}; + +inline void QTextFrameFormat::setBorder(qreal aborder) +{ setProperty(FrameBorder, aborder); } + +inline void QTextFrameFormat::setPadding(qreal apadding) +{ setProperty(FramePadding, apadding); } + +inline void QTextFrameFormat::setWidth(qreal awidth) +{ setProperty(FrameWidth, QTextLength(QTextLength::FixedLength, awidth)); } + +inline void QTextFrameFormat::setHeight(qreal aheight) +{ setProperty(FrameHeight, QTextLength(QTextLength::FixedLength, aheight)); } +inline void QTextFrameFormat::setHeight(const QTextLength &aheight) +{ setProperty(FrameHeight, aheight); } + +inline void QTextFrameFormat::setTopMargin(qreal amargin) +{ setProperty(FrameTopMargin, amargin); } + +inline void QTextFrameFormat::setBottomMargin(qreal amargin) +{ setProperty(FrameBottomMargin, amargin); } + +inline void QTextFrameFormat::setLeftMargin(qreal amargin) +{ setProperty(FrameLeftMargin, amargin); } + +inline void QTextFrameFormat::setRightMargin(qreal amargin) +{ setProperty(FrameRightMargin, amargin); } + +class Q_GUI_EXPORT QTextTableFormat : public QTextFrameFormat +{ +public: + QTextTableFormat(); + + inline bool isValid() const { return isTableFormat(); } + + inline int columns() const + { int cols = intProperty(TableColumns); if (cols == 0) cols = 1; return cols; } + inline void setColumns(int columns); + + inline void setColumnWidthConstraints(const QVector<QTextLength> &constraints) + { setProperty(TableColumnWidthConstraints, constraints); } + + inline QVector<QTextLength> columnWidthConstraints() const + { return lengthVectorProperty(TableColumnWidthConstraints); } + + inline void clearColumnWidthConstraints() + { clearProperty(TableColumnWidthConstraints); } + + inline qreal cellSpacing() const + { return doubleProperty(TableCellSpacing); } + inline void setCellSpacing(qreal spacing) + { setProperty(TableCellSpacing, spacing); } + + inline qreal cellPadding() const + { return doubleProperty(TableCellPadding); } + inline void setCellPadding(qreal padding); + + inline void setAlignment(Qt::Alignment alignment); + inline Qt::Alignment alignment() const + { return QFlag(intProperty(BlockAlignment)); } + + inline void setHeaderRowCount(int count) + { setProperty(TableHeaderRowCount, count); } + inline int headerRowCount() const + { return intProperty(TableHeaderRowCount); } + +protected: + explicit QTextTableFormat(const QTextFormat &fmt); + friend class QTextFormat; +}; + +inline void QTextTableFormat::setColumns(int acolumns) +{ + if (acolumns == 1) + acolumns = 0; + setProperty(TableColumns, acolumns); +} + +inline void QTextTableFormat::setCellPadding(qreal apadding) +{ setProperty(TableCellPadding, apadding); } + +inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment) +{ setProperty(BlockAlignment, int(aalignment)); } + +class Q_GUI_EXPORT QTextTableCellFormat : public QTextCharFormat +{ +public: + QTextTableCellFormat(); + + inline bool isValid() const { return isTableCellFormat(); } + + inline void setTopPadding(qreal padding); + inline qreal topPadding() const; + + inline void setBottomPadding(qreal padding); + inline qreal bottomPadding() const; + + inline void setLeftPadding(qreal padding); + inline qreal leftPadding() const; + + inline void setRightPadding(qreal padding); + inline qreal rightPadding() const; + + inline void setPadding(qreal padding); + +protected: + explicit QTextTableCellFormat(const QTextFormat &fmt); + friend class QTextFormat; +}; + +inline void QTextTableCellFormat::setTopPadding(qreal padding) +{ + setProperty(TableCellTopPadding, padding); +} + +inline qreal QTextTableCellFormat::topPadding() const +{ + return doubleProperty(TableCellTopPadding); +} + +inline void QTextTableCellFormat::setBottomPadding(qreal padding) +{ + setProperty(TableCellBottomPadding, padding); +} + +inline qreal QTextTableCellFormat::bottomPadding() const +{ + return doubleProperty(TableCellBottomPadding); +} + +inline void QTextTableCellFormat::setLeftPadding(qreal padding) +{ + setProperty(TableCellLeftPadding, padding); +} + +inline qreal QTextTableCellFormat::leftPadding() const +{ + return doubleProperty(TableCellLeftPadding); +} + +inline void QTextTableCellFormat::setRightPadding(qreal padding) +{ + setProperty(TableCellRightPadding, padding); +} + +inline qreal QTextTableCellFormat::rightPadding() const +{ + return doubleProperty(TableCellRightPadding); +} + +inline void QTextTableCellFormat::setPadding(qreal padding) +{ + setTopPadding(padding); + setBottomPadding(padding); + setLeftPadding(padding); + setRightPadding(padding); +} + + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTFORMAT_H diff --git a/qtinterface/qt4/Qt/qtextlayout.h b/qtinterface/qt4/Qt/qtextlayout.h new file mode 100644 index 0000000..50a1f97 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextlayout.h @@ -0,0 +1,247 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QTEXTLAYOUT_H +#define QTEXTLAYOUT_H + +#include <QtCore/qstring.h> +#include <QtCore/qnamespace.h> +#include <QtCore/qrect.h> +#include <QtCore/qvector.h> +#include <QtGui/qcolor.h> +#include <QtCore/qobject.h> +#include <QtGui/qevent.h> +#include <QtGui/qtextformat.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextEngine; +class QFont; +class QRect; +class QRegion; +class QTextFormat; +class QPalette; +class QPainter; + +class Q_GUI_EXPORT QTextInlineObject +{ +public: + QTextInlineObject(int i, QTextEngine *e) : itm(i), eng(e) {} + inline QTextInlineObject() : itm(0), eng(0) {} + inline bool isValid() const { return eng; } + + QRectF rect() const; + qreal width() const; + qreal ascent() const; + qreal descent() const; + qreal height() const; + + Qt::LayoutDirection textDirection() const; + + void setWidth(qreal w); + void setAscent(qreal a); + void setDescent(qreal d); + + int textPosition() const; + + int formatIndex() const; + QTextFormat format() const; + +private: + friend class QTextLayout; + int itm; + QTextEngine *eng; +}; + +class QPaintDevice; +class QTextFormat; +class QTextLine; +class QTextBlock; +class QTextOption; + +class Q_GUI_EXPORT QTextLayout +{ +public: + // does itemization + QTextLayout(); + QTextLayout(const QString& text); + QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = 0); + QTextLayout(const QTextBlock &b); + ~QTextLayout(); + + void setFont(const QFont &f); + QFont font() const; + + void setText(const QString& string); + QString text() const; + + void setTextOption(const QTextOption &option); + QTextOption textOption() const; + + void setPreeditArea(int position, const QString &text); + int preeditAreaPosition() const; + QString preeditAreaText() const; + + struct FormatRange { + int start; + int length; + QTextCharFormat format; + }; + void setAdditionalFormats(const QList<FormatRange> &overrides); + QList<FormatRange> additionalFormats() const; + void clearAdditionalFormats(); + + void setCacheEnabled(bool enable); + bool cacheEnabled() const; + + void beginLayout(); + void endLayout(); + void clearLayout(); + + QTextLine createLine(); + + int lineCount() const; + QTextLine lineAt(int i) const; + QTextLine lineForTextPosition(int pos) const; + + enum CursorMode { + SkipCharacters, + SkipWords + }; + bool isValidCursorPosition(int pos) const; + int nextCursorPosition(int oldPos, CursorMode mode = SkipCharacters) const; + int previousCursorPosition(int oldPos, CursorMode mode = SkipCharacters) const; + + void draw(QPainter *p, const QPointF &pos, const QVector<FormatRange> &selections = QVector<FormatRange>(), + const QRectF &clip = QRectF()) const; + void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const; + void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width) const; + + QPointF position() const; + void setPosition(const QPointF &p); + + QRectF boundingRect() const; + + qreal minimumWidth() const; + qreal maximumWidth() const; + + QTextEngine *engine() const { return d; } + void setFlags(int flags); +private: + QTextLayout(QTextEngine *e) : d(e) {} + Q_DISABLE_COPY(QTextLayout) + + friend class QPainter; + friend class QPSPrinter; + friend class QGraphicsSimpleTextItemPrivate; + friend class QGraphicsSimpleTextItem; + friend void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *, const QString& str, + QRectF *brect, int tabstops, int* tabarray, int tabarraylen, + QPainter *painter); + QTextEngine *d; +}; + + +class Q_GUI_EXPORT QTextLine +{ +public: + inline QTextLine() : i(0), eng(0) {} + inline bool isValid() const { return eng; } + + QRectF rect() const; + qreal x() const; + qreal y() const; + qreal width() const; + qreal ascent() const; + qreal descent() const; + qreal height() const; + qreal leading() const; + + void setLeadingIncluded(bool included); + bool leadingIncluded() const; + + qreal naturalTextWidth() const; + QRectF naturalTextRect() const; + + enum Edge { + Leading, + Trailing + }; + enum CursorPosition { + CursorBetweenCharacters, + CursorOnCharacter + }; + + /* cursorPos gets set to the valid position */ + qreal cursorToX(int *cursorPos, Edge edge = Leading) const; + inline qreal cursorToX(int cursorPos, Edge edge = Leading) const { return cursorToX(&cursorPos, edge); } + int xToCursor(qreal x, CursorPosition = CursorBetweenCharacters) const; + + void setLineWidth(qreal width); + void setNumColumns(int columns); + void setNumColumns(int columns, qreal alignmentWidth); + + void setPosition(const QPointF &pos); + QPointF position() const; + + int textStart() const; + int textLength() const; + + int lineNumber() const { return i; } + + void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = 0) const; + +private: + QTextLine(int line, QTextEngine *e) : i(line), eng(e) {} + void layout_helper(int numGlyphs); + friend class QTextLayout; + int i; + QTextEngine *eng; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTLAYOUT_H diff --git a/qtinterface/qt4/Qt/qtextlist.h b/qtinterface/qt4/Qt/qtextlist.h new file mode 100644 index 0000000..190d0e0 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextlist.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTLIST_H +#define QTEXTLIST_H + +#include <QtGui/qtextobject.h> +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextListPrivate; +class QTextCursor; + +class Q_GUI_EXPORT QTextList : public QTextBlockGroup +{ + Q_OBJECT +public: + explicit QTextList(QTextDocument *doc); + ~QTextList(); + + int count() const; + + inline bool isEmpty() const + { return count() == 0; } + + QTextBlock item(int i) const; + + int itemNumber(const QTextBlock &) const; + QString itemText(const QTextBlock &) const; + + void removeItem(int i); + void remove(const QTextBlock &); + + void add(const QTextBlock &block); + + inline void setFormat(const QTextListFormat &format); + QTextListFormat format() const { return QTextObject::format().toListFormat(); } + +private: + Q_DISABLE_COPY(QTextList) + Q_DECLARE_PRIVATE(QTextList) +}; + +inline void QTextList::setFormat(const QTextListFormat &aformat) +{ QTextObject::setFormat(aformat); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTLIST_H diff --git a/qtinterface/qt4/Qt/qtextobject.h b/qtinterface/qt4/Qt/qtextobject.h new file mode 100644 index 0000000..9fe4922 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextobject.h @@ -0,0 +1,328 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTOBJECT_H +#define QTEXTOBJECT_H + +#include <QtCore/qobject.h> +#include <QtGui/qtextformat.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextObjectPrivate; +class QTextDocument; +class QTextDocumentPrivate; +class QTextCursor; +class QTextBlock; +class QTextFragment; +class QTextLayout; +class QTextList; + +class Q_GUI_EXPORT QTextObject : public QObject +{ + Q_OBJECT + +protected: + explicit QTextObject(QTextDocument *doc); + ~QTextObject(); + + void setFormat(const QTextFormat &format); + +public: + QTextFormat format() const; + int formatIndex() const; + + QTextDocument *document() const; + + int objectIndex() const; + + QTextDocumentPrivate *docHandle() const; + +protected: + QTextObject(QTextObjectPrivate &p, QTextDocument *doc); + +private: + Q_DECLARE_PRIVATE(QTextObject) + Q_DISABLE_COPY(QTextObject) + friend class QTextDocumentPrivate; +}; + +class QTextBlockGroupPrivate; +class Q_GUI_EXPORT QTextBlockGroup : public QTextObject +{ + Q_OBJECT + +protected: + explicit QTextBlockGroup(QTextDocument *doc); + ~QTextBlockGroup(); + + virtual void blockInserted(const QTextBlock &block); + virtual void blockRemoved(const QTextBlock &block); + virtual void blockFormatChanged(const QTextBlock &block); + + QList<QTextBlock> blockList() const; + +protected: + QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc); +private: + Q_DECLARE_PRIVATE(QTextBlockGroup) + Q_DISABLE_COPY(QTextBlockGroup) + friend class QTextDocumentPrivate; +}; + +class Q_GUI_EXPORT QTextFrameLayoutData { +public: + virtual ~QTextFrameLayoutData(); +}; + +class QTextFramePrivate; +class Q_GUI_EXPORT QTextFrame : public QTextObject +{ + Q_OBJECT + +public: + explicit QTextFrame(QTextDocument *doc); + ~QTextFrame(); + + inline void setFrameFormat(const QTextFrameFormat &format); + QTextFrameFormat frameFormat() const { return QTextObject::format().toFrameFormat(); } + + QTextCursor firstCursorPosition() const; + QTextCursor lastCursorPosition() const; + int firstPosition() const; + int lastPosition() const; + + QTextFrameLayoutData *layoutData() const; + void setLayoutData(QTextFrameLayoutData *data); + + QList<QTextFrame *> childFrames() const; + QTextFrame *parentFrame() const; + + class Q_GUI_EXPORT iterator { + QTextFrame *f; + int b; + int e; + QTextFrame *cf; + int cb; + + friend class QTextFrame; + friend class QTextTableCell; + friend class QTextDocumentLayoutPrivate; + iterator(QTextFrame *frame, int block, int begin, int end); + public: + iterator(); + iterator(const iterator &o); + iterator &operator=(const iterator &o); + + QTextFrame *parentFrame() const { return f; } + + QTextFrame *currentFrame() const; + QTextBlock currentBlock() const; + + bool atEnd() const { return !cf && cb == e; } + + inline bool operator==(const iterator &o) const { return f == o.f && cf == o.cf && cb == o.cb; } + inline bool operator!=(const iterator &o) const { return f != o.f || cf != o.cf || cb != o.cb; } + iterator &operator++(); + inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; } + iterator &operator--(); + inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; } + }; + + friend class iterator; + // more Qt + typedef iterator Iterator; + + iterator begin() const; + iterator end() const; + +protected: + QTextFrame(QTextFramePrivate &p, QTextDocument *doc); +private: + friend class QTextDocumentPrivate; + Q_DECLARE_PRIVATE(QTextFrame) + Q_DISABLE_COPY(QTextFrame) +}; +Q_DECLARE_TYPEINFO(QTextFrame::iterator, Q_MOVABLE_TYPE); + +inline void QTextFrame::setFrameFormat(const QTextFrameFormat &aformat) +{ QTextObject::setFormat(aformat); } + +class Q_GUI_EXPORT QTextBlockUserData { +public: + virtual ~QTextBlockUserData(); +}; + +class Q_GUI_EXPORT QTextBlock +{ + friend class QSyntaxHighlighter; +public: + inline QTextBlock(QTextDocumentPrivate *priv, int b) : p(priv), n(b) {} + inline QTextBlock() : p(0), n(0) {} + inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {} + inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; } + + inline bool isValid() const { return p != 0 && n != 0; } + + inline bool operator==(const QTextBlock &o) const { return p == o.p && n == o.n; } + inline bool operator!=(const QTextBlock &o) const { return p != o.p || n != o.n; } + inline bool operator<(const QTextBlock &o) const { return position() < o.position(); } + + int position() const; + int length() const; + bool contains(int position) const; + + QTextLayout *layout() const; + void clearLayout(); + QTextBlockFormat blockFormat() const; + int blockFormatIndex() const; + QTextCharFormat charFormat() const; + int charFormatIndex() const; + + QString text() const; + + const QTextDocument *document() const; + + QTextList *textList() const; + + QTextBlockUserData *userData() const; + void setUserData(QTextBlockUserData *data); + + int userState() const; + void setUserState(int state); + + int revision() const; + void setRevision(int rev); + + bool isVisible() const; + void setVisible(bool visible); + + int blockNumber() const; + int firstLineNumber() const; + + void setLineCount(int count); + int lineCount() const; + + class Q_GUI_EXPORT iterator { + const QTextDocumentPrivate *p; + int b; + int e; + int n; + friend class QTextBlock; + iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {} + public: + iterator() : p(0), b(0), e(0), n(0) {} + iterator(const iterator &o) : p(o.p), b(o.b), e(o.e), n(o.n) {} + + QTextFragment fragment() const; + + bool atEnd() const { return n == e; } + + inline bool operator==(const iterator &o) const { return p == o.p && n == o.n; } + inline bool operator!=(const iterator &o) const { return p != o.p || n != o.n; } + iterator &operator++(); + inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; } + iterator &operator--(); + inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; } + }; + + // more Qt + typedef iterator Iterator; + + iterator begin() const; + iterator end() const; + + QTextBlock next() const; + QTextBlock previous() const; + + inline QTextDocumentPrivate *docHandle() const { return p; } + inline int fragmentIndex() const { return n; } + +private: + QTextDocumentPrivate *p; + int n; + friend class QTextDocumentPrivate; + friend class QTextLayout; +}; + +Q_DECLARE_TYPEINFO(QTextBlock, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QTextBlock::iterator, Q_MOVABLE_TYPE); + + +class Q_GUI_EXPORT QTextFragment +{ +public: + inline QTextFragment(const QTextDocumentPrivate *priv, int f, int fe) : p(priv), n(f), ne(fe) {} + inline QTextFragment() : p(0), n(0), ne(0) {} + inline QTextFragment(const QTextFragment &o) : p(o.p), n(o.n), ne(o.ne) {} + inline QTextFragment &operator=(const QTextFragment &o) { p = o.p; n = o.n; ne = o.ne; return *this; } + + inline bool isValid() const { return p && n; } + + inline bool operator==(const QTextFragment &o) const { return p == o.p && n == o.n; } + inline bool operator!=(const QTextFragment &o) const { return p != o.p || n != o.n; } + inline bool operator<(const QTextFragment &o) const { return position() < o.position(); } + + int position() const; + int length() const; + bool contains(int position) const; + + QTextCharFormat charFormat() const; + int charFormatIndex() const; + QString text() const; + +private: + const QTextDocumentPrivate *p; + int n; + int ne; +}; + +Q_DECLARE_TYPEINFO(QTextFragment, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTOBJECT_H diff --git a/qtinterface/qt4/Qt/qtextoption.h b/qtinterface/qt4/Qt/qtextoption.h new file mode 100644 index 0000000..356dba7 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextoption.h @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTOPTION_H +#define QTEXTOPTION_H + +#include <QtCore/qnamespace.h> +#include <QtCore/qchar.h> +#include <QtCore/qmetatype.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +template <typename T> class QList; +struct QTextOptionPrivate; + +class Q_GUI_EXPORT QTextOption +{ +public: + enum TabType { + LeftTab, + RightTab, + CenterTab, + DelimiterTab + }; + + struct Q_GUI_EXPORT Tab { + inline Tab() : position(80), type(QTextOption::LeftTab) { } + + inline bool operator==(const Tab &other) const { + return type == other.type + && qFuzzyCompare(position, other.position) + && delimiter == other.delimiter; + } + + inline bool operator!=(const Tab &other) const { + return !operator==(other); + } + + qreal position; + TabType type; + QChar delimiter; + }; + + QTextOption(); + QTextOption(Qt::Alignment alignment); + ~QTextOption(); + + QTextOption(const QTextOption &o); + QTextOption &operator=(const QTextOption &o); + + inline void setAlignment(Qt::Alignment alignment); + inline Qt::Alignment alignment() const { return Qt::Alignment(align); } + + inline void setTextDirection(Qt::LayoutDirection aDirection) { this->direction = aDirection; } + inline Qt::LayoutDirection textDirection() const { return Qt::LayoutDirection(direction); } + + enum WrapMode { + NoWrap, + WordWrap, + ManualWrap, + WrapAnywhere, + WrapAtWordBoundaryOrAnywhere + }; + inline void setWrapMode(WrapMode wrap) { wordWrap = wrap; } + inline WrapMode wrapMode() const { return static_cast<WrapMode>(wordWrap); } + + enum Flag { + ShowTabsAndSpaces = 0x1, + ShowLineAndParagraphSeparators = 0x2, + AddSpaceForLineAndParagraphSeparators = 0x4, + SuppressColors = 0x8, + IncludeTrailingSpaces = 0x80000000 + }; + Q_DECLARE_FLAGS(Flags, Flag) + inline void setFlags(Flags flags); + inline Flags flags() const { return Flags(f); } + + inline void setTabStop(qreal tabStop); + inline qreal tabStop() const { return tab; } + + void setTabArray(QList<qreal> tabStops); + QList<qreal> tabArray() const; + + void setTabs(QList<Tab> tabStops); + QList<Tab> tabs() const; + + void setUseDesignMetrics(bool b) { design = b; } + bool useDesignMetrics() const { return design; } + +private: + uint align : 8; + uint wordWrap : 4; + uint design : 1; + uint direction : 1; + uint unused : 19; + uint f; + qreal tab; + QTextOptionPrivate *d; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextOption::Flags) + +inline void QTextOption::setAlignment(Qt::Alignment aalignment) +{ align = aalignment; } + +inline void QTextOption::setFlags(Flags aflags) +{ f = aflags; } + +inline void QTextOption::setTabStop(qreal atabStop) +{ tab = atabStop; } + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE( QTextOption::Tab ) + +QT_END_HEADER + +#endif // QTEXTOPTION_H diff --git a/qtinterface/qt4/Qt/qtextstream.h b/qtinterface/qt4/Qt/qtextstream.h new file mode 100644 index 0000000..80263c7 --- /dev/null +++ b/qtinterface/qt4/Qt/qtextstream.h @@ -0,0 +1,376 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTSTREAM_H +#define QTEXTSTREAM_H + +#include <QtCore/qiodevice.h> +#include <QtCore/qstring.h> +#include <QtCore/qchar.h> +#include <QtCore/qlocale.h> +#include <QtCore/qscopedpointer.h> + +#ifndef QT_NO_TEXTCODEC +# ifdef QT3_SUPPORT +# include <QtCore/qtextcodec.h> +# endif +#endif + +#include <stdio.h> + +#ifdef Status +#error qtextstream.h must be included before any header file that defines Status +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QTextCodec; +class QTextDecoder; + +class QTextStreamPrivate; +class Q_CORE_EXPORT QTextStream // text stream class +{ + Q_DECLARE_PRIVATE(QTextStream) + +public: + enum RealNumberNotation { + SmartNotation, + FixedNotation, + ScientificNotation + }; + enum FieldAlignment { + AlignLeft, + AlignRight, + AlignCenter, + AlignAccountingStyle + }; + enum Status { + Ok, + ReadPastEnd, + ReadCorruptData + }; + enum NumberFlag { + ShowBase = 0x1, + ForcePoint = 0x2, + ForceSign = 0x4, + UppercaseBase = 0x8, + UppercaseDigits = 0x10 + }; + Q_DECLARE_FLAGS(NumberFlags, NumberFlag) + + QTextStream(); + explicit QTextStream(QIODevice *device); + explicit QTextStream(FILE *fileHandle, QIODevice::OpenMode openMode = QIODevice::ReadWrite); + explicit QTextStream(QString *string, QIODevice::OpenMode openMode = QIODevice::ReadWrite); + explicit QTextStream(QByteArray *array, QIODevice::OpenMode openMode = QIODevice::ReadWrite); + explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly); + virtual ~QTextStream(); + +#ifndef QT_NO_TEXTCODEC + void setCodec(QTextCodec *codec); + void setCodec(const char *codecName); + QTextCodec *codec() const; + void setAutoDetectUnicode(bool enabled); + bool autoDetectUnicode() const; + void setGenerateByteOrderMark(bool generate); + bool generateByteOrderMark() const; +#endif + + void setLocale(const QLocale &locale); + QLocale locale() const; + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setString(QString *string, QIODevice::OpenMode openMode = QIODevice::ReadWrite); + QString *string() const; + + Status status() const; + void setStatus(Status status); + void resetStatus(); + + bool atEnd() const; + void reset(); + void flush(); + bool seek(qint64 pos); + qint64 pos() const; + + void skipWhiteSpace(); + + QString readLine(qint64 maxlen = 0); + QString readAll(); + QString read(qint64 maxlen); + + void setFieldAlignment(FieldAlignment alignment); + FieldAlignment fieldAlignment() const; + + void setPadChar(QChar ch); + QChar padChar() const; + + void setFieldWidth(int width); + int fieldWidth() const; + + void setNumberFlags(NumberFlags flags); + NumberFlags numberFlags() const; + + void setIntegerBase(int base); + int integerBase() const; + + void setRealNumberNotation(RealNumberNotation notation); + RealNumberNotation realNumberNotation() const; + + void setRealNumberPrecision(int precision); + int realNumberPrecision() const; + + QTextStream &operator>>(QChar &ch); + QTextStream &operator>>(char &ch); + QTextStream &operator>>(signed short &i); + QTextStream &operator>>(unsigned short &i); + QTextStream &operator>>(signed int &i); + QTextStream &operator>>(unsigned int &i); + QTextStream &operator>>(signed long &i); + QTextStream &operator>>(unsigned long &i); + QTextStream &operator>>(qlonglong &i); + QTextStream &operator>>(qulonglong &i); + QTextStream &operator>>(float &f); + QTextStream &operator>>(double &f); + QTextStream &operator>>(QString &s); + QTextStream &operator>>(QByteArray &array); + QTextStream &operator>>(char *c); + + QTextStream &operator<<(QBool b); + QTextStream &operator<<(QChar ch); + QTextStream &operator<<(char ch); + QTextStream &operator<<(signed short i); + QTextStream &operator<<(unsigned short i); + QTextStream &operator<<(signed int i); + QTextStream &operator<<(unsigned int i); + QTextStream &operator<<(signed long i); + QTextStream &operator<<(unsigned long i); + QTextStream &operator<<(qlonglong i); + QTextStream &operator<<(qulonglong i); + QTextStream &operator<<(float f); + QTextStream &operator<<(double f); + QTextStream &operator<<(const QString &s); + QTextStream &operator<<(const QByteArray &array); + QTextStream &operator<<(const char *c); + QTextStream &operator<<(const void *ptr); + +#ifdef QT3_SUPPORT + // not marked as QT3_SUPPORT to avoid double compiler warnings, as + // they are used in the QT3_SUPPORT functions below. + inline QT3_SUPPORT int flags() const { return flagsInternal(); } + inline QT3_SUPPORT int flags(int f) { return flagsInternal(f); } + + inline QT3_SUPPORT int setf(int bits) + { int old = flagsInternal(); flagsInternal(flagsInternal() | bits); return old; } + inline QT3_SUPPORT int setf(int bits, int mask) + { int old = flagsInternal(); flagsInternal(flagsInternal() | (bits & mask)); return old; } + inline QT3_SUPPORT int unsetf(int bits) + { int old = flagsInternal(); flagsInternal(flagsInternal() & ~bits); return old; } + + inline QT3_SUPPORT int width(int w) + { int old = fieldWidth(); setFieldWidth(w); return old; } + inline QT3_SUPPORT int fill(int f) + { QChar ch = padChar(); setPadChar(QChar(f)); return ch.unicode(); } + inline QT3_SUPPORT int precision(int p) + { int old = realNumberPrecision(); setRealNumberPrecision(p); return old; } + + enum { + skipws = 0x0001, // skip whitespace on input + left = 0x0002, // left-adjust output + right = 0x0004, // right-adjust output + internal = 0x0008, // pad after sign + bin = 0x0010, // binary format integer + oct = 0x0020, // octal format integer + dec = 0x0040, // decimal format integer + hex = 0x0080, // hex format integer + showbase = 0x0100, // show base indicator + showpoint = 0x0200, // force decimal point (float) + uppercase = 0x0400, // upper-case hex output + showpos = 0x0800, // add '+' to positive integers + scientific = 0x1000, // scientific float output + fixed = 0x2000 // fixed float output + }; + enum { + basefield = bin | oct | dec | hex, + adjustfield = left | right | internal, + floatfield = scientific | fixed + }; + +#ifndef QT_NO_TEXTCODEC + enum Encoding { Locale, Latin1, Unicode, UnicodeNetworkOrder, + UnicodeReverse, RawUnicode, UnicodeUTF8 }; + QT3_SUPPORT void setEncoding(Encoding encoding); +#endif + inline QT3_SUPPORT QString read() { return readAll(); } + inline QT3_SUPPORT void unsetDevice() { setDevice(0); } +#endif + +private: +#ifdef QT3_SUPPORT + int flagsInternal() const; + int flagsInternal(int flags); +#endif + + Q_DISABLE_COPY(QTextStream) + + QScopedPointer<QTextStreamPrivate> d_ptr; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextStream::NumberFlags) + +/***************************************************************************** + QTextStream manipulators + *****************************************************************************/ + +typedef QTextStream & (*QTextStreamFunction)(QTextStream &);// manipulator function +typedef void (QTextStream::*QTSMFI)(int); // manipulator w/int argument +typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument + +class Q_CORE_EXPORT QTextStreamManipulator +{ +public: + QTextStreamManipulator(QTSMFI m, int a) { mf = m; mc = 0; arg = a; } + QTextStreamManipulator(QTSMFC m, QChar c) { mf = 0; mc = m; ch = c; arg = -1; } + void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } } + +private: + QTSMFI mf; // QTextStream member function + QTSMFC mc; // QTextStream member function + int arg; // member function argument + QChar ch; +}; + +inline QTextStream &operator>>(QTextStream &s, QTextStreamFunction f) +{ return (*f)(s); } + +inline QTextStream &operator<<(QTextStream &s, QTextStreamFunction f) +{ return (*f)(s); } + +inline QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m) +{ m.exec(s); return s; } + +Q_CORE_EXPORT QTextStream &bin(QTextStream &s); +Q_CORE_EXPORT QTextStream &oct(QTextStream &s); +Q_CORE_EXPORT QTextStream &dec(QTextStream &s); +Q_CORE_EXPORT QTextStream &hex(QTextStream &s); + +Q_CORE_EXPORT QTextStream &showbase(QTextStream &s); +Q_CORE_EXPORT QTextStream &forcesign(QTextStream &s); +Q_CORE_EXPORT QTextStream &forcepoint(QTextStream &s); +Q_CORE_EXPORT QTextStream &noshowbase(QTextStream &s); +Q_CORE_EXPORT QTextStream &noforcesign(QTextStream &s); +Q_CORE_EXPORT QTextStream &noforcepoint(QTextStream &s); + +Q_CORE_EXPORT QTextStream &uppercasebase(QTextStream &s); +Q_CORE_EXPORT QTextStream &uppercasedigits(QTextStream &s); +Q_CORE_EXPORT QTextStream &lowercasebase(QTextStream &s); +Q_CORE_EXPORT QTextStream &lowercasedigits(QTextStream &s); + +Q_CORE_EXPORT QTextStream &fixed(QTextStream &s); +Q_CORE_EXPORT QTextStream &scientific(QTextStream &s); + +Q_CORE_EXPORT QTextStream &left(QTextStream &s); +Q_CORE_EXPORT QTextStream &right(QTextStream &s); +Q_CORE_EXPORT QTextStream ¢er(QTextStream &s); + +Q_CORE_EXPORT QTextStream &endl(QTextStream &s); +Q_CORE_EXPORT QTextStream &flush(QTextStream &s); +Q_CORE_EXPORT QTextStream &reset(QTextStream &s); + +Q_CORE_EXPORT QTextStream &bom(QTextStream &s); + +Q_CORE_EXPORT QTextStream &ws(QTextStream &s); + +inline QTextStreamManipulator qSetFieldWidth(int width) +{ + QTSMFI func = &QTextStream::setFieldWidth; + return QTextStreamManipulator(func,width); +} + +inline QTextStreamManipulator qSetPadChar(QChar ch) +{ + QTSMFC func = &QTextStream::setPadChar; + return QTextStreamManipulator(func, ch); +} + +inline QTextStreamManipulator qSetRealNumberPrecision(int precision) +{ + QTSMFI func = &QTextStream::setRealNumberPrecision; + return QTextStreamManipulator(func, precision); +} + +#ifdef QT3_SUPPORT +typedef QTextStream QTS; + +class Q_CORE_EXPORT QTextIStream : public QTextStream +{ +public: + inline explicit QTextIStream(const QString *s) : QTextStream(const_cast<QString *>(s), QIODevice::ReadOnly) {} + inline explicit QTextIStream(QByteArray *a) : QTextStream(a, QIODevice::ReadOnly) {} + inline QTextIStream(FILE *f) : QTextStream(f, QIODevice::ReadOnly) {} + +private: + Q_DISABLE_COPY(QTextIStream) +}; + +class Q_CORE_EXPORT QTextOStream : public QTextStream +{ +public: + inline explicit QTextOStream(QString *s) : QTextStream(s, QIODevice::WriteOnly) {} + inline explicit QTextOStream(QByteArray *a) : QTextStream(a, QIODevice::WriteOnly) {} + inline QTextOStream(FILE *f) : QTextStream(f, QIODevice::WriteOnly) {} + +private: + Q_DISABLE_COPY(QTextOStream) +}; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTSTREAM_H diff --git a/qtinterface/qt4/Qt/qtexttable.h b/qtinterface/qt4/Qt/qtexttable.h new file mode 100644 index 0000000..277819b --- /dev/null +++ b/qtinterface/qt4/Qt/qtexttable.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTEXTTABLE_H +#define QTEXTTABLE_H + +#include <QtCore/qglobal.h> +#include <QtCore/qobject.h> +#include <QtGui/qtextobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QTextCursor; +class QTextTable; +class QTextTablePrivate; + +class Q_GUI_EXPORT QTextTableCell +{ +public: + QTextTableCell() : table(0) {} + ~QTextTableCell() {} + QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {} + QTextTableCell &operator=(const QTextTableCell &o) + { table = o.table; fragment = o.fragment; return *this; } + + void setFormat(const QTextCharFormat &format); + QTextCharFormat format() const; + + int row() const; + int column() const; + + int rowSpan() const; + int columnSpan() const; + + inline bool isValid() const { return table != 0; } + + QTextCursor firstCursorPosition() const; + QTextCursor lastCursorPosition() const; + int firstPosition() const; + int lastPosition() const; + + inline bool operator==(const QTextTableCell &other) const + { return table == other.table && fragment == other.fragment; } + inline bool operator!=(const QTextTableCell &other) const + { return !operator==(other); } + + QTextFrame::iterator begin() const; + QTextFrame::iterator end() const; + + int tableCellFormatIndex() const; + +private: + friend class QTextTable; + QTextTableCell(const QTextTable *t, int f) + : table(t), fragment(f) {} + + const QTextTable *table; + int fragment; +}; + +class Q_GUI_EXPORT QTextTable : public QTextFrame +{ + Q_OBJECT +public: + explicit QTextTable(QTextDocument *doc); + ~QTextTable(); + + void resize(int rows, int cols); + void insertRows(int pos, int num); + void insertColumns(int pos, int num); + void appendRows(int count); + void appendColumns(int count); + void removeRows(int pos, int num); + void removeColumns(int pos, int num); + + void mergeCells(int row, int col, int numRows, int numCols); + void mergeCells(const QTextCursor &cursor); + void splitCell(int row, int col, int numRows, int numCols); + + int rows() const; + int columns() const; + + QTextTableCell cellAt(int row, int col) const; + QTextTableCell cellAt(int position) const; + QTextTableCell cellAt(const QTextCursor &c) const; + + QTextCursor rowStart(const QTextCursor &c) const; + QTextCursor rowEnd(const QTextCursor &c) const; + + void setFormat(const QTextTableFormat &format); + QTextTableFormat format() const { return QTextObject::format().toTableFormat(); } + +private: + Q_DISABLE_COPY(QTextTable) + Q_DECLARE_PRIVATE(QTextTable) + friend class QTextTableCell; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTTABLE_H diff --git a/qtinterface/qt4/Qt/qthread.h b/qtinterface/qt4/Qt/qthread.h new file mode 100644 index 0000000..5266061 --- /dev/null +++ b/qtinterface/qt4/Qt/qthread.h @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTHREAD_H +#define QTHREAD_H + +#include <QtCore/qobject.h> + +#include <limits.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QThreadData; +class QThreadPrivate; + +#ifndef QT_NO_THREAD +class Q_CORE_EXPORT QThread : public QObject +{ +public: + static Qt::HANDLE currentThreadId(); + static QThread *currentThread(); + static int idealThreadCount(); + static void yieldCurrentThread(); + + explicit QThread(QObject *parent = 0); + ~QThread(); + + enum Priority { + IdlePriority, + + LowestPriority, + LowPriority, + NormalPriority, + HighPriority, + HighestPriority, + + TimeCriticalPriority, + + InheritPriority + }; + + void setPriority(Priority priority); + Priority priority() const; + + bool isFinished() const; + bool isRunning() const; + + void setStackSize(uint stackSize); + uint stackSize() const; + + void exit(int retcode = 0); + +public Q_SLOTS: + void start(Priority = InheritPriority); + void terminate(); + void quit(); + +public: + // default argument causes thread to block indefinately + bool wait(unsigned long time = ULONG_MAX); + +Q_SIGNALS: + void started(); + void finished(); + void terminated(); + +protected: + virtual void run(); + int exec(); + + static void setTerminationEnabled(bool enabled = true); + + static void sleep(unsigned long); + static void msleep(unsigned long); + static void usleep(unsigned long); + +#ifdef QT3_SUPPORT +public: + inline QT3_SUPPORT bool finished() const { return isFinished(); } + inline QT3_SUPPORT bool running() const { return isRunning(); } +#endif + +protected: + QThread(QThreadPrivate &dd, QObject *parent = 0); + +private: + Q_OBJECT + Q_DECLARE_PRIVATE(QThread) + + static void initialize(); + static void cleanup(); + + friend class QCoreApplication; + friend class QThreadData; +}; + +#else // QT_NO_THREAD + +class Q_CORE_EXPORT QThread : public QObject +{ +public: + static Qt::HANDLE currentThreadId() { return Qt::HANDLE(currentThread()); } + static QThread* currentThread(); + +protected: + QThread(QThreadPrivate &dd, QObject *parent = 0); + +private: + explicit QThread(QObject *parent = 0); + static QThread *instance; + + friend class QCoreApplication; + friend class QThreadData; + friend class QAdoptedThread; + Q_DECLARE_PRIVATE(QThread) +}; + +#endif // QT_NO_THREAD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTHREAD_H diff --git a/qtinterface/qt4/Qt/qthreadpool.h b/qtinterface/qt4/Qt/qthreadpool.h new file mode 100644 index 0000000..874fe1a --- /dev/null +++ b/qtinterface/qt4/Qt/qthreadpool.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTHREADPOOL_H +#define QTHREADPOOL_H + +#include <QtCore/qglobal.h> + +#include <QtCore/qthread.h> +#include <QtCore/qrunnable.h> + +#ifndef QT_NO_THREAD + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QThreadPoolPrivate; +class Q_CORE_EXPORT QThreadPool : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QThreadPool) + Q_PROPERTY(int expiryTimeout READ expiryTimeout WRITE setExpiryTimeout) + Q_PROPERTY(int maxThreadCount READ maxThreadCount WRITE setMaxThreadCount) + Q_PROPERTY(int activeThreadCount READ activeThreadCount) + friend class QFutureInterfaceBase; + +public: + QThreadPool(QObject *parent = 0); + ~QThreadPool(); + + static QThreadPool *globalInstance(); + + void start(QRunnable *runnable, int priority = 0); + bool tryStart(QRunnable *runnable); + + int expiryTimeout() const; + void setExpiryTimeout(int expiryTimeout); + + int maxThreadCount() const; + void setMaxThreadCount(int maxThreadCount); + + int activeThreadCount() const; + + void reserveThread(); + void releaseThread(); + + void waitForDone(); +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_THREAD + +#endif diff --git a/qtinterface/qt4/Qt/qthreadstorage.h b/qtinterface/qt4/Qt/qthreadstorage.h new file mode 100644 index 0000000..0e5453c --- /dev/null +++ b/qtinterface/qt4/Qt/qthreadstorage.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTHREADSTORAGE_H +#define QTHREADSTORAGE_H + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_THREAD + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QThreadStorageData +{ +public: + explicit QThreadStorageData(void (*func)(void *)); + ~QThreadStorageData(); + + void** get() const; + void** set(void* p); + + static void finish(void**); + int id; +}; + +#if !defined(QT_MOC_CPP) +// MOC_SKIP_BEGIN + +// pointer specialization +template <typename T> +inline +T *&qThreadStorage_localData(QThreadStorageData &d, T **) +{ + void **v = d.get(); + if (!v) v = d.set(0); + return *(reinterpret_cast<T**>(v)); +} + +template <typename T> +inline +T *qThreadStorage_localData_const(const QThreadStorageData &d, T **) +{ + void **v = d.get(); + return v ? *(reinterpret_cast<T**>(v)) : 0; +} + +template <typename T> +inline +void qThreadStorage_setLocalData(QThreadStorageData &d, T **t) +{ (void) d.set(*t); } + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + +// value-based specialization +template <typename T> +inline +T &qThreadStorage_localData(QThreadStorageData &d, T *) +{ + void **v = d.get(); + if (!v) v = d.set(new T()); + return *(reinterpret_cast<T*>(*v)); +} + +template <typename T> +inline +T qThreadStorage_localData_const(const QThreadStorageData &d, T *) +{ + void **v = d.get(); + return v ? *(reinterpret_cast<T*>(*v)) : T(); +} + +template <typename T> +inline +void qThreadStorage_setLocalData(QThreadStorageData &d, T *t) +{ (void) d.set(new T(*t)); } + +#endif // QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + +// MOC_SKIP_END +#endif + +template <class T> +class QThreadStorage +{ +private: + QThreadStorageData d; + + Q_DISABLE_COPY(QThreadStorage) + + static inline void deleteData(void *x) + { delete static_cast<T>(x); } + +public: + inline QThreadStorage() : d(deleteData) { } + inline ~QThreadStorage() { } + + inline bool hasLocalData() const + { return d.get() != 0; } + + inline T& localData() + { return qThreadStorage_localData(d, reinterpret_cast<T*>(0)); } + inline T localData() const + { return qThreadStorage_localData_const(d, reinterpret_cast<T*>(0)); } + + inline void setLocalData(T t) + { qThreadStorage_setLocalData(d, &t); } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_THREAD + +#endif // QTHREADSTORAGE_H diff --git a/qtinterface/qt4/Qt/qtimeline.h b/qtinterface/qt4/Qt/qtimeline.h new file mode 100644 index 0000000..6a11113 --- /dev/null +++ b/qtinterface/qt4/Qt/qtimeline.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTIMELINE_H +#define QTIMELINE_H + +#include <QtCore/qeasingcurve.h> +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QTimeLinePrivate; +class Q_CORE_EXPORT QTimeLine : public QObject +{ + Q_OBJECT + Q_PROPERTY(int duration READ duration WRITE setDuration) + Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval) + Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime) + Q_PROPERTY(Direction direction READ direction WRITE setDirection) + Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount) + Q_PROPERTY(CurveShape curveShape READ curveShape WRITE setCurveShape) + Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve) +public: + enum State { + NotRunning, + Paused, + Running + }; + enum Direction { + Forward, + Backward + }; + enum CurveShape { + EaseInCurve, + EaseOutCurve, + EaseInOutCurve, + LinearCurve, + SineCurve, + CosineCurve + }; + + explicit QTimeLine(int duration = 1000, QObject *parent = 0); + virtual ~QTimeLine(); + + State state() const; + + int loopCount() const; + void setLoopCount(int count); + + Direction direction() const; + void setDirection(Direction direction); + + int duration() const; + void setDuration(int duration); + + int startFrame() const; + void setStartFrame(int frame); + int endFrame() const; + void setEndFrame(int frame); + void setFrameRange(int startFrame, int endFrame); + + int updateInterval() const; + void setUpdateInterval(int interval); + + CurveShape curveShape() const; + void setCurveShape(CurveShape shape); + + QEasingCurve easingCurve() const; + void setEasingCurve(const QEasingCurve &curve); + + int currentTime() const; + int currentFrame() const; + qreal currentValue() const; + + int frameForTime(int msec) const; + virtual qreal valueForTime(int msec) const; + +public Q_SLOTS: + void start(); + void resume(); + void stop(); + void setPaused(bool paused); + void setCurrentTime(int msec); + void toggleDirection(); + +Q_SIGNALS: + void valueChanged(qreal x); + void frameChanged(int); + void stateChanged(QTimeLine::State newState); + void finished(); + +protected: + void timerEvent(QTimerEvent *event); + +private: + Q_DISABLE_COPY(QTimeLine) + Q_DECLARE_PRIVATE(QTimeLine) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qtimer.h b/qtinterface/qt4/Qt/qtimer.h new file mode 100644 index 0000000..0759db5 --- /dev/null +++ b/qtinterface/qt4/Qt/qtimer.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTIMER_H +#define QTIMER_H + +#ifndef QT_NO_QOBJECT + +#include <QtCore/qbasictimer.h> // conceptual inheritance +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +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(bool active READ isActive) +public: + explicit QTimer(QObject *parent = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QTimer(QObject *parent, const char *name); +#endif + ~QTimer(); + + inline bool isActive() const { return id >= 0; } + int timerId() const { return id; } + + void setInterval(int msec); + int interval() const { return inter; } + + inline void setSingleShot(bool singleShot); + inline bool isSingleShot() const { return single; } + + static void singleShot(int msec, QObject *receiver, const char *member); + +public Q_SLOTS: + void start(int msec); + + void start(); + void stop(); + +#ifdef QT3_SUPPORT + inline QT_MOC_COMPAT void changeInterval(int msec) { start(msec); } + QT_MOC_COMPAT int start(int msec, bool sshot); +#endif + +Q_SIGNALS: + void timeout(); + +protected: + void timerEvent(QTimerEvent *); + +private: + Q_DISABLE_COPY(QTimer) + + inline int startTimer(int){ return -1;} + inline void killTimer(int){} + + int id, inter, del; + uint single : 1; + uint nulltimer : 1; +}; + +inline void QTimer::setSingleShot(bool asingleShot) { single = asingleShot; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_QOBJECT + +#endif // QTIMER_H diff --git a/qtinterface/qt4/Qt/qtoolbar.h b/qtinterface/qt4/Qt/qtoolbar.h new file mode 100644 index 0000000..466cea9 --- /dev/null +++ b/qtinterface/qt4/Qt/qtoolbar.h @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDYNAMICTOOLBAR_H +#define QDYNAMICTOOLBAR_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TOOLBAR + +class QToolBarPrivate; + +class QAction; +class QIcon; +class QMainWindow; +class QStyleOptionToolBar; + +class Q_GUI_EXPORT QToolBar : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(bool movable READ isMovable WRITE setMovable + DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) != 0) + NOTIFY movableChanged) + Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas + DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) != 0) + NOTIFY allowedAreasChanged) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation + DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) == 0) + NOTIFY orientationChanged) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged) + Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle + NOTIFY toolButtonStyleChanged) + Q_PROPERTY(bool floating READ isFloating) + Q_PROPERTY(bool floatable READ isFloatable WRITE setFloatable) + +public: + explicit QToolBar(const QString &title, QWidget *parent = 0); + explicit QToolBar(QWidget *parent = 0); + ~QToolBar(); + + void setMovable(bool movable); + bool isMovable() const; + + void setAllowedAreas(Qt::ToolBarAreas areas); + Qt::ToolBarAreas allowedAreas() const; + + inline bool isAreaAllowed(Qt::ToolBarArea area) const + { return (allowedAreas() & area) == area; } + + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + + void clear(); + +#ifdef Q_NO_USING_KEYWORD + inline void addAction(QAction *action) + { QWidget::addAction(action); } +#else + using QWidget::addAction; +#endif + + QAction *addAction(const QString &text); + QAction *addAction(const QIcon &icon, const QString &text); + QAction *addAction(const QString &text, const QObject *receiver, const char* member); + QAction *addAction(const QIcon &icon, const QString &text, + const QObject *receiver, const char* member); + + QAction *addSeparator(); + QAction *insertSeparator(QAction *before); + + QAction *addWidget(QWidget *widget); + QAction *insertWidget(QAction *before, QWidget *widget); + + QRect actionGeometry(QAction *action) const; + QAction *actionAt(const QPoint &p) const; + inline QAction *actionAt(int x, int y) const; + + QAction *toggleViewAction() const; + + QSize iconSize() const; + Qt::ToolButtonStyle toolButtonStyle() const; + + QWidget *widgetForAction(QAction *action) const; + + bool isFloatable() const; + void setFloatable(bool floatable); + bool isFloating() const; + +public Q_SLOTS: + void setIconSize(const QSize &iconSize); + void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle); + +Q_SIGNALS: + void actionTriggered(QAction *action); + void movableChanged(bool movable); + void allowedAreasChanged(Qt::ToolBarAreas allowedAreas); + void orientationChanged(Qt::Orientation orientation); + void iconSizeChanged(const QSize &iconSize); + void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle); + void topLevelChanged(bool topLevel); + +protected: + void actionEvent(QActionEvent *event); + void changeEvent(QEvent *event); + void childEvent(QChildEvent *event); + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + bool event(QEvent *event); + void initStyleOption(QStyleOptionToolBar *option) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QToolBar(QWidget *parent, const char *name); + inline QT3_SUPPORT void setLabel(const QString &label) + { setWindowTitle(label); } + inline QT3_SUPPORT QString label() const + { return windowTitle(); } +#endif + +private: + Q_DECLARE_PRIVATE(QToolBar) + Q_DISABLE_COPY(QToolBar) + Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) + Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &)) + Q_PRIVATE_SLOT(d_func(), void _q_updateToolButtonStyle(Qt::ToolButtonStyle)) + + friend class QMainWindow; + friend class QMainWindowLayout; + friend class QToolBarLayout; + friend class QToolBarAreaLayout; +}; + +inline QAction *QToolBar::actionAt(int ax, int ay) const +{ return actionAt(QPoint(ax, ay)); } + +#endif // QT_NO_TOOLBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDYNAMICTOOLBAR_H diff --git a/qtinterface/qt4/Qt/qtoolbox.h b/qtinterface/qt4/Qt/qtoolbox.h new file mode 100644 index 0000000..bf1ba60 --- /dev/null +++ b/qtinterface/qt4/Qt/qtoolbox.h @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTOOLBOX_H +#define QTOOLBOX_H + +#include <QtGui/qframe.h> +#include <QtGui/qicon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TOOLBOX + +class QToolBoxPrivate; + +class Q_GUI_EXPORT QToolBox : public QFrame +{ + Q_OBJECT + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) + Q_PROPERTY(int count READ count) + +public: + explicit QToolBox(QWidget *parent = 0, Qt::WindowFlags f = 0); + ~QToolBox(); + + int addItem(QWidget *widget, const QString &text); + int addItem(QWidget *widget, const QIcon &icon, const QString &text); + int insertItem(int index, QWidget *widget, const QString &text); + int insertItem(int index, QWidget *widget, const QIcon &icon, const QString &text); + + void removeItem(int index); + + void setItemEnabled(int index, bool enabled); + bool isItemEnabled(int index) const; + + void setItemText(int index, const QString &text); + QString itemText(int index) const; + + void setItemIcon(int index, const QIcon &icon); + QIcon itemIcon(int index) const; + +#ifndef QT_NO_TOOLTIP + void setItemToolTip(int index, const QString &toolTip); + QString itemToolTip(int index) const; +#endif + + int currentIndex() const; + QWidget *currentWidget() const; + QWidget *widget(int index) const; + int indexOf(QWidget *widget) const; + int count() const; + +public Q_SLOTS: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *widget); + +Q_SIGNALS: + void currentChanged(int index); + +protected: + bool event(QEvent *e); + virtual void itemInserted(int index); + virtual void itemRemoved(int index); + void showEvent(QShowEvent *e); + void changeEvent(QEvent *); + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QToolBox(QWidget *parent, const char *name, Qt::WindowFlags f = 0); + inline QT3_SUPPORT void setItemLabel(int index, const QString &text) { setItemText(index, text); } + inline QT3_SUPPORT QString itemLabel(int index) const { return itemText(index); } + inline QT3_SUPPORT QWidget *currentItem() const { return widget(currentIndex()); } + inline QT3_SUPPORT void setCurrentItem(QWidget *item) { setCurrentIndex(indexOf(item)); } + inline QT3_SUPPORT void setItemIconSet(int index, const QIcon &icon) { setItemIcon(index, icon); } + inline QT3_SUPPORT QIcon itemIconSet(int index) const { return itemIcon(index); } + inline QT3_SUPPORT int removeItem(QWidget *item) + { int i = indexOf(item); removeItem(i); return i; } + inline QT3_SUPPORT QWidget *item(int index) const { return widget(index); } + QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } + QT3_SUPPORT int margin() const + { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } +#endif + +private: + Q_DECLARE_PRIVATE(QToolBox) + Q_DISABLE_COPY(QToolBox) + Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked()) + Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject*)) +}; + + +inline int QToolBox::addItem(QWidget *item, const QString &text) +{ return insertItem(-1, item, QIcon(), text); } +inline int QToolBox::addItem(QWidget *item, const QIcon &iconSet, + const QString &text) +{ return insertItem(-1, item, iconSet, text); } +inline int QToolBox::insertItem(int index, QWidget *item, const QString &text) +{ return insertItem(index, item, QIcon(), text); } + +#endif // QT_NO_TOOLBOX + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTOOLBOX_H diff --git a/qtinterface/qt4/Qt/qtoolbutton.h b/qtinterface/qt4/Qt/qtoolbutton.h new file mode 100644 index 0000000..622fe9b --- /dev/null +++ b/qtinterface/qt4/Qt/qtoolbutton.h @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTOOLBUTTON_H +#define QTOOLBUTTON_H + +#include <QtGui/qabstractbutton.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TOOLBUTTON + +class QToolButtonPrivate; +class QMenu; +class QStyleOptionToolButton; + +class Q_GUI_EXPORT QToolButton : public QAbstractButton +{ + Q_OBJECT + Q_ENUMS(Qt::ToolButtonStyle Qt::ArrowType ToolButtonPopupMode) +#ifndef QT_NO_MENU + Q_PROPERTY(ToolButtonPopupMode popupMode READ popupMode WRITE setPopupMode) +#endif + Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle) + Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise) + Q_PROPERTY(Qt::ArrowType arrowType READ arrowType WRITE setArrowType) + +public: + enum ToolButtonPopupMode { + DelayedPopup, + MenuButtonPopup, + InstantPopup + }; + + explicit QToolButton(QWidget * parent=0); + ~QToolButton(); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + Qt::ToolButtonStyle toolButtonStyle() const; + + Qt::ArrowType arrowType() const; + void setArrowType(Qt::ArrowType type); + +#ifndef QT_NO_MENU + void setMenu(QMenu* menu); + QMenu* menu() const; + + void setPopupMode(ToolButtonPopupMode mode); + ToolButtonPopupMode popupMode() const; +#endif + + QAction *defaultAction() const; + + void setAutoRaise(bool enable); + bool autoRaise() const; + +public Q_SLOTS: +#ifndef QT_NO_MENU + void showMenu(); +#endif + void setToolButtonStyle(Qt::ToolButtonStyle style); + void setDefaultAction(QAction *); + +Q_SIGNALS: + void triggered(QAction *); + +protected: + QToolButton(QToolButtonPrivate &, QWidget* parent); + bool event(QEvent *e); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void paintEvent(QPaintEvent *); + void actionEvent(QActionEvent *); + + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + void timerEvent(QTimerEvent *); + void changeEvent(QEvent *); + + bool hitButton(const QPoint &pos) const; + void nextCheckState(); + void initStyleOption(QStyleOptionToolButton *option) const; + +private: + Q_DISABLE_COPY(QToolButton) + Q_DECLARE_PRIVATE(QToolButton) +#ifndef QT_NO_MENU + Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed()) + Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown()) + Q_PRIVATE_SLOT(d_func(), void _q_menuTriggered(QAction*)) +#endif + Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) + +#ifdef QT3_SUPPORT +public: + enum TextPosition { + BesideIcon, + BelowIcon + , Right = BesideIcon, + Under = BelowIcon + }; + + QT3_SUPPORT_CONSTRUCTOR QToolButton(QWidget * parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QToolButton(Qt::ArrowType type, QWidget *parent, const char* name); + QT3_SUPPORT_CONSTRUCTOR QToolButton( const QIcon& s, const QString &textLabel, + const QString& grouptext, + QObject * receiver, const char* slot, + QWidget * parent, const char* name=0 ); + inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap) { setIcon(static_cast<QIcon>(pixmap)); } + QT3_SUPPORT void setOnIconSet(const QIcon&); + QT3_SUPPORT void setOffIconSet(const QIcon&); + inline QT3_SUPPORT void setIconSet(const QIcon &icon){setIcon(icon);} + QT3_SUPPORT void setIconSet(const QIcon &, bool on); + inline QT3_SUPPORT void setTextLabel(const QString &text, bool tooltip = true) { + setText(text); +#ifndef QT_NO_TOOLTIP + if (tooltip) + setToolTip(text); +#else + Q_UNUSED(tooltip); +#endif + } + inline QT3_SUPPORT QString textLabel() const { return text(); } + QT3_SUPPORT QIcon onIconSet() const; + QT3_SUPPORT QIcon offIconSet() const; + QT3_SUPPORT QIcon iconSet(bool on) const; + inline QT3_SUPPORT QIcon iconSet() const { return icon(); } + inline QT3_SUPPORT void openPopup() { showMenu(); } + inline QT3_SUPPORT void setPopup(QMenu* popup) {setMenu(popup); } + inline QT3_SUPPORT QMenu* popup() const { return menu(); } + inline QT3_SUPPORT bool usesBigPixmap() const { return iconSize().height() > 22; } + inline QT3_SUPPORT bool usesTextLabel() const { return toolButtonStyle() != Qt::ToolButtonIconOnly; } + inline QT3_SUPPORT TextPosition textPosition() const + { return toolButtonStyle() == Qt::ToolButtonTextUnderIcon ? BelowIcon : BesideIcon; } + QT3_SUPPORT void setPopupDelay(int delay); + QT3_SUPPORT int popupDelay() const; + +public Q_SLOTS: + QT_MOC_COMPAT void setUsesBigPixmap(bool enable) + { setIconSize(enable?QSize(32,32):QSize(22,22)); } + QT_MOC_COMPAT void setUsesTextLabel(bool enable) + { setToolButtonStyle(enable?Qt::ToolButtonTextUnderIcon : Qt::ToolButtonIconOnly); } + QT_MOC_COMPAT void setTextPosition(QToolButton::TextPosition pos) + { setToolButtonStyle(pos == BesideIcon ? Qt::ToolButtonTextBesideIcon : Qt::ToolButtonTextUnderIcon); } + +#endif +}; + +#endif // QT_NO_TOOLBUTTON + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTOOLBUTTON_H diff --git a/qtinterface/qt4/Qt/qtooltip.h b/qtinterface/qt4/Qt/qtooltip.h new file mode 100644 index 0000000..6bcd943 --- /dev/null +++ b/qtinterface/qt4/Qt/qtooltip.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTOOLTIP_H +#define QTOOLTIP_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TOOLTIP + +class Q_GUI_EXPORT QToolTip +{ + QToolTip(); +public: + static void showText(const QPoint &pos, const QString &text, QWidget *w = 0); + static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect); + static inline void hideText() { showText(QPoint(), QString()); } + + static bool isVisible(); + static QString text(); + + static QPalette palette(); + static void setPalette(const QPalette &); + static QFont font(); + static void setFont(const QFont &); +#ifdef QT3_SUPPORT + static inline QT3_SUPPORT void add(QWidget *w, const QString &s) { w->setToolTip(s); } + static inline QT3_SUPPORT void add(QWidget *w, const QRect &, const QString &s) + { w->setToolTip(s); } + static inline QT3_SUPPORT void remove(QWidget *w) { w->setToolTip(QString()); } +#endif +}; + +#endif // QT_NO_TOOLTIP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTOOLTIP_H diff --git a/qtinterface/qt4/Qt/qtransform.h b/qtinterface/qt4/Qt/qtransform.h new file mode 100644 index 0000000..19cd258 --- /dev/null +++ b/qtinterface/qt4/Qt/qtransform.h @@ -0,0 +1,395 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QTRANSFORM_H +#define QTRANSFORM_H + +#include <QtGui/qmatrix.h> +#include <QtGui/qpainterpath.h> +#include <QtGui/qpolygon.h> +#include <QtGui/qregion.h> +#include <QtGui/qwindowdefs.h> +#include <QtCore/qline.h> +#include <QtCore/qpoint.h> +#include <QtCore/qrect.h> + +#if defined(Q_OS_VXWORKS) && defined(m_type) +# undef m_type +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QVariant; + +class Q_GUI_EXPORT QTransform +{ + Q_ENUMS(TransformationType) +public: + enum TransformationType { + TxNone = 0x00, + TxTranslate = 0x01, + TxScale = 0x02, + TxRotate = 0x04, + TxShear = 0x08, + TxProject = 0x10 + }; + + inline explicit QTransform(Qt::Initialization) : affine(Qt::Uninitialized) {} + QTransform(); + QTransform(qreal h11, qreal h12, qreal h13, + qreal h21, qreal h22, qreal h23, + qreal h31, qreal h32, qreal h33 = 1.0); + QTransform(qreal h11, qreal h12, qreal h21, + qreal h22, qreal dx, qreal dy); + explicit QTransform(const QMatrix &mtx); + + bool isAffine() const; + bool isIdentity() const; + bool isInvertible() const; + bool isScaling() const; + bool isRotating() const; + bool isTranslating() const; + + TransformationType type() const; + + inline qreal determinant() const; + qreal det() const; + + qreal m11() const; + qreal m12() const; + qreal m13() const; + qreal m21() const; + qreal m22() const; + qreal m23() const; + qreal m31() const; + qreal m32() const; + qreal m33() const; + qreal dx() const; + qreal dy() const; + + void setMatrix(qreal m11, qreal m12, qreal m13, + qreal m21, qreal m22, qreal m23, + qreal m31, qreal m32, qreal m33); + + QTransform inverted(bool *invertible = 0) const; + QTransform adjoint() const; + QTransform transposed() const; + + QTransform &translate(qreal dx, qreal dy); + QTransform &scale(qreal sx, qreal sy); + QTransform &shear(qreal sh, qreal sv); + QTransform &rotate(qreal a, Qt::Axis axis = Qt::ZAxis); + QTransform &rotateRadians(qreal a, Qt::Axis axis = Qt::ZAxis); + + static bool squareToQuad(const QPolygonF &square, QTransform &result); + static bool quadToSquare(const QPolygonF &quad, QTransform &result); + static bool quadToQuad(const QPolygonF &one, + const QPolygonF &two, + QTransform &result); + + bool operator==(const QTransform &) const; + bool operator!=(const QTransform &) const; + + QTransform &operator*=(const QTransform &); + QTransform operator*(const QTransform &o) const; + + QTransform &operator=(const QTransform &); + + operator QVariant() const; + + void reset(); + QPoint map(const QPoint &p) const; + QPointF map(const QPointF &p) const; + QLine map(const QLine &l) const; + QLineF map(const QLineF &l) const; + QPolygonF map(const QPolygonF &a) const; + QPolygon map(const QPolygon &a) const; + QRegion map(const QRegion &r) const; + QPainterPath map(const QPainterPath &p) const; + QPolygon mapToPolygon(const QRect &r) const; + QRect mapRect(const QRect &) const; + QRectF mapRect(const QRectF &) const; + void map(int x, int y, int *tx, int *ty) const; + void map(qreal x, qreal y, qreal *tx, qreal *ty) const; + + const QMatrix &toAffine() const; + + QTransform &operator*=(qreal div); + QTransform &operator/=(qreal div); + QTransform &operator+=(qreal div); + QTransform &operator-=(qreal div); + + static QTransform fromTranslate(qreal dx, qreal dy); + static QTransform fromScale(qreal dx, qreal dy); + +private: + inline QTransform(qreal h11, qreal h12, qreal h13, + qreal h21, qreal h22, qreal h23, + qreal h31, qreal h32, qreal h33, bool) + : affine(h11, h12, h21, h22, h31, h32, true) + , m_13(h13), m_23(h23), m_33(h33) + , m_type(TxNone) + , m_dirty(TxProject) {} + inline QTransform(bool) + : affine(true) + , m_13(0), m_23(0), m_33(1) + , m_type(TxNone) + , m_dirty(TxNone) {} + inline TransformationType inline_type() const; + QMatrix affine; + qreal m_13; + qreal m_23; + qreal m_33; + + mutable uint m_type : 5; + mutable uint m_dirty : 5; + + class Private; + Private *d; +}; +Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE); + +/******* inlines *****/ +inline QTransform::TransformationType QTransform::inline_type() const +{ + if (m_dirty == TxNone) + return static_cast<TransformationType>(m_type); + return type(); +} + +inline bool QTransform::isAffine() const +{ + return inline_type() < TxProject; +} +inline bool QTransform::isIdentity() const +{ + return inline_type() == TxNone; +} + +inline bool QTransform::isInvertible() const +{ + return !qFuzzyIsNull(determinant()); +} + +inline bool QTransform::isScaling() const +{ + return type() >= TxScale; +} +inline bool QTransform::isRotating() const +{ + return inline_type() >= TxRotate; +} + +inline bool QTransform::isTranslating() const +{ + return inline_type() >= TxTranslate; +} + +inline qreal QTransform::determinant() const +{ + return affine._m11*(m_33*affine._m22-affine._dy*m_23) - + affine._m21*(m_33*affine._m12-affine._dy*m_13)+affine._dx*(m_23*affine._m12-affine._m22*m_13); +} +inline qreal QTransform::det() const +{ + return determinant(); +} +inline qreal QTransform::m11() const +{ + return affine._m11; +} +inline qreal QTransform::m12() const +{ + return affine._m12; +} +inline qreal QTransform::m13() const +{ + return m_13; +} +inline qreal QTransform::m21() const +{ + return affine._m21; +} +inline qreal QTransform::m22() const +{ + return affine._m22; +} +inline qreal QTransform::m23() const +{ + return m_23; +} +inline qreal QTransform::m31() const +{ + return affine._dx; +} +inline qreal QTransform::m32() const +{ + return affine._dy; +} +inline qreal QTransform::m33() const +{ + return m_33; +} +inline qreal QTransform::dx() const +{ + return affine._dx; +} +inline qreal QTransform::dy() const +{ + return affine._dy; +} + +inline QTransform &QTransform::operator*=(qreal num) +{ + if (num == 1.) + return *this; + affine._m11 *= num; + affine._m12 *= num; + m_13 *= num; + affine._m21 *= num; + affine._m22 *= num; + m_23 *= num; + affine._dx *= num; + affine._dy *= num; + m_33 *= num; + m_dirty |= TxScale; + return *this; +} +inline QTransform &QTransform::operator/=(qreal div) +{ + if (div == 0) + return *this; + div = 1/div; + return operator*=(div); +} +inline QTransform &QTransform::operator+=(qreal num) +{ + if (num == 0) + return *this; + affine._m11 += num; + affine._m12 += num; + m_13 += num; + affine._m21 += num; + affine._m22 += num; + m_23 += num; + affine._dx += num; + affine._dy += num; + m_33 += num; + m_dirty |= TxProject; + return *this; +} +inline QTransform &QTransform::operator-=(qreal num) +{ + if (num == 0) + return *this; + affine._m11 -= num; + affine._m12 -= num; + m_13 -= num; + affine._m21 -= num; + affine._m22 -= num; + m_23 -= num; + affine._dx -= num; + affine._dy -= num; + m_33 -= num; + m_dirty |= TxProject; + return *this; +} + +inline bool qFuzzyCompare(const QTransform& t1, const QTransform& t2) +{ + return qFuzzyCompare(t1.m11(), t2.m11()) + && qFuzzyCompare(t1.m12(), t2.m12()) + && qFuzzyCompare(t1.m13(), t2.m13()) + && qFuzzyCompare(t1.m21(), t2.m21()) + && qFuzzyCompare(t1.m22(), t2.m22()) + && qFuzzyCompare(t1.m23(), t2.m23()) + && qFuzzyCompare(t1.m31(), t2.m31()) + && qFuzzyCompare(t1.m32(), t2.m32()) + && qFuzzyCompare(t1.m33(), t2.m33()); +} + + +/****** stream functions *******************/ +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QTransform &); +#endif +/****** end stream functions *******************/ + +// mathematical semantics +Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QTransform &m) +{ return m.map(p); } +Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QTransform &m) +{ return m.map(p); } +Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QTransform &m) +{ return m.map(l); } +Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QTransform &m) +{ return m.map(l); } +Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QTransform &m) +{ return m.map(a); } +Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QTransform &m) +{ return m.map(a); } +Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QTransform &m) +{ return m.map(r); } +Q_GUI_EXPORT_INLINE QPainterPath operator *(const QPainterPath &p, const QTransform &m) +{ return m.map(p); } + +Q_GUI_EXPORT_INLINE QTransform operator *(const QTransform &a, qreal n) +{ QTransform t(a); t *= n; return t; } +Q_GUI_EXPORT_INLINE QTransform operator /(const QTransform &a, qreal n) +{ QTransform t(a); t /= n; return t; } +Q_GUI_EXPORT_INLINE QTransform operator +(const QTransform &a, qreal n) +{ QTransform t(a); t += n; return t; } +Q_GUI_EXPORT_INLINE QTransform operator -(const QTransform &a, qreal n) +{ QTransform t(a); t -= n; return t; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qtranslator.h b/qtinterface/qt4/Qt/qtranslator.h new file mode 100644 index 0000000..c1f6449 --- /dev/null +++ b/qtinterface/qt4/Qt/qtranslator.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTRANSLATOR_H +#define QTRANSLATOR_H + +#include <QtCore/qobject.h> +#include <QtCore/qbytearray.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_TRANSLATION + +class QTranslatorPrivate; + +class Q_CORE_EXPORT QTranslator : public QObject +{ + Q_OBJECT +public: + explicit QTranslator(QObject *parent = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QTranslator(QObject * parent, const char * name); +#endif + ~QTranslator(); + + // ### Qt 5: Merge (with "int n = -1") + virtual QString translate(const char *context, const char *sourceText, + const char *disambiguation = 0) const; + QString translate(const char *context, const char *sourceText, const char *disambiguation, + int n) const; + + virtual bool isEmpty() const; + + bool load(const QString & filename, + const QString & directory = QString(), + const QString & search_delimiters = QString(), + const QString & suffix = QString()); + bool load(const uchar *data, int len); + +#ifdef QT3_SUPPORT + QT3_SUPPORT QString find(const char *context, const char *sourceText, const char * comment = 0) const + { return translate(context, sourceText, comment); } +#endif + +private: + Q_DISABLE_COPY(QTranslator) + Q_DECLARE_PRIVATE(QTranslator) +}; + +#endif // QT_NO_TRANSLATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTRANSLATOR_H diff --git a/qtinterface/qt4/Qt/qtransportauth_qws.h b/qtinterface/qt4/Qt/qtransportauth_qws.h new file mode 100644 index 0000000..1920699 --- /dev/null +++ b/qtinterface/qt4/Qt/qtransportauth_qws.h @@ -0,0 +1,281 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTRANSPORTAUTH_QWS_H +#define QTRANSPORTAUTH_QWS_H + +#include <QtCore/qglobal.h> + +#if !defined(QT_NO_SXE) || defined(SXE_INSTALLER) + +#include <QtCore/qobject.h> +#include <QtCore/qhash.h> +#include <QtCore/qstring.h> +#include <QtCore/qbuffer.h> +#include <QtCore/qpointer.h> + +#include <sys/types.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAuthDevice; +class QWSClient; +class QIODevice; +class QTransportAuthPrivate; +class QMutex; + +class Q_GUI_EXPORT QTransportAuth : public QObject +{ + Q_OBJECT +public: + static QTransportAuth *getInstance(); + + enum Result { + // Error codes + Pending = 0x00, + TooSmall = 0x01, + CacheMiss = 0x02, + NoMagic = 0x03, + NoSuchKey = 0x04, + FailMatch = 0x05, + OutOfDate = 0x06, + // reserved for expansion + Success = 0x1e, + ErrMask = 0x1f, + + // Verification codes + Allow = 0x20, + Deny = 0x40, + Ask = 0x60, + // reserved + StatusMask = 0xe0 + }; + + enum Properties { + Trusted = 0x01, + Connection = 0x02, + UnixStreamSock = 0x04, + SharedMemory = 0x08, + MessageQueue = 0x10, + UDP = 0x20, + TCP = 0x40, + UserDefined = 0x80, + TransportType = 0xfc + }; + + struct Data + { + Data() { processId = -1; } + Data( unsigned char p, int d ) + : properties( p ) + , descriptor( d ) + , processId( -1 ) + { + if (( properties & TransportType ) == TCP || + ( properties & TransportType ) == UnixStreamSock ) + properties |= Connection; + } + + unsigned char properties; + unsigned char progId; + unsigned char status; + unsigned int descriptor; // socket fd or shmget key + pid_t processId; + + bool trusted() const; + void setTrusted( bool ); + bool connection() const; + void setConnection( bool ); + }; + + static const char *errorString( const QTransportAuth::Data & ); + + QTransportAuth::Data *connectTransport( unsigned char, int ); + + QAuthDevice *authBuf( QTransportAuth::Data *, QIODevice * ); + QAuthDevice *recvBuf( QTransportAuth::Data *, QIODevice * ); + QIODevice *passThroughByClient( QWSClient * ) const; + + void setKeyFilePath( const QString & ); + QString keyFilePath() const; + const unsigned char *getClientKey( unsigned char progId ); + void invalidateClientKeyCache(); + QMutex *getKeyFileMutex(); + void setLogFilePath( const QString & ); + QString logFilePath() const; + void setPackageRegistry( QObject *registry ); + bool isDiscoveryMode() const; + void setProcessKey( const char * ); + void setProcessKey( const char *, const char * ); + void registerPolicyReceiver( QObject * ); + void unregisterPolicyReceiver( QObject * ); + + bool authToMessage( QTransportAuth::Data &d, char *hdr, const char *msg, int msgLen ); + bool authFromMessage( QTransportAuth::Data &d, const char *msg, int msgLen ); + + bool authorizeRequest( QTransportAuth::Data &d, const QString &request ); + +Q_SIGNALS: + void policyCheck( QTransportAuth::Data &, const QString & ); + void authViolation( QTransportAuth::Data & ); +private Q_SLOTS: + void bufferDestroyed( QObject * ); + +private: + // users should never construct their own + QTransportAuth(); + ~QTransportAuth(); + + friend class QAuthDevice; + Q_DECLARE_PRIVATE(QTransportAuth) +}; + +class Q_GUI_EXPORT RequestAnalyzer +{ +public: + RequestAnalyzer(); + virtual ~RequestAnalyzer(); + QString operator()( QByteArray *data ) { return analyze( data ); } + bool requireMoreData() const { return moreData; } + qint64 bytesAnalyzed() const { return dataSize; } +protected: + virtual QString analyze( QByteArray * ); + bool moreData; + qint64 dataSize; +}; + +/*! + \internal + \class QAuthDevice + + \brief Pass-through QIODevice sub-class for authentication. + + Use this class to forward on or receive forwarded data over a real + device for authentication. +*/ +class Q_GUI_EXPORT QAuthDevice : public QIODevice +{ + Q_OBJECT +public: + enum AuthDirection { + Receive, + Send + }; + QAuthDevice( QIODevice *, QTransportAuth::Data *, AuthDirection ); + ~QAuthDevice(); + void setTarget( QIODevice *t ) { m_target = t; } + QIODevice *target() const { return m_target; } + void setClient( QObject* ); + QObject *client() const; + void setRequestAnalyzer( RequestAnalyzer * ); + bool isSequential() const; + bool atEnd() const; + qint64 bytesAvailable() const; + qint64 bytesToWrite() const; + bool seek( qint64 ); + QByteArray & buffer(); + +protected: + qint64 readData( char *, qint64 ); + qint64 writeData(const char *, qint64 ); +private Q_SLOTS: + void recvReadyRead(); + void targetBytesWritten( qint64 ); +private: + bool authorizeMessage(); + + QTransportAuth::Data *d; + AuthDirection way; + QIODevice *m_target; + QObject *m_client; + QByteArray msgQueue; + qint64 m_bytesAvailable; + qint64 m_skipWritten; + + RequestAnalyzer *analyzer; +}; + +inline bool QAuthDevice::isSequential() const +{ + return true; +} + +inline bool QAuthDevice::seek( qint64 ) +{ + return false; +} + +inline bool QAuthDevice::atEnd() const +{ + return msgQueue.isEmpty(); +} + +inline qint64 QAuthDevice::bytesAvailable() const +{ + if ( way == Receive ) + return m_bytesAvailable; + else + return ( m_target ? m_target->bytesAvailable() : 0 ); +} + +inline qint64 QAuthDevice::bytesToWrite() const +{ + return msgQueue.size(); +} + +inline QByteArray &QAuthDevice::buffer() +{ + return msgQueue; +} + + + + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_SXE +#endif // QTRANSPORTAUTH_QWS_H diff --git a/qtinterface/qt4/Qt/qtransportauthdefs_qws.h b/qtinterface/qt4/Qt/qtransportauthdefs_qws.h new file mode 100644 index 0000000..7717b67 --- /dev/null +++ b/qtinterface/qt4/Qt/qtransportauthdefs_qws.h @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTRANSPORTAUTHDEFS_QWS_H +#define QTRANSPORTAUTHDEFS_QWS_H + +#include <sys/types.h> +#include <string.h> + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#define QSXE_KEY_LEN 16 +#define QSXE_MAGIC_BYTES 4 + +// Number of bytes of each message to authenticate. Just need to ensure +// that the command at the beginning hasn't been tampered with. This value +// does not matter for trusted transports. +#define AMOUNT_TO_AUTHENTICATE 200 + +#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN])) +#define AUTH_KEY(k) ((unsigned char *)(k)) + +// must be a largish -ve number under any endianess when cast as an int +const unsigned char magic[QSXE_MAGIC_BYTES] = { 0xBA, 0xD4, 0xD4, 0xBA }; +const int magicInt = 0xBAD4D4BA; + +#define QSXE_KEYFILE "keyfile" + +/* + Header in above format, less the magic bytes. + Useful for reading off the socket +*/ +struct AuthHeader +{ + unsigned char len; + unsigned char pad; + unsigned char digest[QSXE_KEY_LEN]; + unsigned char id; + unsigned char seq; +}; + +/* + Header in a form suitable for authentication routines +*/ +struct AuthMessage +{ + AuthMessage() + { + ::memset( authData, 0, sizeof(authData) ); + ::memcpy( pad_magic, magic, QSXE_MAGIC_BYTES ); + } + unsigned char pad_magic[QSXE_MAGIC_BYTES]; + union { + AuthHeader hdr; + char authData[sizeof(AuthHeader)]; + }; + char payLoad[AMOUNT_TO_AUTHENTICATE]; +}; + +/** + Auth data as stored in _key +*/ +struct AuthCookie +{ + unsigned char key[QSXE_KEY_LEN]; + unsigned char pad; + unsigned char progId; +}; + +/* + Auth data as written to the key file - SUPERSEDED by usr_key_entry + + This is still used internally for some functions, ie the socket + related calls. +*/ +struct AuthRecord +{ + union { + AuthCookie auth; + char data[sizeof(struct AuthCookie)]; + }; + time_t change_time; +}; + +/*! + \class usr_key_entry + This comes from the SXE kernel patch file include/linux/lidsif.h + + This is the (new) data record for the key file (version 2). + + The key file is (now) either /proc/lids/keys (and the per-process + keys in /proc/<pid>/lids_key) OR for desktop/development ONLY (not + for production) it is $QPEDIR/etc/keyfile + + The key file maps keys to files. + + File are identified by inode and device numbers, not paths. + + (See the "installs" file for path to inode/device mapping) +*/ +struct usr_key_entry +{ + char key[QSXE_KEY_LEN]; + ino_t ino; + dev_t dev; +}; + + +/*! + \class IdBlock + \brief Data record for the manifest file. + The manifest file maps program id's to files +*/ +struct IdBlock +{ + quint64 inode; + quint64 device; + unsigned char pad; + unsigned char progId; + unsigned short installId; + unsigned int keyOffset; + qint64 install_time; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTRANSPORTAUTHDEFS_QWS_H + diff --git a/qtinterface/qt4/Qt/qtreeview.h b/qtinterface/qt4/Qt/qtreeview.h new file mode 100644 index 0000000..83760ee --- /dev/null +++ b/qtinterface/qt4/Qt/qtreeview.h @@ -0,0 +1,239 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTREEVIEW_H +#define QTREEVIEW_H + +#include <QtGui/qabstractitemview.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TREEVIEW + +class QTreeViewPrivate; +class QHeaderView; + +class Q_GUI_EXPORT QTreeView : public QAbstractItemView +{ + Q_OBJECT + Q_PROPERTY(int autoExpandDelay READ autoExpandDelay WRITE setAutoExpandDelay) + Q_PROPERTY(int indentation READ indentation WRITE setIndentation) + Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated) + Q_PROPERTY(bool uniformRowHeights READ uniformRowHeights WRITE setUniformRowHeights) + Q_PROPERTY(bool itemsExpandable READ itemsExpandable WRITE setItemsExpandable) + Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled) + Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) + Q_PROPERTY(bool allColumnsShowFocus READ allColumnsShowFocus WRITE setAllColumnsShowFocus) + Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) + Q_PROPERTY(bool headerHidden READ isHeaderHidden WRITE setHeaderHidden) + Q_PROPERTY(bool expandsOnDoubleClick READ expandsOnDoubleClick WRITE setExpandsOnDoubleClick) + +public: + explicit QTreeView(QWidget *parent = 0); + ~QTreeView(); + + void setModel(QAbstractItemModel *model); + void setRootIndex(const QModelIndex &index); + void setSelectionModel(QItemSelectionModel *selectionModel); + + QHeaderView *header() const; + void setHeader(QHeaderView *header); + + int autoExpandDelay() const; + void setAutoExpandDelay(int delay); + + int indentation() const; + void setIndentation(int i); + + bool rootIsDecorated() const; + void setRootIsDecorated(bool show); + + bool uniformRowHeights() const; + void setUniformRowHeights(bool uniform); + + bool itemsExpandable() const; + void setItemsExpandable(bool enable); + + bool expandsOnDoubleClick() const; + void setExpandsOnDoubleClick(bool enable); + + int columnViewportPosition(int column) const; + int columnWidth(int column) const; + void setColumnWidth(int column, int width); + int columnAt(int x) const; + + bool isColumnHidden(int column) const; + void setColumnHidden(int column, bool hide); + + bool isHeaderHidden() const; + void setHeaderHidden(bool hide); + + bool isRowHidden(int row, const QModelIndex &parent) const; + void setRowHidden(int row, const QModelIndex &parent, bool hide); + + bool isFirstColumnSpanned(int row, const QModelIndex &parent) const; + void setFirstColumnSpanned(int row, const QModelIndex &parent, bool span); + + bool isExpanded(const QModelIndex &index) const; + void setExpanded(const QModelIndex &index, bool expand); + + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + + void setAnimated(bool enable); + bool isAnimated() const; + + void setAllColumnsShowFocus(bool enable); + bool allColumnsShowFocus() const; + + void setWordWrap(bool on); + bool wordWrap() const; + + void keyboardSearch(const QString &search); + + QRect visualRect(const QModelIndex &index) const; + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); + QModelIndex indexAt(const QPoint &p) const; + QModelIndex indexAbove(const QModelIndex &index) const; + QModelIndex indexBelow(const QModelIndex &index) const; + + void doItemsLayout(); + void reset(); + + void sortByColumn(int column, Qt::SortOrder order); + + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void selectAll(); + +Q_SIGNALS: + void expanded(const QModelIndex &index); + void collapsed(const QModelIndex &index); + +public Q_SLOTS: + void hideColumn(int column); + void showColumn(int column); + void expand(const QModelIndex &index); + void collapse(const QModelIndex &index); + void resizeColumnToContents(int column); + void sortByColumn(int column); + void expandAll(); + void collapseAll(); + void expandToDepth(int depth); + +protected Q_SLOTS: + void columnResized(int column, int oldSize, int newSize); + void columnCountChanged(int oldCount, int newCount); + void columnMoved(); + void reexpand(); + void rowsRemoved(const QModelIndex &parent, int first, int last); + +protected: + QTreeView(QTreeViewPrivate &dd, QWidget *parent = 0); + void scrollContentsBy(int dx, int dy); + void rowsInserted(const QModelIndex &parent, int start, int end); + void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + + QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + int horizontalOffset() const; + int verticalOffset() const; + + void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + QRegion visualRegionForSelection(const QItemSelection &selection) const; + QModelIndexList selectedIndexes() const; + + void timerEvent(QTimerEvent *event); + void paintEvent(QPaintEvent *event); + + void drawTree(QPainter *painter, const QRegion ®ion) const; + virtual void drawRow(QPainter *painter, + const QStyleOptionViewItem &options, + const QModelIndex &index) const; + virtual void drawBranches(QPainter *painter, + const QRect &rect, + const QModelIndex &index) const; + + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void keyPressEvent(QKeyEvent *event); +#ifndef QT_NO_DRAGANDDROP + void dragMoveEvent(QDragMoveEvent *event); +#endif + bool viewportEvent(QEvent *event); + + void updateGeometries(); + + int sizeHintForColumn(int column) const; + int indexRowSizeHint(const QModelIndex &index) const; + int rowHeight(const QModelIndex &index) const; + + void horizontalScrollbarAction(int action); + + bool isIndexHidden(const QModelIndex &index) const; + void selectionChanged(const QItemSelection &selected, + const QItemSelection &deselected); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + +private: + friend class QAccessibleItemView; + int visualIndex(const QModelIndex &index) const; + + Q_DECLARE_PRIVATE(QTreeView) + Q_DISABLE_COPY(QTreeView) +#ifndef QT_NO_ANIMATION + Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) +#endif //QT_NO_ANIMATION + Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) + Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order)) +}; + +#endif // QT_NO_TREEVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTREEVIEW_H diff --git a/qtinterface/qt4/Qt/qtreewidget.h b/qtinterface/qt4/Qt/qtreewidget.h new file mode 100644 index 0000000..65c2ca0 --- /dev/null +++ b/qtinterface/qt4/Qt/qtreewidget.h @@ -0,0 +1,432 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTREEWIDGET_H +#define QTREEWIDGET_H + +#include <QtGui/qtreeview.h> +#include <QtGui/qtreewidgetitemiterator.h> +#include <QtCore/qvariant.h> +#include <QtCore/qvector.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TREEWIDGET + +class QTreeWidget; +class QTreeModel; +class QWidgetItemData; +class QTreeWidgetItemPrivate; + +class Q_GUI_EXPORT QTreeWidgetItem +{ + friend class QTreeModel; + friend class QTreeWidget; + friend class QTreeWidgetPrivate; + friend class QTreeWidgetItemIterator; + friend class QTreeWidgetItemPrivate; +public: + enum ItemType { Type = 0, UserType = 1000 }; + explicit QTreeWidgetItem(int type = Type); + QTreeWidgetItem(const QStringList &strings, int type = Type); + explicit QTreeWidgetItem(QTreeWidget *view, int type = Type); + QTreeWidgetItem(QTreeWidget *view, const QStringList &strings, int type = Type); + QTreeWidgetItem(QTreeWidget *view, QTreeWidgetItem *after, int type = Type); + explicit QTreeWidgetItem(QTreeWidgetItem *parent, int type = Type); + QTreeWidgetItem(QTreeWidgetItem *parent, const QStringList &strings, int type = Type); + QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after, int type = Type); + QTreeWidgetItem(const QTreeWidgetItem &other); + virtual ~QTreeWidgetItem(); + + virtual QTreeWidgetItem *clone() const; + + inline QTreeWidget *treeWidget() const { return view; } + + inline void setSelected(bool select); + inline bool isSelected() const; + + inline void setHidden(bool hide); + inline bool isHidden() const; + + inline void setExpanded(bool expand); + inline bool isExpanded() const; + + inline void setFirstColumnSpanned(bool span); + inline bool isFirstColumnSpanned() const; + + inline void setDisabled(bool disabled); + inline bool isDisabled() const; + + enum ChildIndicatorPolicy { ShowIndicator, DontShowIndicator, DontShowIndicatorWhenChildless }; + void setChildIndicatorPolicy(QTreeWidgetItem::ChildIndicatorPolicy policy); + QTreeWidgetItem::ChildIndicatorPolicy childIndicatorPolicy() const; + + Qt::ItemFlags flags() const; + void setFlags(Qt::ItemFlags flags); + + inline QString text(int column) const + { return data(column, Qt::DisplayRole).toString(); } + inline void setText(int column, const QString &text); + + inline QIcon icon(int column) const + { return qvariant_cast<QIcon>(data(column, Qt::DecorationRole)); } + inline void setIcon(int column, const QIcon &icon); + + inline QString statusTip(int column) const + { return data(column, Qt::StatusTipRole).toString(); } + inline void setStatusTip(int column, const QString &statusTip); + +#ifndef QT_NO_TOOLTIP + inline QString toolTip(int column) const + { return data(column, Qt::ToolTipRole).toString(); } + inline void setToolTip(int column, const QString &toolTip); +#endif + +#ifndef QT_NO_WHATSTHIS + inline QString whatsThis(int column) const + { return data(column, Qt::WhatsThisRole).toString(); } + inline void setWhatsThis(int column, const QString &whatsThis); +#endif + + inline QFont font(int column) const + { return qvariant_cast<QFont>(data(column, Qt::FontRole)); } + inline void setFont(int column, const QFont &font); + + inline int textAlignment(int column) const + { return data(column, Qt::TextAlignmentRole).toInt(); } + inline void setTextAlignment(int column, int alignment) + { setData(column, Qt::TextAlignmentRole, alignment); } + + inline QColor backgroundColor(int column) const + { return qvariant_cast<QColor>(data(column, Qt::BackgroundColorRole)); } + inline void setBackgroundColor(int column, const QColor &color) + { setData(column, Qt::BackgroundColorRole, color); } + + inline QBrush background(int column) const + { return qvariant_cast<QBrush>(data(column, Qt::BackgroundRole)); } + inline void setBackground(int column, const QBrush &brush) + { setData(column, Qt::BackgroundRole, brush); } + + inline QColor textColor(int column) const + { return qvariant_cast<QColor>(data(column, Qt::TextColorRole)); } + inline void setTextColor(int column, const QColor &color) + { setData(column, Qt::TextColorRole, color); } + + inline QBrush foreground(int column) const + { return qvariant_cast<QBrush>(data(column, Qt::ForegroundRole)); } + inline void setForeground(int column, const QBrush &brush) + { setData(column, Qt::ForegroundRole, brush); } + + inline Qt::CheckState checkState(int column) const + { return static_cast<Qt::CheckState>(data(column, Qt::CheckStateRole).toInt()); } + inline void setCheckState(int column, Qt::CheckState state) + { setData(column, Qt::CheckStateRole, state); } + + inline QSize sizeHint(int column) const + { return qvariant_cast<QSize>(data(column, Qt::SizeHintRole)); } + inline void setSizeHint(int column, const QSize &size) + { setData(column, Qt::SizeHintRole, size); } + + virtual QVariant data(int column, int role) const; + virtual void setData(int column, int role, const QVariant &value); + + virtual bool operator<(const QTreeWidgetItem &other) const; + +#ifndef QT_NO_DATASTREAM + virtual void read(QDataStream &in); + virtual void write(QDataStream &out) const; +#endif + QTreeWidgetItem &operator=(const QTreeWidgetItem &other); + + inline QTreeWidgetItem *parent() const { return par; } + inline QTreeWidgetItem *child(int index) const { + if (index < 0 || index >= children.size()) + return 0; + executePendingSort(); + return children.at(index); + } + inline int childCount() const { return children.count(); } + inline int columnCount() const { return values.count(); } + inline int indexOfChild(QTreeWidgetItem *child) const; + + void addChild(QTreeWidgetItem *child); + void insertChild(int index, QTreeWidgetItem *child); + void removeChild(QTreeWidgetItem *child); + QTreeWidgetItem *takeChild(int index); + + void addChildren(const QList<QTreeWidgetItem*> &children); + void insertChildren(int index, const QList<QTreeWidgetItem*> &children); + QList<QTreeWidgetItem*> takeChildren(); + + inline int type() const { return rtti; } + inline void sortChildren(int column, Qt::SortOrder order) + { sortChildren(column, order, false); } + +protected: + void emitDataChanged(); + +private: + void sortChildren(int column, Qt::SortOrder order, bool climb); + QVariant childrenCheckState(int column) const; + void itemChanged(); + void executePendingSort() const; + + int rtti; + // One item has a vector of column entries. Each column has a vector of (role, value) pairs. + QVector< QVector<QWidgetItemData> > values; + QTreeWidget *view; + QTreeWidgetItemPrivate *d; + QTreeWidgetItem *par; + QList<QTreeWidgetItem*> children; + Qt::ItemFlags itemFlags; +}; + +inline void QTreeWidgetItem::setText(int column, const QString &atext) +{ setData(column, Qt::DisplayRole, atext); } + +inline void QTreeWidgetItem::setIcon(int column, const QIcon &aicon) +{ setData(column, Qt::DecorationRole, aicon); } + +#ifndef QT_NO_STATUSTIP +inline void QTreeWidgetItem::setStatusTip(int column, const QString &astatusTip) +{ setData(column, Qt::StatusTipRole, astatusTip); } +#endif + +#ifndef QT_NO_TOOLTIP +inline void QTreeWidgetItem::setToolTip(int column, const QString &atoolTip) +{ setData(column, Qt::ToolTipRole, atoolTip); } +#endif + +#ifndef QT_NO_WHATSTHIS +inline void QTreeWidgetItem::setWhatsThis(int column, const QString &awhatsThis) +{ setData(column, Qt::WhatsThisRole, awhatsThis); } +#endif + +inline void QTreeWidgetItem::setFont(int column, const QFont &afont) +{ setData(column, Qt::FontRole, afont); } + +inline int QTreeWidgetItem::indexOfChild(QTreeWidgetItem *achild) const +{ executePendingSort(); return children.indexOf(achild); } + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item); +#endif + +class QTreeWidgetPrivate; + +class Q_GUI_EXPORT QTreeWidget : public QTreeView +{ + Q_OBJECT + Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount) + Q_PROPERTY(int topLevelItemCount READ topLevelItemCount) + + friend class QTreeModel; + friend class QTreeWidgetItem; +public: + explicit QTreeWidget(QWidget *parent = 0); + ~QTreeWidget(); + + int columnCount() const; + void setColumnCount(int columns); + + QTreeWidgetItem *invisibleRootItem() const; + QTreeWidgetItem *topLevelItem(int index) const; + int topLevelItemCount() const; + void insertTopLevelItem(int index, QTreeWidgetItem *item); + void addTopLevelItem(QTreeWidgetItem *item); + QTreeWidgetItem *takeTopLevelItem(int index); + int indexOfTopLevelItem(QTreeWidgetItem *item); // ### Qt 5: remove me + int indexOfTopLevelItem(QTreeWidgetItem *item) const; + + void insertTopLevelItems(int index, const QList<QTreeWidgetItem*> &items); + void addTopLevelItems(const QList<QTreeWidgetItem*> &items); + + QTreeWidgetItem *headerItem() const; + void setHeaderItem(QTreeWidgetItem *item); + void setHeaderLabels(const QStringList &labels); + inline void setHeaderLabel(const QString &label); + + QTreeWidgetItem *currentItem() const; + int currentColumn() const; + void setCurrentItem(QTreeWidgetItem *item); + void setCurrentItem(QTreeWidgetItem *item, int column); + void setCurrentItem(QTreeWidgetItem *item, int column, QItemSelectionModel::SelectionFlags command); + + QTreeWidgetItem *itemAt(const QPoint &p) const; + inline QTreeWidgetItem *itemAt(int x, int y) const; + QRect visualItemRect(const QTreeWidgetItem *item) const; + + int sortColumn() const; + void sortItems(int column, Qt::SortOrder order); + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + + void editItem(QTreeWidgetItem *item, int column = 0); + void openPersistentEditor(QTreeWidgetItem *item, int column = 0); + void closePersistentEditor(QTreeWidgetItem *item, int column = 0); + + QWidget *itemWidget(QTreeWidgetItem *item, int column) const; + void setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget); + inline void removeItemWidget(QTreeWidgetItem *item, int column); + + bool isItemSelected(const QTreeWidgetItem *item) const; + void setItemSelected(const QTreeWidgetItem *item, bool select); + QList<QTreeWidgetItem*> selectedItems() const; + QList<QTreeWidgetItem*> findItems(const QString &text, Qt::MatchFlags flags, + int column = 0) const; + + bool isItemHidden(const QTreeWidgetItem *item) const; + void setItemHidden(const QTreeWidgetItem *item, bool hide); + + bool isItemExpanded(const QTreeWidgetItem *item) const; + void setItemExpanded(const QTreeWidgetItem *item, bool expand); + + bool isFirstItemColumnSpanned(const QTreeWidgetItem *item) const; + void setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool span); + + QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const; + QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const; + + void setSelectionModel(QItemSelectionModel *selectionModel); + +public Q_SLOTS: + void scrollToItem(const QTreeWidgetItem *item, + QAbstractItemView::ScrollHint hint = EnsureVisible); + void expandItem(const QTreeWidgetItem *item); + void collapseItem(const QTreeWidgetItem *item); + void clear(); + +Q_SIGNALS: + void itemPressed(QTreeWidgetItem *item, int column); + void itemClicked(QTreeWidgetItem *item, int column); + void itemDoubleClicked(QTreeWidgetItem *item, int column); + void itemActivated(QTreeWidgetItem *item, int column); + void itemEntered(QTreeWidgetItem *item, int column); + void itemChanged(QTreeWidgetItem *item, int column); + void itemExpanded(QTreeWidgetItem *item); + void itemCollapsed(QTreeWidgetItem *item); + void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); + void itemSelectionChanged(); + +protected: + bool event(QEvent *e); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QList<QTreeWidgetItem*> items) const; + virtual bool dropMimeData(QTreeWidgetItem *parent, int index, + const QMimeData *data, Qt::DropAction action); + virtual Qt::DropActions supportedDropActions() const; + QList<QTreeWidgetItem*> items(const QMimeData *data) const; + + QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; + QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const; + void dropEvent(QDropEvent *event); + +private: + void setModel(QAbstractItemModel *model); + + Q_DECLARE_PRIVATE(QTreeWidget) + Q_DISABLE_COPY(QTreeWidget) + + Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemClicked(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemDoubleClicked(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemActivated(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemEntered(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemExpanded(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitItemCollapsed(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex ¤t)) + Q_PRIVATE_SLOT(d_func(), void _q_sort()) + Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)) + Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)) +}; + +inline void QTreeWidget::removeItemWidget(QTreeWidgetItem *item, int column) +{ setItemWidget(item, column, 0); } + +inline QTreeWidgetItem *QTreeWidget::itemAt(int ax, int ay) const +{ return itemAt(QPoint(ax, ay)); } + +inline void QTreeWidget::setHeaderLabel(const QString &alabel) +{ setHeaderLabels(QStringList(alabel)); } + +inline void QTreeWidgetItem::setSelected(bool aselect) +{ if (view) view->setItemSelected(this, aselect); } + +inline bool QTreeWidgetItem::isSelected() const +{ return (view ? view->isItemSelected(this) : false); } + +inline void QTreeWidgetItem::setHidden(bool ahide) +{ if (view) view->setItemHidden(this, ahide); } + +inline bool QTreeWidgetItem::isHidden() const +{ return (view ? view->isItemHidden(this) : false); } + +inline void QTreeWidgetItem::setExpanded(bool aexpand) +{ if (view) view->setItemExpanded(this, aexpand); } + +inline bool QTreeWidgetItem::isExpanded() const +{ return (view ? view->isItemExpanded(this) : false); } + +inline void QTreeWidgetItem::setFirstColumnSpanned(bool aspan) +{ if (view) view->setFirstItemColumnSpanned(this, aspan); } + +inline bool QTreeWidgetItem::isFirstColumnSpanned() const +{ return (view ? view->isFirstItemColumnSpanned(this) : false); } + +inline void QTreeWidgetItem::setDisabled(bool disabled) +{ setFlags(disabled ? (flags() & ~Qt::ItemIsEnabled) : flags() | Qt::ItemIsEnabled); } + +inline bool QTreeWidgetItem::isDisabled() const +{ return !(flags() & Qt::ItemIsEnabled); } + +#endif // QT_NO_TREEWIDGET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTREEWIDGET_H diff --git a/qtinterface/qt4/Qt/qtreewidgetitemiterator.h b/qtinterface/qt4/Qt/qtreewidgetitemiterator.h new file mode 100644 index 0000000..91ff37c --- /dev/null +++ b/qtinterface/qt4/Qt/qtreewidgetitemiterator.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTREEWIDGETITEMITERATOR_H +#define QTREEWIDGETITEMITERATOR_H + +#include <QtCore/qglobal.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_TREEWIDGET + +class QTreeWidget; +class QTreeWidgetItem; +class QTreeModel; + +class QTreeWidgetItemIteratorPrivate; +class Q_GUI_EXPORT QTreeWidgetItemIterator +{ + friend class QTreeModel; + +public: + enum IteratorFlag { + All = 0x00000000, + Hidden = 0x00000001, + NotHidden = 0x00000002, + Selected = 0x00000004, + Unselected = 0x00000008, + Selectable = 0x00000010, + NotSelectable = 0x00000020, + DragEnabled = 0x00000040, + DragDisabled = 0x00000080, + DropEnabled = 0x00000100, + DropDisabled = 0x00000200, + HasChildren = 0x00000400, + NoChildren = 0x00000800, + Checked = 0x00001000, + NotChecked = 0x00002000, + Enabled = 0x00004000, + Disabled = 0x00008000, + Editable = 0x00010000, + NotEditable = 0x00020000, + UserFlag = 0x01000000 // The first flag that can be used by the user. + }; + Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) + + QTreeWidgetItemIterator(const QTreeWidgetItemIterator &it); + explicit QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFlags flags = All); + explicit QTreeWidgetItemIterator(QTreeWidgetItem *item, IteratorFlags flags = All); + ~QTreeWidgetItemIterator(); + + QTreeWidgetItemIterator &operator=(const QTreeWidgetItemIterator &it); + + QTreeWidgetItemIterator &operator++(); + inline const QTreeWidgetItemIterator operator++(int); + inline QTreeWidgetItemIterator &operator+=(int n); + + QTreeWidgetItemIterator &operator--(); + inline const QTreeWidgetItemIterator operator--(int); + inline QTreeWidgetItemIterator &operator-=(int n); + + inline QTreeWidgetItem *operator*() const; + +private: + bool matchesFlags(const QTreeWidgetItem *item) const; + QScopedPointer<QTreeWidgetItemIteratorPrivate> d_ptr; + QTreeWidgetItem *current; + IteratorFlags flags; + Q_DECLARE_PRIVATE(QTreeWidgetItemIterator) +}; + +inline const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator++(int) +{ + QTreeWidgetItemIterator it = *this; + ++(*this); + return it; +} + +inline const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator--(int) +{ + QTreeWidgetItemIterator it = *this; + --(*this); + return it; +} + +inline QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator+=(int n) +{ + if (n < 0) + return (*this) -= (-n); + while (current && n--) + ++(*this); + return *this; +} + +inline QTreeWidgetItemIterator &QTreeWidgetItemIterator::operator-=(int n) +{ + if (n < 0) + return (*this) += (-n); + while (current && n--) + --(*this); + return *this; +} + +inline QTreeWidgetItem *QTreeWidgetItemIterator::operator*() const +{ + return current; +} + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags) + + +QT_END_NAMESPACE +#endif // QT_NO_TREEWIDGET +QT_END_HEADER + +#endif // QTREEWIDGETITEMITERATOR_H diff --git a/qtinterface/qt4/Qt/qudpsocket.h b/qtinterface/qt4/Qt/qudpsocket.h new file mode 100644 index 0000000..3c4bd27 --- /dev/null +++ b/qtinterface/qt4/Qt/qudpsocket.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUDPSOCKET_H +#define QUDPSOCKET_H + +#include <QtNetwork/qabstractsocket.h> +#include <QtNetwork/qhostaddress.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_UDPSOCKET + +class QUdpSocketPrivate; + +class Q_NETWORK_EXPORT QUdpSocket : public QAbstractSocket +{ + Q_OBJECT +public: + enum BindFlag { + DefaultForPlatform = 0x0, + ShareAddress = 0x1, + DontShareAddress = 0x2, + ReuseAddressHint = 0x4 + }; + Q_DECLARE_FLAGS(BindMode, BindFlag) + + explicit QUdpSocket(QObject *parent = 0); + virtual ~QUdpSocket(); + + bool bind(const QHostAddress &address, quint16 port); + bool bind(quint16 port = 0); + bool bind(const QHostAddress &address, quint16 port, BindMode mode); + bool bind(quint16 port, BindMode mode); + // ### Qt 5: Merge the bind functions + + bool hasPendingDatagrams() const; + qint64 pendingDatagramSize() const; + qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *host = 0, quint16 *port = 0); + qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &host, quint16 port); + inline qint64 writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port) + { return writeDatagram(datagram.constData(), datagram.size(), host, port); } + +private: + Q_DISABLE_COPY(QUdpSocket) + Q_DECLARE_PRIVATE(QUdpSocket) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QUdpSocket::BindMode) + +#endif // QT_NO_UDPSOCKET + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QUDPSOCKET_H diff --git a/qtinterface/qt4/Qt/qundogroup.h b/qtinterface/qt4/Qt/qundogroup.h new file mode 100644 index 0000000..3a670c9 --- /dev/null +++ b/qtinterface/qt4/Qt/qundogroup.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUNDOGROUP_H +#define QUNDOGROUP_H + +#include <QtCore/qobject.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QUndoGroupPrivate; +class QUndoStack; +class QAction; + +QT_MODULE(Gui) + +#ifndef QT_NO_UNDOGROUP + +class Q_GUI_EXPORT QUndoGroup : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QUndoGroup) + +public: + explicit QUndoGroup(QObject *parent = 0); + ~QUndoGroup(); + + void addStack(QUndoStack *stack); + void removeStack(QUndoStack *stack); + QList<QUndoStack*> stacks() const; + QUndoStack *activeStack() const; + +#ifndef QT_NO_ACTION + QAction *createUndoAction(QObject *parent, + const QString &prefix = QString()) const; + QAction *createRedoAction(QObject *parent, + const QString &prefix = QString()) const; +#endif // QT_NO_ACTION + bool canUndo() const; + bool canRedo() const; + QString undoText() const; + QString redoText() const; + bool isClean() const; + +public Q_SLOTS: + void undo(); + void redo(); + void setActiveStack(QUndoStack *stack); + +Q_SIGNALS: + void activeStackChanged(QUndoStack *stack); + void indexChanged(int idx); + void cleanChanged(bool clean); + void canUndoChanged(bool canUndo); + void canRedoChanged(bool canRedo); + void undoTextChanged(const QString &undoText); + void redoTextChanged(const QString &redoText); + +private: + Q_DISABLE_COPY(QUndoGroup) +}; + +#endif // QT_NO_UNDOGROUP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QUNDOGROUP_H diff --git a/qtinterface/qt4/Qt/qundostack.h b/qtinterface/qt4/Qt/qundostack.h new file mode 100644 index 0000000..81168e7 --- /dev/null +++ b/qtinterface/qt4/Qt/qundostack.h @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUNDOSTACK_H +#define QUNDOSTACK_H + +#include <QtCore/qobject.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QAction; +class QUndoCommandPrivate; +class QUndoStackPrivate; + +#ifndef QT_NO_UNDOCOMMAND + +class Q_GUI_EXPORT QUndoCommand +{ + QUndoCommandPrivate *d; + +public: + explicit QUndoCommand(QUndoCommand *parent = 0); + explicit QUndoCommand(const QString &text, QUndoCommand *parent = 0); + virtual ~QUndoCommand(); + + virtual void undo(); + virtual void redo(); + + QString text() const; + void setText(const QString &text); + + virtual int id() const; + virtual bool mergeWith(const QUndoCommand *other); + + int childCount() const; + const QUndoCommand *child(int index) const; + +private: + Q_DISABLE_COPY(QUndoCommand) + friend class QUndoStack; +}; + +#endif // QT_NO_UNDOCOMMAND + +#ifndef QT_NO_UNDOSTACK + +class Q_GUI_EXPORT QUndoStack : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QUndoStack) + Q_PROPERTY(bool active READ isActive WRITE setActive) + Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit) + +public: + explicit QUndoStack(QObject *parent = 0); + ~QUndoStack(); + void clear(); + + void push(QUndoCommand *cmd); + + bool canUndo() const; + bool canRedo() const; + QString undoText() const; + QString redoText() const; + + int count() const; + int index() const; + QString text(int idx) const; + +#ifndef QT_NO_ACTION + QAction *createUndoAction(QObject *parent, + const QString &prefix = QString()) const; + QAction *createRedoAction(QObject *parent, + const QString &prefix = QString()) const; +#endif // QT_NO_ACTION + + bool isActive() const; + bool isClean() const; + int cleanIndex() const; + + void beginMacro(const QString &text); + void endMacro(); + + void setUndoLimit(int limit); + int undoLimit() const; + + const QUndoCommand *command(int index) const; + +public Q_SLOTS: + void setClean(); + void setIndex(int idx); + void undo(); + void redo(); + void setActive(bool active = true); + +Q_SIGNALS: + void indexChanged(int idx); + void cleanChanged(bool clean); + void canUndoChanged(bool canUndo); + void canRedoChanged(bool canRedo); + void undoTextChanged(const QString &undoText); + void redoTextChanged(const QString &redoText); + +private: + Q_DISABLE_COPY(QUndoStack) + friend class QUndoGroup; +}; + +#endif // QT_NO_UNDOSTACK + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QUNDOSTACK_H diff --git a/qtinterface/qt4/Qt/qundoview.h b/qtinterface/qt4/Qt/qundoview.h new file mode 100644 index 0000000..8584b0a --- /dev/null +++ b/qtinterface/qt4/Qt/qundoview.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUNDOVIEW_H +#define QUNDOVIEW_H + +#include <QtGui/qlistview.h> +#include <QtCore/qstring.h> + +#ifndef QT_NO_UNDOVIEW + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QUndoViewPrivate; +class QUndoStack; +class QUndoGroup; +class QIcon; + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QUndoView : public QListView +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QUndoView) + Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel) + Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon) + +public: + explicit QUndoView(QWidget *parent = 0); + explicit QUndoView(QUndoStack *stack, QWidget *parent = 0); +#ifndef QT_NO_UNDOGROUP + explicit QUndoView(QUndoGroup *group, QWidget *parent = 0); +#endif + ~QUndoView(); + + QUndoStack *stack() const; +#ifndef QT_NO_UNDOGROUP + QUndoGroup *group() const; +#endif + + void setEmptyLabel(const QString &label); + QString emptyLabel() const; + + void setCleanIcon(const QIcon &icon); + QIcon cleanIcon() const; + +public Q_SLOTS: + void setStack(QUndoStack *stack); +#ifndef QT_NO_UNDOGROUP + void setGroup(QUndoGroup *group); +#endif + +private: + Q_DISABLE_COPY(QUndoView) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_UNDOVIEW +#endif // QUNDOVIEW_H diff --git a/qtinterface/qt4/Qt/qurl.h b/qtinterface/qt4/Qt/qurl.h new file mode 100644 index 0000000..38fe993 --- /dev/null +++ b/qtinterface/qt4/Qt/qurl.h @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QURL_H +#define QURL_H + +#include <QtCore/qbytearray.h> +#include <QtCore/qobjectdefs.h> +#include <QtCore/qpair.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QUrlPrivate; +class QDataStream; + +class Q_CORE_EXPORT QUrl +{ +public: + enum ParsingMode { + TolerantMode, + StrictMode + }; + + // encoding / toString values + enum FormattingOption { + None = 0x0, + RemoveScheme = 0x1, + RemovePassword = 0x2, + RemoveUserInfo = RemovePassword | 0x4, + RemovePort = 0x8, + RemoveAuthority = RemoveUserInfo | RemovePort | 0x10, + RemovePath = 0x20, + RemoveQuery = 0x40, + RemoveFragment = 0x80, + + StripTrailingSlash = 0x10000 + }; + Q_DECLARE_FLAGS(FormattingOptions, FormattingOption) + + QUrl(); +#ifdef QT_NO_URL_CAST_FROM_STRING + explicit +#endif + QUrl(const QString &url); + QUrl(const QString &url, ParsingMode mode); + // ### Qt 5: merge the two constructors, with mode = TolerantMode + QUrl(const QUrl ©); + QUrl &operator =(const QUrl ©); +#ifndef QT_NO_URL_CAST_FROM_STRING + QUrl &operator =(const QString &url); +#endif + ~QUrl(); + + void setUrl(const QString &url); + void setUrl(const QString &url, ParsingMode mode); + // ### Qt 5: merge the two setUrl() functions, with mode = TolerantMode + void setEncodedUrl(const QByteArray &url); + void setEncodedUrl(const QByteArray &url, ParsingMode mode); + // ### Qt 5: merge the two setEncodedUrl() functions, with mode = TolerantMode + + bool isValid() const; + + bool isEmpty() const; + + void clear(); + + void setScheme(const QString &scheme); + QString scheme() const; + + void setAuthority(const QString &authority); + QString authority() const; + + void setUserInfo(const QString &userInfo); + QString userInfo() const; + + void setUserName(const QString &userName); + QString userName() const; + void setEncodedUserName(const QByteArray &userName); + QByteArray encodedUserName() const; + + void setPassword(const QString &password); + QString password() const; + void setEncodedPassword(const QByteArray &password); + QByteArray encodedPassword() const; + + void setHost(const QString &host); + QString host() const; + void setEncodedHost(const QByteArray &host); + QByteArray encodedHost() const; + + void setPort(int port); + int port() const; + int port(int defaultPort) const; + // ### Qt 5: merge the two port() functions, with defaultPort = -1 + + void setPath(const QString &path); + QString path() const; + void setEncodedPath(const QByteArray &path); + QByteArray encodedPath() const; + + bool hasQuery() const; + + void setEncodedQuery(const QByteArray &query); + QByteArray encodedQuery() const; + + void setQueryDelimiters(char valueDelimiter, char pairDelimiter); + char queryValueDelimiter() const; + char queryPairDelimiter() const; + + void setQueryItems(const QList<QPair<QString, QString> > &query); + void addQueryItem(const QString &key, const QString &value); + QList<QPair<QString, QString> > queryItems() const; + bool hasQueryItem(const QString &key) const; + QString queryItemValue(const QString &key) const; + QStringList allQueryItemValues(const QString &key) const; + void removeQueryItem(const QString &key); + void removeAllQueryItems(const QString &key); + + void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query); + void addEncodedQueryItem(const QByteArray &key, const QByteArray &value); + QList<QPair<QByteArray, QByteArray> > encodedQueryItems() const; + bool hasEncodedQueryItem(const QByteArray &key) const; + QByteArray encodedQueryItemValue(const QByteArray &key) const; + QList<QByteArray> allEncodedQueryItemValues(const QByteArray &key) const; + void removeEncodedQueryItem(const QByteArray &key); + void removeAllEncodedQueryItems(const QByteArray &key); + + void setFragment(const QString &fragment); + QString fragment() const; + void setEncodedFragment(const QByteArray &fragment); + QByteArray encodedFragment() const; + bool hasFragment() const; + + QUrl resolved(const QUrl &relative) const; + + bool isRelative() const; + bool isParentOf(const QUrl &url) const; + + static QUrl fromLocalFile(const QString &localfile); + QString toLocalFile() const; + + QString toString(FormattingOptions options = None) const; + + QByteArray toEncoded(FormattingOptions options = None) const; + static QUrl fromEncoded(const QByteArray &url); + static QUrl fromEncoded(const QByteArray &url, ParsingMode mode); + // ### Qt 5: merge the two fromEncoded() functions, with mode = TolerantMode + + static QUrl fromUserInput(const QString &userInput); + + void detach(); + bool isDetached() const; + + bool operator <(const QUrl &url) const; + bool operator ==(const QUrl &url) const; + bool operator !=(const QUrl &url) const; + + static QString fromPercentEncoding(const QByteArray &); + static QByteArray toPercentEncoding(const QString &, + const QByteArray &exclude = QByteArray(), + const QByteArray &include = QByteArray()); + static QString fromPunycode(const QByteArray &); + static QByteArray toPunycode(const QString &); + static QString fromAce(const QByteArray &); + static QByteArray toAce(const QString &); + static QStringList idnWhitelist(); + static void setIdnWhitelist(const QStringList &); + +#if defined QT3_SUPPORT + inline QT3_SUPPORT QString protocol() const { return scheme(); } + inline QT3_SUPPORT void setProtocol(const QString &s) { setScheme(s); } + inline QT3_SUPPORT void setUser(const QString &s) { setUserName(s); } + inline QT3_SUPPORT QString user() const { return userName(); } + inline QT3_SUPPORT bool hasUser() const { return !userName().isEmpty(); } + inline QT3_SUPPORT bool hasPassword() const { return !password().isEmpty(); } + inline QT3_SUPPORT bool hasHost() const { return !host().isEmpty(); } + inline QT3_SUPPORT bool hasPort() const { return port() != -1; } + inline QT3_SUPPORT bool hasPath() const { return !path().isEmpty(); } + inline QT3_SUPPORT void setQuery(const QString &txt) + { + setEncodedQuery(txt.toLatin1()); + } + inline QT3_SUPPORT QString query() const + { + return QString::fromLatin1(encodedQuery().constData()); + } + inline QT3_SUPPORT QString ref() const { return fragment(); } + inline QT3_SUPPORT void setRef(const QString &txt) { setFragment(txt); } + inline QT3_SUPPORT bool hasRef() const { return !fragment().isEmpty(); } + inline QT3_SUPPORT void addPath(const QString &p) { setPath(path() + QLatin1Char('/') + p); } + QT3_SUPPORT void setFileName(const QString &txt); + QT3_SUPPORT QString fileName() const; + QT3_SUPPORT QString dirPath() const; + static inline QT3_SUPPORT void decode(QString &url) + { + url = QUrl::fromPercentEncoding(url.toLatin1()); + } + static inline QT3_SUPPORT void encode(QString &url) + { + url = QString::fromLatin1(QUrl::toPercentEncoding(url).constData()); + } + inline QT3_SUPPORT operator QString() const { return toString(); } + inline QT3_SUPPORT bool cdUp() + { + *this = resolved(QUrl(QLatin1String(".."))); + return true; + } + static inline QT3_SUPPORT bool isRelativeUrl(const QString &url) + { + return QUrl(url).isRelative(); + } +#endif + + QString errorString() const; + +protected: +#if defined (QT3_SUPPORT) + inline QT3_SUPPORT void reset() { clear(); } +#endif + +private: + QUrlPrivate *d; +public: + typedef QUrlPrivate * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_TYPEINFO(QUrl, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QUrl) +Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions) + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUrl &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QUrl &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QURL_H diff --git a/qtinterface/qt4/Qt/qurlinfo.h b/qtinterface/qt4/Qt/qurlinfo.h new file mode 100644 index 0000000..8a17094 --- /dev/null +++ b/qtinterface/qt4/Qt/qurlinfo.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QURLINFO_H +#define QURLINFO_H + +#include <QtCore/qdatetime.h> +#include <QtCore/qstring.h> +#include <QtCore/qiodevice.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +#ifndef QT_NO_URLINFO + +class QUrl; +class QUrlInfoPrivate; + +class Q_NETWORK_EXPORT QUrlInfo +{ +public: + enum PermissionSpec { + ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100, + ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010, + ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 }; + + QUrlInfo(); + QUrlInfo(const QUrlInfo &ui); + QUrlInfo(const QString &name, int permissions, const QString &owner, + const QString &group, qint64 size, const QDateTime &lastModified, + const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, + bool isWritable, bool isReadable, bool isExecutable); + QUrlInfo(const QUrl &url, int permissions, const QString &owner, + const QString &group, qint64 size, const QDateTime &lastModified, + const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, + bool isWritable, bool isReadable, bool isExecutable); + QUrlInfo &operator=(const QUrlInfo &ui); + virtual ~QUrlInfo(); + + virtual void setName(const QString &name); + virtual void setDir(bool b); + virtual void setFile(bool b); + virtual void setSymLink(bool b); + virtual void setOwner(const QString &s); + virtual void setGroup(const QString &s); + virtual void setSize(qint64 size); + virtual void setWritable(bool b); + virtual void setReadable(bool b); + virtual void setPermissions(int p); + virtual void setLastModified(const QDateTime &dt); + void setLastRead(const QDateTime &dt); + + bool isValid() const; + + QString name() const; + int permissions() const; + QString owner() const; + QString group() const; + qint64 size() const; + QDateTime lastModified() const; + QDateTime lastRead() const; + bool isDir() const; + bool isFile() const; + bool isSymLink() const; + bool isWritable() const; + bool isReadable() const; + bool isExecutable() const; + + static bool greaterThan(const QUrlInfo &i1, const QUrlInfo &i2, + int sortBy); + static bool lessThan(const QUrlInfo &i1, const QUrlInfo &i2, + int sortBy); + static bool equal(const QUrlInfo &i1, const QUrlInfo &i2, + int sortBy); + + bool operator==(const QUrlInfo &i) const; + inline bool operator!=(const QUrlInfo &i) const + { return !operator==(i); } + +private: + QUrlInfoPrivate *d; +}; + +#endif // QT_NO_URLINFO + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QURLINFO_H diff --git a/qtinterface/qt4/Qt/quuid.h b/qtinterface/qt4/Qt/quuid.h new file mode 100644 index 0000000..67c226d --- /dev/null +++ b/qtinterface/qt4/Qt/quuid.h @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUUID_H +#define QUUID_H + +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +#if defined(Q_OS_WIN) +#ifndef GUID_DEFINED +#define GUID_DEFINED +typedef struct _GUID +{ + ulong Data1; + ushort Data2; + ushort Data3; + uchar Data4[8]; +} GUID, *REFGUID, *LPGUID; +#endif +#endif + + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +struct Q_CORE_EXPORT QUuid +{ + enum Variant { + VarUnknown =-1, + NCS = 0, // 0 - - + DCE = 2, // 1 0 - + Microsoft = 6, // 1 1 0 + Reserved = 7 // 1 1 1 + }; + + enum Version { + 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 + }; + + QUuid() + { + data1 = 0; + data2 = 0; + data3 = 0; + for(int i = 0; i < 8; i++) + data4[i] = 0; + } + QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) + { + data1 = l; + data2 = w1; + data3 = w2; + data4[0] = b1; + data4[1] = b2; + data4[2] = b3; + data4[3] = b4; + data4[4] = b5; + data4[5] = b6; + data4[6] = b7; + data4[7] = b8; + } +#ifndef QT_NO_QUUID_STRING + QUuid(const QString &); + QUuid(const char *); + QString toString() const; + operator QString() const { return toString(); } +#endif + bool isNull() const; + + bool operator==(const QUuid &orig) const + { + uint i; + if (data1 != orig.data1 || data2 != orig.data2 || + data3 != orig.data3) + return false; + + for(i = 0; i < 8; i++) + if (data4[i] != orig.data4[i]) + return false; + + return true; + } + + bool operator!=(const QUuid &orig) const + { + return !(*this == orig); + } + + bool operator<(const QUuid &other) const; + bool operator>(const QUuid &other) const; + +#if defined(Q_OS_WIN) + // On Windows we have a type GUID that is used by the platform API, so we + // provide convenience operators to cast from and to this type. + QUuid(const GUID &guid) + { + data1 = guid.Data1; + data2 = guid.Data2; + data3 = guid.Data3; + for(int i = 0; i < 8; i++) + data4[i] = guid.Data4[i]; + } + + QUuid &operator=(const GUID &guid) + { + *this = QUuid(guid); + return *this; + } + + operator GUID() const + { + GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } }; + return guid; + } + + bool operator==(const GUID &guid) const + { + return *this == QUuid(guid); + } + + bool operator!=(const GUID &guid) const + { + return !(*this == guid); + } +#endif + static QUuid createUuid(); + QUuid::Variant variant() const; + QUuid::Version version() const; + + uint data1; + ushort data2; + ushort data3; + uchar data4[8]; +}; + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QUUID_H diff --git a/qtinterface/qt4/Qt/qvalidator.h b/qtinterface/qt4/Qt/qvalidator.h new file mode 100644 index 0000000..0142ea0 --- /dev/null +++ b/qtinterface/qt4/Qt/qvalidator.h @@ -0,0 +1,215 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVALIDATOR_H +#define QVALIDATOR_H + +#include <QtCore/qobject.h> +#include <QtCore/qstring.h> +#include <QtCore/qregexp.h> +#include <QtCore/qlocale.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_VALIDATOR + +class QValidatorPrivate; + +class Q_GUI_EXPORT QValidator : public QObject +{ + Q_OBJECT +public: + explicit QValidator(QObject * parent = 0); + ~QValidator(); + + enum State { + Invalid, + Intermediate, + Acceptable + +#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) + , Valid = Intermediate +#endif + }; + + void setLocale(const QLocale &locale); + QLocale locale() const; + + virtual State validate(QString &, int &) const = 0; + virtual void fixup(QString &) const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QValidator(QObject * parent, const char *name); +#endif +protected: + QValidator(QObjectPrivate &d, QObject *parent); + QValidator(QValidatorPrivate &d, QObject *parent); + +private: + Q_DISABLE_COPY(QValidator) + Q_DECLARE_PRIVATE(QValidator) +}; + +class Q_GUI_EXPORT QIntValidator : public QValidator +{ + Q_OBJECT + Q_PROPERTY(int bottom READ bottom WRITE setBottom) + Q_PROPERTY(int top READ top WRITE setTop) + +public: + explicit QIntValidator(QObject * parent = 0); + QIntValidator(int bottom, int top, QObject * parent); + ~QIntValidator(); + + QValidator::State validate(QString &, int &) const; + + void setBottom(int); + void setTop(int); + virtual void setRange(int bottom, int top); + + int bottom() const { return b; } + int top() const { return t; } + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QIntValidator(QObject * parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QIntValidator(int bottom, int top, QObject * parent, const char *name); +#endif + +private: + Q_DISABLE_COPY(QIntValidator) + + int b; + int t; +}; + +#ifndef QT_NO_REGEXP + +class QDoubleValidatorPrivate; + +class Q_GUI_EXPORT QDoubleValidator : public QValidator +{ + Q_OBJECT + Q_PROPERTY(double bottom READ bottom WRITE setBottom) + Q_PROPERTY(double top READ top WRITE setTop) + Q_PROPERTY(int decimals READ decimals WRITE setDecimals) + Q_PROPERTY(Notation notation READ notation WRITE setNotation) + +public: + explicit QDoubleValidator(QObject * parent); + QDoubleValidator(double bottom, double top, int decimals, QObject * parent); + ~QDoubleValidator(); + + enum Notation { + StandardNotation, + ScientificNotation + }; + + QValidator::State validate(QString &, int &) const; + + virtual void setRange(double bottom, double top, int decimals = 0); + void setBottom(double); + void setTop(double); + void setDecimals(int); + void setNotation(Notation); + + double bottom() const { return b; } + double top() const { return t; } + int decimals() const { return dec; } + Notation notation() const; + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QDoubleValidator(QObject * parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QDoubleValidator(double bottom, double top, int decimals, + QObject * parent, const char *name); +#endif +private: + Q_DECLARE_PRIVATE(QDoubleValidator) + Q_DISABLE_COPY(QDoubleValidator) + + double b; + double t; + int dec; +}; + + +class Q_GUI_EXPORT QRegExpValidator : public QValidator +{ + Q_OBJECT + Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) + +public: + explicit QRegExpValidator(QObject *parent); + QRegExpValidator(const QRegExp& rx, QObject *parent); + ~QRegExpValidator(); + + 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 + +#ifdef QT3_SUPPORT +public: + QT3_SUPPORT_CONSTRUCTOR QRegExpValidator(QObject *parent, const char *name); + QT3_SUPPORT_CONSTRUCTOR QRegExpValidator(const QRegExp& rx, QObject *parent, const char *name); +#endif + +private: + Q_DISABLE_COPY(QRegExpValidator) + + QRegExp r; +}; + +#endif // QT_NO_REGEXP + +#endif // QT_NO_VALIDATOR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QVALIDATOR_H diff --git a/qtinterface/qt4/Qt/qvariant.h b/qtinterface/qt4/Qt/qvariant.h new file mode 100644 index 0000000..17e4d51 --- /dev/null +++ b/qtinterface/qt4/Qt/qvariant.h @@ -0,0 +1,617 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVARIANT_H +#define QVARIANT_H + +#include <QtCore/qatomic.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qlist.h> +#include <QtCore/qmetatype.h> +#include <QtCore/qmap.h> +#include <QtCore/qhash.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QBitArray; +class QDataStream; +class QDate; +class QDateTime; +class QLine; +class QLineF; +class QLocale; +class QMatrix; +class QTransform; +class QStringList; +class QTime; +class QPoint; +class QPointF; +class QSize; +class QSizeF; +class QRect; +class QRectF; +#ifndef QT_NO_REGEXP +class QRegExp; +#endif +class QTextFormat; +class QTextLength; +class QUrl; +class QVariant; +class QVariantComparisonHelper; + +#ifndef QT_NO_MEMBER_TEMPLATES +template <typename T> +inline QVariant qVariantFromValue(const T &); + +template <typename T> +inline void qVariantSetValue(QVariant &, const T &); + +template<typename T> +inline T qVariantValue(const QVariant &); + +template<typename T> +inline bool qVariantCanConvert(const QVariant &); +#endif + +class Q_CORE_EXPORT QVariant +{ + public: + enum Type { + Invalid = 0, + + Bool = 1, + Int = 2, + UInt = 3, + LongLong = 4, + ULongLong = 5, + Double = 6, + Char = 7, + Map = 8, + List = 9, + String = 10, + StringList = 11, + ByteArray = 12, + BitArray = 13, + Date = 14, + Time = 15, + DateTime = 16, + Url = 17, + Locale = 18, + Rect = 19, + RectF = 20, + Size = 21, + SizeF = 22, + Line = 23, + LineF = 24, + Point = 25, + PointF = 26, + RegExp = 27, + Hash = 28, + LastCoreType = Hash, + + // value 62 is internally reserved +#ifdef QT3_SUPPORT + ColorGroup = 63, +#endif + Font = 64, + Pixmap = 65, + Brush = 66, + Color = 67, + Palette = 68, + Icon = 69, + Image = 70, + Polygon = 71, + Region = 72, + Bitmap = 73, + Cursor = 74, + SizePolicy = 75, + KeySequence = 76, + Pen = 77, + TextLength = 78, + TextFormat = 79, + Matrix = 80, + Transform = 81, + Matrix4x4 = 82, + Vector2D = 83, + Vector3D = 84, + Vector4D = 85, + Quaternion = 86, + LastGuiType = Quaternion, + + UserType = 127, +#ifdef QT3_SUPPORT + IconSet = Icon, + CString = ByteArray, + PointArray = Polygon, +#endif + LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type + }; + + inline QVariant(); + ~QVariant(); + QVariant(Type type); + QVariant(int typeOrUserType, const void *copy); + QVariant(int typeOrUserType, const void *copy, uint flags); + QVariant(const QVariant &other); + +#ifndef QT_NO_DATASTREAM + QVariant(QDataStream &s); +#endif + + QVariant(int i); + QVariant(uint ui); + QVariant(qlonglong ll); + QVariant(qulonglong ull); + QVariant(bool b); + QVariant(double d); + QVariant(float f) { d.is_null = false; d.type = QMetaType::Float; d.data.f = f; } +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN_CONSTRUCTOR QVariant(const char *str); +#endif + + QVariant(const QByteArray &bytearray); + QVariant(const QBitArray &bitarray); + QVariant(const QString &string); + QVariant(const QLatin1String &string); + QVariant(const QStringList &stringlist); + QVariant(const QChar &qchar); + QVariant(const QDate &date); + QVariant(const QTime &time); + QVariant(const QDateTime &datetime); + QVariant(const QList<QVariant> &list); + QVariant(const QMap<QString,QVariant> &map); + QVariant(const QHash<QString,QVariant> &hash); +#ifndef QT_NO_GEOM_VARIANT + QVariant(const QSize &size); + QVariant(const QSizeF &size); + QVariant(const QPoint &pt); + QVariant(const QPointF &pt); + QVariant(const QLine &line); + QVariant(const QLineF &line); + QVariant(const QRect &rect); + QVariant(const QRectF &rect); +#endif + QVariant(const QUrl &url); + QVariant(const QLocale &locale); +#ifndef QT_NO_REGEXP + QVariant(const QRegExp ®Exp); +#endif + QVariant(Qt::GlobalColor color); + + QVariant& operator=(const QVariant &other); + + Type type() const; + int userType() const; + const char *typeName() const; + + bool canConvert(Type t) const; + bool convert(Type t); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT bool canCast(Type t) const + { return canConvert(t); } + inline QT3_SUPPORT bool cast(Type t) + { return convert(t); } +#endif + + inline bool isValid() const; + bool isNull() const; + + void clear(); + + void detach(); + inline bool isDetached() const; + + int toInt(bool *ok = 0) const; + uint toUInt(bool *ok = 0) const; + qlonglong toLongLong(bool *ok = 0) const; + qulonglong toULongLong(bool *ok = 0) const; + bool toBool() const; + double toDouble(bool *ok = 0) const; + float toFloat(bool *ok = 0) const; + qreal toReal(bool *ok = 0) const; + QByteArray toByteArray() const; + QBitArray toBitArray() const; + QString toString() const; + QStringList toStringList() const; + QChar toChar() const; + QDate toDate() const; + QTime toTime() const; + QDateTime toDateTime() const; + QList<QVariant> toList() const; + QMap<QString, QVariant> toMap() const; + QHash<QString, QVariant> toHash() const; + +#ifndef QT_NO_GEOM_VARIANT + QPoint toPoint() const; + QPointF toPointF() const; + QRect toRect() const; + QSize toSize() const; + QSizeF toSizeF() const; + QLine toLine() const; + QLineF toLineF() const; + QRectF toRectF() const; +#endif + QUrl toUrl() const; + QLocale toLocale() const; +#ifndef QT_NO_REGEXP + QRegExp toRegExp() const; +#endif + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT int &asInt(); + inline QT3_SUPPORT uint &asUInt(); + inline QT3_SUPPORT qlonglong &asLongLong(); + inline QT3_SUPPORT qulonglong &asULongLong(); + inline QT3_SUPPORT bool &asBool(); + inline QT3_SUPPORT double &asDouble(); + inline QT3_SUPPORT QByteArray &asByteArray(); + inline QT3_SUPPORT QBitArray &asBitArray(); + inline QT3_SUPPORT QString &asString(); + inline QT3_SUPPORT QStringList &asStringList(); + inline QT3_SUPPORT QDate &asDate(); + inline QT3_SUPPORT QTime &asTime(); + inline QT3_SUPPORT QDateTime &asDateTime(); + inline QT3_SUPPORT QList<QVariant> &asList(); + inline QT3_SUPPORT QMap<QString,QVariant> &asMap(); + inline QT3_SUPPORT QPoint &asPoint(); + inline QT3_SUPPORT QRect &asRect(); + inline QT3_SUPPORT QSize &asSize(); +#endif //QT3_SUPPORT + +#ifndef QT_NO_DATASTREAM + void load(QDataStream &ds); + void save(QDataStream &ds) const; +#endif + static const char *typeToName(Type type); + static Type nameToType(const char *name); + +#ifdef QT3_SUPPORT + inline QT3_SUPPORT_CONSTRUCTOR QVariant(bool val, int) { create(Bool, &val); } + inline QT3_SUPPORT const QByteArray toCString() const { return toByteArray(); } + inline QT3_SUPPORT QByteArray &asCString() { return *reinterpret_cast<QByteArray *>(castOrDetach(ByteArray)); } +#endif + + void *data(); + const void *constData() const; + inline const void *data() const { return constData(); } + +#ifndef QT_NO_MEMBER_TEMPLATES + template<typename T> + inline void setValue(const T &value); + + template<typename T> + inline T value() const + { return qVariantValue<T>(*this); } + + template<typename T> + static inline QVariant fromValue(const T &value) + { return qVariantFromValue(value); } + + template<typename T> + bool canConvert() const + { return qVariantCanConvert<T>(*this); } +#endif + + public: +#ifndef qdoc + struct PrivateShared + { + inline PrivateShared(void *v) : ptr(v), ref(1) { } + void *ptr; + QAtomicInt ref; + }; + struct Private + { + inline Private(): type(Invalid), is_shared(false), is_null(true) { data.ptr = 0; } + inline Private(const Private &other) + : data(other.data), type(other.type), + is_shared(other.is_shared), is_null(other.is_null) + {} + union Data + { + char c; + int i; + uint u; + bool b; + double d; + float f; + qreal real; + qlonglong ll; + qulonglong ull; + QObject *o; + void *ptr; + PrivateShared *shared; + } data; + uint type : 30; + uint is_shared : 1; + uint is_null : 1; + }; + public: + typedef void (*f_construct)(Private *, const void *); + typedef void (*f_clear)(Private *); + typedef bool (*f_null)(const Private *); +#ifndef QT_NO_DATASTREAM + typedef void (*f_load)(Private *, QDataStream &); + typedef void (*f_save)(const Private *, QDataStream &); +#endif + typedef bool (*f_compare)(const Private *, const Private *); + typedef bool (*f_convert)(const QVariant::Private *d, Type t, void *, bool *); + typedef bool (*f_canConvert)(const QVariant::Private *d, Type t); + typedef void (*f_debugStream)(QDebug, const QVariant &); + struct Handler { + f_construct construct; + f_clear clear; + f_null isNull; +#ifndef QT_NO_DATASTREAM + f_load load; + f_save save; +#endif + f_compare compare; + f_convert convert; + f_canConvert canConvert; + f_debugStream debugStream; + }; +#endif + + inline bool operator==(const QVariant &v) const + { return cmp(v); } + inline bool operator!=(const QVariant &v) const + { return !cmp(v); } + +protected: + friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *); + friend int qRegisterGuiVariant(); + friend int 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; + + void create(int type, const void *copy); +#ifdef QT3_SUPPORT + void *castOrDetach(Type t); +#endif + bool cmp(const QVariant &other) const; + +private: + // force compile error, prevent QVariant(bool) to be called + inline QVariant(void *) { Q_ASSERT(false); } +#ifdef QT_NO_CAST_FROM_ASCII + // force compile error when implicit conversion is not wanted + inline QVariant(const char *) { Q_ASSERT(false); } +#endif +#ifndef QT3_SUPPORT + // force compile error, prevent QVariant(QVariant::Type, int) to be called + inline QVariant(bool, int) { Q_ASSERT(false); } +#endif +public: + typedef Private DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +typedef QList<QVariant> QVariantList; +typedef QMap<QString, QVariant> QVariantMap; +typedef QHash<QString, QVariant> QVariantHash; + +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) +{ + return QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t, QTypeInfo<T>::isPointer); +} + +template <> +inline QVariant qVariantFromValue(const QVariant &t) { return t; } + +template <typename T> +inline void qVariantSetValue(QVariant &v, const T &t) +{ + //if possible we reuse the current QVariant private + const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0)); + QVariant::Private &d = v.data_ptr(); + if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) { + d.type = type; + d.is_null = false; + T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr); + if (QTypeInfo<T>::isComplex) + old->~T(); + new (old) T(t); //call the copy constructor + } else { + v = QVariant(type, &t, QTypeInfo<T>::isPointer); + } +} + +template <> +inline void qVariantSetValue<QVariant>(QVariant &v, const QVariant &t) +{ + v = t; +} + + +inline QVariant::QVariant() {} +inline bool QVariant::isValid() const { return d.type != Invalid; } + +#ifdef QT3_SUPPORT +inline int &QVariant::asInt() +{ return *reinterpret_cast<int *>(castOrDetach(Int)); } +inline uint &QVariant::asUInt() +{ return *reinterpret_cast<uint *>(castOrDetach(UInt)); } +inline qlonglong &QVariant::asLongLong() +{ return *reinterpret_cast<qlonglong *>(castOrDetach(LongLong)); } +inline qulonglong &QVariant::asULongLong() +{ return *reinterpret_cast<qulonglong *>(castOrDetach(ULongLong)); } +inline bool &QVariant::asBool() +{ return *reinterpret_cast<bool *>(castOrDetach(Bool)); } +inline double &QVariant::asDouble() +{ return *reinterpret_cast<double *>(castOrDetach(Double)); } +inline QByteArray& QVariant::asByteArray() +{ return *reinterpret_cast<QByteArray *>(castOrDetach(ByteArray)); } +inline QBitArray& QVariant::asBitArray() +{ return *reinterpret_cast<QBitArray *>(castOrDetach(BitArray)); } +inline QString& QVariant::asString() +{ return *reinterpret_cast<QString *>(castOrDetach(String)); } +inline QStringList& QVariant::asStringList() +{ return *reinterpret_cast<QStringList *>(castOrDetach(StringList)); } +inline QDate& QVariant::asDate() +{ return *reinterpret_cast<QDate *>(castOrDetach(Date)); } +inline QTime& QVariant::asTime() +{ return *reinterpret_cast<QTime *>(castOrDetach(Time)); } +inline QDateTime& QVariant::asDateTime() +{ return *reinterpret_cast<QDateTime *>(castOrDetach(DateTime)); } +inline QList<QVariant>& QVariant::asList() +{ return *reinterpret_cast<QList<QVariant> *>(castOrDetach(List)); } +inline QMap<QString, QVariant>& QVariant::asMap() +{ return *reinterpret_cast<QMap<QString, QVariant> *>(castOrDetach(Map)); } +inline QPoint &QVariant::asPoint() +{ return *reinterpret_cast<QPoint *>(castOrDetach(Point)); } +inline QRect &QVariant::asRect() +{ return *reinterpret_cast<QRect *>(castOrDetach(Rect)); } +inline QSize &QVariant::asSize() +{ return *reinterpret_cast<QSize *>(castOrDetach(Size)); } +#endif //QT3_SUPPORT + +#ifndef QT_NO_MEMBER_TEMPLATES +template<typename T> +inline void QVariant::setValue(const T &avalue) +{ qVariantSetValue(*this, avalue); } +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream& operator>> (QDataStream& s, QVariant& p); +Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant& p); +Q_CORE_EXPORT QDataStream& operator>> (QDataStream& s, QVariant::Type& p); +Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p); +#endif + +inline bool QVariant::isDetached() const +{ return !d.is_shared || d.data.shared->ref == 1; } + + +#ifdef qdoc + inline bool operator==(const QVariant &v1, const QVariant &v2); + inline bool operator!=(const QVariant &v1, const QVariant &v2); +#else + +/* Helper class to add one more level of indirection to prevent + implicit casts. +*/ +class QVariantComparisonHelper +{ +public: + inline QVariantComparisonHelper(const QVariant &var) + : v(&var) {} +private: + friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &); + const QVariant *v; +}; + +inline bool operator==(const QVariant &v1, const QVariantComparisonHelper &v2) +{ + return v1.cmp(*v2.v); +} + +inline bool operator!=(const QVariant &v1, const QVariantComparisonHelper &v2) +{ + return !operator==(v1, v2); +} +#endif + +#ifndef QT_MOC +template<typename T> inline T qvariant_cast(const QVariant &v) +{ + const int vid = qMetaTypeId<T>(static_cast<T *>(0)); + if (vid == v.userType()) + return *reinterpret_cast<const T *>(v.constData()); + if (vid < int(QMetaType::User)) { + T t; + if (qvariant_cast_helper(v, QVariant::Type(vid), &t)) + return t; + } + return T(); +} + +template<> inline QVariant qvariant_cast<QVariant>(const QVariant &v) +{ + static const int vid = qRegisterMetaType<QVariant>("QVariant"); + if (vid == v.userType()) + return *reinterpret_cast<const QVariant *>(v.constData()); + return v; +} + +template<typename T> +inline T qVariantValue(const QVariant &variant) +{ return qvariant_cast<T>(variant); } + +template<typename T> +inline bool qVariantCanConvert(const QVariant &variant) +{ + return variant.canConvert(static_cast<QVariant::Type>( + qMetaTypeId<T>(static_cast<T *>(0)))); +} +#endif +Q_DECLARE_SHARED(QVariant) +Q_DECLARE_TYPEINFO(QVariant, Q_MOVABLE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &); +Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant::Type); +#endif + +QT_END_NAMESPACE + +Q_DECLARE_BUILTIN_METATYPE(QVariantList, QVariantList) +Q_DECLARE_BUILTIN_METATYPE(QVariantMap, QVariantMap) +Q_DECLARE_BUILTIN_METATYPE(QVariantHash, QVariantHash) + +QT_END_HEADER + +#endif // QVARIANT_H diff --git a/qtinterface/qt4/Qt/qvariantanimation.h b/qtinterface/qt4/Qt/qvariantanimation.h new file mode 100644 index 0000000..e96319f --- /dev/null +++ b/qtinterface/qt4/Qt/qvariantanimation.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANIMATION_H +#define QANIMATION_H + +#include <QtCore/qeasingcurve.h> +#include <QtCore/qabstractanimation.h> +#include <QtCore/qvector.h> +#include <QtCore/qvariant.h> +#include <QtCore/qpair.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_ANIMATION + +class QVariantAnimationPrivate; +class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation +{ + Q_OBJECT + Q_PROPERTY(QVariant startValue READ startValue WRITE setStartValue) + Q_PROPERTY(QVariant endValue READ endValue WRITE setEndValue) + Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY valueChanged) + Q_PROPERTY(int duration READ duration WRITE setDuration) + Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve) + +public: + typedef QPair<qreal, QVariant> KeyValue; + typedef QVector<KeyValue> KeyValues; + + QVariantAnimation(QObject *parent = 0); + ~QVariantAnimation(); + + QVariant startValue() const; + void setStartValue(const QVariant &value); + + QVariant endValue() const; + void setEndValue(const QVariant &value); + + QVariant keyValueAt(qreal step) const; + void setKeyValueAt(qreal step, const QVariant &value); + + KeyValues keyValues() const; + void setKeyValues(const KeyValues &values); + + QVariant currentValue() const; + + int duration() const; + void setDuration(int msecs); + + QEasingCurve easingCurve() const; + void setEasingCurve(const QEasingCurve &easing); + + typedef QVariant (*Interpolator)(const void *from, const void *to, qreal progress); + +Q_SIGNALS: + void valueChanged(const QVariant &value); + +protected: + QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = 0); + bool event(QEvent *event); + + void updateCurrentTime(int); + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + + virtual void updateCurrentValue(const QVariant &value) = 0; + virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; + +private: + template <typename T> friend void qRegisterAnimationInterpolator(QVariant (*func)(const T &, const T &, qreal)); + static void registerInterpolator(Interpolator func, int interpolationType); + + Q_DISABLE_COPY(QVariantAnimation) + Q_DECLARE_PRIVATE(QVariantAnimation) +}; + +template <typename T> +void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) { + QVariantAnimation::registerInterpolator(reinterpret_cast<QVariantAnimation::Interpolator>(func), qMetaTypeId<T>()); +} + +#endif //QT_NO_ANIMATION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QANIMATION_H diff --git a/qtinterface/qt4/Qt/qvarlengtharray.h b/qtinterface/qt4/Qt/qvarlengtharray.h new file mode 100644 index 0000000..244bf9b --- /dev/null +++ b/qtinterface/qt4/Qt/qvarlengtharray.h @@ -0,0 +1,256 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVARLENGTHARRAY_H +#define QVARLENGTHARRAY_H + +#include <QtCore/qcontainerfwd.h> +#include <QtCore/qglobal.h> +#include <new> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template<class T, int Prealloc> +class QPodList; + +// Prealloc = 256 by default, specified in qcontainerfwd.h +template<class T, int Prealloc> +class QVarLengthArray +{ +public: + inline explicit QVarLengthArray(int size = 0); + + inline QVarLengthArray(const QVarLengthArray<T, Prealloc> &other) + : a(Prealloc), s(0), ptr(reinterpret_cast<T *>(array)) + { + append(other.constData(), other.size()); + } + + inline ~QVarLengthArray() { + if (QTypeInfo<T>::isComplex) { + T *i = ptr + s; + while (i-- != ptr) + i->~T(); + } + if (ptr != reinterpret_cast<T *>(array)) + qFree(ptr); + } + inline QVarLengthArray<T, Prealloc> &operator=(const QVarLengthArray<T, Prealloc> &other) + { + if (this != &other) { + clear(); + append(other.constData(), other.size()); + } + return *this; + } + + inline void removeLast() { + Q_ASSERT(s > 0); + realloc(s - 1, a); + } + inline int size() const { return s; } + inline int count() const { return s; } + inline bool isEmpty() const { return (s == 0); } + inline void resize(int size); + inline void clear() { resize(0); } + + inline int capacity() const { return a; } + inline void reserve(int size); + + inline T &operator[](int idx) { + Q_ASSERT(idx >= 0 && idx < s); + return ptr[idx]; + } + inline const T &operator[](int idx) const { + Q_ASSERT(idx >= 0 && idx < s); + return ptr[idx]; + } + + inline void append(const T &t) { + if (s == a) // i.e. s != 0 + realloc(s, s<<1); + const int idx = s++; + if (QTypeInfo<T>::isComplex) { + new (ptr + idx) T(t); + } else { + ptr[idx] = t; + } + } + void append(const T *buf, int size); + + inline T *data() { return ptr; } + inline const T *data() const { return ptr; } + inline const T * constData() const { return ptr; } + +private: + friend class QPodList<T, Prealloc>; + void realloc(int size, int alloc); + + int a; + int s; + T *ptr; + union { + // ### Qt 5: Use 'Prealloc * sizeof(T)' as array size + char array[sizeof(qint64) * (((Prealloc * sizeof(T)) / sizeof(qint64)) + 1)]; + qint64 q_for_alignment_1; + double q_for_alignment_2; + }; +}; + +template <class T, int Prealloc> +Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize) + : s(asize) { + if (s > Prealloc) { + ptr = reinterpret_cast<T *>(qMalloc(s * sizeof(T))); + Q_CHECK_PTR(ptr); + a = s; + } else { + ptr = reinterpret_cast<T *>(array); + a = Prealloc; + } + if (QTypeInfo<T>::isComplex) { + T *i = ptr + s; + while (i != ptr) + new (--i) T; + } +} + +template <class T, int Prealloc> +Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::resize(int asize) +{ realloc(asize, qMax(asize, a)); } + +template <class T, int Prealloc> +Q_INLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::reserve(int asize) +{ if (asize > a) realloc(s, asize); } + +template <class T, int Prealloc> +Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, int increment) +{ + Q_ASSERT(abuf); + if (increment <= 0) + return; + + const int asize = s + increment; + + if (asize >= a) + realloc(s, qMax(s*2, asize)); + + if (QTypeInfo<T>::isComplex) { + // call constructor for new objects (which can throw) + while (s < asize) + new (ptr+(s++)) T(*abuf++); + } else { + qMemCopy(&ptr[s], abuf, increment * sizeof(T)); + s = asize; + } +} + +template <class T, int Prealloc> +Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int aalloc) +{ + Q_ASSERT(aalloc >= asize); + T *oldPtr = ptr; + int osize = s; + // s = asize; + + if (aalloc != a) { + ptr = reinterpret_cast<T *>(qMalloc(aalloc * sizeof(T))); + Q_CHECK_PTR(ptr); + if (ptr) { + s = 0; + a = aalloc; + + if (QTypeInfo<T>::isStatic) { + QT_TRY { + // copy all the old elements + const int copySize = qMin(asize, osize); + while (s < copySize) { + new (ptr+s) T(*(oldPtr+s)); + (oldPtr+s)->~T(); + s++; + } + } QT_CATCH(...) { + // clean up all the old objects and then free the old ptr + int sClean = s; + while (sClean < osize) + (oldPtr+(sClean++))->~T(); + if (oldPtr != reinterpret_cast<T *>(array) && oldPtr != ptr) + qFree(oldPtr); + QT_RETHROW; + } + } else { + qMemCopy(ptr, oldPtr, qMin(asize, osize) * sizeof(T)); + s = asize; + } + } else { + ptr = oldPtr; + return; + } + } + + if (QTypeInfo<T>::isComplex) { + while (osize > asize) + (oldPtr+(--osize))->~T(); + if( oldPtr == ptr ) + s = osize; + } + + if (oldPtr != reinterpret_cast<T *>(array) && oldPtr != ptr) + qFree(oldPtr); + + if (QTypeInfo<T>::isComplex) { + // call default constructor for new objects (which can throw) + while (s < asize) + new (ptr+(s++)) T; + } else { + s = asize; + } +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QVARLENGTHARRAY_H diff --git a/qtinterface/qt4/Qt/qvector.h b/qtinterface/qt4/Qt/qvector.h new file mode 100644 index 0000000..3c77ef4 --- /dev/null +++ b/qtinterface/qt4/Qt/qvector.h @@ -0,0 +1,800 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVECTOR_H +#define QVECTOR_H + +#include <QtCore/qiterator.h> +#include <QtCore/qatomic.h> +#include <QtCore/qalgorithms.h> +#include <QtCore/qlist.h> + +#ifndef QT_NO_STL +#include <iterator> +#include <vector> +#endif +#include <stdlib.h> +#include <string.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +struct Q_CORE_EXPORT QVectorData +{ + QBasicAtomicInt ref; + int alloc; + int size; +#if defined(QT_ARCH_SPARC) && defined(Q_CC_GNU) && defined(__LP64__) && defined(QT_BOOTSTRAPPED) + // workaround for bug in gcc 3.4.2 + uint sharable; + uint capacity; + uint reserved; +#else + uint sharable : 1; + uint capacity : 1; + uint reserved : 30; +#endif + + static QVectorData shared_null; + // ### Qt 5: rename to 'allocate()'. The current name causes problems for + // some debugges when the QVector is member of a class within an unnamed namespace. + // ### Qt 5: can be removed completely. (Ralf) + static QVectorData *malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init); + static QVectorData *allocate(int size, int alignment); + static QVectorData *reallocate(QVectorData *old, int newsize, int oldsize, int alignment); + static void free(QVectorData *data, int alignment); + static int grow(int sizeofTypedData, int size, int sizeofT, bool excessive); +}; + +template <typename T> +struct QVectorTypedData : private QVectorData +{ // private inheritance as we must not access QVectorData member thought QVectorTypedData + // as this would break strict aliasing rules. (in the case of shared_null) + T array[1]; + + static inline void free(QVectorTypedData<T> *x, int alignment) { QVectorData::free(static_cast<QVectorData *>(x), alignment); } +}; + +class QRegion; + +template <typename T> +class QVector +{ + typedef QVectorTypedData<T> Data; + union { + QVectorData *d; +#if defined(Q_CC_SUN) && (__SUNPRO_CC <= 0x550) + QVectorTypedData<T> *p; +#else + Data *p; +#endif + }; + +public: + inline QVector() : d(&QVectorData::shared_null) { d->ref.ref(); } + explicit QVector(int size); + QVector(int size, const T &t); + inline QVector(const QVector<T> &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } + inline ~QVector() { if (!d) return; if (!d->ref.deref()) free(p); } + QVector<T> &operator=(const QVector<T> &v); + bool operator==(const QVector<T> &v) const; + inline bool operator!=(const QVector<T> &v) const { return !(*this == v); } + + inline int size() const { return d->size; } + + inline bool isEmpty() const { return d->size == 0; } + + void resize(int size); + + inline int capacity() const { return d->alloc; } + void reserve(int size); + inline void squeeze() { realloc(d->size, d->size); d->capacity = 0; } + + inline void detach() { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + inline T *data() { detach(); return p->array; } + inline const T *data() const { return p->array; } + inline const T *constData() const { return p->array; } + void clear(); + + const T &at(int i) const; + T &operator[](int i); + const T &operator[](int i) const; + void append(const T &t); + void prepend(const T &t); + void insert(int i, const T &t); + void insert(int i, int n, const T &t); + void replace(int i, const T &t); + void remove(int i); + void remove(int i, int n); + + QVector<T> &fill(const T &t, int size = -1); + + int indexOf(const T &t, int from = 0) const; + int lastIndexOf(const T &t, int from = -1) const; + bool contains(const T &t) const; + int count(const T &t) const; + +#ifdef QT_STRICT_ITERATORS + class iterator { + public: + T *i; + typedef std::random_access_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + inline iterator() : i(0) {} + inline iterator(T *n) : i(n) {} + inline iterator(const iterator &o): i(o.i){} + inline T &operator*() const { return *i; } + inline T *operator->() const { return i; } + inline T &operator[](int j) const { return *(i + j); } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator<(const iterator& other) const { return i < other.i; } + inline bool operator<=(const iterator& other) const { return i <= other.i; } + inline bool operator>(const iterator& other) const { return i > other.i; } + inline bool operator>=(const iterator& other) const { return i >= other.i; } + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { T *n = i; ++i; return n; } + inline iterator &operator--() { i--; return *this; } + inline iterator operator--(int) { T *n = i; i--; return n; } + inline iterator &operator+=(int j) { i+=j; return *this; } + inline iterator &operator-=(int j) { i-=j; return *this; } + inline iterator operator+(int j) const { return iterator(i+j); } + inline iterator operator-(int j) const { return iterator(i-j); } + inline int operator-(iterator j) const { return i - j.i; } + }; + friend class iterator; + + class const_iterator { + public: + T *i; + typedef std::random_access_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() : i(0) {} + inline const_iterator(T *n) : i(n) {} + inline const_iterator(const const_iterator &o): i(o.i) {} + inline explicit const_iterator(const iterator &o): i(o.i) {} + inline const T &operator*() const { return *i; } + inline const T *operator->() const { return i; } + inline const T &operator[](int j) const { return *(i + j); } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline bool operator<(const const_iterator& other) const { return i < other.i; } + inline bool operator<=(const const_iterator& other) const { return i <= other.i; } + inline bool operator>(const const_iterator& other) const { return i > other.i; } + inline bool operator>=(const const_iterator& other) const { return i >= other.i; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { T *n = i; ++i; return n; } + inline const_iterator &operator--() { i--; return *this; } + inline const_iterator operator--(int) { T *n = i; i--; return n; } + inline const_iterator &operator+=(int j) { i+=j; return *this; } + inline const_iterator &operator-=(int j) { i-=j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(i+j); } + inline const_iterator operator-(int j) const { return const_iterator(i-j); } + inline int operator-(const_iterator j) const { return i - j.i; } + }; + friend class const_iterator; +#else + // STL-style + typedef T* iterator; + typedef const T* const_iterator; +#endif + inline iterator begin() { detach(); return p->array; } + inline const_iterator begin() const { return p->array; } + inline const_iterator constBegin() const { return p->array; } + inline iterator end() { detach(); return p->array + d->size; } + inline const_iterator end() const { return p->array + d->size; } + inline const_iterator constEnd() const { return p->array + d->size; } + iterator insert(iterator before, int n, const T &x); + inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); } + iterator erase(iterator begin, iterator end); + inline iterator erase(iterator pos) { return erase(pos, pos+1); } + + // more Qt + inline int count() const { return d->size; } + inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); } + inline const T &first() const { Q_ASSERT(!isEmpty()); return *begin(); } + inline T& last() { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline const T &last() const { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; } + inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; } + QVector<T> mid(int pos, int length = -1) const; + + T value(int i) const; + T value(int i, const T &defaultValue) const; + + // STL compatibility + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef ptrdiff_t difference_type; + typedef iterator Iterator; + typedef const_iterator ConstIterator; + typedef int size_type; + inline void push_back(const T &t) { append(t); } + inline void push_front(const T &t) { prepend(t); } + void pop_back() { Q_ASSERT(!isEmpty()); erase(end()-1); } + void pop_front() { Q_ASSERT(!isEmpty()); erase(begin()); } + inline bool empty() const + { return d->size == 0; } + inline T& front() { return first(); } + inline const_reference front() const { return first(); } + inline reference back() { return last(); } + inline const_reference back() const { return last(); } + + // comfort + QVector<T> &operator+=(const QVector<T> &l); + inline QVector<T> operator+(const QVector<T> &l) const + { QVector n = *this; n += l; return n; } + inline QVector<T> &operator+=(const T &t) + { append(t); return *this; } + inline QVector<T> &operator<< (const T &t) + { append(t); return *this; } + inline QVector<T> &operator<<(const QVector<T> &l) + { *this += l; return *this; } + + QList<T> toList() const; + + static QVector<T> fromList(const QList<T> &list); + +#ifndef QT_NO_STL + static inline QVector<T> fromStdVector(const std::vector<T> &vector) + { QVector<T> tmp; qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; } + inline std::vector<T> toStdVector() const + { std::vector<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } +#endif + +private: + friend class QRegion; // Optimization for QRegion::rects() + + void detach_helper(); + QVectorData *malloc(int alloc); + void realloc(int size, int alloc); + void free(Data *d); + int sizeOfTypedData() { + // this is more or less the same as sizeof(Data), except that it doesn't + // count the padding at the end + return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this); + } + inline int alignOfTypedData() const + { +#ifdef Q_ALIGNOF + return qMax<int>(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } +}; + +template <typename T> +void QVector<T>::detach_helper() +{ realloc(d->size, d->alloc); } +template <typename T> +void QVector<T>::reserve(int asize) +{ if (asize > d->alloc) realloc(d->size, asize); if (d->ref == 1) d->capacity = 1; } +template <typename T> +void QVector<T>::resize(int asize) +{ realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ? + QVectorData::grow(sizeOfTypedData(), asize, sizeof(T), QTypeInfo<T>::isStatic) + : d->alloc); } +template <typename T> +inline void QVector<T>::clear() +{ *this = QVector<T>(); } +template <typename T> +inline const T &QVector<T>::at(int i) const +{ Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::at", "index out of range"); + return p->array[i]; } +template <typename T> +inline const T &QVector<T>::operator[](int i) const +{ Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::operator[]", "index out of range"); + return p->array[i]; } +template <typename T> +inline T &QVector<T>::operator[](int i) +{ Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::operator[]", "index out of range"); + return data()[i]; } +template <typename T> +inline void QVector<T>::insert(int i, const T &t) +{ Q_ASSERT_X(i >= 0 && i <= d->size, "QVector<T>::insert", "index out of range"); + insert(begin() + i, 1, t); } +template <typename T> +inline void QVector<T>::insert(int i, int n, const T &t) +{ Q_ASSERT_X(i >= 0 && i <= d->size, "QVector<T>::insert", "index out of range"); + insert(begin() + i, n, t); } +template <typename T> +inline void QVector<T>::remove(int i, int n) +{ Q_ASSERT_X(i >= 0 && n >= 0 && i + n <= d->size, "QVector<T>::remove", "index out of range"); + erase(begin() + i, begin() + i + n); } +template <typename T> +inline void QVector<T>::remove(int i) +{ Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::remove", "index out of range"); + erase(begin() + i, begin() + i + 1); } +template <typename T> +inline void QVector<T>::prepend(const T &t) +{ insert(begin(), 1, t); } + +template <typename T> +inline void QVector<T>::replace(int i, const T &t) +{ + Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::replace", "index out of range"); + const T copy(t); + data()[i] = copy; +} + +template <typename T> +QVector<T> &QVector<T>::operator=(const QVector<T> &v) +{ + v.d->ref.ref(); + if (!d->ref.deref()) + free(p); + d = v.d; + if (!d->sharable) + detach_helper(); + return *this; +} + +template <typename T> +inline QVectorData *QVector<T>::malloc(int aalloc) +{ + QVectorData *vectordata = QVectorData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); + Q_CHECK_PTR(vectordata); + return vectordata; +} + +template <typename T> +QVector<T>::QVector(int asize) +{ + d = malloc(asize); + d->ref = 1; + d->alloc = d->size = asize; + d->sharable = true; + d->capacity = false; + if (QTypeInfo<T>::isComplex) { + T* b = p->array; + T* i = p->array + d->size; + while (i != b) + new (--i) T; + } else { + qMemSet(p->array, 0, asize * sizeof(T)); + } +} + +template <typename T> +QVector<T>::QVector(int asize, const T &t) +{ + d = malloc(asize); + d->ref = 1; + d->alloc = d->size = asize; + d->sharable = true; + d->capacity = false; + T* i = p->array + d->size; + while (i != p->array) + new (--i) T(t); +} + +template <typename T> +void QVector<T>::free(Data *x) +{ + if (QTypeInfo<T>::isComplex) { + T* b = x->array; + union { QVectorData *d; Data *p; } u; + u.p = x; + T* i = b + u.d->size; + while (i-- != b) + i->~T(); + } + x->free(x, alignOfTypedData()); +} + +template <typename T> +void QVector<T>::realloc(int asize, int aalloc) +{ + Q_ASSERT(asize <= aalloc); + T *pOld; + T *pNew; + union { QVectorData *d; Data *p; } x; + x.d = d; + + if (QTypeInfo<T>::isComplex && asize < d->size && d->ref == 1 ) { + // call the destructor on all objects that need to be + // destroyed when shrinking + pOld = p->array + d->size; + pNew = p->array + asize; + while (asize < d->size) { + (--pOld)->~T(); + d->size--; + } + } + + if (aalloc != d->alloc || d->ref != 1) { + // (re)allocate memory + if (QTypeInfo<T>::isStatic) { + x.d = malloc(aalloc); + Q_CHECK_PTR(x.p); + x.d->size = 0; + } else if (d->ref != 1) { + x.d = malloc(aalloc); + Q_CHECK_PTR(x.p); + if (QTypeInfo<T>::isComplex) { + x.d->size = 0; + } else { + ::memcpy(x.p, p, sizeOfTypedData() + (qMin(aalloc, d->alloc) - 1) * sizeof(T)); + x.d->size = d->size; + } + } else { + QT_TRY { + QVectorData *mem = QVectorData::reallocate(d, sizeOfTypedData() + (aalloc - 1) * sizeof(T), + sizeOfTypedData() + (d->alloc - 1) * sizeof(T), alignOfTypedData()); + Q_CHECK_PTR(mem); + x.d = d = mem; + x.d->size = d->size; + } QT_CATCH (const std::bad_alloc &) { + if (aalloc > d->alloc) // ignore the error in case we are just shrinking. + QT_RETHROW; + } + } + x.d->ref = 1; + x.d->alloc = aalloc; + x.d->sharable = true; + x.d->capacity = d->capacity; + x.d->reserved = 0; + } + + if (QTypeInfo<T>::isComplex) { + QT_TRY { + pOld = p->array + x.d->size; + pNew = x.p->array + x.d->size; + // copy objects from the old array into the new array + const int toMove = qMin(asize, d->size); + while (x.d->size < toMove) { + new (pNew++) T(*pOld++); + x.d->size++; + } + // construct all new objects when growing + while (x.d->size < asize) { + new (pNew++) T; + x.d->size++; + } + } QT_CATCH (...) { + free(x.p); + QT_RETHROW; + } + + } else if (asize > x.d->size) { + // initialize newly allocated memory to 0 + qMemSet(x.p->array + x.d->size, 0, (asize - x.d->size) * sizeof(T)); + } + x.d->size = asize; + + if (d != x.d) { + if (!d->ref.deref()) + free(p); + d = x.d; + } +} + +template<typename T> +Q_OUTOFLINE_TEMPLATE T QVector<T>::value(int i) const +{ + if (i < 0 || i >= d->size) { + return T(); + } + return p->array[i]; +} +template<typename T> +Q_OUTOFLINE_TEMPLATE T QVector<T>::value(int i, const T &defaultValue) const +{ + return ((i < 0 || i >= d->size) ? defaultValue : p->array[i]); +} + +template <typename T> +void QVector<T>::append(const T &t) +{ + if (d->ref != 1 || d->size + 1 > d->alloc) { + const T copy(t); + realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + 1, sizeof(T), + QTypeInfo<T>::isStatic)); + if (QTypeInfo<T>::isComplex) + new (p->array + d->size) T(copy); + else + p->array[d->size] = copy; + } else { + if (QTypeInfo<T>::isComplex) + new (p->array + d->size) T(t); + else + p->array[d->size] = t; + } + ++d->size; +} + +template <typename T> +Q_TYPENAME QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, const T &t) +{ + int offset = int(before - p->array); + if (n != 0) { + const T copy(t); + if (d->ref != 1 || d->size + n > d->alloc) + realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + n, sizeof(T), + QTypeInfo<T>::isStatic)); + if (QTypeInfo<T>::isStatic) { + T *b = p->array + d->size; + T *i = p->array + d->size + n; + while (i != b) + new (--i) T; + i = p->array + d->size; + T *j = i + n; + b = p->array + offset; + while (i != b) + *--j = *--i; + i = b+n; + while (i != b) + *--i = copy; + } else { + T *b = p->array + offset; + T *i = b + n; + memmove(i, b, (d->size - offset) * sizeof(T)); + while (i != b) + new (--i) T(copy); + } + d->size += n; + } + return p->array + offset; +} + +template <typename T> +Q_TYPENAME QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend) +{ + int f = int(abegin - p->array); + int l = int(aend - p->array); + int n = l - f; + detach(); + if (QTypeInfo<T>::isComplex) { + qCopy(p->array+l, p->array+d->size, p->array+f); + T *i = p->array+d->size; + T* b = p->array+d->size-n; + while (i != b) { + --i; + i->~T(); + } + } else { + memmove(p->array + f, p->array + l, (d->size-l)*sizeof(T)); + } + d->size -= n; + return p->array + f; +} + +template <typename T> +bool QVector<T>::operator==(const QVector<T> &v) const +{ + if (d->size != v.d->size) + return false; + if (d == v.d) + return true; + T* b = p->array; + T* i = b + d->size; + T* j = v.p->array + d->size; + while (i != b) + if (!(*--i == *--j)) + return false; + return true; +} + +template <typename T> +QVector<T> &QVector<T>::fill(const T &from, int asize) +{ + const T copy(from); + resize(asize < 0 ? d->size : asize); + if (d->size) { + T *i = p->array + d->size; + T *b = p->array; + while (i != b) + *--i = copy; + } + return *this; +} + +template <typename T> +QVector<T> &QVector<T>::operator+=(const QVector &l) +{ + int newSize = d->size + l.d->size; + realloc(d->size, newSize); + + T *w = p->array + newSize; + T *i = l.p->array + l.d->size; + T *b = l.p->array; + while (i != b) { + if (QTypeInfo<T>::isComplex) + new (--w) T(*--i); + else + *--w = *--i; + } + d->size = newSize; + return *this; +} + +template <typename T> +int QVector<T>::indexOf(const T &t, int from) const +{ + if (from < 0) + from = qMax(from + d->size, 0); + if (from < d->size) { + T* n = p->array + from - 1; + T* e = p->array + d->size; + while (++n != e) + if (*n == t) + return n - p->array; + } + return -1; +} + +template <typename T> +int QVector<T>::lastIndexOf(const T &t, int from) const +{ + if (from < 0) + from += d->size; + else if (from >= d->size) + from = d->size-1; + if (from >= 0) { + T* b = p->array; + T* n = p->array + from + 1; + while (n != b) { + if (*--n == t) + return n - b; + } + } + return -1; +} + +template <typename T> +bool QVector<T>::contains(const T &t) const +{ + T* b = p->array; + T* i = p->array + d->size; + while (i != b) + if (*--i == t) + return true; + return false; +} + +template <typename T> +int QVector<T>::count(const T &t) const +{ + int c = 0; + T* b = p->array; + T* i = p->array + d->size; + while (i != b) + if (*--i == t) + ++c; + return c; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QVector<T> QVector<T>::mid(int pos, int length) const +{ + if (length < 0) + length = size() - pos; + if (pos == 0 && length == size()) + return *this; + QVector<T> copy; + if (pos + length > size()) + length = size() - pos; + for (int i = pos; i < pos + length; ++i) + copy += at(i); + return copy; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QList<T> QVector<T>::toList() const +{ + QList<T> result; + for (int i = 0; i < size(); ++i) + result.append(at(i)); + return result; +} + +template <typename T> +Q_OUTOFLINE_TEMPLATE QVector<T> QList<T>::toVector() const +{ + QVector<T> result(size()); + for (int i = 0; i < size(); ++i) + result[i] = at(i); + return result; +} + +template <typename T> +QVector<T> QVector<T>::fromList(const QList<T> &list) +{ + return list.toVector(); +} + +template <typename T> +QList<T> QList<T>::fromVector(const QVector<T> &vector) +{ + return vector.toList(); +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(Vector) +Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(Vector) + +/* + ### Qt 5: + ### This needs to be removed for next releases of Qt. It is a workaround for vc++ because + ### Qt exports QPolygon and QPolygonF that inherit QVector<QPoint> and + ### QVector<QPointF> respectively. +*/ + +#ifdef Q_CC_MSVC +QT_BEGIN_INCLUDE_NAMESPACE +#include <QtCore/QPointF> +#include <QtCore/QPoint> +QT_END_INCLUDE_NAMESPACE + +#if defined(QT_BUILD_CORE_LIB) +#define Q_TEMPLATE_EXTERN +#else +#define Q_TEMPLATE_EXTERN extern +#endif +# pragma warning(push) /* MSVC 6.0 doesn't care about the disabling in qglobal.h (why?), so do it here */ +# pragma warning(disable: 4231) /* nonstandard extension used : 'extern' before template explicit instantiation */ +Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPointF>; +Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPoint>; +# pragma warning(pop) +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QVECTOR_H diff --git a/qtinterface/qt4/Qt/qvector2d.h b/qtinterface/qt4/Qt/qvector2d.h new file mode 100644 index 0000000..7852e2b --- /dev/null +++ b/qtinterface/qt4/Qt/qvector2d.h @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVECTOR2D_H +#define QVECTOR2D_H + +#include <QtCore/qpoint.h> +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QVector3D; +class QVector4D; +class QVariant; + +#ifndef QT_NO_VECTOR2D + +class Q_GUI_EXPORT QVector2D +{ +public: + QVector2D(); + QVector2D(qreal xpos, qreal ypos); + explicit QVector2D(const QPoint& point); + explicit QVector2D(const QPointF& point); +#ifndef QT_NO_VECTOR3D + explicit QVector2D(const QVector3D& vector); +#endif +#ifndef QT_NO_VECTOR4D + explicit QVector2D(const QVector4D& vector); +#endif + + bool isNull() const; + + qreal x() const; + qreal y() const; + + void setX(qreal x); + void setY(qreal y); + + qreal length() const; + qreal lengthSquared() const; + + QVector2D normalized() const; + void normalize(); + + QVector2D &operator+=(const QVector2D &vector); + QVector2D &operator-=(const QVector2D &vector); + QVector2D &operator*=(qreal factor); + QVector2D &operator*=(const QVector2D &vector); + QVector2D &operator/=(qreal divisor); + + static qreal dotProduct(const QVector2D& v1, const QVector2D& v2); + + friend inline bool operator==(const QVector2D &v1, const QVector2D &v2); + friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2); + friend inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2); + friend inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2); + friend inline const QVector2D operator*(qreal factor, const QVector2D &vector); + friend inline const QVector2D operator*(const QVector2D &vector, qreal factor); + friend inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2); + friend inline const QVector2D operator-(const QVector2D &vector); + friend inline const QVector2D operator/(const QVector2D &vector, qreal divisor); + + friend inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2); + +#ifndef QT_NO_VECTOR3D + QVector3D toVector3D() const; +#endif +#ifndef QT_NO_VECTOR4D + QVector4D toVector4D() const; +#endif + + QPoint toPoint() const; + QPointF toPointF() const; + + operator QVariant() const; + +private: + float xp, yp; + + QVector2D(float xpos, float ypos, int dummy); + + friend class QVector3D; + friend class QVector4D; +}; + +inline QVector2D::QVector2D() : xp(0.0f), yp(0.0f) {} + +inline QVector2D::QVector2D(float xpos, float ypos, int) : xp(xpos), yp(ypos) {} + +inline QVector2D::QVector2D(qreal xpos, qreal ypos) : xp(xpos), yp(ypos) {} + +inline QVector2D::QVector2D(const QPoint& point) : xp(point.x()), yp(point.y()) {} + +inline QVector2D::QVector2D(const QPointF& point) : xp(point.x()), yp(point.y()) {} + +inline bool QVector2D::isNull() const +{ + return qIsNull(xp) && qIsNull(yp); +} + +inline qreal QVector2D::x() const { return qreal(xp); } +inline qreal QVector2D::y() const { return qreal(yp); } + +inline void QVector2D::setX(qreal aX) { xp = aX; } +inline void QVector2D::setY(qreal aY) { yp = aY; } + +inline QVector2D &QVector2D::operator+=(const QVector2D &vector) +{ + xp += vector.xp; + yp += vector.yp; + return *this; +} + +inline QVector2D &QVector2D::operator-=(const QVector2D &vector) +{ + xp -= vector.xp; + yp -= vector.yp; + return *this; +} + +inline QVector2D &QVector2D::operator*=(qreal factor) +{ + xp *= factor; + yp *= factor; + return *this; +} + +inline QVector2D &QVector2D::operator*=(const QVector2D &vector) +{ + xp *= vector.xp; + yp *= vector.yp; + return *this; +} + +inline QVector2D &QVector2D::operator/=(qreal divisor) +{ + xp /= divisor; + yp /= divisor; + return *this; +} + +inline bool operator==(const QVector2D &v1, const QVector2D &v2) +{ + return v1.xp == v2.xp && v1.yp == v2.yp; +} + +inline bool operator!=(const QVector2D &v1, const QVector2D &v2) +{ + return v1.xp != v2.xp || v1.yp != v2.yp; +} + +inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2) +{ + return QVector2D(v1.xp + v2.xp, v1.yp + v2.yp, 1); +} + +inline const QVector2D operator-(const QVector2D &v1, const QVector2D &v2) +{ + return QVector2D(v1.xp - v2.xp, v1.yp - v2.yp, 1); +} + +inline const QVector2D operator*(qreal factor, const QVector2D &vector) +{ + return QVector2D(vector.xp * factor, vector.yp * factor, 1); +} + +inline const QVector2D operator*(const QVector2D &vector, qreal factor) +{ + return QVector2D(vector.xp * factor, vector.yp * factor, 1); +} + +inline const QVector2D operator*(const QVector2D &v1, const QVector2D &v2) +{ + return QVector2D(v1.xp * v2.xp, v1.yp * v2.yp, 1); +} + +inline const QVector2D operator-(const QVector2D &vector) +{ + return QVector2D(-vector.xp, -vector.yp, 1); +} + +inline const QVector2D operator/(const QVector2D &vector, qreal divisor) +{ + return QVector2D(vector.xp / divisor, vector.yp / divisor, 1); +} + +inline bool qFuzzyCompare(const QVector2D& v1, const QVector2D& v2) +{ + return qFuzzyCompare(v1.xp, v2.xp) && qFuzzyCompare(v1.yp, v2.yp); +} + +inline QPoint QVector2D::toPoint() const +{ + return QPoint(qRound(xp), qRound(yp)); +} + +inline QPointF QVector2D::toPointF() const +{ + return QPointF(qreal(xp), qreal(yp)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector2D &vector); +#endif + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector2D &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector2D &); +#endif + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qvector3d.h b/qtinterface/qt4/Qt/qvector3d.h new file mode 100644 index 0000000..9fb6dfd --- /dev/null +++ b/qtinterface/qt4/Qt/qvector3d.h @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVECTOR3D_H +#define QVECTOR3D_H + +#include <QtCore/qpoint.h> +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QMatrix4x4; +class QVector2D; +class QVector4D; + +#ifndef QT_NO_VECTOR3D + +class Q_GUI_EXPORT QVector3D +{ +public: + QVector3D(); + QVector3D(qreal xpos, qreal ypos, qreal zpos); + explicit QVector3D(const QPoint& point); + explicit QVector3D(const QPointF& point); +#ifndef QT_NO_VECTOR2D + QVector3D(const QVector2D& vector); + QVector3D(const QVector2D& vector, qreal zpos); +#endif +#ifndef QT_NO_VECTOR4D + explicit QVector3D(const QVector4D& vector); +#endif + + bool isNull() const; + + qreal x() const; + qreal y() const; + qreal z() const; + + void setX(qreal x); + void setY(qreal y); + void setZ(qreal z); + + qreal length() const; + qreal lengthSquared() const; + + QVector3D normalized() const; + void normalize(); + + QVector3D &operator+=(const QVector3D &vector); + QVector3D &operator-=(const QVector3D &vector); + QVector3D &operator*=(qreal factor); + QVector3D &operator*=(const QVector3D& vector); + QVector3D &operator/=(qreal divisor); + + static qreal dotProduct(const QVector3D& v1, const QVector3D& v2); + static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); + static QVector3D normal(const QVector3D& v1, const QVector3D& v2); + static QVector3D normal + (const QVector3D& v1, const QVector3D& v2, const QVector3D& v3); + + qreal distanceToPlane(const QVector3D& plane, const QVector3D& normal) const; + qreal distanceToPlane(const QVector3D& plane1, const QVector3D& plane2, const QVector3D& plane3) const; + qreal distanceToLine(const QVector3D& point, const QVector3D& direction) const; + + friend inline bool operator==(const QVector3D &v1, const QVector3D &v2); + friend inline bool operator!=(const QVector3D &v1, const QVector3D &v2); + friend inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2); + friend inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2); + friend inline const QVector3D operator*(qreal factor, const QVector3D &vector); + friend inline const QVector3D operator*(const QVector3D &vector, qreal factor); + friend const QVector3D operator*(const QVector3D &v1, const QVector3D& v2); + friend inline const QVector3D operator-(const QVector3D &vector); + friend inline const QVector3D operator/(const QVector3D &vector, qreal divisor); + + friend inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2); + +#ifndef QT_NO_VECTOR2D + QVector2D toVector2D() const; +#endif +#ifndef QT_NO_VECTOR4D + QVector4D toVector4D() const; +#endif + + QPoint toPoint() const; + QPointF toPointF() const; + + operator QVariant() const; + +private: + float xp, yp, zp; + + QVector3D(float xpos, float ypos, float zpos, int dummy); + + friend class QVector2D; + friend class QVector4D; +#ifndef QT_NO_MATRIX4X4 + friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix); + friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector); +#endif +}; + +inline QVector3D::QVector3D() : xp(0.0f), yp(0.0f), zp(0.0f) {} + +inline QVector3D::QVector3D(qreal xpos, qreal ypos, qreal zpos) : xp(xpos), yp(ypos), zp(zpos) {} + +inline QVector3D::QVector3D(float xpos, float ypos, float zpos, int) : xp(xpos), yp(ypos), zp(zpos) {} + +inline QVector3D::QVector3D(const QPoint& point) : xp(point.x()), yp(point.y()), zp(0.0f) {} + +inline QVector3D::QVector3D(const QPointF& point) : xp(point.x()), yp(point.y()), zp(0.0f) {} + +inline bool QVector3D::isNull() const +{ + return qIsNull(xp) && qIsNull(yp) && qIsNull(zp); +} + +inline qreal QVector3D::x() const { return qreal(xp); } +inline qreal QVector3D::y() const { return qreal(yp); } +inline qreal QVector3D::z() const { return qreal(zp); } + +inline void QVector3D::setX(qreal aX) { xp = aX; } +inline void QVector3D::setY(qreal aY) { yp = aY; } +inline void QVector3D::setZ(qreal aZ) { zp = aZ; } + +inline QVector3D &QVector3D::operator+=(const QVector3D &vector) +{ + xp += vector.xp; + yp += vector.yp; + zp += vector.zp; + return *this; +} + +inline QVector3D &QVector3D::operator-=(const QVector3D &vector) +{ + xp -= vector.xp; + yp -= vector.yp; + zp -= vector.zp; + return *this; +} + +inline QVector3D &QVector3D::operator*=(qreal factor) +{ + xp *= factor; + yp *= factor; + zp *= factor; + return *this; +} + +inline QVector3D &QVector3D::operator*=(const QVector3D& vector) +{ + xp *= vector.xp; + yp *= vector.yp; + zp *= vector.zp; + return *this; +} + +inline QVector3D &QVector3D::operator/=(qreal divisor) +{ + xp /= divisor; + yp /= divisor; + zp /= divisor; + return *this; +} + +inline bool operator==(const QVector3D &v1, const QVector3D &v2) +{ + return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp; +} + +inline bool operator!=(const QVector3D &v1, const QVector3D &v2) +{ + return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp; +} + +inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2) +{ + return QVector3D(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp, 1); +} + +inline const QVector3D operator-(const QVector3D &v1, const QVector3D &v2) +{ + return QVector3D(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp, 1); +} + +inline const QVector3D operator*(qreal factor, const QVector3D &vector) +{ + return QVector3D(vector.xp * factor, vector.yp * factor, vector.zp * factor, 1); +} + +inline const QVector3D operator*(const QVector3D &vector, qreal factor) +{ + return QVector3D(vector.xp * factor, vector.yp * factor, vector.zp * factor, 1); +} + +inline const QVector3D operator*(const QVector3D &v1, const QVector3D& v2) +{ + return QVector3D(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp, 1); +} + +inline const QVector3D operator-(const QVector3D &vector) +{ + return QVector3D(-vector.xp, -vector.yp, -vector.zp, 1); +} + +inline const QVector3D operator/(const QVector3D &vector, qreal divisor) +{ + return QVector3D(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor, 1); +} + +inline bool qFuzzyCompare(const QVector3D& v1, const QVector3D& v2) +{ + return qFuzzyCompare(v1.xp, v2.xp) && + qFuzzyCompare(v1.yp, v2.yp) && + qFuzzyCompare(v1.zp, v2.zp); +} + +inline QPoint QVector3D::toPoint() const +{ + return QPoint(qRound(xp), qRound(yp)); +} + +inline QPointF QVector3D::toPointF() const +{ + return QPointF(qreal(xp), qreal(yp)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector3D &vector); +#endif + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector3D &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector3D &); +#endif + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qvector4d.h b/qtinterface/qt4/Qt/qvector4d.h new file mode 100644 index 0000000..0493fdf --- /dev/null +++ b/qtinterface/qt4/Qt/qvector4d.h @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVECTOR4D_H +#define QVECTOR4D_H + +#include <QtCore/qpoint.h> +#include <QtCore/qmetatype.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QMatrix4x4; +class QVector2D; +class QVector3D; + +#ifndef QT_NO_VECTOR4D + +class Q_GUI_EXPORT QVector4D +{ +public: + QVector4D(); + QVector4D(qreal xpos, qreal ypos, qreal zpos, qreal wpos); + explicit QVector4D(const QPoint& point); + explicit QVector4D(const QPointF& point); +#ifndef QT_NO_VECTOR2D + QVector4D(const QVector2D& vector); + QVector4D(const QVector2D& vector, qreal zpos, qreal wpos); +#endif +#ifndef QT_NO_VECTOR3D + QVector4D(const QVector3D& vector); + QVector4D(const QVector3D& vector, qreal wpos); +#endif + + bool isNull() const; + + qreal x() const; + qreal y() const; + qreal z() const; + qreal w() const; + + void setX(qreal x); + void setY(qreal y); + void setZ(qreal z); + void setW(qreal w); + + qreal length() const; + qreal lengthSquared() const; + + QVector4D normalized() const; + void normalize(); + + QVector4D &operator+=(const QVector4D &vector); + QVector4D &operator-=(const QVector4D &vector); + QVector4D &operator*=(qreal factor); + QVector4D &operator*=(const QVector4D &vector); + QVector4D &operator/=(qreal divisor); + + static qreal dotProduct(const QVector4D& v1, const QVector4D& v2); + + friend inline bool operator==(const QVector4D &v1, const QVector4D &v2); + friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2); + friend inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2); + friend inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2); + friend inline const QVector4D operator*(qreal factor, const QVector4D &vector); + friend inline const QVector4D operator*(const QVector4D &vector, qreal factor); + friend inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2); + friend inline const QVector4D operator-(const QVector4D &vector); + friend inline const QVector4D operator/(const QVector4D &vector, qreal divisor); + + friend inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2); + +#ifndef QT_NO_VECTOR2D + QVector2D toVector2D() const; + QVector2D toVector2DAffine() const; +#endif +#ifndef QT_NO_VECTOR3D + QVector3D toVector3D() const; + QVector3D toVector3DAffine() const; +#endif + + QPoint toPoint() const; + QPointF toPointF() const; + + operator QVariant() const; + +private: + float xp, yp, zp, wp; + + QVector4D(float xpos, float ypos, float zpos, float wpos, int dummy); + + friend class QVector2D; + friend class QVector3D; +#ifndef QT_NO_MATRIX4X4 + friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix); + friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector); +#endif +}; + +inline QVector4D::QVector4D() : xp(0.0f), yp(0.0f), zp(0.0f), wp(0.0f) {} + +inline QVector4D::QVector4D(qreal xpos, qreal ypos, qreal zpos, qreal wpos) : xp(xpos), yp(ypos), zp(zpos), wp(wpos) {} + +inline QVector4D::QVector4D(float xpos, float ypos, float zpos, float wpos, int) : xp(xpos), yp(ypos), zp(zpos), wp(wpos) {} + +inline QVector4D::QVector4D(const QPoint& point) : xp(point.x()), yp(point.y()), zp(0.0f), wp(0.0f) {} + +inline QVector4D::QVector4D(const QPointF& point) : xp(point.x()), yp(point.y()), zp(0.0f), wp(0.0f) {} + +inline bool QVector4D::isNull() const +{ + return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp); +} + +inline qreal QVector4D::x() const { return qreal(xp); } +inline qreal QVector4D::y() const { return qreal(yp); } +inline qreal QVector4D::z() const { return qreal(zp); } +inline qreal QVector4D::w() const { return qreal(wp); } + +inline void QVector4D::setX(qreal aX) { xp = aX; } +inline void QVector4D::setY(qreal aY) { yp = aY; } +inline void QVector4D::setZ(qreal aZ) { zp = aZ; } +inline void QVector4D::setW(qreal aW) { wp = aW; } + +inline QVector4D &QVector4D::operator+=(const QVector4D &vector) +{ + xp += vector.xp; + yp += vector.yp; + zp += vector.zp; + wp += vector.wp; + return *this; +} + +inline QVector4D &QVector4D::operator-=(const QVector4D &vector) +{ + xp -= vector.xp; + yp -= vector.yp; + zp -= vector.zp; + wp -= vector.wp; + return *this; +} + +inline QVector4D &QVector4D::operator*=(qreal factor) +{ + xp *= factor; + yp *= factor; + zp *= factor; + wp *= factor; + return *this; +} + +inline QVector4D &QVector4D::operator*=(const QVector4D &vector) +{ + xp *= vector.xp; + yp *= vector.yp; + zp *= vector.zp; + wp *= vector.wp; + return *this; +} + +inline QVector4D &QVector4D::operator/=(qreal divisor) +{ + xp /= divisor; + yp /= divisor; + zp /= divisor; + wp /= divisor; + return *this; +} + +inline bool operator==(const QVector4D &v1, const QVector4D &v2) +{ + return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp && v1.wp == v2.wp; +} + +inline bool operator!=(const QVector4D &v1, const QVector4D &v2) +{ + return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp || v1.wp != v2.wp; +} + +inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2) +{ + return QVector4D(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp, v1.wp + v2.wp, 1); +} + +inline const QVector4D operator-(const QVector4D &v1, const QVector4D &v2) +{ + return QVector4D(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp, v1.wp - v2.wp, 1); +} + +inline const QVector4D operator*(qreal factor, const QVector4D &vector) +{ + return QVector4D(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.wp * factor, 1); +} + +inline const QVector4D operator*(const QVector4D &vector, qreal factor) +{ + return QVector4D(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.wp * factor, 1); +} + +inline const QVector4D operator*(const QVector4D &v1, const QVector4D& v2) +{ + return QVector4D(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp, v1.wp * v2.wp, 1); +} + +inline const QVector4D operator-(const QVector4D &vector) +{ + return QVector4D(-vector.xp, -vector.yp, -vector.zp, -vector.wp, 1); +} + +inline const QVector4D operator/(const QVector4D &vector, qreal divisor) +{ + return QVector4D(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor, vector.wp / divisor, 1); +} + +inline bool qFuzzyCompare(const QVector4D& v1, const QVector4D& v2) +{ + return qFuzzyCompare(v1.xp, v2.xp) && + qFuzzyCompare(v1.yp, v2.yp) && + qFuzzyCompare(v1.zp, v2.zp) && + qFuzzyCompare(v1.wp, v2.wp); +} + +inline QPoint QVector4D::toPoint() const +{ + return QPoint(qRound(xp), qRound(yp)); +} + +inline QPointF QVector4D::toPointF() const +{ + return QPointF(qreal(xp), qreal(yp)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector4D &vector); +#endif + +#ifndef QT_NO_DATASTREAM +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector4D &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector4D &); +#endif + +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qvfbhdr.h b/qtinterface/qt4/Qt/qvfbhdr.h new file mode 100644 index 0000000..e93123d --- /dev/null +++ b/qtinterface/qt4/Qt/qvfbhdr.h @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVFBHDR_H +#define QVFBHDR_H + +#include <QtGui/qcolor.h> +#include <QtGui/qwindowdefs.h> +#include <QtCore/qrect.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_QWS_TEMP_DIR +#define QT_QWS_TEMP_DIR "/tmp" +#endif + +#ifdef QT_PRIVATE_QWS +#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3") \ + .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY) + +#define QT_VFB_MOUSE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/qtvfb_mouse") +#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/qtvfb_keyboard") +#define QT_VFB_MAP(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/qtvfb_map") +#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/qt_soundserver") +#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/QtEmbedded") +#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY) +#else +#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2") \ + .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) +#define QT_VFB_MOUSE_PIPE(DISPLAY) QString("/tmp/.qtvfb_mouse-%1").arg(DISPLAY) +#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QString("/tmp/.qtvfb_keyboard-%1").arg(DISPLAY) +#define QT_VFB_MAP(DISPLAY) QString("/tmp/.qtvfb_map-%1").arg(DISPLAY) +#define QT_VFB_SOUND_PIPE(DISPLAY) QString("/tmp/.qt_soundserver-%1").arg(DISPLAY) +#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/QtEmbedded-%1") \ + .arg(DISPLAY) +#define QTE_PIPE_QVFB(DISPLAY) QString("/tmp/qtembedded-%1/QtEmbedded-%1") \ + .arg(DISPLAY) +#endif + +struct QVFbHeader +{ + int width; + int height; + int depth; + int linestep; + int dataoffset; + QRect update; + bool dirty; + int numcols; + QRgb clut[256]; + int viewerVersion; + int serverVersion; + int brightness; // since 4.4.0 + WId windowId; // since 4.5.0 +}; + +struct QVFbKeyData +{ + unsigned int keycode; + Qt::KeyboardModifiers modifiers; + unsigned short int unicode; + bool press; + bool repeat; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QVFBHDR_H diff --git a/qtinterface/qt4/Qt/qvideoframe.h b/qtinterface/qt4/Qt/qvideoframe.h new file mode 100644 index 0000000..249339b --- /dev/null +++ b/qtinterface/qt4/Qt/qvideoframe.h @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVIDEOFRAME_H +#define QVIDEOFRAME_H + +#include <QtCore/qmetatype.h> +#include <QtCore/qshareddata.h> +#include <QtGui/qimage.h> +#include <QtMultimedia/qabstractvideobuffer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QSize; +class QVariant; + +class QVideoFramePrivate; + +class Q_MULTIMEDIA_EXPORT QVideoFrame +{ +public: + enum FieldType + { + ProgressiveFrame, + TopField, + BottomField, + InterlacedFrame + }; + + enum PixelFormat + { + Format_Invalid, + Format_ARGB32, + Format_ARGB32_Premultiplied, + Format_RGB32, + Format_RGB24, + Format_RGB565, + Format_RGB555, + Format_ARGB8565_Premultiplied, + Format_BGRA32, + Format_BGRA32_Premultiplied, + Format_BGR32, + Format_BGR24, + Format_BGR565, + Format_BGR555, + Format_BGRA5658_Premultiplied, + + Format_AYUV444, + Format_AYUV444_Premultiplied, + Format_YUV444, + Format_YUV420P, + Format_YV12, + Format_UYVY, + Format_YUYV, + Format_NV12, + Format_NV21, + Format_IMC1, + Format_IMC2, + Format_IMC3, + Format_IMC4, + Format_Y8, + Format_Y16, + + Format_User = 1000 + }; + + QVideoFrame(); + QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format); + QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format); + QVideoFrame(const QImage &image); + QVideoFrame(const QVideoFrame &other); + ~QVideoFrame(); + + QVideoFrame &operator =(const QVideoFrame &other); + + bool isValid() const; + + PixelFormat pixelFormat() const; + + QAbstractVideoBuffer::HandleType handleType() const; + + QSize size() const; + int width() const; + int height() const; + + FieldType fieldType() const; + void setFieldType(FieldType); + + bool isMapped() const; + bool isReadable() const; + bool isWritable() const; + + QAbstractVideoBuffer::MapMode mapMode() const; + + bool map(QAbstractVideoBuffer::MapMode mode); + void unmap(); + + int bytesPerLine() const; + + uchar *bits(); + const uchar *bits() const; + int mappedBytes() const; + + QVariant handle() const; + + qint64 startTime() const; + void setStartTime(qint64 time); + + qint64 endTime() const; + void setEndTime(qint64 time); + + static PixelFormat pixelFormatFromImageFormat(QImage::Format format); + static QImage::Format imageFormatFromPixelFormat(PixelFormat format); + +private: + QExplicitlySharedDataPointer<QVideoFramePrivate> d; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QVideoFrame::FieldType) +Q_DECLARE_METATYPE(QVideoFrame::PixelFormat) + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qvideosurfaceformat.h b/qtinterface/qt4/Qt/qvideosurfaceformat.h new file mode 100644 index 0000000..9d0988d --- /dev/null +++ b/qtinterface/qt4/Qt/qvideosurfaceformat.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVIDEOSURFACEFORMAT_H +#define QVIDEOSURFACEFORMAT_H + +#include <QtCore/qlist.h> +#include <QtCore/qpair.h> +#include <QtCore/qshareddata.h> +#include <QtCore/qsize.h> +#include <QtGui/qimage.h> +#include <QtMultimedia/qvideoframe.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +class QDebug; + +class QVideoSurfaceFormatPrivate; + +class Q_MULTIMEDIA_EXPORT QVideoSurfaceFormat +{ +public: + enum Direction + { + TopToBottom, + BottomToTop + }; + + enum YCbCrColorSpace + { + YCbCr_Undefined, + YCbCr_BT601, + YCbCr_BT709, + YCbCr_xvYCC601, + YCbCr_xvYCC709, + YCbCr_JPEG, +#ifndef qdoc + YCbCr_CustomMatrix +#endif + }; + + QVideoSurfaceFormat(); + QVideoSurfaceFormat( + const QSize &size, + QVideoFrame::PixelFormat pixelFormat, + QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); + QVideoSurfaceFormat(const QVideoSurfaceFormat &format); + ~QVideoSurfaceFormat(); + + QVideoSurfaceFormat &operator =(const QVideoSurfaceFormat &format); + + bool operator ==(const QVideoSurfaceFormat &format) const; + bool operator !=(const QVideoSurfaceFormat &format) const; + + bool isValid() const; + + QVideoFrame::PixelFormat pixelFormat() const; + QAbstractVideoBuffer::HandleType handleType() const; + + QSize frameSize() const; + void setFrameSize(const QSize &size); + void setFrameSize(int width, int height); + + int frameWidth() const; + int frameHeight() const; + + QRect viewport() const; + void setViewport(const QRect &viewport); + + Direction scanLineDirection() const; + void setScanLineDirection(Direction direction); + + qreal frameRate() const; + void setFrameRate(qreal rate); + + QSize pixelAspectRatio() const; + void setPixelAspectRatio(const QSize &ratio); + void setPixelAspectRatio(int width, int height); + + YCbCrColorSpace yCbCrColorSpace() const; + void setYCbCrColorSpace(YCbCrColorSpace colorSpace); + + QSize sizeHint() const; + + QList<QByteArray> propertyNames() const; + QVariant property(const char *name) const; + void setProperty(const char *name, const QVariant &value); + +private: + QSharedDataPointer<QVideoSurfaceFormatPrivate> d; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &); +#endif + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) +Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace) + +QT_END_HEADER + +#endif + diff --git a/qtinterface/qt4/Qt/qwaitcondition.h b/qtinterface/qt4/Qt/qwaitcondition.h new file mode 100644 index 0000000..584a436 --- /dev/null +++ b/qtinterface/qt4/Qt/qwaitcondition.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAITCONDITION_H +#define QWAITCONDITION_H + +#include <QtCore/qglobal.h> + +#include <limits.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_THREAD + +class QWaitConditionPrivate; +class QMutex; +class QReadWriteLock; + +class Q_CORE_EXPORT QWaitCondition +{ +public: + QWaitCondition(); + ~QWaitCondition(); + + bool wait(QMutex *mutex, unsigned long time = ULONG_MAX); + bool wait(QReadWriteLock *readWriteLock, unsigned long time = ULONG_MAX); + + void wakeOne(); + void wakeAll(); + +private: + Q_DISABLE_COPY(QWaitCondition) + + QWaitConditionPrivate * d; +}; + +#else + +class QMutex; +class Q_CORE_EXPORT QWaitCondition +{ +public: + QWaitCondition() {} + ~QWaitCondition() {} + + bool wait(QMutex *mutex, unsigned long time = ULONG_MAX) + { + Q_UNUSED(mutex); + Q_UNUSED(time); + return true; + } + + void wakeOne() {} + void wakeAll() {} +}; + +#endif // QT_NO_THREAD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWAITCONDITION_H diff --git a/qtinterface/qt4/Qt/qwebdatabase.h b/qtinterface/qt4/Qt/qwebdatabase.h new file mode 100644 index 0000000..875b2eb --- /dev/null +++ b/qtinterface/qt4/Qt/qwebdatabase.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef _WEBDATABASE_H_ +#define _WEBDATABASE_H_ + +#include <QtCore/qstring.h> +#include <QtCore/qshareddata.h> + +#include "qwebkitglobal.h" + +namespace WebCore { + class DatabaseDetails; +} + +class QWebDatabasePrivate; +class QWebSecurityOrigin; + +class QWEBKIT_EXPORT QWebDatabase { +public: + QWebDatabase(const QWebDatabase& other); + QWebDatabase &operator=(const QWebDatabase& other); + ~QWebDatabase(); + + QString name() const; + QString displayName() const; + qint64 expectedSize() const; + qint64 size() const; + QString fileName() const; + QWebSecurityOrigin origin() const; + + static void removeDatabase(const QWebDatabase&); + static void removeAllDatabases(); + +private: + QWebDatabase(QWebDatabasePrivate* priv); + friend class QWebSecurityOrigin; + +private: + QExplicitlySharedDataPointer<QWebDatabasePrivate> d; +}; + +#endif + diff --git a/qtinterface/qt4/Qt/qwebelement.h b/qtinterface/qt4/Qt/qwebelement.h new file mode 100644 index 0000000..3833070 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebelement.h @@ -0,0 +1,258 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBELEMENT_H +#define QWEBELEMENT_H + +#include <QString> +#include <QStringList> +#include <QRect> +#include <QVariant> +#include <QExplicitlySharedDataPointer> + +#include "qwebkitglobal.h" +namespace WebCore { + class Element; + class Node; +} + +QT_BEGIN_NAMESPACE +class QPainter; +QT_END_NAMESPACE + +class QWebFrame; +class QWebElementCollection; +class QWebElementPrivate; + +class QWEBKIT_EXPORT QWebElement { +public: + QWebElement(); + QWebElement(const QWebElement&); + QWebElement &operator=(const QWebElement&); + ~QWebElement(); + + bool operator==(const QWebElement& o) const; + bool operator!=(const QWebElement& o) const; + + bool isNull() const; + + QWebElementCollection findAll(const QString &selectorQuery) const; + QWebElement findFirst(const QString &selectorQuery) const; + + void setPlainText(const QString& text); + QString toPlainText() const; + + void setOuterXml(const QString& markup); + QString toOuterXml() const; + + void setInnerXml(const QString& markup); + QString toInnerXml() const; + + void setAttribute(const QString& name, const QString& value); + void setAttributeNS(const QString& namespaceUri, const QString& name, const QString& value); + QString attribute(const QString& name, const QString& defaultValue = QString()) const; + QString attributeNS(const QString& namespaceUri, const QString& name, const QString& defaultValue = QString()) const; + bool hasAttribute(const QString& name) const; + bool hasAttributeNS(const QString& namespaceUri, const QString& name) const; + void removeAttribute(const QString& name); + void removeAttributeNS(const QString& namespaceUri, const QString& name); + bool hasAttributes() const; + QStringList attributeNames(const QString& namespaceUri = QString()) const; + + QStringList classes() const; + bool hasClass(const QString& name) const; + void addClass(const QString& name); + void removeClass(const QString& name); + void toggleClass(const QString& name); + + bool hasFocus() const; + void setFocus(); + + QRect geometry() const; + + QString tagName() const; + QString prefix() const; + QString localName() const; + QString namespaceUri() const; + + QWebElement parent() const; + QWebElement firstChild() const; + QWebElement lastChild() const; + QWebElement nextSibling() const; + QWebElement previousSibling() const; + QWebElement document() const; + QWebFrame *webFrame() const; + + // TODO: Add QWebElementCollection overloads + // docs need example snippet + void appendInside(const QString& markup); + void appendInside(const QWebElement& element); + + // docs need example snippet + void prependInside(const QString& markup); + void prependInside(const QWebElement& element); + + // docs need example snippet + void appendOutside(const QString& markup); + void appendOutside(const QWebElement& element); + + // docs need example snippet + void prependOutside(const QString& markup); + void prependOutside(const QWebElement& element); + + // docs need example snippet + void encloseContentsWith(const QWebElement& element); + void encloseContentsWith(const QString& markup); + void encloseWith(const QString& markup); + void encloseWith(const QWebElement& element); + + void replace(const QString& markup); + void replace(const QWebElement& element); + + QWebElement clone() const; + QWebElement& takeFromDocument(); + void removeFromDocument(); + void removeAllChildren(); + + QVariant evaluateJavaScript(const QString& scriptSource); + + enum StyleResolveStrategy { + InlineStyle, + CascadedStyle, + ComputedStyle, + }; + QString styleProperty(const QString& name, StyleResolveStrategy strategy) const; + void setStyleProperty(const QString& name, const QString& value); + + void render(QPainter* painter); + +private: + explicit QWebElement(WebCore::Element*); + explicit QWebElement(WebCore::Node*); + + static QWebElement enclosingElement(WebCore::Node*); + + friend class QWebFrame; + friend class QWebElementCollection; + friend class QWebHitTestResult; + friend class QWebHitTestResultPrivate; + friend class QWebPage; + + QWebElementPrivate* d; + WebCore::Element* m_element; +}; + +class QWebElementCollectionPrivate; + +class QWEBKIT_EXPORT QWebElementCollection +{ +public: + QWebElementCollection(); + QWebElementCollection(const QWebElement &contextElement, const QString &query); + QWebElementCollection(const QWebElementCollection &); + QWebElementCollection &operator=(const QWebElementCollection &); + ~QWebElementCollection(); + + QWebElementCollection operator+(const QWebElementCollection &other) const; + inline QWebElementCollection &operator+=(const QWebElementCollection &other) + { + append(other); return *this; + } + + void append(const QWebElementCollection &collection); + + int count() const; + QWebElement at(int i) const; + inline QWebElement operator[](int i) const { return at(i); } + + inline QWebElement first() const { return at(0); } + inline QWebElement last() const { return at(count() - 1); } + + QList<QWebElement> toList() const; + + class const_iterator { + public: + inline const_iterator(const QWebElementCollection* collection, int index) : i(index), collection(collection) {} + inline const_iterator(const const_iterator& o) : i(o.i), collection(o.collection) {} + + inline const QWebElement operator*() const { return collection->at(i); } + + inline bool operator==(const const_iterator& o) const { return i == o.i && collection == o.collection; } + inline bool operator!=(const const_iterator& o) const { return i != o.i || collection != o.collection; } + inline bool operator<(const const_iterator& o) const { return i < o.i; } + inline bool operator<=(const const_iterator& o) const { return i <= o.i; } + inline bool operator>(const const_iterator& o) const { return i > o.i; } + inline bool operator>=(const const_iterator& o) const { return i >= o.i; } + + inline const_iterator& operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator n(collection, i); ++i; return n; } + inline const_iterator& operator--() { i--; return *this; } + inline const_iterator operator--(int) { const_iterator n(collection, i); i--; return n; } + inline const_iterator& operator+=(int j) { i += j; return *this; } + inline const_iterator& operator-=(int j) { i -= j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(collection, i + j); } + inline const_iterator operator-(int j) const { return const_iterator(collection, i - j); } + inline int operator-(const_iterator j) const { return i - j.i; } + private: + int i; + const QWebElementCollection* const collection; + }; + friend class const_iterator; + + inline const_iterator begin() const { return constBegin(); } + inline const_iterator end() const { return constEnd(); } + inline const_iterator constBegin() const { return const_iterator(this, 0); } + inline const_iterator constEnd() const { return const_iterator(this, count()); }; + + class iterator { + public: + inline iterator(const QWebElementCollection* collection, int index) : i(index), collection(collection) {} + inline iterator(const iterator& o) : i(o.i), collection(o.collection) {} + + inline QWebElement operator*() const { return collection->at(i); } + + inline bool operator==(const iterator& o) const { return i == o.i && collection == o.collection; } + inline bool operator!=(const iterator& o) const { return i != o.i || collection != o.collection; } + inline bool operator<(const iterator& o) const { return i < o.i; } + inline bool operator<=(const iterator& o) const { return i <= o.i; } + inline bool operator>(const iterator& o) const { return i > o.i; } + inline bool operator>=(const iterator& o) const { return i >= o.i; } + + inline iterator& operator++() { ++i; return *this; } + inline iterator operator++(int) { iterator n(collection, i); ++i; return n; } + inline iterator& operator--() { i--; return *this; } + inline iterator operator--(int) { iterator n(collection, i); i--; return n; } + inline iterator& operator+=(int j) { i += j; return *this; } + inline iterator& operator-=(int j) { i -= j; return *this; } + inline iterator operator+(int j) const { return iterator(collection, i + j); } + inline iterator operator-(int j) const { return iterator(collection, i - j); } + inline int operator-(iterator j) const { return i - j.i; } + private: + int i; + const QWebElementCollection* const collection; + }; + friend class iterator; + + inline iterator begin() { return iterator(this, 0); } + inline iterator end() { return iterator(this, count()); } +private: + QExplicitlySharedDataPointer<QWebElementCollectionPrivate> d; +}; + +#endif // QWEBELEMENT_H diff --git a/qtinterface/qt4/Qt/qwebframe.h b/qtinterface/qt4/Qt/qwebframe.h new file mode 100644 index 0000000..08285f8 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebframe.h @@ -0,0 +1,235 @@ +/* + Copyright (C) 2008,2009 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2007 Staikos Computing Services Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBFRAME_H +#define QWEBFRAME_H + +#include <QtCore/qobject.h> +#include <QtCore/qurl.h> +#include <QtCore/qvariant.h> +#include <QtGui/qicon.h> +#include <QtScript/qscriptengine.h> +#if QT_VERSION >= 0x040400 +#include <QtNetwork/qnetworkaccessmanager.h> +#endif +#include "qwebkitglobal.h" + +QT_BEGIN_NAMESPACE +class QRect; +class QPoint; +class QPainter; +class QPixmap; +class QMouseEvent; +class QWheelEvent; +class QNetworkRequest; +class QRegion; +class QPrinter; +QT_END_NAMESPACE + +class QWebNetworkRequest; +class QWebFramePrivate; +class QWebPage; +class QWebHitTestResult; +class QWebHistoryItem; +class QWebSecurityOrigin; +class QWebElement; +class QWebElementCollection; + +namespace WebCore { + class WidgetPrivate; + class FrameLoaderClientQt; + class ChromeClientQt; +} +class QWebFrameData; +class QWebHitTestResultPrivate; +class QWebFrame; + +class QWEBKIT_EXPORT QWebHitTestResult { +public: + QWebHitTestResult(); + QWebHitTestResult(const QWebHitTestResult &other); + QWebHitTestResult &operator=(const QWebHitTestResult &other); + ~QWebHitTestResult(); + + bool isNull() const; + + QPoint pos() const; + QRect boundingRect() const; + QWebElement enclosingBlockElement() const; + QString title() const; + + QString linkText() const; + QUrl linkUrl() const; + QUrl linkTitle() const; + QWebFrame *linkTargetFrame() const; + QWebElement linkElement() const; + + QString alternateText() const; // for img, area, input and applet + + QUrl imageUrl() const; + QPixmap pixmap() const; + + bool isContentEditable() const; + bool isContentSelected() const; + + QWebElement element() const; + + QWebFrame *frame() const; + +private: + QWebHitTestResult(QWebHitTestResultPrivate *priv); + QWebHitTestResultPrivate *d; + + friend class QWebFrame; + friend class QWebPagePrivate; + friend class QWebPage; +}; + +class QWEBKIT_EXPORT QWebFrame : public QObject { + Q_OBJECT + Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) + Q_PROPERTY(QString title READ title) + Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(QUrl requestedUrl READ requestedUrl) + Q_PROPERTY(QUrl baseUrl READ baseUrl) + Q_PROPERTY(QIcon icon READ icon) + Q_PROPERTY(QSize contentsSize READ contentsSize) + Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition) + Q_PROPERTY(bool focus READ hasFocus) +private: + QWebFrame(QWebPage *parent, QWebFrameData *frameData); + QWebFrame(QWebFrame *parent, QWebFrameData *frameData); + ~QWebFrame(); + +public: + QWebPage *page() const; + + void load(const QUrl &url); +#if QT_VERSION < 0x040400 + void load(const QWebNetworkRequest &request); +#else + void load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, + const QByteArray &body = QByteArray()); +#endif + void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); + void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); + + void addToJavaScriptWindowObject(const QString &name, QObject *object); + void addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership); + QString toHtml() const; + QString toPlainText() const; + QString renderTreeDump() const; + + QString title() const; + void setUrl(const QUrl &url); + QUrl url() const; + QUrl requestedUrl() const; + QUrl baseUrl() const; + QIcon icon() const; + QMultiMap<QString, QString> metaData() const; + + QString frameName() const; + + QWebFrame *parentFrame() const; + QList<QWebFrame*> childFrames() const; + + Qt::ScrollBarPolicy scrollBarPolicy(Qt::Orientation orientation) const; + void setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPolicy policy); + + void setScrollBarValue(Qt::Orientation orientation, int value); + int scrollBarValue(Qt::Orientation orientation) const; + int scrollBarMinimum(Qt::Orientation orientation) const; + int scrollBarMaximum(Qt::Orientation orientation) const; + QRect scrollBarGeometry(Qt::Orientation orientation) const; + + void scroll(int, int); + QPoint scrollPosition() const; + void setScrollPosition(const QPoint &pos); + + enum RenderLayer { + ContentsLayer = 0x10, + ScrollBarLayer = 0x20, + PanIconLayer = 0x40, + + AllLayers = 0xff + }; + + void render(QPainter*); + void render(QPainter*, const QRegion& clip); + void render(QPainter*, RenderLayer layer, const QRegion& clip = QRegion()); + + void setTextSizeMultiplier(qreal factor); + qreal textSizeMultiplier() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal factor); + + bool hasFocus() const; + void setFocus(); + + QPoint pos() const; + QRect geometry() const; + QSize contentsSize() const; + + QWebElement documentElement() const; + QWebElementCollection findAllElements(const QString &selectorQuery) const; + QWebElement findFirstElement(const QString &selectorQuery) const; + + QWebHitTestResult hitTestContent(const QPoint &pos) const; + + virtual bool event(QEvent *); + + QWebSecurityOrigin securityOrigin() const; + +public Q_SLOTS: + QVariant evaluateJavaScript(const QString& scriptSource); +#ifndef QT_NO_PRINTER + void print(QPrinter *printer) const; +#endif + +Q_SIGNALS: + void javaScriptWindowObjectCleared(); + + void provisionalLoad(); + void titleChanged(const QString &title); + void urlChanged(const QUrl &url); + + void initialLayoutCompleted(); + + void iconChanged(); + + void contentsSizeChanged(const QSize &size); + + void loadStarted(); + void loadFinished(bool ok); + +private: + friend class QWebPage; + friend class QWebPagePrivate; + friend class QWebFramePrivate; + friend class WebCore::WidgetPrivate; + friend class WebCore::FrameLoaderClientQt; + friend class WebCore::ChromeClientQt; + QWebFramePrivate *d; +}; + +#endif diff --git a/qtinterface/qt4/Qt/qwebhistory.h b/qtinterface/qt4/Qt/qwebhistory.h new file mode 100644 index 0000000..cce4553 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebhistory.h @@ -0,0 +1,115 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBHISTORY_H +#define QWEBHISTORY_H + +#include <QtCore/qurl.h> +#include <QtCore/qstring.h> +#include <QtGui/qicon.h> +#include <QtCore/qdatetime.h> +#include <QtCore/qshareddata.h> + +#include "qwebkitglobal.h" + +class QWebPage; + +namespace WebCore { + class FrameLoaderClientQt; +} + +class QWebHistoryItemPrivate; + +class QWEBKIT_EXPORT QWebHistoryItem { +public: + QWebHistoryItem(const QWebHistoryItem &other); + QWebHistoryItem &operator=(const QWebHistoryItem &other); + ~QWebHistoryItem(); + + QUrl originalUrl() const; + QUrl url() const; + + QString title() const; + QDateTime lastVisited() const; + + QIcon icon() const; + + QVariant userData() const; + void setUserData(const QVariant& userData); + + bool isValid() const; + +private: + QWebHistoryItem(QWebHistoryItemPrivate *priv); + friend class QWebHistory; + friend class QWebPage; + friend class WebCore::FrameLoaderClientQt; + friend class QWebHistoryItemPrivate; + //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); + //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); + QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; +}; + + +class QWebHistoryPrivate; +class QWEBKIT_EXPORT QWebHistory { +public: + void clear(); + + QList<QWebHistoryItem> items() const; + QList<QWebHistoryItem> backItems(int maxItems) const; + QList<QWebHistoryItem> forwardItems(int maxItems) const; + + bool canGoBack() const; + bool canGoForward() const; + + void back(); + void forward(); + void goToItem(const QWebHistoryItem &item); + + QWebHistoryItem backItem() const; + QWebHistoryItem currentItem() const; + QWebHistoryItem forwardItem() const; + QWebHistoryItem itemAt(int i) const; + + int currentItemIndex() const; + + int count() const; + + int maximumItemCount() const; + void setMaximumItemCount(int count); + +private: + QWebHistory(); + ~QWebHistory(); + + friend class QWebPage; + friend class QWebPagePrivate; + friend QWEBKIT_EXPORT QDataStream& operator>>(QDataStream&, QWebHistory&); + friend QWEBKIT_EXPORT QDataStream& operator<<(QDataStream&, const QWebHistory&); + + Q_DISABLE_COPY(QWebHistory) + + QWebHistoryPrivate *d; +}; + +QWEBKIT_EXPORT QDataStream& operator<<(QDataStream& stream, const QWebHistory& history); +QWEBKIT_EXPORT QDataStream& operator>>(QDataStream& stream, QWebHistory& history); + +#endif diff --git a/qtinterface/qt4/Qt/qwebhistoryinterface.h b/qtinterface/qt4/Qt/qwebhistoryinterface.h new file mode 100644 index 0000000..a49c586 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebhistoryinterface.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2007 Staikos Computing Services, Inc. <info@staikos.net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + This class provides all functionality needed for tracking global history. +*/ + +#ifndef QWEBHISTORYINTERFACE_H +#define QWEBHISTORYINTERFACE_H + +#include <QtCore/qobject.h> + +#include "qwebkitglobal.h" + +class QWEBKIT_EXPORT QWebHistoryInterface : public QObject { + Q_OBJECT +public: + QWebHistoryInterface(QObject *parent = 0); + ~QWebHistoryInterface(); + + static void setDefaultInterface(QWebHistoryInterface *defaultInterface); + static QWebHistoryInterface *defaultInterface(); + + virtual bool historyContains(const QString &url) const = 0; + virtual void addHistoryEntry(const QString &url) = 0; +}; + +#endif diff --git a/qtinterface/qt4/Qt/qwebinspector.h b/qtinterface/qt4/Qt/qwebinspector.h new file mode 100644 index 0000000..a5c1ed5 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebinspector.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBINSPECTOR_H +#define QWEBINSPECTOR_H + +#include "qwebkitglobal.h" +#include "qwebpage.h" + +#include "qwebview.h" + +class QWebInspectorPrivate; + +class QWEBKIT_EXPORT QWebInspector : public QWidget { + Q_OBJECT +public: + QWebInspector(QWidget* parent = 0); + ~QWebInspector(); + + void setPage(QWebPage* page); + QWebPage* page() const; + + QSize sizeHint() const; + bool event(QEvent*); + +protected: + void resizeEvent(QResizeEvent* event); + void showEvent(QShowEvent* event); + void hideEvent(QHideEvent* event); + +private: + QWebInspectorPrivate* d; + + friend class QWebInspectorPrivate; + friend class QWebPage; + friend class QWebPagePrivate; + friend class WebCore::InspectorClientQt; +}; +#endif diff --git a/qtinterface/qt4/Qt/qwebkitglobal.h b/qtinterface/qt4/Qt/qwebkitglobal.h new file mode 100644 index 0000000..0885bdc --- /dev/null +++ b/qtinterface/qt4/Qt/qwebkitglobal.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBKITGLOBAL_H +#define QWEBKITGLOBAL_H + +#include <QtCore/qglobal.h> + +#if defined(QT_MAKEDLL) /* create a Qt DLL library */ +# if defined(BUILD_WEBKIT) +# define QWEBKIT_EXPORT Q_DECL_EXPORT +# else +# define QWEBKIT_EXPORT Q_DECL_IMPORT +# endif +#elif defined(QT_DLL) /* use a Qt DLL library */ +# define QWEBKIT_EXPORT Q_DECL_IMPORT +#endif + +#if !defined(QWEBKIT_EXPORT) +# if defined(QT_SHARED) +# define QWEBKIT_EXPORT Q_DECL_EXPORT +# else +# define QWEBKIT_EXPORT +# endif +#endif + +#if QT_VERSION < 0x040400 + #ifndef QT_BEGIN_NAMESPACE + #define QT_BEGIN_NAMESPACE + #endif + + #ifndef QT_END_NAMESPACE + #define QT_END_NAMESPACE + #endif +#endif + + +#endif // QWEBKITGLOBAL_H diff --git a/qtinterface/qt4/Qt/qwebkitversion.h b/qtinterface/qt4/Qt/qwebkitversion.h new file mode 100644 index 0000000..f0fbef0 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebkitversion.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2009 Robert Hogan <robert@roberthogan.net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <qstring.h> + +#ifndef qwebkitversion_h +#define qwebkitversion_h + +#include <QtCore/qstring.h> +#include "qwebkitglobal.h" + +QWEBKIT_EXPORT QString qWebKitVersion(); +QWEBKIT_EXPORT int qWebKitMajorVersion(); +QWEBKIT_EXPORT int qWebKitMinorVersion(); + +#endif // qwebkitversion_h diff --git a/qtinterface/qt4/Qt/qwebpage.h b/qtinterface/qt4/Qt/qwebpage.h new file mode 100644 index 0000000..8c455b1 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebpage.h @@ -0,0 +1,388 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2007 Staikos Computing Services Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBPAGE_H +#define QWEBPAGE_H + +#include "qwebsettings.h" +#include "qwebkitglobal.h" + +#include <QtCore/qobject.h> +#include <QtCore/qurl.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_NAMESPACE +class QNetworkProxy; +class QUndoStack; +class QMenu; +class QNetworkRequest; +class QNetworkReply; +class QNetworkAccessManager; +QT_END_NAMESPACE + +class QWebElement; +class QWebFrame; +class QWebNetworkRequest; +class QWebHistory; + +class QWebPagePrivate; +class QWebFrameData; +class QWebNetworkInterface; +class QWebPluginFactory; +class QWebHitTestResult; +class QWebHistoryItem; + +namespace WebCore { + class ChromeClientQt; + class EditorClientQt; + class FrameLoaderClientQt; + class InspectorClientQt; + class ResourceHandle; + class HitTestResult; + class QNetworkReplyHandler; + + struct FrameLoadRequest; +} + +class QWEBKIT_EXPORT QWebPage : public QObject { + Q_OBJECT + + Q_PROPERTY(bool modified READ isModified) + Q_PROPERTY(QString selectedText READ selectedText) + Q_PROPERTY(QSize viewportSize READ viewportSize WRITE setViewportSize) + Q_PROPERTY(QSize preferredContentsSize READ preferredContentsSize WRITE setPreferredContentsSize) + Q_PROPERTY(bool forwardUnsupportedContent READ forwardUnsupportedContent WRITE setForwardUnsupportedContent) + Q_PROPERTY(LinkDelegationPolicy linkDelegationPolicy READ linkDelegationPolicy WRITE setLinkDelegationPolicy) + Q_PROPERTY(QPalette palette READ palette WRITE setPalette) + Q_PROPERTY(bool contentEditable READ isContentEditable WRITE setContentEditable) + Q_ENUMS(LinkDelegationPolicy NavigationType WebAction) +public: + enum NavigationType { + NavigationTypeLinkClicked, + NavigationTypeFormSubmitted, + NavigationTypeBackOrForward, + NavigationTypeReload, + NavigationTypeFormResubmitted, + NavigationTypeOther + }; + + enum WebAction { + NoWebAction = - 1, + + OpenLink, + + OpenLinkInNewWindow, + OpenFrameInNewWindow, + + DownloadLinkToDisk, + CopyLinkToClipboard, + + OpenImageInNewWindow, + DownloadImageToDisk, + CopyImageToClipboard, + + Back, + Forward, + Stop, + Reload, + + Cut, + Copy, + Paste, + + Undo, + Redo, + MoveToNextChar, + MoveToPreviousChar, + MoveToNextWord, + MoveToPreviousWord, + MoveToNextLine, + MoveToPreviousLine, + MoveToStartOfLine, + MoveToEndOfLine, + MoveToStartOfBlock, + MoveToEndOfBlock, + MoveToStartOfDocument, + MoveToEndOfDocument, + SelectNextChar, + SelectPreviousChar, + SelectNextWord, + SelectPreviousWord, + SelectNextLine, + SelectPreviousLine, + SelectStartOfLine, + SelectEndOfLine, + SelectStartOfBlock, + SelectEndOfBlock, + SelectStartOfDocument, + SelectEndOfDocument, + DeleteStartOfWord, + DeleteEndOfWord, + + SetTextDirectionDefault, + SetTextDirectionLeftToRight, + SetTextDirectionRightToLeft, + + ToggleBold, + ToggleItalic, + ToggleUnderline, + + InspectElement, + + InsertParagraphSeparator, + InsertLineSeparator, + + SelectAll, + ReloadAndBypassCache, + + PasteAndMatchStyle, + RemoveFormat, + + ToggleStrikethrough, + ToggleSubscript, + ToggleSuperscript, + InsertUnorderedList, + InsertOrderedList, + Indent, + Outdent, + + AlignCenter, + AlignJustified, + AlignLeft, + AlignRight, + + WebActionCount + }; + + enum FindFlag { + FindBackward = 1, + FindCaseSensitively = 2, + FindWrapsAroundDocument = 4, + HighlightAllOccurrences = 8 + }; + Q_DECLARE_FLAGS(FindFlags, FindFlag) + + enum LinkDelegationPolicy { + DontDelegateLinks, + DelegateExternalLinks, + DelegateAllLinks + }; + + enum WebWindowType { + WebBrowserWindow, + WebModalDialog + }; + + explicit QWebPage(QObject *parent = 0); + ~QWebPage(); + + QWebFrame *mainFrame() const; + QWebFrame *currentFrame() const; + QWebFrame* frameAt(const QPoint& pos) const; + + QWebHistory *history() const; + QWebSettings *settings() const; + + void setView(QWidget *view); + QWidget *view() const; + + bool isModified() const; +#ifndef QT_NO_UNDOSTACK + QUndoStack *undoStack() const; +#endif + +#if QT_VERSION < 0x040400 && !defined(qdoc) + void setNetworkInterface(QWebNetworkInterface *interface); + QWebNetworkInterface *networkInterface() const; + + // #### why is this in the page itself? +#ifndef QT_NO_NETWORKPROXY + void setNetworkProxy(const QNetworkProxy& proxy); + QNetworkProxy networkProxy() const; +#endif + +#else + void setNetworkAccessManager(QNetworkAccessManager *manager); + QNetworkAccessManager *networkAccessManager() const; +#endif + + void setPluginFactory(QWebPluginFactory *factory); + QWebPluginFactory *pluginFactory() const; + + quint64 totalBytes() const; + quint64 bytesReceived() const; + + QString selectedText() const; + + QAction *action(WebAction action) const; + virtual void triggerAction(WebAction action, bool checked = false); + + QSize viewportSize() const; + void setViewportSize(const QSize &size) const; + + QSize preferredContentsSize() const; + void setPreferredContentsSize(const QSize &size) const; + + virtual bool event(QEvent*); + bool focusNextPrevChild(bool next); + + QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + + bool findText(const QString &subString, FindFlags options = 0); + + void setForwardUnsupportedContent(bool forward); + bool forwardUnsupportedContent() const; + + void setLinkDelegationPolicy(LinkDelegationPolicy policy); + LinkDelegationPolicy linkDelegationPolicy() const; + + void setPalette(const QPalette &palette); + QPalette palette() const; + + void setContentEditable(bool editable); + bool isContentEditable() const; + +#ifndef QT_NO_CONTEXTMENU + bool swallowContextMenuEvent(QContextMenuEvent *event); +#endif + void updatePositionDependentActions(const QPoint &pos); + + QMenu *createStandardContextMenu(); + + enum Extension { + ChooseMultipleFilesExtension, + ErrorPageExtension + }; + class ExtensionOption + {}; + class ExtensionReturn + {}; + + class ChooseMultipleFilesExtensionOption : public ExtensionOption { + public: + QWebFrame *parentFrame; + QStringList suggestedFileNames; + }; + + class ChooseMultipleFilesExtensionReturn : public ExtensionReturn { + public: + QStringList fileNames; + }; + + enum ErrorDomain { QtNetwork, Http, WebKit }; + class ErrorPageExtensionOption : public ExtensionOption { + public: + QUrl url; + QWebFrame* frame; + ErrorDomain domain; + int error; + QString errorString; + }; + + class ErrorPageExtensionReturn : public ExtensionReturn { + public: + ErrorPageExtensionReturn() : contentType(QLatin1String("text/html")), encoding(QLatin1String("utf-8")) {}; + QString contentType; + QString encoding; + QUrl baseUrl; + QByteArray content; + }; + + + virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0); + virtual bool supportsExtension(Extension extension) const; + + inline QWebPagePrivate* handle() const { return d; } + +public Q_SLOTS: + bool shouldInterruptJavaScript(); + +Q_SIGNALS: + void loadStarted(); + void loadProgress(int progress); + void loadFinished(bool ok); + + void linkHovered(const QString &link, const QString &title, const QString &textContent); + void statusBarMessage(const QString& text); + void selectionChanged(); + void frameCreated(QWebFrame *frame); + void geometryChangeRequested(const QRect& geom); + void repaintRequested(const QRect& dirtyRect); + void scrollRequested(int dx, int dy, const QRect& scrollViewRect); + void windowCloseRequested(); + void printRequested(QWebFrame *frame); + void linkClicked(const QUrl &url); + + void toolBarVisibilityChangeRequested(bool visible); + void statusBarVisibilityChangeRequested(bool visible); + void menuBarVisibilityChangeRequested(bool visible); + +#if QT_VERSION >= 0x040400 + void unsupportedContent(QNetworkReply *reply); + void downloadRequested(const QNetworkRequest &request); +#endif + + void microFocusChanged(); + void contentsChanged(); + void databaseQuotaExceeded(QWebFrame* frame, QString databaseName); + + void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); + void restoreFrameStateRequested(QWebFrame* frame); + +protected: + virtual QWebPage *createWindow(WebWindowType type); + virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); + +#if QT_VERSION >= 0x040400 + virtual bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type); +#else + virtual bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, NavigationType type); +#endif + virtual QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); + virtual void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); + virtual bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); + virtual bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); + virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); + + virtual QString userAgentForUrl(const QUrl& url) const; + +private: + Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int)) + Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked)) + Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages()) + + QWebPagePrivate *d; + + friend class QWebFrame; + friend class QWebPagePrivate; + friend class QWebView; + friend class QGraphicsWebView; + friend class QWebInspector; + friend class WebCore::ChromeClientQt; + friend class WebCore::EditorClientQt; + friend class WebCore::FrameLoaderClientQt; + friend class WebCore::InspectorClientQt; + friend class WebCore::ResourceHandle; + friend class WebCore::QNetworkReplyHandler; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QWebPage::FindFlags) + +#endif diff --git a/qtinterface/qt4/Qt/qwebpluginfactory.h b/qtinterface/qt4/Qt/qwebpluginfactory.h new file mode 100644 index 0000000..4a06b59 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebpluginfactory.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBPLUGINFACTORY_H +#define QWEBPLUGINFACTORY_H + +#include "qwebkitglobal.h" + +#include <QtCore/qobject.h> +#include <QtCore/qstringlist.h> + +QT_BEGIN_NAMESPACE +class QUrl; +class QString; +QT_END_NAMESPACE +class QWebPluginFactoryPrivate; + +class QWEBKIT_EXPORT QWebPluginFactory : public QObject { + Q_OBJECT +public: + struct QWEBKIT_EXPORT MimeType { + QString name; + QString description; + QStringList fileExtensions; + bool operator==(const MimeType& other) const; + inline bool operator!=(const MimeType& other) const { return !operator==(other); } + }; + + struct Plugin { + QString name; + QString description; + QList<MimeType> mimeTypes; + }; + + explicit QWebPluginFactory(QObject* parent = 0); + virtual ~QWebPluginFactory(); + + virtual QList<Plugin> plugins() const = 0; + virtual void refreshPlugins(); + + virtual QObject *create(const QString& mimeType, + const QUrl&, + const QStringList& argumentNames, + const QStringList& argumentValues) const = 0; + + enum Extension { + }; + class ExtensionOption + {}; + class ExtensionReturn + {}; + virtual bool extension(Extension extension, const ExtensionOption* option = 0, ExtensionReturn* output = 0); + virtual bool supportsExtension(Extension extension) const; + +private: + QWebPluginFactoryPrivate* d; +}; + +#endif diff --git a/qtinterface/qt4/Qt/qwebsecurityorigin.h b/qtinterface/qt4/Qt/qwebsecurityorigin.h new file mode 100644 index 0000000..16f8bc1 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebsecurityorigin.h @@ -0,0 +1,69 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _WEBSECURITYORIGIN_H_ +#define _WEBSECURITYORIGIN_H_ + +#include <QtCore/qurl.h> +#include <QtCore/qshareddata.h> + +#include "qwebkitglobal.h" + +namespace WebCore { + class SecurityOrigin; + class ChromeClientQt; +} + +class QWebSecurityOriginPrivate; +class QWebDatabase; +class QWebFrame; + +class QWEBKIT_EXPORT QWebSecurityOrigin { +public: + static QList<QWebSecurityOrigin> allOrigins(); + static void addLocalScheme(const QString& scheme); + static void removeLocalScheme(const QString& scheme); + static QStringList localSchemes(); + + ~QWebSecurityOrigin(); + + QString scheme() const; + QString host() const; + int port() const; + + qint64 databaseUsage() const; + qint64 databaseQuota() const; + + void setDatabaseQuota(qint64 quota); + + QList<QWebDatabase> databases() const; + + QWebSecurityOrigin(const QWebSecurityOrigin& other); + QWebSecurityOrigin &operator=(const QWebSecurityOrigin& other); +private: + friend class QWebDatabase; + friend class QWebFrame; + friend class WebCore::ChromeClientQt; + QWebSecurityOrigin(QWebSecurityOriginPrivate* priv); + +private: + QExplicitlySharedDataPointer<QWebSecurityOriginPrivate> d; +}; + +#endif diff --git a/qtinterface/qt4/Qt/qwebsettings.h b/qtinterface/qt4/Qt/qwebsettings.h new file mode 100644 index 0000000..50cf424 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebsettings.h @@ -0,0 +1,151 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBSETTINGS_H +#define QWEBSETTINGS_H + +#include "qwebkitglobal.h" + +#include <QtCore/qstring.h> +#include <QtGui/qpixmap.h> +#include <QtGui/qicon.h> +#include <QtCore/qshareddata.h> + +namespace WebCore { + class Settings; +} + +class QWebPage; +class QWebPluginDatabase; +class QWebSettingsPrivate; +QT_BEGIN_NAMESPACE +class QUrl; +QT_END_NAMESPACE + +class QWEBKIT_EXPORT QWebSettings { +public: + enum FontFamily { + StandardFont, + FixedFont, + SerifFont, + SansSerifFont, + CursiveFont, + FantasyFont + }; + enum WebAttribute { + AutoLoadImages, + JavascriptEnabled, + JavaEnabled, + PluginsEnabled, + PrivateBrowsingEnabled, + JavascriptCanOpenWindows, + JavascriptCanAccessClipboard, + DeveloperExtrasEnabled, + LinksIncludedInFocusChain, + ZoomTextOnly, + PrintElementBackgrounds, + OfflineStorageDatabaseEnabled, + OfflineWebApplicationCacheEnabled, + LocalStorageEnabled, +#ifdef QT_DEPRECATED + LocalStorageDatabaseEnabled = LocalStorageEnabled, +#endif + LocalContentCanAccessRemoteUrls, + DnsPrefetchEnabled + }; + enum WebGraphic { + MissingImageGraphic, + MissingPluginGraphic, + DefaultFrameIconGraphic, + TextAreaSizeGripCornerGraphic + }; + enum FontSize { + MinimumFontSize, + MinimumLogicalFontSize, + DefaultFontSize, + DefaultFixedFontSize + }; + + static QWebSettings *globalSettings(); + + void setFontFamily(FontFamily which, const QString &family); + QString fontFamily(FontFamily which) const; + void resetFontFamily(FontFamily which); + + void setFontSize(FontSize type, int size); + int fontSize(FontSize type) const; + void resetFontSize(FontSize type); + + void setAttribute(WebAttribute attr, bool on); + bool testAttribute(WebAttribute attr) const; + void resetAttribute(WebAttribute attr); + + void setUserStyleSheetUrl(const QUrl &location); + QUrl userStyleSheetUrl() const; + + void setDefaultTextEncoding(const QString &encoding); + QString defaultTextEncoding() const; + + static void setIconDatabasePath(const QString &location); + static QString iconDatabasePath(); + static void clearIconDatabase(); + static QIcon iconForUrl(const QUrl &url); + + //static QWebPluginDatabase *pluginDatabase(); + + static void setWebGraphic(WebGraphic type, const QPixmap &graphic); + static QPixmap webGraphic(WebGraphic type); + + static void setMaximumPagesInCache(int pages); + static int maximumPagesInCache(); + static void setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity); + + static void setOfflineStoragePath(const QString& path); + static QString offlineStoragePath(); + static void setOfflineStorageDefaultQuota(qint64 maximumSize); + static qint64 offlineStorageDefaultQuota(); + + static void setOfflineWebApplicationCachePath(const QString& path); + static QString offlineWebApplicationCachePath(); + static void setOfflineWebApplicationCacheQuota(qint64 maximumSize); + static qint64 offlineWebApplicationCacheQuota(); + + void setLocalStoragePath(const QString& path); + QString localStoragePath() const; + + static void clearMemoryCaches(); + + static void enablePersistentStorage(const QString& path = QString()); + + inline QWebSettingsPrivate* handle() const { return d; } + +private: + friend class QWebPagePrivate; + friend class QWebSettingsPrivate; + + Q_DISABLE_COPY(QWebSettings) + + QWebSettings(); + QWebSettings(WebCore::Settings *settings); + ~QWebSettings(); + + QWebSettingsPrivate *d; +}; + +#endif diff --git a/qtinterface/qt4/Qt/qwebview.h b/qtinterface/qt4/Qt/qwebview.h new file mode 100644 index 0000000..0f79c70 --- /dev/null +++ b/qtinterface/qt4/Qt/qwebview.h @@ -0,0 +1,167 @@ +/* + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2007 Staikos Computing Services Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBVIEW_H +#define QWEBVIEW_H + +#include "qwebkitglobal.h" +#include "qwebpage.h" +#include <QtGui/qwidget.h> +#include <QtGui/qicon.h> +#include <QtGui/qpainter.h> +#include <QtCore/qurl.h> +#if QT_VERSION >= 0x040400 +#include <QtNetwork/qnetworkaccessmanager.h> +#endif + +QT_BEGIN_NAMESPACE +class QNetworkRequest; +class QPrinter; +QT_END_NAMESPACE + +class QWebPage; +class QWebViewPrivate; +class QWebNetworkRequest; + +class QWEBKIT_EXPORT QWebView : public QWidget { + Q_OBJECT + Q_PROPERTY(QString title READ title) + Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(QIcon icon READ icon) + Q_PROPERTY(QString selectedText READ selectedText) + Q_PROPERTY(bool modified READ isModified) + //Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) + Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) + + Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints) + Q_FLAGS(QPainter::RenderHints) +public: + explicit QWebView(QWidget* parent = 0); + virtual ~QWebView(); + + QWebPage* page() const; + void setPage(QWebPage* page); + + void load(const QUrl& url); +#if QT_VERSION < 0x040400 && !defined(qdoc) + void load(const QWebNetworkRequest& request); +#else + void load(const QNetworkRequest& request, + QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, + const QByteArray &body = QByteArray()); +#endif + void setHtml(const QString& html, const QUrl& baseUrl = QUrl()); + void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl()); + + QWebHistory* history() const; + QWebSettings* settings() const; + + QString title() const; + void setUrl(const QUrl &url); + QUrl url() const; + QIcon icon() const; + + QString selectedText() const; + + QAction* pageAction(QWebPage::WebAction action) const; + void triggerPageAction(QWebPage::WebAction action, bool checked = false); + + bool isModified() const; + + /* + Qt::TextInteractionFlags textInteractionFlags() const; + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + void setTextInteractionFlag(Qt::TextInteractionFlag flag); + */ + + QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + + QSize sizeHint() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal factor); + + void setTextSizeMultiplier(qreal factor); + qreal textSizeMultiplier() const; + + QPainter::RenderHints renderHints() const; + void setRenderHints(QPainter::RenderHints hints); + void setRenderHint(QPainter::RenderHint hint, bool enabled = true); + + bool findText(const QString& subString, QWebPage::FindFlags options = 0); + + virtual bool event(QEvent*); + +public Q_SLOTS: + void stop(); + void back(); + void forward(); + void reload(); + + void print(QPrinter*) const; + +Q_SIGNALS: + void loadStarted(); + void loadProgress(int progress); + void loadFinished(bool); + void titleChanged(const QString& title); + void statusBarMessage(const QString& text); + void linkClicked(const QUrl&); + void selectionChanged(); + void iconChanged(); + void urlChanged(const QUrl&); + +protected: + void resizeEvent(QResizeEvent*); + void paintEvent(QPaintEvent*); + + virtual QWebView *createWindow(QWebPage::WebWindowType type); + + virtual void changeEvent(QEvent*); + virtual void mouseMoveEvent(QMouseEvent*); + virtual void mousePressEvent(QMouseEvent*); + virtual void mouseDoubleClickEvent(QMouseEvent*); + virtual void mouseReleaseEvent(QMouseEvent*); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QContextMenuEvent*); +#endif +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent*); +#endif + virtual void keyPressEvent(QKeyEvent*); + virtual void keyReleaseEvent(QKeyEvent*); + virtual void dragEnterEvent(QDragEnterEvent*); + virtual void dragLeaveEvent(QDragLeaveEvent*); + virtual void dragMoveEvent(QDragMoveEvent*); + virtual void dropEvent(QDropEvent*); + virtual void focusInEvent(QFocusEvent*); + virtual void focusOutEvent(QFocusEvent*); + virtual void inputMethodEvent(QInputMethodEvent*); + + virtual bool focusNextPrevChild(bool next); + +private: + friend class QWebPage; + QWebViewPrivate* d; + Q_PRIVATE_SLOT(d, void _q_pageDestroyed()) +}; + +#endif // QWEBVIEW_H diff --git a/qtinterface/qt4/Qt/qwhatsthis.h b/qtinterface/qt4/Qt/qwhatsthis.h new file mode 100644 index 0000000..041862f --- /dev/null +++ b/qtinterface/qt4/Qt/qwhatsthis.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWHATSTHIS_H +#define QWHATSTHIS_H + +#include <QtCore/qobject.h> +#include <QtGui/qcursor.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_WHATSTHIS + +class QAction; +#ifdef QT3_SUPPORT +class QToolButton; +#endif + +class Q_GUI_EXPORT QWhatsThis +{ + QWhatsThis(); + +public: + static void enterWhatsThisMode(); + static bool inWhatsThisMode(); + static void leaveWhatsThisMode(); + + static void showText(const QPoint &pos, const QString &text, QWidget *w = 0); + static void hideText(); + + static QAction *createAction(QObject *parent = 0); + +#ifdef QT3_SUPPORT + static QT3_SUPPORT void add(QWidget *w, const QString &s); + static QT3_SUPPORT void remove(QWidget *); + static QT3_SUPPORT QToolButton *whatsThisButton(QWidget *parent); +#endif +}; + +#endif // QT_NO_WHATSTHIS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWHATSTHIS_H diff --git a/qtinterface/qt4/Qt/qwidget.h b/qtinterface/qt4/Qt/qwidget.h new file mode 100644 index 0000000..e66c35d --- /dev/null +++ b/qtinterface/qt4/Qt/qwidget.h @@ -0,0 +1,1074 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIDGET_H +#define QWIDGET_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qobject.h> +#include <QtCore/qmargins.h> +#include <QtGui/qpaintdevice.h> +#include <QtGui/qpalette.h> +#include <QtGui/qfont.h> +#include <QtGui/qfontmetrics.h> +#include <QtGui/qfontinfo.h> +#include <QtGui/qsizepolicy.h> +#include <QtGui/qregion.h> +#include <QtGui/qbrush.h> +#include <QtGui/qcursor.h> +#include <QtGui/qkeysequence.h> + +#ifdef QT_INCLUDE_COMPAT +#include <QtGui/qevent.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QLayout; +class QWSRegionManager; +class QStyle; +class QAction; +class QVariant; + +class QActionEvent; +class QMouseEvent; +class QWheelEvent; +class QHoverEvent; +class QKeyEvent; +class QFocusEvent; +class QPaintEvent; +class QMoveEvent; +class QResizeEvent; +class QCloseEvent; +class QContextMenuEvent; +class QInputMethodEvent; +class QTabletEvent; +class QDragEnterEvent; +class QDragMoveEvent; +class QDragLeaveEvent; +class QDropEvent; +class QShowEvent; +class QHideEvent; +class QInputContext; +class QIcon; +class QWindowSurface; +class QLocale; +class QGraphicsProxyWidget; +class QGraphicsEffect; +#if defined(Q_WS_X11) +class QX11Info; +#endif + +class QWidgetData +{ +public: + WId winid; + uint widget_attributes; + Qt::WindowFlags window_flags; + uint window_state : 4; + uint focus_policy : 4; + uint sizehint_forced :1; + uint is_closing :1; + uint in_show : 1; + uint in_set_window_state : 1; + mutable uint fstrut_dirty : 1; + uint context_menu_policy : 3; + uint window_modality : 2; + uint in_destructor : 1; + uint unused : 13; + QRect crect; + mutable QPalette pal; + QFont fnt; +#if defined(Q_WS_QWS) +// QRegion req_region; // Requested region +// mutable QRegion paintable_region; // Paintable region +// mutable bool paintable_region_dirty;// needs to be recalculated +// mutable QRegion alloc_region; // Allocated region +// mutable bool alloc_region_dirty; // needs to be recalculated +// mutable int overlapping_children; // Handle overlapping children + + int alloc_region_index; +// int alloc_region_revision; +#endif + QRect wrect; +}; + +class QWidgetPrivate; + +class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWidget) + + Q_PROPERTY(bool modal READ isModal) + Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) + Q_PROPERTY(QRect frameGeometry READ frameGeometry) + Q_PROPERTY(QRect normalGeometry READ normalGeometry) + Q_PROPERTY(int x READ x) + Q_PROPERTY(int y READ y) + Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false) + Q_PROPERTY(QSize frameSize READ frameSize) + Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false) + Q_PROPERTY(int width READ width) + Q_PROPERTY(int height READ height) + Q_PROPERTY(QRect rect READ rect) + Q_PROPERTY(QRect childrenRect READ childrenRect) + Q_PROPERTY(QRegion childrenRegion READ childrenRegion) + Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) + Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) + Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) + Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false) + Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false) + Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false) + Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false) + Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement) + Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize) + Q_PROPERTY(QPalette palette READ palette WRITE setPalette) + Q_PROPERTY(QFont font READ font WRITE setFont) +#ifndef QT_NO_CURSOR + Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) +#endif + Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking) + Q_PROPERTY(bool isActiveWindow READ isActiveWindow) + Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) + Q_PROPERTY(bool focus READ hasFocus) + Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy) + Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false) + Q_PROPERTY(bool minimized READ isMinimized) + Q_PROPERTY(bool maximized READ isMaximized) + Q_PROPERTY(bool fullScreen READ isFullScreen) + Q_PROPERTY(QSize sizeHint READ sizeHint) + Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint) + Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow) + Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow) + Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow) + Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow) + Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow) +#ifndef QT_NO_TOOLTIP + Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) +#endif +#ifndef QT_NO_STATUSTIP + Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) +#endif +#ifndef QT_NO_WHATSTHIS + Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) +#endif +#ifndef QT_NO_ACCESSIBILITY + Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName) + Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription) +#endif + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) + QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) + Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground) +#ifndef QT_NO_STYLE_STYLESHEET + Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) +#endif + Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale) + Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow) + Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) + +public: + enum RenderFlag { + DrawWindowBackground = 0x1, + DrawChildren = 0x2, + IgnoreMask = 0x4 + }; + Q_DECLARE_FLAGS(RenderFlags, RenderFlag) + + explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QWidget(QWidget* parent, const char *name, Qt::WindowFlags f = 0); +#endif + ~QWidget(); + + int devType() const; + + WId winId() const; + void createWinId(); // internal, going away + inline WId internalWinId() const { return data->winid; } + WId effectiveWinId() const; + + // GUI style setting + QStyle *style() const; + void setStyle(QStyle *); + // Widget types and states + + bool isTopLevel() const; + bool isWindow() const; + + bool isModal() const; + Qt::WindowModality windowModality() const; + void setWindowModality(Qt::WindowModality windowModality); + + bool isEnabled() const; + bool isEnabledTo(QWidget*) const; + bool isEnabledToTLW() const; + +public Q_SLOTS: + void setEnabled(bool); + void setDisabled(bool); + void setWindowModified(bool); + + // Widget coordinates + +public: + QRect frameGeometry() const; + const QRect &geometry() const; + QRect normalGeometry() const; + + int x() const; + int y() const; + QPoint pos() const; + QSize frameSize() const; + QSize size() const; + inline int width() const; + inline int height() const; + inline QRect rect() const; + QRect childrenRect() const; + QRegion childrenRegion() const; + + QSize minimumSize() const; + QSize maximumSize() const; + int minimumWidth() const; + int minimumHeight() const; + int maximumWidth() const; + int maximumHeight() const; + void setMinimumSize(const QSize &); + void setMinimumSize(int minw, int minh); + void setMaximumSize(const QSize &); + void setMaximumSize(int maxw, int maxh); + void setMinimumWidth(int minw); + void setMinimumHeight(int minh); + void setMaximumWidth(int maxw); + void setMaximumHeight(int maxh); + +#ifdef Q_QDOC + void setupUi(QWidget *widget); +#endif + + QSize sizeIncrement() const; + void setSizeIncrement(const QSize &); + void setSizeIncrement(int w, int h); + QSize baseSize() const; + void setBaseSize(const QSize &); + void setBaseSize(int basew, int baseh); + + void setFixedSize(const QSize &); + void setFixedSize(int w, int h); + void setFixedWidth(int w); + void setFixedHeight(int h); + + // Widget coordinate mapping + + QPoint mapToGlobal(const QPoint &) const; + QPoint mapFromGlobal(const QPoint &) const; + QPoint mapToParent(const QPoint &) const; + QPoint mapFromParent(const QPoint &) const; + QPoint mapTo(QWidget *, const QPoint &) const; + QPoint mapFrom(QWidget *, const QPoint &) const; + + QWidget *window() const; + QWidget *nativeParentWidget() const; + inline QWidget *topLevelWidget() const { return window(); } + + // Widget appearance functions + const QPalette &palette() const; + void setPalette(const QPalette &); + + void setBackgroundRole(QPalette::ColorRole); + QPalette::ColorRole backgroundRole() const; + + void setForegroundRole(QPalette::ColorRole); + QPalette::ColorRole foregroundRole() const; + + const QFont &font() const; + void setFont(const QFont &); + QFontMetrics fontMetrics() const; + QFontInfo fontInfo() const; + +#ifndef QT_NO_CURSOR + QCursor cursor() const; + void setCursor(const QCursor &); + void unsetCursor(); +#endif + + void setMouseTracking(bool enable); + bool hasMouseTracking() const; + bool underMouse() const; + + void setMask(const QBitmap &); + void setMask(const QRegion &); + QRegion mask() const; + void clearMask(); + + void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(), + const QRegion &sourceRegion = QRegion(), + RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); + + void render(QPainter *painter, const QPoint &targetOffset = QPoint(), + const QRegion &sourceRegion = QRegion(), + RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); + +#ifndef QT_NO_GRAPHICSEFFECT + QGraphicsEffect *graphicsEffect() const; + void setGraphicsEffect(QGraphicsEffect *effect); +#endif //QT_NO_GRAPHICSEFFECT + + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); + void ungrabGesture(Qt::GestureType type); + +public Q_SLOTS: + void setWindowTitle(const QString &); +#ifndef QT_NO_STYLE_STYLESHEET + void setStyleSheet(const QString& styleSheet); +#endif +public: +#ifndef QT_NO_STYLE_STYLESHEET + QString styleSheet() const; +#endif + QString windowTitle() const; + void setWindowIcon(const QIcon &icon); + QIcon windowIcon() const; + void setWindowIconText(const QString &); + QString windowIconText() const; + void setWindowRole(const QString &); + QString windowRole() const; + void setWindowFilePath(const QString &filePath); + QString windowFilePath() const; + + void setWindowOpacity(qreal level); + qreal windowOpacity() const; + + bool isWindowModified() const; +#ifndef QT_NO_TOOLTIP + void setToolTip(const QString &); + QString toolTip() const; +#endif +#ifndef QT_NO_STATUSTIP + void setStatusTip(const QString &); + QString statusTip() const; +#endif +#ifndef QT_NO_WHATSTHIS + void setWhatsThis(const QString &); + QString whatsThis() const; +#endif +#ifndef QT_NO_ACCESSIBILITY + QString accessibleName() const; + void setAccessibleName(const QString &name); + QString accessibleDescription() const; + void setAccessibleDescription(const QString &description); +#endif + + void setLayoutDirection(Qt::LayoutDirection direction); + Qt::LayoutDirection layoutDirection() const; + void unsetLayoutDirection(); + + void setLocale(const QLocale &locale); + QLocale locale() const; + void unsetLocale(); + + inline bool isRightToLeft() const { return layoutDirection() == Qt::RightToLeft; } + inline bool isLeftToRight() const { return layoutDirection() == Qt::LeftToRight; } + +public Q_SLOTS: + inline void setFocus() { setFocus(Qt::OtherFocusReason); } + +public: + bool isActiveWindow() const; + void activateWindow(); + void clearFocus(); + + void setFocus(Qt::FocusReason reason); + Qt::FocusPolicy focusPolicy() const; + void setFocusPolicy(Qt::FocusPolicy policy); + bool hasFocus() const; + static void setTabOrder(QWidget *, QWidget *); + void setFocusProxy(QWidget *); + QWidget *focusProxy() const; + Qt::ContextMenuPolicy contextMenuPolicy() const; + void setContextMenuPolicy(Qt::ContextMenuPolicy policy); + + // Grab functions + void grabMouse(); +#ifndef QT_NO_CURSOR + void grabMouse(const QCursor &); +#endif + void releaseMouse(); + void grabKeyboard(); + void releaseKeyboard(); +#ifndef QT_NO_SHORTCUT + int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut); + void releaseShortcut(int id); + void setShortcutEnabled(int id, bool enable = true); + void setShortcutAutoRepeat(int id, bool enable = true); +#endif + static QWidget *mouseGrabber(); + static QWidget *keyboardGrabber(); + + // Update/refresh functions + inline bool updatesEnabled() const; + void setUpdatesEnabled(bool enable); + +#if 0 //def Q_WS_QWS + void repaintUnclipped(const QRegion &, bool erase = true); +#endif + +#ifndef QT_NO_GRAPHICSVIEW + QGraphicsProxyWidget *graphicsProxyWidget() const; +#endif + +public Q_SLOTS: + void update(); + void repaint(); + +public: + inline void update(int x, int y, int w, int h); + void update(const QRect&); + void update(const QRegion&); + + void repaint(int x, int y, int w, int h); + void repaint(const QRect &); + void repaint(const QRegion &); + +public Q_SLOTS: + // Widget management functions + + virtual void setVisible(bool visible); + inline void setHidden(bool hidden) { setVisible(!hidden); } +#ifndef Q_WS_WINCE + inline void show() { setVisible(true); } +#else + void show(); +#endif + inline void hide() { setVisible(false); } + inline QT_MOC_COMPAT void setShown(bool shown) { setVisible(shown); } + + void showMinimized(); + void showMaximized(); + void showFullScreen(); + void showNormal(); + + bool close(); + void raise(); + void lower(); + +public: + void stackUnder(QWidget*); + void move(int x, int y); + void move(const QPoint &); + void resize(int w, int h); + void resize(const QSize &); + inline void setGeometry(int x, int y, int w, int h); + void setGeometry(const QRect &); + QByteArray saveGeometry() const; + bool restoreGeometry(const QByteArray &geometry); + void adjustSize(); + bool isVisible() const; + bool isVisibleTo(QWidget*) const; + // ### Qt 5: bool isVisibleTo(_const_ QWidget *) const + inline bool isHidden() const; + + bool isMinimized() const; + bool isMaximized() const; + bool isFullScreen() const; + + Qt::WindowStates windowState() const; + void setWindowState(Qt::WindowStates state); + void overrideWindowState(Qt::WindowStates state); + + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + + QSizePolicy sizePolicy() const; + void setSizePolicy(QSizePolicy); + inline void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical); + virtual int heightForWidth(int) const; + + QRegion visibleRegion() const; + + void setContentsMargins(int left, int top, int right, int bottom); + void setContentsMargins(const QMargins &margins); + void getContentsMargins(int *left, int *top, int *right, int *bottom) const; + QMargins contentsMargins() const; + + QRect contentsRect() const; + +public: + QLayout *layout() const; + void setLayout(QLayout *); + void updateGeometry(); + + void setParent(QWidget *parent); + void setParent(QWidget *parent, Qt::WindowFlags f); + + void scroll(int dx, int dy); + void scroll(int dx, int dy, const QRect&); + + // Misc. functions + + QWidget *focusWidget() const; + QWidget *nextInFocusChain() const; + QWidget *previousInFocusChain() const; + + // drag and drop + bool acceptDrops() const; + void setAcceptDrops(bool on); + +#ifndef QT_NO_ACTION + //actions + void addAction(QAction *action); + void addActions(QList<QAction*> actions); + void insertAction(QAction *before, QAction *action); + void insertActions(QAction *before, QList<QAction*> actions); + void removeAction(QAction *action); + QList<QAction*> actions() const; +#endif + + QWidget *parentWidget() const; + + void setWindowFlags(Qt::WindowFlags type); + inline Qt::WindowFlags windowFlags() const; + void overrideWindowFlags(Qt::WindowFlags type); + + inline Qt::WindowType windowType() const; + + static QWidget *find(WId); +#ifdef QT3_SUPPORT + static QT3_SUPPORT QWidgetMapper *wmapper(); +#endif + inline QWidget *childAt(int x, int y) const; + QWidget *childAt(const QPoint &p) const; + +#if defined(Q_WS_X11) + const QX11Info &x11Info() const; + Qt::HANDLE x11PictureHandle() const; +#endif + +#if defined(Q_WS_MAC) + Qt::HANDLE macQDHandle() const; + Qt::HANDLE macCGHandle() const; +#endif + +#if defined(Q_WS_WIN) + HDC getDC() const; + void releaseDC(HDC) const; +#else + Qt::HANDLE handle() const; +#endif + + void setAttribute(Qt::WidgetAttribute, bool on = true); + inline bool testAttribute(Qt::WidgetAttribute) const; + + QPaintEngine *paintEngine() const; + + void ensurePolished() const; + + QInputContext *inputContext(); + void setInputContext(QInputContext *); + + bool isAncestorOf(const QWidget *child) const; + +#ifdef QT_KEYPAD_NAVIGATION + bool hasEditFocus() const; + void setEditFocus(bool on); +#endif + + bool autoFillBackground() const; + void setAutoFillBackground(bool enabled); + + void setWindowSurface(QWindowSurface *surface); + QWindowSurface *windowSurface() const; + +Q_SIGNALS: + void customContextMenuRequested(const QPoint &pos); + +protected: + // Event handlers + bool event(QEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *); +#endif + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void enterEvent(QEvent *); + virtual void leaveEvent(QEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void moveEvent(QMoveEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void closeEvent(QCloseEvent *); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QContextMenuEvent *); +#endif +#ifndef QT_NO_TABLETEVENT + virtual void tabletEvent(QTabletEvent *); +#endif +#ifndef QT_NO_ACTION + virtual void actionEvent(QActionEvent *); +#endif + +#ifndef QT_NO_DRAGANDDROP + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + virtual void dropEvent(QDropEvent *); +#endif + + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + +#if defined(Q_WS_MAC) + virtual bool macEvent(EventHandlerCallRef, EventRef); +#endif +#if defined(Q_WS_WIN) + virtual bool winEvent(MSG *message, long *result); +#endif +#if defined(Q_WS_X11) + virtual bool x11Event(XEvent *); +#endif +#if defined(Q_WS_QWS) + virtual bool qwsEvent(QWSEvent *); +#endif + + // Misc. protected functions + virtual void changeEvent(QEvent *); + + int metric(PaintDeviceMetric) const; + + virtual void inputMethodEvent(QInputMethodEvent *); +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + + Qt::InputMethodHints inputMethodHints() const; + void setInputMethodHints(Qt::InputMethodHints hints); + +protected: + void resetInputContext(); +protected Q_SLOTS: + void updateMicroFocus(); +protected: + + void create(WId = 0, bool initializeWindow = true, + bool destroyOldWindow = true); + void destroy(bool destroyWindow = true, + bool destroySubWindows = true); + + virtual bool focusNextPrevChild(bool next); + inline bool focusNextChild() { return focusNextPrevChild(true); } + inline bool focusPreviousChild() { return focusNextPrevChild(false); } + +protected: + QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f); +private: + + bool testAttribute_helper(Qt::WidgetAttribute) const; + + QLayout *takeLayout(); + + friend class QBackingStoreDevice; + friend class QWidgetBackingStore; + friend class QApplication; + friend class QApplicationPrivate; + friend class QBaseApplication; + friend class QPainter; + friend class QPainterPrivate; + friend class QPixmap; // for QPixmap::fill() + friend class QFontMetrics; + friend class QFontInfo; + friend class QETWidget; + friend class QLayout; + friend class QWidgetItem; + friend class QWidgetItemV2; + friend class QGLContext; + friend class QGLWidget; + friend class QGLWindowSurface; + friend class QX11PaintEngine; + friend class QWin32PaintEngine; + friend class QShortcutPrivate; + friend class QShortcutMap; + friend class QWindowSurface; + friend class QGraphicsProxyWidget; + friend class QGraphicsProxyWidgetPrivate; + friend class QStyleSheetStyle; + friend struct QWidgetExceptionCleaner; + friend class QGestureManager; + friend class QWinNativePanGestureRecognizer; + 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); + 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); +#endif +#ifdef Q_WS_QWS + friend class QWSBackingStore; + friend class QWSManager; + friend class QWSManagerPrivate; + friend class QDecoration; + friend class QWSWindowSurface; + friend class QScreen; + friend class QVNCScreen; + friend bool isWidgetOpaque(const QWidget *); + friend class QGLWidgetPrivate; +#endif +#ifdef Q_OS_SYMBIAN + friend class QSymbianControl; + friend class QS60WindowSurface; +#endif +#ifdef Q_WS_X11 + friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp); + friend void qt_net_remove_user_time(QWidget *tlw); +#endif + + friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); + friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget); + +private: + Q_DISABLE_COPY(QWidget) + Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) +#ifdef Q_OS_SYMBIAN + Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId)) +#endif + + QWidgetData *data; + +#ifdef QT3_SUPPORT +public: + inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); } + QT3_SUPPORT QStyle *setStyle(const QString&); + inline QT3_SUPPORT bool isVisibleToTLW() const; + QT3_SUPPORT QRect visibleRect() const; + inline QT3_SUPPORT void iconify() { showMinimized(); } + inline QT3_SUPPORT void constPolish() const { ensurePolished(); } + inline QT3_SUPPORT void polish() { ensurePolished(); } + inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false) + { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } + inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false) + { setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } + inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false) + { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } + inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw) + { QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);} + inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); } +#ifndef QT_NO_CURSOR + inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); } +#endif + inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); } + inline QT3_SUPPORT void unsetFont() { setFont(QFont()); } + inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); } + inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); } + Qt::BackgroundMode QT3_SUPPORT backgroundMode() const; + void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground); + const QT3_SUPPORT QColor &eraseColor() const; + void QT3_SUPPORT setEraseColor(const QColor &); + const QT3_SUPPORT QColor &foregroundColor() const; + const QT3_SUPPORT QPixmap *erasePixmap() const; + void QT3_SUPPORT setErasePixmap(const QPixmap &); + const QT3_SUPPORT QColor &paletteForegroundColor() const; + void QT3_SUPPORT setPaletteForegroundColor(const QColor &); + const QT3_SUPPORT QColor &paletteBackgroundColor() const; + void QT3_SUPPORT setPaletteBackgroundColor(const QColor &); + const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const; + void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &); + const QT3_SUPPORT QBrush& backgroundBrush() const; + const QT3_SUPPORT QColor &backgroundColor() const; + const QT3_SUPPORT QPixmap *backgroundPixmap() const; + void QT3_SUPPORT setBackgroundPixmap(const QPixmap &); + QT3_SUPPORT void setBackgroundColor(const QColor &); + QT3_SUPPORT QColorGroup colorGroup() const; + QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const; + inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); } + inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); } + inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); } + enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin }; + inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {} + inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; } + inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); } + inline QT3_SUPPORT void repaint(bool) { repaint(); } + inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); } + inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); } + inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); } + QT3_SUPPORT void erase(); + inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); } + QT3_SUPPORT void erase(const QRect &); + QT3_SUPPORT void erase(const QRegion &); + QT3_SUPPORT void drawText(const QPoint &p, const QString &s) + { drawText_helper(p.x(), p.y(), s); } + inline QT3_SUPPORT void drawText(int x, int y, const QString &s) + { drawText_helper(x, y, s); } + QT3_SUPPORT bool close(bool); + inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const + { + QWidget *w = childAt(x, y); + return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0); + } + inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const + { + QWidget *w = childAt(p); + return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0); + } + inline QT3_SUPPORT void setCaption(const QString &c) { setWindowTitle(c); } + QT3_SUPPORT void setIcon(const QPixmap &i); + inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); } + inline QT3_SUPPORT QString caption() const { return windowTitle(); } + QT3_SUPPORT const QPixmap *icon() const; + inline QT3_SUPPORT QString iconText() const { return windowIconText(); } + inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); } + inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); } + inline QT3_SUPPORT void setActiveWindow() { activateWindow(); } + inline QT3_SUPPORT bool isShown() const { return !isHidden(); } + inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; } + inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; } + inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; } + + +private: + void drawText_helper(int x, int y, const QString &); + void erase_helper(int x, int y, int w, int h); +#endif // QT3_SUPPORT + +protected: + virtual void styleChange(QStyle&); // compat + virtual void enabledChange(bool); // compat + virtual void paletteChange(const QPalette &); // compat + virtual void fontChange(const QFont &); // compat + virtual void windowActivationChange(bool); // compat + virtual void languageChange(); // compat +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags) + +#if defined Q_CC_MSVC && _MSC_VER < 1300 +template <> inline QWidget *qobject_cast_helper<QWidget*>(QObject *o, QWidget *) +{ + if (!o || !o->isWidgetType()) return 0; + return (QWidget*)(o); +} +#else +template <> inline QWidget *qobject_cast<QWidget*>(QObject *o) +{ + if (!o || !o->isWidgetType()) return 0; + return static_cast<QWidget*>(o); +} +template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o) +{ + if (!o || !o->isWidgetType()) return 0; + return static_cast<const QWidget*>(o); +} +#endif + +inline QWidget *QWidget::childAt(int ax, int ay) const +{ return childAt(QPoint(ax, ay)); } + +inline Qt::WindowType QWidget::windowType() const +{ return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); } +inline Qt::WindowFlags QWidget::windowFlags() const +{ return data->window_flags; } + +inline bool QWidget::isTopLevel() const +{ return (windowType() & Qt::Window); } + +inline bool QWidget::isWindow() const +{ return (windowType() & Qt::Window); } + +inline bool QWidget::isEnabled() const +{ return !testAttribute(Qt::WA_Disabled); } + +inline bool QWidget::isModal() const +{ return data->window_modality != Qt::NonModal; } + +inline bool QWidget::isEnabledToTLW() const +{ return isEnabled(); } + +inline int QWidget::minimumWidth() const +{ return minimumSize().width(); } + +inline int QWidget::minimumHeight() const +{ return minimumSize().height(); } + +inline int QWidget::maximumWidth() const +{ return maximumSize().width(); } + +inline int QWidget::maximumHeight() const +{ return maximumSize().height(); } + +inline void QWidget::setMinimumSize(const QSize &s) +{ setMinimumSize(s.width(),s.height()); } + +inline void QWidget::setMaximumSize(const QSize &s) +{ setMaximumSize(s.width(),s.height()); } + +inline void QWidget::setSizeIncrement(const QSize &s) +{ setSizeIncrement(s.width(),s.height()); } + +inline void QWidget::setBaseSize(const QSize &s) +{ setBaseSize(s.width(),s.height()); } + +inline const QFont &QWidget::font() const +{ return data->fnt; } + +inline QFontMetrics QWidget::fontMetrics() const +{ return QFontMetrics(data->fnt); } + +inline QFontInfo QWidget::fontInfo() const +{ return QFontInfo(data->fnt); } + +inline void QWidget::setMouseTracking(bool enable) +{ setAttribute(Qt::WA_MouseTracking, enable); } + +inline bool QWidget::hasMouseTracking() const +{ return testAttribute(Qt::WA_MouseTracking); } + +inline bool QWidget::underMouse() const +{ return testAttribute(Qt::WA_UnderMouse); } + +inline bool QWidget::updatesEnabled() const +{ return !testAttribute(Qt::WA_UpdatesDisabled); } + +inline void QWidget::update(int ax, int ay, int aw, int ah) +{ update(QRect(ax, ay, aw, ah)); } + +inline bool QWidget::isVisible() const +{ return testAttribute(Qt::WA_WState_Visible); } + +inline bool QWidget::isHidden() const +{ return testAttribute(Qt::WA_WState_Hidden); } + +inline void QWidget::move(int ax, int ay) +{ move(QPoint(ax, ay)); } + +inline void QWidget::resize(int w, int h) +{ resize(QSize(w, h)); } + +inline void QWidget::setGeometry(int ax, int ay, int aw, int ah) +{ setGeometry(QRect(ax, ay, aw, ah)); } + +inline QRect QWidget::rect() const +{ return QRect(0,0,data->crect.width(),data->crect.height()); } + +inline const QRect &QWidget::geometry() const +{ return data->crect; } + +inline QSize QWidget::size() const +{ return data->crect.size(); } + +inline int QWidget::width() const +{ return data->crect.width(); } + +inline int QWidget::height() const +{ return data->crect.height(); } + +inline QWidget *QWidget::parentWidget() const +{ return static_cast<QWidget *>(QObject::parent()); } + +inline void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) +{ setSizePolicy(QSizePolicy(hor, ver)); } + +inline bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const +{ + if (attribute < int(8*sizeof(uint))) + return data->widget_attributes & (1<<attribute); + return testAttribute_helper(attribute); +} + +#ifdef QT3_SUPPORT +inline bool QWidget::isVisibleToTLW() const +{ return isVisible(); } +inline QWidget *QWidget::parentWidget(bool sameWindow) const +{ + if (sameWindow && isWindow()) + return 0; + return static_cast<QWidget *>(QObject::parent()); +} +inline QColorGroup QWidget::colorGroup() const +{ return QColorGroup(palette()); } +inline void QWidget::setPaletteForegroundColor(const QColor &c) +{ QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); } +inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); } +inline void QWidget::setBackgroundPixmap(const QPixmap &pm) +{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } +inline const QPixmap *QWidget::backgroundPixmap() const { return 0; } +inline void QWidget::setBackgroundColor(const QColor &c) +{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } +inline const QColor & QWidget::backgroundColor() const { return palette().color(backgroundRole()); } +inline const QColor &QWidget::foregroundColor() const { return palette().color(foregroundRole());} +inline const QColor &QWidget::eraseColor() const { return palette().color(backgroundRole()); } +inline void QWidget::setEraseColor(const QColor &c) +{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } +inline const QPixmap *QWidget::erasePixmap() const { return 0; } +inline void QWidget::setErasePixmap(const QPixmap &pm) +{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } +inline const QColor &QWidget::paletteForegroundColor() const { return palette().color(foregroundRole());} +inline const QColor &QWidget::paletteBackgroundColor() const { return palette().color(backgroundRole()); } +inline void QWidget::setPaletteBackgroundColor(const QColor &c) +{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } +inline const QPixmap *QWidget::paletteBackgroundPixmap() const +{ return 0; } +inline void QWidget::setPaletteBackgroundPixmap(const QPixmap &pm) +{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } +inline QT3_SUPPORT void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); } +inline QT3_SUPPORT void QWidget::erase(const QRect &r) { erase_helper(r.x(), r.y(), r.width(), r.height()); } +#endif + +#define QWIDGETSIZE_MAX ((1<<24)-1) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWIDGET_H diff --git a/qtinterface/qt4/Qt/qwidgetaction.h b/qtinterface/qt4/Qt/qwidgetaction.h new file mode 100644 index 0000000..9d876f6 --- /dev/null +++ b/qtinterface/qt4/Qt/qwidgetaction.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIDGETACTION_H +#define QWIDGETACTION_H + +#include <QtGui/qaction.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_ACTION + +class QWidgetActionPrivate; + +class Q_GUI_EXPORT QWidgetAction : public QAction +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWidgetAction) + +public: + explicit QWidgetAction(QObject *parent); + virtual ~QWidgetAction(); + + void setDefaultWidget(QWidget *w); + QWidget *defaultWidget() const; + + QWidget *requestWidget(QWidget *parent); + void releaseWidget(QWidget *widget); + +protected: + virtual bool event(QEvent *); + virtual bool eventFilter(QObject *, QEvent *); + virtual QWidget *createWidget(QWidget *parent); + virtual void deleteWidget(QWidget *widget); + QList<QWidget *> createdWidgets() const; + +private: + Q_DISABLE_COPY(QWidgetAction) + Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject *)) + friend class QToolBar; +}; + +#endif // QT_NO_ACTION + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWIDGETACTION_H diff --git a/qtinterface/qt4/Qt/qwindowdefs.h b/qtinterface/qt4/Qt/qwindowdefs.h new file mode 100644 index 0000000..1b0542d --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowdefs.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWDEFS_H +#define QWINDOWDEFS_H + +#include <QtCore/qobjectdefs.h> +#include <QtCore/qnamespace.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +// Class forward definitions + +class QPaintDevice; +class QWidget; +class QDialog; +class QColor; +class QPalette; +#ifdef QT3_SUPPORT +class QColorGroup; +#endif +class QCursor; +class QPoint; +class QSize; +class QRect; +class QPolygon; +class QPainter; +class QRegion; +class QFont; +class QFontMetrics; +class QFontInfo; +class QPen; +class QBrush; +class QMatrix; +class QPixmap; +class QBitmap; +class QMovie; +class QImage; +class QPicture; +class QPrinter; +class QTimer; +class QTime; +class QClipboard; +class QString; +class QByteArray; +class QApplication; + +template<typename T> class QList; +typedef QList<QWidget *> QWidgetList; + +QT_END_NAMESPACE +QT_END_HEADER + +// Window system dependent definitions + +#if defined(Q_WS_MAC) && !defined(Q_WS_QWS) + +#include <QtGui/qmacdefines_mac.h> + +#ifdef Q_WS_MAC32 +typedef int WId; +#else +typedef long WId; +#endif + +#endif // Q_WS_MAC + +#if defined(Q_WS_WIN) +#include <QtGui/qwindowdefs_win.h> +#endif // Q_WS_WIN + +#if defined(Q_WS_X11) + +typedef struct _XDisplay Display; +typedef union _XEvent XEvent; +typedef struct _XGC *GC; +typedef struct _XRegion *Region; +typedef unsigned long WId; + +#endif // Q_WS_X11 + +#if defined(Q_WS_QWS) + +typedef unsigned long WId; +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE +struct QWSEvent; +QT_END_NAMESPACE +QT_END_HEADER + +#endif // Q_WS_QWS + +#if defined(Q_OS_SYMBIAN) +class CCoeControl; +typedef CCoeControl * WId; +#endif // Q_OS_SYMBIAN + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +template<class K, class V> class QHash; +typedef QHash<WId, QWidget *> QWidgetMapper; + +template<class V> class QSet; +typedef QSet<QWidget *> QWidgetSet; + +QT_END_NAMESPACE +QT_END_HEADER + +#if defined(QT_NEEDS_QMAIN) +#define main qMain +#endif + +// Global platform-independent types and functions + +#endif // QWINDOWDEFS_H diff --git a/qtinterface/qt4/Qt/qwindowdefs_win.h b/qtinterface/qt4/Qt/qwindowdefs_win.h new file mode 100644 index 0000000..3e3ef16 --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowdefs_win.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWDEFS_WIN_H +#define QWINDOWDEFS_WIN_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +QT_END_NAMESPACE + +#if !defined(Q_NOWINSTRICT) +#define Q_WINSTRICT +#endif + +#if defined(Q_WINSTRICT) + +#if !defined(STRICT) +#define STRICT +#endif +#undef NO_STRICT +#define Q_DECLARE_HANDLE(name) struct name##__; typedef struct name##__ *name + +#else + +#if !defined(NO_STRICT) +#define NO_STRICT +#endif +#undef STRICT +#define Q_DECLARE_HANDLE(name) typedef HANDLE name + +#endif + +#ifndef HINSTANCE +Q_DECLARE_HANDLE(HINSTANCE); +#endif +#ifndef HDC +Q_DECLARE_HANDLE(HDC); +#endif +#ifndef HWND +Q_DECLARE_HANDLE(HWND); +#endif +#ifndef HFONT +Q_DECLARE_HANDLE(HFONT); +#endif +#ifndef HPEN +Q_DECLARE_HANDLE(HPEN); +#endif +#ifndef HBRUSH +Q_DECLARE_HANDLE(HBRUSH); +#endif +#ifndef HBITMAP +Q_DECLARE_HANDLE(HBITMAP); +#endif +#ifndef HICON +Q_DECLARE_HANDLE(HICON); +#endif +#ifndef HCURSOR +typedef HICON HCURSOR; +#endif +#ifndef HPALETTE +Q_DECLARE_HANDLE(HPALETTE); +#endif +#ifndef HRGN +Q_DECLARE_HANDLE(HRGN); +#endif +#ifndef HMONITOR +Q_DECLARE_HANDLE(HMONITOR); +#endif +#ifndef HRESULT +typedef long HRESULT; +#endif + +typedef struct tagMSG MSG; +typedef HWND WId; + + +QT_BEGIN_NAMESPACE + +Q_CORE_EXPORT HINSTANCE qWinAppInst(); +Q_CORE_EXPORT HINSTANCE qWinAppPrevInst(); +Q_CORE_EXPORT int qWinAppCmdShow(); +Q_GUI_EXPORT HDC qt_win_display_dc(); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOWDEFS_WIN_H diff --git a/qtinterface/qt4/Qt/qwindowscestyle.h b/qtinterface/qt4/Qt/qwindowscestyle.h new file mode 100644 index 0000000..3da76ec --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowscestyle.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSCESTYLE_H +#define QWINDOWSCESTYLE_H + +#include <QtGui/qwindowsstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_WINDOWSCE) + +class Q_GUI_EXPORT QWindowsCEStyle : public QWindowsStyle +{ + Q_OBJECT +public: + QWindowsCEStyle(); + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget = 0) const; + + void drawControl(ControlElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const; + + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, + QPainter *painter, const QWidget *widget) const; + + virtual void drawItemText(QPainter *painter, const QRect &rect, + int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget) const; + + SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, + const QPoint &pos, const QWidget *widget = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + void polish(QWidget *widget); + void polish(QPalette &palette); + void polish(QApplication *app); + QPalette standardPalette() const; +}; + +#endif // QT_NO_STYLE_WINDOWSCE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOWSCESTYLE_H diff --git a/qtinterface/qt4/Qt/qwindowsmobilestyle.h b/qtinterface/qt4/Qt/qwindowsmobilestyle.h new file mode 100644 index 0000000..e574291 --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowsmobilestyle.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSMOBILESTYLE_H +#define QWINDOWSMOBILESTYLE_H + +#include <QtGui/qwindowsstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_WINDOWSMOBILE) + +class QWindowsMobileStylePrivate; + +class Q_GUI_EXPORT QWindowsMobileStyle : public QWindowsStyle +{ + Q_OBJECT +public: + QWindowsMobileStyle(); + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget = 0) const; + + void drawControl(ControlElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const; + + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, + QPainter *painter, const QWidget *widget) const; + + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; + + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget) const; + + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, + const QStyleOption *option) const; + + QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option, + const QWidget *widget) const; + + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + void polish(QApplication*); + void unpolish(QApplication*); + void polish(QWidget *widget); + void unpolish(QWidget *widget); + void polish(QPalette &); + + QPalette standardPalette() const; + + bool doubleControls() const; + + void setDoubleControls(bool); + +protected: + QWindowsMobileStyle(QWindowsMobileStylePrivate &dd); + +private: + Q_DECLARE_PRIVATE(QWindowsMobileStyle) +}; + +#endif // QT_NO_STYLE_WINDOWSMOBILE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QWINDOWSMOBILESTYLE_H diff --git a/qtinterface/qt4/Qt/qwindowsstyle.h b/qtinterface/qt4/Qt/qwindowsstyle.h new file mode 100644 index 0000000..1c73aa5 --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowsstyle.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSSTYLE_H +#define QWINDOWSSTYLE_H + +#include <QtGui/qcommonstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_WINDOWS) + +class QWindowsStylePrivate; + +class Q_GUI_EXPORT QWindowsStyle : public QCommonStyle +{ + Q_OBJECT +public: + QWindowsStyle(); + ~QWindowsStyle(); + + void polish(QApplication*); + void unpolish(QApplication*); + + void polish(QWidget*); + void unpolish(QWidget*); + + void polish(QPalette &); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, + const QWidget *w = 0) const; + QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, + const QSize &contentsSize, const QWidget *widget = 0) const; + + int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; + +protected: + bool eventFilter(QObject *o, QEvent *e); + void timerEvent(QTimerEvent *event); + QWindowsStyle(QWindowsStylePrivate &dd); + +private: + Q_DISABLE_COPY(QWindowsStyle) + Q_DECLARE_PRIVATE(QWindowsStyle) + void *reserved; +}; + +#endif // QT_NO_STYLE_WINDOWS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOWSSTYLE_H diff --git a/qtinterface/qt4/Qt/qwindowsvistastyle.h b/qtinterface/qt4/Qt/qwindowsvistastyle.h new file mode 100644 index 0000000..1b05476 --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowsvistastyle.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSVISTASTYLE_H +#define QWINDOWSVISTASTYLE_H + +#include <QtGui/qwindowsxpstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_WINDOWSVISTA) + +class QWindowsVistaStylePrivate; +class Q_GUI_EXPORT QWindowsVistaStyle : public QWindowsXPStyle +{ + Q_OBJECT +public: + QWindowsVistaStyle(); + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *option, + QPainter *painter, const QWidget *widget) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, + QPainter *painter, const QWidget *widget) const; + QSize sizeFromContents(ContentsType type, const QStyleOption *option, + const QSize &size, const QWidget *widget) const; + + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, + SubControl sc, const QWidget *widget) const; + + SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, + const QPoint &pos, const QWidget *widget = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + + void polish(QWidget *widget); + void unpolish(QWidget *widget); + void polish(QPalette &pal); + void polish(QApplication *app); + void unpolish(QApplication *app); + bool event(QEvent *event); + QPalette standardPalette() const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; + +private: + Q_DISABLE_COPY(QWindowsVistaStyle) + Q_DECLARE_PRIVATE(QWindowsVistaStyle) + friend class QStyleFactory; +}; +#endif //QT_NO_STYLE_WINDOWSVISTA + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QWINDOWSVISTASTYLE_H diff --git a/qtinterface/qt4/Qt/qwindowsxpstyle.h b/qtinterface/qt4/Qt/qwindowsxpstyle.h new file mode 100644 index 0000000..a35355c --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowsxpstyle.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSXPSTYLE_H +#define QWINDOWSXPSTYLE_H + +#include <QtGui/qwindowsstyle.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_WINDOWSXP) + +class QWindowsXPStylePrivate; +class Q_GUI_EXPORT QWindowsXPStyle : public QWindowsStyle +{ + Q_OBJECT +public: + QWindowsXPStyle(); + QWindowsXPStyle(QWindowsXPStylePrivate &dd); + ~QWindowsXPStyle(); + + void unpolish(QApplication*); + void polish(QApplication*); + void polish(QWidget*); + void polish(QPalette&); + void unpolish(QWidget*); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *option, QPainter *p, + const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *option, QPainter *p, + const QWidget *wwidget = 0) const; + QRect subElementRect(SubElement r, const QStyleOption *option, const QWidget *widget = 0) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, + const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option, QPainter *p, + const QWidget *widget = 0) const; + QSize sizeFromContents(ContentsType ct, const QStyleOption *option, const QSize &contentsSize, + const QWidget *widget = 0) const; + int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, + const QWidget *widget = 0) const; + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + QPalette standardPalette() const; + QPixmap standardPixmap(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, + const QWidget *widget = 0) const; + +private: + Q_DISABLE_COPY(QWindowsXPStyle) + Q_DECLARE_PRIVATE(QWindowsXPStyle) + friend class QStyleFactory; + void *reserved; +}; + +#endif // QT_NO_STYLE_WINDOWSXP + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOWSXPSTYLE_H diff --git a/qtinterface/qt4/Qt/qwindowsystem_qws.h b/qtinterface/qt4/Qt/qwindowsystem_qws.h new file mode 100644 index 0000000..a81153d --- /dev/null +++ b/qtinterface/qt4/Qt/qwindowsystem_qws.h @@ -0,0 +1,508 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSYSTEM_QWS_H +#define QWINDOWSYSTEM_QWS_H + +#include <QtCore/qbytearray.h> +#include <QtCore/qmap.h> +#include <QtCore/qdatetime.h> +#include <QtCore/qlist.h> + +#include <QtGui/qwsevent_qws.h> +#include <QtGui/qkbd_qws.h> +#include <QtGui/qregion.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +struct QWSWindowPrivate; +class QWSCursor; +class QWSClient; +class QWSRegionManager; +class QBrush; +class QVariant; +class QInputMethodEvent; +class QWSInputMethod; +class QWSBackingStore; +class QWSWindowSurface; + +#ifdef QT3_SUPPORT +class QImage; +class QColor; +#endif + +class QWSInternalWindowInfo +{ +public: + int winid; + unsigned int clientid; + QString name; // Corresponds to QObject name of top-level widget +}; + + +class Q_GUI_EXPORT QWSScreenSaver +{ +public: + virtual ~QWSScreenSaver(); + virtual void restore()=0; + virtual bool save(int level)=0; +}; + + +class Q_GUI_EXPORT QWSWindow +{ + friend class QWSServer; + friend class QWSServerPrivate; + +public: + QWSWindow(int i, QWSClient* client); + ~QWSWindow(); + + int winId() const { return id; } + const QString &name() const { return rgnName; } + const QString &caption() const { return rgnCaption; } + QWSClient* client() const { return c; } + const QRegion &requestedRegion() const { return requested_region; } + QRegion allocatedRegion() const; + QRegion paintedRegion() const; + bool isVisible() const { return !requested_region.isEmpty(); } + bool isPartiallyObscured() const { return requested_region != allocatedRegion(); } + bool isFullyObscured() const { return allocatedRegion().isEmpty(); } + + enum State { NoState, Hidden, Showing, Visible, Hiding, Raising, Lowering, Moving, ChangingGeometry, Destroyed }; + State state() const; + Qt::WindowFlags windowFlags() const; + QRegion dirtyOnScreen() const; + + void raise(); + void lower(); + void show(); + void hide(); + void setActiveWindow(); + + bool isOpaque() const {return opaque && _opacity == 255;} + uint opacity() const { return _opacity; } + + QWSWindowSurface* windowSurface() const { return surface; } + +private: + bool hidden() const { return requested_region.isEmpty(); } + bool forClient(const QWSClient* cl) const { return cl==c; } + + void setName(const QString &n); + void setCaption(const QString &c); + + void focus(bool get); + int focusPriority() const { return last_focus_time; } + void operation(QWSWindowOperationEvent::Operation o); + void shuttingDown() { last_focus_time=0; } + +#ifdef QT_QWS_CLIENTBLIT + QRegion directPaintRegion() const; + inline void setDirectPaintRegion(const QRegion &topmost); +#endif + inline void setAllocatedRegion(const QRegion ®ion); + + void createSurface(const QString &key, const QByteArray &data); + +#ifndef QT_NO_QWSEMBEDWIDGET + void startEmbed(QWSWindow *window); + void stopEmbed(QWSWindow *window); +#endif + +private: + int id; + QString rgnName; + QString rgnCaption; + bool modified; + bool onTop; + QWSClient* c; + QRegion requested_region; + QRegion exposed; + int last_focus_time; + QWSWindowSurface *surface; + uint _opacity; + bool opaque; + QWSWindowPrivate *d; +#ifdef QT3_SUPPORT + inline QT3_SUPPORT QRegion requested() const { return requested_region; } +// inline QT3_SUPPORT QRegion allocation() const { return allocated_region; } +#endif +}; + + +#ifndef QT_NO_SOUND +class QWSSoundServer; +#ifdef QT_USE_OLD_QWS_SOUND +class QWSSoundServerData; + +class Q_GUI_EXPORT QWSSoundServer : public QObject { + Q_OBJECT +public: + QWSSoundServer(QObject* parent); + ~QWSSoundServer(); + void playFile(const QString& filename); +private Q_SLOTS: + void feedDevice(int fd); +private: + QWSSoundServerData* d; +}; +#endif +#endif + + +/********************************************************************* + * + * Class: QWSServer + * + *********************************************************************/ + +class QWSMouseHandler; +struct QWSCommandStruct; +class QWSServerPrivate; +class QWSServer; + +extern Q_GUI_EXPORT QWSServer *qwsServer; + +class Q_GUI_EXPORT QWSServer : public QObject +{ + friend class QCopChannel; + friend class QWSMouseHandler; + friend class QWSWindow; + friend class QWSDisplay; + friend class QWSInputMethod; + Q_OBJECT + Q_DECLARE_PRIVATE(QWSServer) +public: + explicit QWSServer(int flags = 0, QObject *parent=0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QWSServer(int flags, QObject *parent, const char *name); +#endif + ~QWSServer(); + enum ServerFlags { DisableKeyboard = 0x01, + DisableMouse = 0x02 }; + + static void sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, + bool isPress, bool autoRepeat); +#ifndef QT_NO_QWS_KEYBOARD + static void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, + bool isPress, bool autoRepeat); +#endif + + static QWSServer* instance() { return qwsServer; } + +#ifndef QT_NO_QWS_INPUTMETHODS +#ifdef QT3_SUPPORT + enum IMState { IMCompose, IMEnd, IMStart = IMCompose }; +#endif + enum IMMouse { MousePress, MouseRelease, MouseMove, MouseOutside }; //MouseMove reserved but not used + void sendIMEvent(const QInputMethodEvent*); + void sendIMQuery(int property); +#endif + +#ifndef QT_NO_QWS_KEYBOARD + class KeyboardFilter + { + public: + virtual ~KeyboardFilter() {} + virtual bool filter(int unicode, int keycode, int modifiers, + bool isPress, bool autoRepeat)=0; + }; + static void addKeyboardFilter(KeyboardFilter *f); + static void removeKeyboardFilter(); +#endif + +#ifndef QT_NO_QWS_INPUTMETHODS + static void setCurrentInputMethod(QWSInputMethod *im); + static void resetInputMethod(); +#endif + + static void setDefaultMouse(const char *); + static void setDefaultKeyboard(const char *); + static void setMaxWindowRect(const QRect&); + static void sendMouseEvent(const QPoint& pos, int state, int wheel = 0); + + static void setBackground(const QBrush &); +#ifdef QT3_SUPPORT + static QT3_SUPPORT void setDesktopBackground(const QImage &img); + static QT3_SUPPORT void setDesktopBackground(const QColor &); +#endif + static QWSMouseHandler *mouseHandler(); + static const QList<QWSMouseHandler*>& mouseHandlers(); + static void setMouseHandler(QWSMouseHandler*); +#ifndef QT_NO_QWS_KEYBOARD + static QWSKeyboardHandler* keyboardHandler(); + static void setKeyboardHandler(QWSKeyboardHandler* kh); +#endif + QWSWindow *windowAt(const QPoint& pos); + + const QList<QWSWindow*> &clientWindows(); + + void openMouse(); + void closeMouse(); + void suspendMouse(); + void resumeMouse(); +#ifndef QT_NO_QWS_KEYBOARD + void openKeyboard(); + void closeKeyboard(); +#endif + + static void setScreenSaver(QWSScreenSaver*); + static void setScreenSaverIntervals(int* ms); + static void setScreenSaverInterval(int); + static void setScreenSaverBlockLevel(int); + static bool screenSaverActive(); + static void screenSaverActivate(bool); + + // the following are internal. + void refresh(); + void refresh(QRegion &); + + void enablePainting(bool); + static void processEventQueue(); + static QList<QWSInternalWindowInfo*> * windowList(); + + void sendPropertyNotifyEvent(int property, int state); + + static QPoint mousePosition; + + static void startup(int flags); + static void closedown(); + + static void beginDisplayReconfigure(); + static void endDisplayReconfigure(); + +#ifndef QT_NO_QWS_CURSOR + static void setCursorVisible(bool); + static bool isCursorVisible(); +#endif + + const QBrush &backgroundBrush() const; + + enum WindowEvent { Create=0x0001, Destroy=0x0002, Hide=0x0004, Show=0x0008, + Raise=0x0010, Lower=0x0020, Geometry=0x0040, Active = 0x0080, + Name=0x0100 }; + +Q_SIGNALS: + void windowEvent(QWSWindow *w, QWSServer::WindowEvent e); + +#ifndef QT_NO_COP + void newChannel(const QString& channel); + void removedChannel(const QString& channel); + +#endif +#ifndef QT_NO_QWS_INPUTMETHODS + void markedText(const QString &); +#endif + +protected: + void timerEvent(QTimerEvent *e); + +private: + friend class QApplicationPrivate; + void updateWindowRegions() const; + +#ifdef QT3_SUPPORT +#ifndef QT_NO_QWS_KEYBOARD + static inline QT3_SUPPORT void setKeyboardFilter(QWSServer::KeyboardFilter *f) + { if (f) addKeyboardFilter(f); else removeKeyboardFilter(); } +#endif +#endif + +private: +#ifndef QT_NO_QWS_MULTIPROCESS + Q_PRIVATE_SLOT(d_func(), void _q_clientClosed()) + Q_PRIVATE_SLOT(d_func(), void _q_doClient()) + Q_PRIVATE_SLOT(d_func(), void _q_deleteWindowsLater()) +#endif + + Q_PRIVATE_SLOT(d_func(), void _q_screenSaverWake()) + Q_PRIVATE_SLOT(d_func(), void _q_screenSaverSleep()) + Q_PRIVATE_SLOT(d_func(), void _q_screenSaverTimeout()) + +#ifndef QT_NO_QWS_MULTIPROCESS + Q_PRIVATE_SLOT(d_func(), void _q_newConnection()) +#endif +}; + +#ifndef QT_NO_QWS_INPUTMETHODS +class Q_GUI_EXPORT QWSInputMethod : public QObject +{ + Q_OBJECT +public: + QWSInputMethod(); + virtual ~QWSInputMethod(); + + enum UpdateType {Update, FocusIn, FocusOut, Reset, Destroyed}; + + virtual bool filter(int unicode, int keycode, int modifiers, + bool isPress, bool autoRepeat); + + virtual bool filter(const QPoint &, int state, int wheel); + + virtual void reset(); + virtual void updateHandler(int type); + virtual void mouseHandler(int pos, int state); + virtual void queryResponse(int property, const QVariant&); + +protected: + uint setInputResolution(bool isHigh); + uint inputResolutionShift() const; + // needed for required transform + void sendMouseEvent(const QPoint &pos, int state, int wheel); + + void sendEvent(const QInputMethodEvent*); + void sendPreeditString(const QString &preeditString, int cursorPosition, int selectionLength = 0); + void sendCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); + void sendQuery(int property); + +#ifdef QT3_SUPPORT + inline void sendIMEvent(QWSServer::IMState, const QString& txt, int cpos, int selLen = 0); +#endif +private: + bool mIResolution; +}; + +inline void QWSInputMethod::sendEvent(const QInputMethodEvent *ime) +{ + qwsServer->sendIMEvent(ime); +} +#ifdef QT3_SUPPORT +inline void QWSInputMethod::sendIMEvent(QWSServer::IMState state, const QString& txt, int cpos, int selLen) +{ + if (state == QWSServer::IMCompose) sendPreeditString(txt, cpos, selLen); else sendCommitString(txt); +} +#endif + +inline void QWSInputMethod::sendQuery(int property) +{ + qwsServer->sendIMQuery(property); +} + +// mouse events not inline as involve transformations. +#endif // QT_NO_QWS_INPUTMETHODS + + + +/********************************************************************* + * + * Class: QWSClient + * + *********************************************************************/ + +struct QWSMouseEvent; + +typedef QMap<int, QWSCursor*> QWSCursorMap; + +class QWSClientPrivate; +class QWSCommand; +class QWSConvertSelectionCommand; + +class Q_GUI_EXPORT QWSClient : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWSClient) +public: + QWSClient(QObject* parent, QWS_SOCK_BASE *, int id); + ~QWSClient(); + + int socket() const; + + void setIdentity(const QString&); + QString identity() const { return id; } + + void sendEvent(QWSEvent* event); + void sendConnectedEvent(const char *display_spec); + void sendMaxWindowRectEvent(const QRect &rect); + void sendPropertyNotifyEvent(int property, int state); + void sendPropertyReplyEvent(int property, int len, const char *data); + void sendSelectionClearEvent(int windowid); + void sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid); +#ifndef QT_QWS_CLIENTBLIT + void sendRegionEvent(int winid, QRegion rgn, int type); +#else + void sendRegionEvent(int winid, QRegion rgn, int type, int id = 0); +#endif +#ifndef QT_NO_QWSEMBEDWIDGET + void sendEmbedEvent(int winid, QWSEmbedEvent::Type type, + const QRegion ®ion = QRegion()); +#endif + QWSCommand* readMoreCommand(); + + int clientId() const { return cid; } + + QWSCursorMap cursors; // cursors defined by this client +Q_SIGNALS: + void connectionClosed(); + void readyRead(); +private Q_SLOTS: + void closeHandler(); + void errorHandler(); + +private: +#ifndef QT_NO_QWS_MULTIPROCESS + friend class QWSWindow; + void removeUnbufferedSurface(); + void addUnbufferedSurface(); +#endif + +private: + int socketDescriptor; +#ifndef QT_NO_QWS_MULTIPROCESS + QWSSocket *csocket; +#endif + QWSCommand* command; + uint isClosed : 1; + QString id; + int cid; + + friend class QWSServerPrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOWSYSTEM_QWS_H diff --git a/qtinterface/qt4/Qt/qwizard.h b/qtinterface/qt4/Qt/qwizard.h new file mode 100644 index 0000000..1edf669 --- /dev/null +++ b/qtinterface/qt4/Qt/qwizard.h @@ -0,0 +1,263 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIZARD_H +#define QWIZARD_H + +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_WIZARD + +class QAbstractButton; +class QWizardPage; +class QWizardPrivate; + +class Q_GUI_EXPORT QWizard : public QDialog +{ + Q_OBJECT + Q_ENUMS(WizardStyle WizardOption) + Q_FLAGS(WizardOptions) + Q_PROPERTY(WizardStyle wizardStyle READ wizardStyle WRITE setWizardStyle) + Q_PROPERTY(WizardOptions options READ options WRITE setOptions) + Q_PROPERTY(Qt::TextFormat titleFormat READ titleFormat WRITE setTitleFormat) + Q_PROPERTY(Qt::TextFormat subTitleFormat READ subTitleFormat WRITE setSubTitleFormat) + Q_PROPERTY(int startId READ startId WRITE setStartId) + Q_PROPERTY(int currentId READ currentId NOTIFY currentIdChanged) + +public: + enum WizardButton { + BackButton, + NextButton, + CommitButton, + FinishButton, + CancelButton, + HelpButton, + CustomButton1, + CustomButton2, + CustomButton3, + Stretch, + + NoButton = -1, + NStandardButtons = 6, + NButtons = 9 + }; + + enum WizardPixmap { + WatermarkPixmap, + LogoPixmap, + BannerPixmap, + BackgroundPixmap, + NPixmaps + }; + + enum WizardStyle { + ClassicStyle, + ModernStyle, + MacStyle, + AeroStyle, + NStyles + }; + + enum WizardOption { + IndependentPages = 0x00000001, + IgnoreSubTitles = 0x00000002, + ExtendedWatermarkPixmap = 0x00000004, + NoDefaultButton = 0x00000008, + NoBackButtonOnStartPage = 0x00000010, + NoBackButtonOnLastPage = 0x00000020, + DisabledBackButtonOnLastPage = 0x00000040, + HaveNextButtonOnLastPage = 0x00000080, + HaveFinishButtonOnEarlyPages = 0x00000100, + NoCancelButton = 0x00000200, + CancelButtonOnLeft = 0x00000400, + HaveHelpButton = 0x00000800, + HelpButtonOnRight = 0x00001000, + HaveCustomButton1 = 0x00002000, + HaveCustomButton2 = 0x00004000, + HaveCustomButton3 = 0x00008000 + }; + + Q_DECLARE_FLAGS(WizardOptions, WizardOption) + + explicit QWizard(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QWizard(); + + int addPage(QWizardPage *page); + void setPage(int id, QWizardPage *page); + void removePage(int id); + QWizardPage *page(int id) const; + bool hasVisitedPage(int id) const; + QList<int> visitedPages() const; // ### visitedIds()? + QList<int> pageIds() const; + void setStartId(int id); + int startId() const; + QWizardPage *currentPage() const; + int currentId() const; + + virtual bool validateCurrentPage(); + virtual int nextId() const; + + void setField(const QString &name, const QVariant &value); + QVariant field(const QString &name) const; + + void setWizardStyle(WizardStyle style); + WizardStyle wizardStyle() const; + + void setOption(WizardOption option, bool on = true); + bool testOption(WizardOption option) const; + void setOptions(WizardOptions options); + WizardOptions options() const; + + void setButtonText(WizardButton which, const QString &text); + QString buttonText(WizardButton which) const; + void setButtonLayout(const QList<WizardButton> &layout); + void setButton(WizardButton which, QAbstractButton *button); + QAbstractButton *button(WizardButton which) const; + + void setTitleFormat(Qt::TextFormat format); + Qt::TextFormat titleFormat() const; + void setSubTitleFormat(Qt::TextFormat format); + Qt::TextFormat subTitleFormat() const; + void setPixmap(WizardPixmap which, const QPixmap &pixmap); + QPixmap pixmap(WizardPixmap which) const; + + void setDefaultProperty(const char *className, const char *property, + const char *changedSignal); + + void setVisible(bool visible); + QSize sizeHint() const; + +Q_SIGNALS: + void currentIdChanged(int id); + void helpRequested(); + void customButtonClicked(int which); + +public Q_SLOTS: + void back(); + void next(); + void restart(); + +protected: + bool event(QEvent *event); + void resizeEvent(QResizeEvent *event); + void paintEvent(QPaintEvent *event); +#if defined(Q_WS_WIN) + bool winEvent(MSG * message, long * result); +#endif + void done(int result); + virtual void initializePage(int id); + virtual void cleanupPage(int id); + +private: + Q_DISABLE_COPY(QWizard) + Q_DECLARE_PRIVATE(QWizard) + Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked()) + Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates()) + Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *)) + + friend class QWizardPage; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QWizard::WizardOptions) + +class QWizardPagePrivate; + +class Q_GUI_EXPORT QWizardPage : public QWidget +{ + Q_OBJECT + Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(QString subTitle READ subTitle WRITE setSubTitle) + +public: + QWizardPage(QWidget *parent = 0); + + void setTitle(const QString &title); + QString title() const; + void setSubTitle(const QString &subTitle); + QString subTitle() const; + void setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap); + QPixmap pixmap(QWizard::WizardPixmap which) const; + void setFinalPage(bool finalPage); + bool isFinalPage() const; + void setCommitPage(bool commitPage); + bool isCommitPage() const; + void setButtonText(QWizard::WizardButton which, const QString &text); + QString buttonText(QWizard::WizardButton which) const; + + virtual void initializePage(); + virtual void cleanupPage(); + virtual bool validatePage(); + virtual bool isComplete() const; + virtual int nextId() const; + +Q_SIGNALS: + void completeChanged(); + +protected: + void setField(const QString &name, const QVariant &value); + QVariant field(const QString &name) const; + void registerField(const QString &name, QWidget *widget, const char *property = 0, + const char *changedSignal = 0); + QWizard *wizard() const; + +private: + Q_DISABLE_COPY(QWizardPage) + Q_DECLARE_PRIVATE(QWizardPage) + Q_PRIVATE_SLOT(d_func(), void _q_maybeEmitCompleteChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_updateCachedCompleteState()) + + friend class QWizard; + friend class QWizardPrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_WIZARD + +#endif // QWIZARD_H diff --git a/qtinterface/qt4/Qt/qwmatrix.h b/qtinterface/qt4/Qt/qwmatrix.h new file mode 100644 index 0000000..f561a9a --- /dev/null +++ b/qtinterface/qt4/Qt/qwmatrix.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWMATRIX_H +#define QWMATRIX_H + +#include <QtGui/qmatrix.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if defined(QT3_SUPPORT) +typedef QMatrix QWMatrix; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWMATRIX_H diff --git a/qtinterface/qt4/Qt/qworkspace.h b/qtinterface/qt4/Qt/qworkspace.h new file mode 100644 index 0000000..0acc77b --- /dev/null +++ b/qtinterface/qt4/Qt/qworkspace.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWORKSPACE_H +#define QWORKSPACE_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_WORKSPACE + +class QAction; +class QWorkspaceChild; +class QShowEvent; +class QWorkspacePrivate; + +class Q_GUI_EXPORT QWorkspace : public QWidget +{ + Q_OBJECT + Q_PROPERTY(bool scrollBarsEnabled READ scrollBarsEnabled WRITE setScrollBarsEnabled) + Q_PROPERTY(QBrush background READ background WRITE setBackground) + +public: + explicit QWorkspace(QWidget* parent=0); + ~QWorkspace(); + + enum WindowOrder { CreationOrder, StackingOrder }; + + QWidget* activeWindow() const; + QWidgetList windowList(WindowOrder order = CreationOrder) const; + + QWidget * addWindow(QWidget *w, Qt::WindowFlags flags = 0); + + QSize sizeHint() const; + + bool scrollBarsEnabled() const; + void setScrollBarsEnabled(bool enable); + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QWorkspace(QWidget* parent, const char* name); + QT3_SUPPORT void setPaletteBackgroundColor(const QColor &); + QT3_SUPPORT void setPaletteBackgroundPixmap(const QPixmap &); +#endif + + void setBackground(const QBrush &background); + QBrush background() const; + +Q_SIGNALS: + void windowActivated(QWidget* w); + +public Q_SLOTS: + void setActiveWindow(QWidget *w); + void cascade(); + void tile(); + void arrangeIcons(); + void closeActiveWindow(); + void closeAllWindows(); + void activateNextWindow(); + void activatePreviousWindow(); + +protected: + bool event(QEvent *e); + void paintEvent(QPaintEvent *e); + void changeEvent(QEvent *); + void childEvent(QChildEvent *); + void resizeEvent(QResizeEvent *); + bool eventFilter(QObject *, QEvent *); + void showEvent(QShowEvent *e); + void hideEvent(QHideEvent *e); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *e); +#endif + +private: + Q_DECLARE_PRIVATE(QWorkspace) + Q_DISABLE_COPY(QWorkspace) + Q_PRIVATE_SLOT(d_func(), void _q_normalizeActiveWindow()) + Q_PRIVATE_SLOT(d_func(), void _q_minimizeActiveWindow()) + Q_PRIVATE_SLOT(d_func(), void _q_showOperationMenu()) + Q_PRIVATE_SLOT(d_func(), void _q_popupOperationMenu(const QPoint&)) + Q_PRIVATE_SLOT(d_func(), void _q_operationMenuActivated(QAction *)) + Q_PRIVATE_SLOT(d_func(), void _q_updateActions()) + Q_PRIVATE_SLOT(d_func(), void _q_scrollBarChanged()) + + friend class QWorkspaceChild; +}; + +#endif // QT_NO_WORKSPACE + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWORKSPACE_H diff --git a/qtinterface/qt4/Qt/qwscursor_qws.h b/qtinterface/qt4/Qt/qwscursor_qws.h new file mode 100644 index 0000000..76bca1e --- /dev/null +++ b/qtinterface/qt4/Qt/qwscursor_qws.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSCURSOR_QWS_H +#define QWSCURSOR_QWS_H + +#include <QtGui/qimage.h> +#include <QtGui/qregion.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWSCursor +{ +public: + QWSCursor() {} + QWSCursor(const uchar *data, const uchar *mask, int width, int height, + int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + + void set(const uchar *data, const uchar *mask, + int width, int height, int hotX, int hotY); + + QPoint hotSpot() const { return hot; } + QImage &image() { return cursor; } + + static QWSCursor *systemCursor(int id); + +private: + static void createSystemCursor(int id); + void createDropShadow(int dropx, int dropy); + +private: + QPoint hot; + QImage cursor; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSCURSOR_QWS_H diff --git a/qtinterface/qt4/Qt/qwsdisplay_qws.h b/qtinterface/qt4/Qt/qwsdisplay_qws.h new file mode 100644 index 0000000..ca64766 --- /dev/null +++ b/qtinterface/qt4/Qt/qwsdisplay_qws.h @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSDISPLAY_QWS_H +#define QWSDISPLAY_QWS_H + +#include <QtCore/qobject.h> +#include <QtCore/qbytearray.h> +#include <QtGui/qregion.h> +#include <QtGui/qimage.h> +#include <QtGui/qwindowdefs.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWSEvent; +class QWSMouseEvent; +class QWSQCopMessageEvent; +class QVariant; +class QLock; + +class QWSWindowInfo +{ + +public: + + int winid; + unsigned int clientid; + QString name; + +}; + +#define QT_QWS_PROPERTY_CONVERTSELECTION 999 +#define QT_QWS_PROPERTY_WINDOWNAME 998 +#define QT_QWS_PROPERTY_MARKEDTEXT 997 + +class QWSDisplay; +extern Q_GUI_EXPORT QWSDisplay *qt_fbdpy; + +class Q_GUI_EXPORT QWSDisplay +{ +public: + QWSDisplay(); + ~QWSDisplay(); + + static QWSDisplay* instance() { return qt_fbdpy; } + + bool eventPending() const; + QWSEvent *getEvent(); +// QWSRegionManager *regionManager() const; + + uchar* frameBuffer() const; + int width() const; + int height() const; + int depth() const; + int pixmapDepth() const; + bool supportsDepth(int) const; + + uchar *sharedRam() const; + int sharedRamSize() const; + +#ifndef QT_NO_QWS_PROPERTIES + void addProperty(int winId, int property); + void setProperty(int winId, int property, int mode, const QByteArray &data); + void setProperty(int winId, int property, int mode, const char * data); + void removeProperty(int winId, int property); + bool getProperty(int winId, int property, char *&data, int &len); +#endif // QT_NO_QWS_PROPERTIES + + QList<QWSWindowInfo> windowList(); + int windowAt(const QPoint &); + + void setIdentity(const QString &appName); + void nameRegion(int winId, const QString& n, const QString &c); + void requestRegion(int winId, const QString &surfacekey, + const QByteArray &surfaceData, + const QRegion ®ion); + void repaintRegion(int winId, int windowFlags, bool opaque, QRegion); + void moveRegion(int winId, int dx, int dy); + void destroyRegion(int winId); + void requestFocus(int winId, bool get); + void setAltitude(int winId, int altitude, bool fixed = false); + void setOpacity(int winId, int opacity); + int takeId(); + void setSelectionOwner(int winId, const QTime &time); + void convertSelection(int winId, int selectionProperty, const QString &mimeTypes); + void defineCursor(int id, const QBitmap &curs, const QBitmap &mask, + int hotX, int hotY); + void destroyCursor(int id); + void selectCursor(QWidget *w, unsigned int id); + void setCursorPosition(int x, int y); + void grabMouse(QWidget *w, bool grab); + void grabKeyboard(QWidget *w, bool grab); + void playSoundFile(const QString&); + void registerChannel(const QString &channel); + void sendMessage(const QString &channel, const QString &msg, + const QByteArray &data); + void flushCommands(); +#ifndef QT_NO_QWS_INPUTMETHODS + void sendIMUpdate(int type, int winId, int widgetid); + void resetIM(); + void sendIMResponse(int winId, int property, const QVariant &result); + void sendIMMouseEvent(int index, bool isPress); +#endif + QWSQCopMessageEvent* waitForQCopResponse(); + void sendFontCommand(int type, const QByteArray &fontName); + + void setWindowCaption(QWidget *w, const QString &); + + // Lock display for access only by this process + static bool initLock(const QString &filename, bool create = false); + static bool grabbed(); + static void grab(); + static void grab(bool write); + static void ungrab(); + + static void setTransformation(int transformation, int screenNo = -1); + static void setRawMouseEventFilter(void (*filter)(QWSMouseEvent *)); + +private: + friend int qt_fork_qapplication(); + friend void qt_app_reinit( const QString& newAppName ); + friend class QApplication; + friend class QCopChannel; + friend class QWSEmbedWidget; + friend class QWSEmbedWidgetPrivate; + class Data; + friend class Data; + Data *d; + + friend class QWSMemorySurface; + friend class QWSOnScreenSurface; + friend class QWSDirectPainterSurface; + int getPropertyLen; + char *getPropertyData; + static QLock *lock; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSDISPLAY_QWS_H diff --git a/qtinterface/qt4/Qt/qwsembedwidget.h b/qtinterface/qt4/Qt/qwsembedwidget.h new file mode 100644 index 0000000..2f52004 --- /dev/null +++ b/qtinterface/qt4/Qt/qwsembedwidget.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSEMBEDWIDGET_H +#define QWSEMBEDWIDGET_H + +#include <QtGui/qwidget.h> + +#ifndef QT_NO_QWSEMBEDWIDGET + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWSEmbedWidgetPrivate; + +class Q_GUI_EXPORT QWSEmbedWidget : public QWidget +{ + Q_OBJECT + +public: + QWSEmbedWidget(WId winId, QWidget *parent = 0); + ~QWSEmbedWidget(); + +protected: + bool eventFilter(QObject *object, QEvent *event); + void changeEvent(QEvent *event); + void resizeEvent(QResizeEvent *event); + void moveEvent(QMoveEvent *event); + void hideEvent(QHideEvent *event); + void showEvent(QShowEvent *event); + +private: + Q_DECLARE_PRIVATE(QWSEmbedWidget) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_QWSEMBEDWIDGET +#endif // QWSEMBEDWIDGET_H diff --git a/qtinterface/qt4/Qt/qwsevent_qws.h b/qtinterface/qt4/Qt/qwsevent_qws.h new file mode 100644 index 0000000..5e7185f --- /dev/null +++ b/qtinterface/qt4/Qt/qwsevent_qws.h @@ -0,0 +1,459 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSEVENT_QWS_H +#define QWSEVENT_QWS_H + +#include <QtGui/qwsutils_qws.h> +#include <QtGui/qwsprotocolitem_qws.h> +#include <QtCore/qrect.h> +#include <QtGui/qregion.h> +#include <QtCore/qvector.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +struct QWSMouseEvent; + +struct QWSEvent : QWSProtocolItem { + + QWSEvent(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {} + + + + enum Type { + NoEvent, + Connected, + Mouse, + Focus, + Key, + Region, + Creation, + PropertyNotify, + PropertyReply, + SelectionClear, + SelectionRequest, + SelectionNotify, + MaxWindowRect, + QCopMessage, + WindowOperation, + IMEvent, + IMQuery, + IMInit, + Embed, + Font, + ScreenTransformation, + NEvent + }; + + QWSMouseEvent *asMouse() + { return type == Mouse ? reinterpret_cast<QWSMouseEvent*>(this) : 0; } + int window() { return *(reinterpret_cast<int*>(simpleDataPtr)); } + int window() const { return *(reinterpret_cast<int*>(simpleDataPtr)); } + static QWSEvent *factory(int type); +}; + + +//All events must start with windowID + +struct QWSConnectedEvent : QWSEvent { + QWSConnectedEvent() + : QWSEvent(QWSEvent::Connected, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + display = reinterpret_cast<char*>(rawDataPtr); + } + + struct SimpleData { + int window; + int len; + int clientId; + int servershmid; + } simpleData; + + char *display; +}; + +struct QWSMaxWindowRectEvent : QWSEvent { + QWSMaxWindowRectEvent() + : QWSEvent(MaxWindowRect, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { } + struct SimpleData { + int window; + QRect rect; + } simpleData; +}; + +struct QWSMouseEvent : QWSEvent { + QWSMouseEvent() + : QWSEvent(QWSEvent::Mouse, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + struct SimpleData { + int window; + int x_root, y_root, state, delta; + int time; // milliseconds + } simpleData; +}; + +struct QWSFocusEvent : QWSEvent { + QWSFocusEvent() + : QWSEvent(QWSEvent::Focus, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) + { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); } + struct SimpleData { + int window; + uint get_focus:1; + } simpleData; +}; + +struct QWSKeyEvent: QWSEvent { + QWSKeyEvent() + : QWSEvent(QWSEvent::Key, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + struct SimpleData { + int window; + uint keycode; + Qt::KeyboardModifiers modifiers; + ushort unicode; + uint is_press:1; + uint is_auto_repeat:1; + } simpleData; +}; + + +struct QWSCreationEvent : QWSEvent { + QWSCreationEvent() + : QWSEvent(QWSEvent::Creation, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + struct SimpleData { + int objectid; + int count; + } simpleData; +}; + +#ifndef QT_NO_QWS_PROPERTIES +struct QWSPropertyNotifyEvent : QWSEvent { + QWSPropertyNotifyEvent() + : QWSEvent(QWSEvent::PropertyNotify, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + enum State { + PropertyNewValue, + PropertyDeleted + }; + struct SimpleData { + int window; + int property; + int state; + } simpleData; +}; +#endif + +struct QWSSelectionClearEvent : QWSEvent { + QWSSelectionClearEvent() + : QWSEvent(QWSEvent::SelectionClear, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + struct SimpleData { + int window; + } simpleData; +}; + +struct QWSSelectionRequestEvent : QWSEvent { + QWSSelectionRequestEvent() + : QWSEvent(QWSEvent::SelectionRequest, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + struct SimpleData { + int window; + int requestor; // window which wants the selection + int property; // property on requestor into which the selection should be stored, normally QWSProperty::PropSelection + int mimeTypes; // Value is stored in the property mimeType on the requestor window. This value may contain + // multiple mimeTypes separated by ;; where the order reflects the priority + } simpleData; +}; + +struct QWSSelectionNotifyEvent : QWSEvent { + QWSSelectionNotifyEvent() + : QWSEvent(QWSEvent::SelectionNotify, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + struct SimpleData { + int window; + int requestor; // the window which wanted the selection and to which this event is sent + int property; // property of requestor in which the data of the selection is stored + int mimeType; // a property on the requestor in which the mime type in which the selection is, is stored + } simpleData; +}; + +//complex events: + +struct QWSRegionEvent : QWSEvent { + QWSRegionEvent() + : QWSEvent(QWSEvent::Region, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) + { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); } + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + rectangles = reinterpret_cast<QRect*>(rawDataPtr); + } + + void setData(int winId, const QRegion ®ion, uint type) { + const QVector<QRect> rects = region.rects(); + setData(reinterpret_cast<const char*>(rects.constData()), + rects.size() * sizeof(QRect)); + simpleData.window = winId; + simpleData.nrectangles = rects.size(); + simpleData.type = type; +#ifdef QT_QWS_CLIENTBLIT + simpleData.id = 0; +#endif + } + + enum Type {Allocation +#ifdef QT_QWS_CLIENTBLIT + , DirectPaint +#endif + }; + struct SimpleData { + int window; + int nrectangles; +#ifdef QT_QWS_CLIENTBLIT + int id; +#endif + uint type:8; + } simpleData; + + QRect *rectangles; +}; + +#ifndef QT_NO_QWSEMBEDWIDGET +struct QWSEmbedEvent : QWSEvent +{ + QWSEmbedEvent() : QWSEvent(QWSEvent::Embed, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) + {} + + enum Type { StartEmbed = 1, StopEmbed = 2, Region = 4 }; + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + region.setRects(reinterpret_cast<const QRect *>(rawDataPtr), + simpleData.nrectangles); + } + + void setData(int winId, Type type, const QRegion ® = QRegion()) { + simpleData.window = winId; + simpleData.nrectangles = reg.rects().size(); + simpleData.type = type; + region = reg; + const QVector<QRect> rects = reg.rects(); + QWSEvent::setData(reinterpret_cast<const char*>(rects.data()), + rects.size() * sizeof(QRect)); + } + + struct SimpleData { + int window; + int nrectangles; + Type type; + } simpleData; + + QRegion region; +}; +#endif // QT_NO_QWSEMBEDWIDGET + +#ifndef QT_NO_QWS_PROPERTIES +struct QWSPropertyReplyEvent : QWSEvent { + QWSPropertyReplyEvent() + : QWSEvent(QWSEvent::PropertyReply, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + data = reinterpret_cast<char*>(rawDataPtr); + } + + struct SimpleData { + int window; + int property; + int len; + } simpleData; + char *data; +}; +#endif //QT_NO_QWS_PROPERTIES + +#ifndef QT_NO_COP +struct QWSQCopMessageEvent : QWSEvent { + QWSQCopMessageEvent() + : QWSEvent(QWSEvent::QCopMessage, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) + { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); } + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + char* p = rawDataPtr; + channel = QByteArray(p, simpleData.lchannel); + p += simpleData.lchannel; + message = QByteArray(p, simpleData.lmessage); + p += simpleData.lmessage; + data = QByteArray(p, simpleData.ldata); + } + + void setDataDirect(const char *d, int len) { + QWSEvent::setData(d, len, false); + deleteRaw = true; + } + + struct SimpleData { + bool is_response; + int lchannel; + int lmessage; + int ldata; + } simpleData; + + QByteArray channel; + QByteArray message; + QByteArray data; +}; + +#endif + +struct QWSWindowOperationEvent : QWSEvent { + QWSWindowOperationEvent() + : QWSEvent(WindowOperation, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { } + + enum Operation { Show, Hide, ShowMaximized, ShowNormal, ShowMinimized, Close }; + struct SimpleData { + int window; + Operation op; + } simpleData; +}; + +#ifndef QT_NO_QWS_INPUTMETHODS + + +struct QWSIMEvent : QWSEvent { + QWSIMEvent() + : QWSEvent(IMEvent, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) + { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); } + + struct SimpleData { + int window; + int replaceFrom; + int replaceLength; + } simpleData; + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + streamingData = QByteArray::fromRawData(rawDataPtr, len); + } + QByteArray streamingData; +}; + + +struct QWSIMInitEvent : QWSEvent { + QWSIMInitEvent() + : QWSEvent(IMInit, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) + { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); } + + struct SimpleData { + int window; + int existence; + } simpleData; + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + streamingData = QByteArray::fromRawData(rawDataPtr, len); + } + QByteArray streamingData; +}; + + +struct QWSIMQueryEvent : QWSEvent { + QWSIMQueryEvent() + : QWSEvent(QWSEvent::IMQuery, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + + struct SimpleData { + int window; + int property; + } simpleData; + +}; + +#endif + +struct QWSFontEvent : QWSEvent { + QWSFontEvent() + : QWSEvent(QWSEvent::Font, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + + enum EventType { + FontRemoved + }; + + void setData(const char *d, int len, bool allocateMem = true) { + QWSEvent::setData(d, len, allocateMem); + fontName = QByteArray::fromRawData(rawDataPtr, len); + } + + struct SimpleData { + uchar type; + } simpleData; + QByteArray fontName; +}; + +struct QWSScreenTransformationEvent : QWSEvent { + QWSScreenTransformationEvent() + : QWSEvent(QWSEvent::ScreenTransformation, sizeof(simpleData), + reinterpret_cast<char*>(&simpleData)) {} + + struct SimpleData { + int screen; + int transformation; + } simpleData; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSEVENT_QWS_H diff --git a/qtinterface/qt4/Qt/qwsmanager_qws.h b/qtinterface/qt4/Qt/qwsmanager_qws.h new file mode 100644 index 0000000..9c4fe25 --- /dev/null +++ b/qtinterface/qt4/Qt/qwsmanager_qws.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSMANAGER_QWS_H +#define QWSMANAGER_QWS_H + +#include <QtGui/qpixmap.h> +#include <QtCore/qobject.h> +#include <QtGui/qdecoration_qws.h> +#include <QtGui/qevent.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_MANAGER + +class QAction; +class QPixmap; +class QWidget; +class QPopupMenu; +class QRegion; +class QMouseEvent; +class QWSManagerPrivate; + +class Q_GUI_EXPORT QWSManager : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWSManager) +public: + explicit QWSManager(QWidget *); + ~QWSManager(); + + static QDecoration *newDefaultDecoration(); + + QWidget *widget(); + static QWidget *grabbedMouse(); + void maximize(); + void startMove(); + void startResize(); + + QRegion region(); + QRegion &cachedRegion(); + +protected Q_SLOTS: + void menuTriggered(QAction *action); + +protected: + void handleMove(QPoint g); + + virtual bool event(QEvent *e); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void paintEvent(QPaintEvent *); + bool repaintRegion(int region, QDecoration::DecorationState state); + + void menu(const QPoint &); + +private: + friend class QWidget; + friend class QETWidget; + friend class QWidgetPrivate; + friend class QApplication; + friend class QApplicationPrivate; + friend class QWidgetBackingStore; + friend class QWSWindowSurface; + friend class QGLDrawable; +}; + +QT_BEGIN_INCLUDE_NAMESPACE +#include <QtGui/qdecorationdefault_qws.h> +QT_END_INCLUDE_NAMESPACE + +#endif // QT_NO_QWS_MANAGER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSMANAGER_QWS_H diff --git a/qtinterface/qt4/Qt/qwsproperty_qws.h b/qtinterface/qt4/Qt/qwsproperty_qws.h new file mode 100644 index 0000000..c11077f --- /dev/null +++ b/qtinterface/qt4/Qt/qwsproperty_qws.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSPROPERTY_QWS_H +#define QWSPROPERTY_QWS_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +/********************************************************************* + * + * Class: QWSPropertyManager + * + *********************************************************************/ + +#ifndef QT_NO_QWS_PROPERTIES + +class QWSPropertyManager +{ +public: + enum Mode { + PropReplace = 0, + PropPrepend, + PropAppend + }; + + // pre-defined properties + enum Atom { + PropSelection = 0 + }; + + QWSPropertyManager(); + ~QWSPropertyManager(); + + bool setProperty(int winId, int property, int mode, const char *data, int len); + bool hasProperty(int winId, int property); + bool removeProperty(int winId, int property); + bool addProperty(int winId, int property); + bool getProperty(int winId, int property, const char *&data, int &len); + bool removeProperties(int winId); + +private: + class Data; + Data* d; +}; + +#endif // QT_NO_QWS_PROPERTIES + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSPROPERTY_QWS_H diff --git a/qtinterface/qt4/Qt/qwsprotocolitem_qws.h b/qtinterface/qt4/Qt/qwsprotocolitem_qws.h new file mode 100644 index 0000000..f3b8eda --- /dev/null +++ b/qtinterface/qt4/Qt/qwsprotocolitem_qws.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSPROTOCOLITEM_QWS_H +#define QWSPROTOCOLITEM_QWS_H + +/********************************************************************* + * + * QWSCommand base class - only use derived classes from that + * + *********************************************************************/ + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIODevice; + +struct QWSProtocolItem +{ + // ctor - dtor + QWSProtocolItem(int t, int len, char *ptr) : type(t), + simpleLen(len), rawLen(-1), deleteRaw(false), simpleDataPtr(ptr), + rawDataPtr(0), bytesRead(0) { } + virtual ~QWSProtocolItem(); + + // data + int type; + int simpleLen; + int rawLen; + bool deleteRaw; + + // functions +#ifndef QT_NO_QWS_MULTIPROCESS + void write(QIODevice *s); + bool read(QIODevice *s); +#endif + void copyFrom(const QWSProtocolItem *item); + + virtual void setData(const char *data, int len, bool allocateMem = true); + + char *simpleDataPtr; + char *rawDataPtr; + // temp variables + int bytesRead; +}; + +// This should probably be a method on QWSProtocolItem, but this way avoids +// changing the API of this apparently public header +// size = (int)type + (int)rawLenSize + simpleLen + rawLen +#define QWS_PROTOCOL_ITEM_SIZE( item ) \ + (2 * sizeof(int)) + ((item).simpleDataPtr ? (item).simpleLen : 0) + ((item).rawDataPtr ? (item).rawLen : 0) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSPROTOCOLITEM_QWS_H diff --git a/qtinterface/qt4/Qt/qwssocket_qws.h b/qtinterface/qt4/Qt/qwssocket_qws.h new file mode 100644 index 0000000..1676f01 --- /dev/null +++ b/qtinterface/qt4/Qt/qwssocket_qws.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSSOCKET_QWS_H +#define QWSSOCKET_QWS_H + +#include <QtCore/qconfig.h> +#include <QtGui/qwsutils_qws.h> + +#ifndef QT_NO_QWS_MULTIPROCESS + +#ifndef QT_NO_SXE +#include <QtCore/qmutex.h> +#include <QtGui/private/qunixsocketserver_p.h> +#include <QtGui/private/qunixsocket_p.h> +#else +#include <QtNetwork/qtcpsocket.h> +#include <QtNetwork/qtcpserver.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + + +class QWSSocket : public QWS_SOCK_BASE +{ + Q_OBJECT +public: + explicit QWSSocket(QObject *parent=0); + ~QWSSocket(); + + bool connectToLocalFile(const QString &file); + +#ifndef QT_NO_SXE + QString errorString(); +Q_SIGNALS: + void connected(); + void disconnected(); + void error(QAbstractSocket::SocketError); +private Q_SLOTS: + void forwardStateChange(SocketState); +#endif + +private: + Q_DISABLE_COPY(QWSSocket) +}; + + +class QWSServerSocket : public QWS_SOCK_SERVER_BASE +{ + Q_OBJECT +public: + QWSServerSocket(const QString& file, QObject *parent=0); + ~QWSServerSocket(); + +#ifndef QT_NO_SXE + QWSSocket *nextPendingConnection(); +Q_SIGNALS: + void newConnection(); +protected: + void incomingConnection(int socketDescriptor); +private: + QMutex ssmx; + QList<int> inboundConnections; +#endif + +private: + Q_DISABLE_COPY(QWSServerSocket) + + void init(const QString &file); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_QWS_MULTIPROCESS + +#endif // QWSSOCKET_QWS_H diff --git a/qtinterface/qt4/Qt/qwsutils_qws.h b/qtinterface/qt4/Qt/qwsutils_qws.h new file mode 100644 index 0000000..02be510 --- /dev/null +++ b/qtinterface/qt4/Qt/qwsutils_qws.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWSUTILS_QWS_H +#define QWSUTILS_QWS_H + +#include <QtCore/QIODevice> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_SXE +#define QWS_SOCK_BASE QUnixSocket +#define QWS_SOCK_SERVER_BASE QUnixSocketServer +class QUnixSocket; +class QUnixSocketServer; +#else +#define QWS_SOCK_BASE QTcpSocket +#define QWS_SOCK_SERVER_BASE QTcpServer +class QTcpSocket; +class QTcpServer; +#endif +class QWSSocket; +class QWSServerSocket; + +/******************************************************************** + * + * Convenient socket functions + * + ********************************************************************/ +#ifndef QT_NO_QWS_MULTIPROCESS +inline int qws_read_uint(QIODevice *socket) +{ + if (!socket || socket->bytesAvailable() < (int)sizeof(int)) + return -1; + + int i; + socket->read(reinterpret_cast<char*>(&i), sizeof(i)); + + return i; +} + +inline void qws_write_uint(QIODevice *socket, int i) +{ + if (!socket) + return; + + socket->write(reinterpret_cast<char*>(&i), sizeof(i)); +} + +#endif // QT_NO_QWS_MULTIPROCESS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWSUTILS_QWS_H diff --git a/qtinterface/qt4/Qt/qx11embed_x11.h b/qtinterface/qt4/Qt/qx11embed_x11.h new file mode 100644 index 0000000..f9f4400 --- /dev/null +++ b/qtinterface/qt4/Qt/qx11embed_x11.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QX11EMBED_X11_H +#define QX11EMBED_X11_H + +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QX11EmbedWidgetPrivate; +class Q_GUI_EXPORT QX11EmbedWidget : public QWidget +{ + Q_OBJECT +public: + QX11EmbedWidget(QWidget *parent = 0); + ~QX11EmbedWidget(); + + void embedInto(WId id); + WId containerWinId() const; + + enum Error { + Unknown, + Internal, + InvalidWindowID + }; + Error error() const; + +Q_SIGNALS: + void embedded(); + void containerClosed(); + void error(QX11EmbedWidget::Error error); + +protected: + bool x11Event(XEvent *); + bool eventFilter(QObject *, QEvent *); + bool event(QEvent *); + void resizeEvent(QResizeEvent *); + +private: + Q_DECLARE_PRIVATE(QX11EmbedWidget) + Q_DISABLE_COPY(QX11EmbedWidget) +}; + +class QX11EmbedContainerPrivate; +class Q_GUI_EXPORT QX11EmbedContainer : public QWidget +{ + Q_OBJECT +public: + QX11EmbedContainer(QWidget *parent = 0); + ~QX11EmbedContainer(); + + void embedClient(WId id); + void discardClient(); + + WId clientWinId() const; + + QSize minimumSizeHint() const; + + enum Error { + Unknown, + Internal, + InvalidWindowID + }; + Error error() const; + +Q_SIGNALS: + void clientIsEmbedded(); + void clientClosed(); + void error(QX11EmbedContainer::Error); + +protected: + bool x11Event(XEvent *); + bool eventFilter(QObject *, QEvent *); + void paintEvent(QPaintEvent *e); + void resizeEvent(QResizeEvent *); + void showEvent(QShowEvent *); + void hideEvent(QHideEvent *); + bool event(QEvent *); + +private: + Q_DECLARE_PRIVATE(QX11EmbedContainer) + Q_DISABLE_COPY(QX11EmbedContainer) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QX11EMBED_X11_H diff --git a/qtinterface/qt4/Qt/qx11info_x11.h b/qtinterface/qt4/Qt/qx11info_x11.h new file mode 100644 index 0000000..8761a12 --- /dev/null +++ b/qtinterface/qt4/Qt/qx11info_x11.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QX11INFO_X11_H +#define QX11INFO_X11_H + +#include <QtCore/qnamespace.h> + +typedef struct _XDisplay Display; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +struct QX11InfoData; +class QX11Info; +class QPaintDevice; +class QApplicationPrivate; +class QX11InfoPrivate; +struct QX11WindowAttributes; + +void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a); +class Q_GUI_EXPORT QX11Info +{ +public: + QX11Info(); + ~QX11Info(); + QX11Info(const QX11Info &other); + QX11Info &operator=(const QX11Info &other); + + static Display *display(); + static const char *appClass(); + int screen() const; + int depth() const; + int cells() const; + Qt::HANDLE colormap() const; + bool defaultColormap() const; + void *visual() const; + bool defaultVisual() const; + + static int appScreen(); + static int appDepth(int screen = -1); + static int appCells(int screen = -1); + static Qt::HANDLE appColormap(int screen = -1); + static void *appVisual(int screen = -1); + static Qt::HANDLE appRootWindow(int screen = -1); + static bool appDefaultColormap(int screen = -1); + static bool appDefaultVisual(int screen = -1); + static int appDpiX(int screen = -1); + static int appDpiY(int screen = -1); + static void setAppDpiX(int screen, int dpi); + static void setAppDpiY(int screen, int dpi); + static unsigned long appTime(); + static unsigned long appUserTime(); + static void setAppTime(unsigned long time); + static void setAppUserTime(unsigned long time); + static bool isCompositingManagerRunning(); + +protected: + void copyX11Data(const QPaintDevice *); + void cloneX11Data(const QPaintDevice *); + void setX11Data(const QX11InfoData *); + QX11InfoData* getX11Data(bool def = false) const; + + QX11InfoData *x11data; + + friend class QX11PaintEngine; + friend class QPixmap; + friend class QX11PixmapData; + friend class QWidget; + friend class QWidgetPrivate; + friend class QGLWidget; + friend void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual, + Qt::HANDLE colormap); + friend void qt_cleanup(); + friend void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QX11INFO_X11_H diff --git a/qtinterface/qt4/Qt/qxml.h b/qtinterface/qt4/Qt/qxml.h new file mode 100644 index 0000000..f8da87e --- /dev/null +++ b/qtinterface/qt4/Qt/qxml.h @@ -0,0 +1,427 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXML_H +#define QXML_H + +#include <QtCore/qtextstream.h> +#include <QtCore/qfile.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qlist.h> +#include <QtCore/qscopedpointer.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Xml) + +class QXmlNamespaceSupport; +class QXmlAttributes; +class QXmlContentHandler; +class QXmlDefaultHandler; +class QXmlDTDHandler; +class QXmlEntityResolver; +class QXmlErrorHandler; +class QXmlLexicalHandler; +class QXmlDeclHandler; +class QXmlInputSource; +class QXmlLocator; +class QXmlNamespaceSupport; +class QXmlParseException; + +class QXmlReader; +class QXmlSimpleReader; + +class QXmlSimpleReaderPrivate; +class QXmlNamespaceSupportPrivate; +class QXmlAttributesPrivate; +class QXmlInputSourcePrivate; +class QXmlParseExceptionPrivate; +class QXmlLocatorPrivate; +class QXmlDefaultHandlerPrivate; + + +// +// SAX Namespace Support +// + +class Q_XML_EXPORT QXmlNamespaceSupport +{ +public: + QXmlNamespaceSupport(); + ~QXmlNamespaceSupport(); + + void setPrefix(const QString&, const QString&); + + QString prefix(const QString&) const; + QString uri(const QString&) const; + void splitName(const QString&, QString&, QString&) const; + void processName(const QString&, bool, QString&, QString&) const; + QStringList prefixes() const; + QStringList prefixes(const QString&) const; + + void pushContext(); + void popContext(); + void reset(); + +private: + QXmlNamespaceSupportPrivate *d; + + friend class QXmlSimpleReaderPrivate; + Q_DISABLE_COPY(QXmlNamespaceSupport) +}; + + +// +// SAX Attributes +// + +class Q_XML_EXPORT QXmlAttributes +{ +public: + QXmlAttributes() {} + virtual ~QXmlAttributes() {} + + int index(const QString& qName) const; + int index(const QLatin1String& qName) const; + int index(const QString& uri, const QString& localPart) const; + int length() const; + int count() const; + QString localName(int index) const; + QString qName(int index) const; + QString uri(int index) const; + QString type(int index) const; + QString type(const QString& qName) const; + QString type(const QString& uri, const QString& localName) const; + QString value(int index) const; + QString value(const QString& qName) const; + QString value(const QLatin1String& qName) const; + QString value(const QString& uri, const QString& localName) const; + + void clear(); + void append(const QString &qName, const QString &uri, const QString &localPart, const QString &value); + +private: + struct Attribute { + QString qname, uri, localname, value; + }; + typedef QList<Attribute> AttributeList; + AttributeList attList; + + QXmlAttributesPrivate *d; +}; + +// +// SAX Input Source +// + +class Q_XML_EXPORT QXmlInputSource +{ +public: + QXmlInputSource(); + QXmlInputSource(QIODevice *dev); + virtual ~QXmlInputSource(); + + virtual void setData(const QString& dat); + virtual void setData(const QByteArray& dat); + virtual void fetchData(); + virtual QString data() const; + virtual QChar next(); + virtual void reset(); + + static const ushort EndOfData; + static const ushort EndOfDocument; + +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QXmlInputSource(QFile& file); + QT3_SUPPORT_CONSTRUCTOR QXmlInputSource(QTextStream& stream); +#endif + +protected: + virtual QString fromRawData(const QByteArray &data, bool beginning = false); + +private: + void init(); + QXmlInputSourcePrivate *d; +}; + +// +// SAX Exception Classes +// + +class Q_XML_EXPORT QXmlParseException +{ +public: + explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1, + const QString &p = QString(), const QString &s = QString()); + QXmlParseException(const QXmlParseException &other); + ~QXmlParseException(); + + int columnNumber() const; + int lineNumber() const; + QString publicId() const; + QString systemId() const; + QString message() const; + +private: + QScopedPointer<QXmlParseExceptionPrivate> d; +}; + + +// +// XML Reader +// + +class Q_XML_EXPORT QXmlReader +{ +public: + virtual ~QXmlReader() {} + virtual bool feature(const QString& name, bool *ok = 0) const = 0; + virtual void setFeature(const QString& name, bool value) = 0; + virtual bool hasFeature(const QString& name) const = 0; + virtual void* property(const QString& name, bool *ok = 0) const = 0; + virtual void setProperty(const QString& name, void* value) = 0; + virtual bool hasProperty(const QString& name) const = 0; + virtual void setEntityResolver(QXmlEntityResolver* handler) = 0; + virtual QXmlEntityResolver* entityResolver() const = 0; + virtual void setDTDHandler(QXmlDTDHandler* handler) = 0; + virtual QXmlDTDHandler* DTDHandler() const = 0; + virtual void setContentHandler(QXmlContentHandler* handler) = 0; + virtual QXmlContentHandler* contentHandler() const = 0; + virtual void setErrorHandler(QXmlErrorHandler* handler) = 0; + virtual QXmlErrorHandler* errorHandler() const = 0; + virtual void setLexicalHandler(QXmlLexicalHandler* handler) = 0; + virtual QXmlLexicalHandler* lexicalHandler() const = 0; + virtual void setDeclHandler(QXmlDeclHandler* handler) = 0; + virtual QXmlDeclHandler* declHandler() const = 0; + virtual bool parse(const QXmlInputSource& input) = 0; + virtual bool parse(const QXmlInputSource* input) = 0; +}; + +class Q_XML_EXPORT QXmlSimpleReader : public QXmlReader +{ +public: + QXmlSimpleReader(); + virtual ~QXmlSimpleReader(); + + bool feature(const QString& name, bool *ok = 0) const; + void setFeature(const QString& name, bool value); + bool hasFeature(const QString& name) const; + + void* property(const QString& name, bool *ok = 0) const; + void setProperty(const QString& name, void* value); + bool hasProperty(const QString& name) const; + + void setEntityResolver(QXmlEntityResolver* handler); + QXmlEntityResolver* entityResolver() const; + void setDTDHandler(QXmlDTDHandler* handler); + QXmlDTDHandler* DTDHandler() const; + void setContentHandler(QXmlContentHandler* handler); + QXmlContentHandler* contentHandler() const; + void setErrorHandler(QXmlErrorHandler* handler); + QXmlErrorHandler* errorHandler() const; + void setLexicalHandler(QXmlLexicalHandler* handler); + QXmlLexicalHandler* lexicalHandler() const; + void setDeclHandler(QXmlDeclHandler* handler); + QXmlDeclHandler* declHandler() const; + + bool parse(const QXmlInputSource& input); + bool parse(const QXmlInputSource* input); + virtual bool parse(const QXmlInputSource* input, bool incremental); + virtual bool parseContinue(); + +private: + Q_DISABLE_COPY(QXmlSimpleReader) + Q_DECLARE_PRIVATE(QXmlSimpleReader) + QScopedPointer<QXmlSimpleReaderPrivate> d_ptr; + + friend class QXmlSimpleReaderLocator; +}; + +// +// SAX Locator +// + +class Q_XML_EXPORT QXmlLocator +{ +public: + QXmlLocator(); + virtual ~QXmlLocator(); + + virtual int columnNumber() const = 0; + virtual int lineNumber() const = 0; +// QString getPublicId() const +// QString getSystemId() const +}; + +// +// SAX handler classes +// + +class Q_XML_EXPORT QXmlContentHandler +{ +public: + virtual ~QXmlContentHandler() {} + virtual void setDocumentLocator(QXmlLocator* locator) = 0; + virtual bool startDocument() = 0; + virtual bool endDocument() = 0; + virtual bool startPrefixMapping(const QString& prefix, const QString& uri) = 0; + virtual bool endPrefixMapping(const QString& prefix) = 0; + virtual bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) = 0; + virtual bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName) = 0; + virtual bool characters(const QString& ch) = 0; + virtual bool ignorableWhitespace(const QString& ch) = 0; + virtual bool processingInstruction(const QString& target, const QString& data) = 0; + virtual bool skippedEntity(const QString& name) = 0; + virtual QString errorString() const = 0; +}; + +class Q_XML_EXPORT QXmlErrorHandler +{ +public: + virtual ~QXmlErrorHandler() {} + virtual bool warning(const QXmlParseException& exception) = 0; + virtual bool error(const QXmlParseException& exception) = 0; + virtual bool fatalError(const QXmlParseException& exception) = 0; + virtual QString errorString() const = 0; +}; + +class Q_XML_EXPORT QXmlDTDHandler +{ +public: + virtual ~QXmlDTDHandler() {} + virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) = 0; + virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) = 0; + virtual QString errorString() const = 0; +}; + +class Q_XML_EXPORT QXmlEntityResolver +{ +public: + virtual ~QXmlEntityResolver() {} + virtual bool resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) = 0; + virtual QString errorString() const = 0; +}; + +class Q_XML_EXPORT QXmlLexicalHandler +{ +public: + virtual ~QXmlLexicalHandler() {} + virtual bool startDTD(const QString& name, const QString& publicId, const QString& systemId) = 0; + virtual bool endDTD() = 0; + virtual bool startEntity(const QString& name) = 0; + virtual bool endEntity(const QString& name) = 0; + virtual bool startCDATA() = 0; + virtual bool endCDATA() = 0; + virtual bool comment(const QString& ch) = 0; + virtual QString errorString() const = 0; +}; + +class Q_XML_EXPORT QXmlDeclHandler +{ +public: + virtual ~QXmlDeclHandler() {} + virtual bool attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value) = 0; + virtual bool internalEntityDecl(const QString& name, const QString& value) = 0; + virtual bool externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId) = 0; + virtual QString errorString() const = 0; + // ### Qt 5: Conform to SAX by adding elementDecl +}; + + +class Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler +{ +public: + QXmlDefaultHandler() { } + virtual ~QXmlDefaultHandler() { } + + void setDocumentLocator(QXmlLocator* locator); + bool startDocument(); + bool endDocument(); + bool startPrefixMapping(const QString& prefix, const QString& uri); + bool endPrefixMapping(const QString& prefix); + bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts); + bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName); + bool characters(const QString& ch); + bool ignorableWhitespace(const QString& ch); + bool processingInstruction(const QString& target, const QString& data); + bool skippedEntity(const QString& name); + + bool warning(const QXmlParseException& exception); + bool error(const QXmlParseException& exception); + bool fatalError(const QXmlParseException& exception); + + bool notationDecl(const QString& name, const QString& publicId, const QString& systemId); + bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName); + + bool resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret); + + bool startDTD(const QString& name, const QString& publicId, const QString& systemId); + bool endDTD(); + bool startEntity(const QString& name); + bool endEntity(const QString& name); + bool startCDATA(); + bool endCDATA(); + bool comment(const QString& ch); + + bool attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value); + bool internalEntityDecl(const QString& name, const QString& value); + bool externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId); + + QString errorString() const; + +private: + QXmlDefaultHandlerPrivate *d; + Q_DISABLE_COPY(QXmlDefaultHandler) +}; + +// inlines + +inline int QXmlAttributes::count() const +{ return length(); } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QXML_H diff --git a/qtinterface/qt4/Qt/qxmlformatter.h b/qtinterface/qt4/Qt/qxmlformatter.h new file mode 100644 index 0000000..173cc20 --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlformatter.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLFORMATTER_H +#define QXMLFORMATTER_H + +#include <QtXmlPatterns/QXmlSerializer> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QIODevice; +class QTextCodec; +class QXmlQuery; +class QXmlFormatterPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlFormatter : public QXmlSerializer +{ +public: + QXmlFormatter(const QXmlQuery &query, + QIODevice *outputDevice); + + virtual void characters(const QStringRef &value); + virtual void comment(const QString &value); + virtual void startElement(const QXmlName &name); + virtual void endElement(); + + virtual void attribute(const QXmlName &name, + const QStringRef &value); + virtual void processingInstruction(const QXmlName &name, + const QString &value); + virtual void atomicValue(const QVariant &value); + virtual void startDocument(); + virtual void endDocument(); + virtual void startOfSequence(); + virtual void endOfSequence(); + + int indentationDepth() const; + void setIndentationDepth(int depth); + + /* The members below are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ + virtual void item(const QPatternist::Item &item); +private: + inline void startFormattingContent(); + Q_DECLARE_PRIVATE(QXmlFormatter) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlname.h b/qtinterface/qt4/Qt/qxmlname.h new file mode 100644 index 0000000..6619e05 --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlname.h @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLNAME_H +#define QXMLNAME_H + +#include <QtCore/QString> +#include <QtCore/QMetaType> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QXmlName; +class QXmlNamePool; +Q_XMLPATTERNS_EXPORT uint qHash(const QXmlName &name); + +class Q_XMLPATTERNS_EXPORT QXmlName +{ +private: + enum Constant + { + LocalNameOffset = 0, + LocalNameLength = 12, + NamespaceOffset = LocalNameLength, + NamespaceLength = 9, + PrefixLength = 9, + InvalidCode = 1 << 31, + NamespaceMask = ((1 << ((NamespaceOffset + NamespaceLength) - NamespaceOffset)) - 1) << NamespaceOffset, + LocalNameMask = ((1 << ((LocalNameOffset + LocalNameLength) - LocalNameOffset)) - 1) << LocalNameOffset, + PrefixOffset = LocalNameLength + NamespaceLength, + PrefixMask = ((1 << ((PrefixOffset + PrefixLength) - PrefixOffset)) - 1) << PrefixOffset, + MaximumPrefixes = (PrefixMask >> PrefixOffset) - 1, + MaximumLocalNames = (LocalNameMask >> LocalNameOffset) - 1, + MaximumNamespaces = (NamespaceMask >> NamespaceOffset) - 1, + ExpandedNameMask = LocalNameMask | NamespaceMask, + LexicalQNameMask = LocalNameMask | PrefixMask + }; + +public: + + typedef qint16 NamespaceCode; + typedef NamespaceCode PrefixCode; + typedef NamespaceCode LocalNameCode; + + QXmlName(); + + QXmlName(QXmlNamePool &namePool, + const QString &localName, + const QString &namespaceURI = QString(), + const QString &prefix = QString()); + + QString namespaceUri(const QXmlNamePool &query) const; + QString prefix(const QXmlNamePool &query) const; + QString localName(const QXmlNamePool &query) const; + QString toClarkName(const QXmlNamePool &query) const; + bool operator==(const QXmlName &other) const; + bool operator!=(const QXmlName &other) const; + QXmlName &operator=(const QXmlName &other); + bool isNull() const; + static bool isNCName(const QString &candidate); + static QXmlName fromClarkName(const QString &clarkName, + const QXmlNamePool &namePool); + + /* The members below are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ + typedef qint64 Code; + + inline QXmlName(const NamespaceCode uri, + const LocalNameCode ln, + const PrefixCode p = 0); + /* The implementation for these functions are in utils/qnamepool_p.h. */ + inline LocalNameCode localName() const; + inline PrefixCode prefix() const; + inline bool hasPrefix() const; + inline bool hasNamespace() const; + inline NamespaceCode namespaceURI() const; + inline bool isLexicallyEqual(const QXmlName &other) const; + inline void setPrefix(const PrefixCode c); + inline void setNamespaceURI(const NamespaceCode c); + inline void setLocalName(const LocalNameCode c); + inline Code code() const; + + friend Q_XMLPATTERNS_EXPORT uint qHash(const QXmlName &); + +private: + inline QXmlName(const int c) : m_qNameCode(c) + { + } + + Code m_qNameCode; +}; + +Q_DECLARE_TYPEINFO(QXmlName, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QXmlName) /* This macro must appear after QT_END_NAMESPACE. */ + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlnamepool.h b/qtinterface/qt4/Qt/qxmlnamepool.h new file mode 100644 index 0000000..2cf0540 --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlnamepool.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLNAMEPOOL_H +#define QXMLNAMEPOOL_H + +#include <QtCore/QSharedData> +#include <QtCore/QString> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +namespace QPatternist +{ + class NamePool; + class XsdSchemaParser; + class XsdValidatingInstanceReader; +} + +namespace QPatternistSDK +{ + class Global; +} + +class QXmlQueryPrivate; +class QXmlName; + +class Q_XMLPATTERNS_EXPORT QXmlNamePool +{ +public: + QXmlNamePool(); + QXmlNamePool(const QXmlNamePool &other); + ~QXmlNamePool(); + QXmlNamePool &operator=(const QXmlNamePool &other); + +private: + QXmlNamePool(QPatternist::NamePool *namePool); + friend class QXmlQueryPrivate; + friend class QXmlQuery; + friend class QXmlSchemaPrivate; + friend class QXmlSchemaValidatorPrivate; + friend class QXmlSerializerPrivate; + friend class QXmlName; + friend class QPatternist::XsdSchemaParser; + friend class QPatternist::XsdValidatingInstanceReader; + friend class QPatternistSDK::Global; + QExplicitlySharedDataPointer<QPatternist::NamePool> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlquery.h b/qtinterface/qt4/Qt/qxmlquery.h new file mode 100644 index 0000000..e665dbc --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlquery.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLQUERY_H +#define QXMLQUERY_H + +#include <QtCore/QUrl> +#include <QtXmlPatterns/QAbstractXmlNodeModel> +#include <QtXmlPatterns/QAbstractXmlReceiver> +#include <QtXmlPatterns/QXmlNamePool> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractMessageHandler; +class QAbstractUriResolver; +class QIODevice; +class QNetworkAccessManager; +class QXmlName; +class QXmlNodeIndex; +class QXmlQueryPrivate; +class QXmlResultItems; +class QXmlSerializer; + +/* The members in the namespace QPatternistSDK are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ +namespace QPatternistSDK +{ + class TestCase; +} + +namespace QPatternist +{ + class XsdSchemaParser; + class XsdValidatingInstanceReader; + class VariableLoader; +} + +class Q_XMLPATTERNS_EXPORT QXmlQuery +{ +public: + enum QueryLanguage + { + XQuery10 = 1, + XSLT20 = 2, + XmlSchema11IdentityConstraintSelector = 1024, + XmlSchema11IdentityConstraintField = 2048, + XPath20 = 4096 + }; + + QXmlQuery(); + QXmlQuery(const QXmlQuery &other); + QXmlQuery(const QXmlNamePool &np); + QXmlQuery(QueryLanguage queryLanguage, + const QXmlNamePool &np = QXmlNamePool()); + ~QXmlQuery(); + QXmlQuery &operator=(const QXmlQuery &other); + + void setMessageHandler(QAbstractMessageHandler *messageHandler); + QAbstractMessageHandler *messageHandler() const; + + void setQuery(const QString &sourceCode, const QUrl &documentURI = QUrl()); + void setQuery(QIODevice *sourceCode, const QUrl &documentURI = QUrl()); + void setQuery(const QUrl &queryURI, const QUrl &baseURI = QUrl()); + + QXmlNamePool namePool() const; + + void bindVariable(const QXmlName &name, const QXmlItem &value); + void bindVariable(const QString &localName, const QXmlItem &value); + + void bindVariable(const QXmlName &name, QIODevice *); + void bindVariable(const QString &localName, QIODevice *); + void bindVariable(const QXmlName &name, const QXmlQuery &query); + void bindVariable(const QString &localName, const QXmlQuery &query); + + bool isValid() const; + + void evaluateTo(QXmlResultItems *result) const; + bool evaluateTo(QAbstractXmlReceiver *callback) const; + bool evaluateTo(QStringList *target) const; + bool evaluateTo(QIODevice *target) const; + bool evaluateTo(QString *output) const; + + void setUriResolver(const QAbstractUriResolver *resolver); + const QAbstractUriResolver *uriResolver() const; + + void setFocus(const QXmlItem &item); + bool setFocus(const QUrl &documentURI); + bool setFocus(QIODevice *document); + bool setFocus(const QString &focus); + + void setInitialTemplateName(const QXmlName &name); + void setInitialTemplateName(const QString &name); + QXmlName initialTemplateName() const; + + void setNetworkAccessManager(QNetworkAccessManager *newManager); + QNetworkAccessManager *networkAccessManager() const; + + QueryLanguage queryLanguage() const; +private: + friend class QXmlName; + friend class QXmlSerializer; + friend class QPatternistSDK::TestCase; + friend class QPatternist::XsdSchemaParser; + friend class QPatternist::XsdValidatingInstanceReader; + friend class QPatternist::VariableLoader; + template<typename TInputType> friend bool setFocusHelper(QXmlQuery *const queryInstance, + const TInputType &focusValue); + QXmlQueryPrivate *d; +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlresultitems.h b/qtinterface/qt4/Qt/qxmlresultitems.h new file mode 100644 index 0000000..0156e63 --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlresultitems.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLRESULTITEMS +#define QXMLRESULTITEMS + +#include <QtCore/QString> +#include <QtCore/QScopedPointer> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QXmlItem; +class QXmlQuery; +class QXmlResultItemsPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlResultItems +{ +public: + QXmlResultItems(); + virtual ~QXmlResultItems(); + + bool hasError() const; + QXmlItem next(); + QXmlItem current() const; + +private: + friend class QXmlQuery; + Q_DECLARE_PRIVATE(QXmlResultItems) + QScopedPointer<QXmlResultItemsPrivate> d_ptr; + Q_DISABLE_COPY(QXmlResultItems) +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlschema.h b/qtinterface/qt4/Qt/qxmlschema.h new file mode 100644 index 0000000..d17b91c --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlschema.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLSCHEMA_H +#define QXMLSCHEMA_H + +#include <QtCore/QSharedDataPointer> +#include <QtCore/QUrl> +#include <QtXmlPatterns/QXmlNamePool> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractMessageHandler; +class QAbstractUriResolver; +class QIODevice; +class QNetworkAccessManager; +class QUrl; +class QXmlNamePool; +class QXmlSchemaPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlSchema +{ + friend class QXmlSchemaValidatorPrivate; + + public: + QXmlSchema(); + QXmlSchema(const QXmlSchema &other); + ~QXmlSchema(); + + bool load(const QUrl &source); + bool load(QIODevice *source, const QUrl &documentUri = QUrl()); + bool load(const QByteArray &data, const QUrl &documentUri = QUrl()); + + bool isValid() const; + + QXmlNamePool namePool() const; + QUrl documentUri() const; + + void setMessageHandler(QAbstractMessageHandler *handler); + QAbstractMessageHandler *messageHandler() const; + + void setUriResolver(const QAbstractUriResolver *resolver); + const QAbstractUriResolver *uriResolver() const; + + void setNetworkAccessManager(QNetworkAccessManager *networkmanager); + QNetworkAccessManager *networkAccessManager() const; + + private: + QSharedDataPointer<QXmlSchemaPrivate> d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlschemavalidator.h b/qtinterface/qt4/Qt/qxmlschemavalidator.h new file mode 100644 index 0000000..1f3cf8f --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlschemavalidator.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLSCHEMAVALIDATOR_H +#define QXMLSCHEMAVALIDATOR_H + +#include <QtCore/QUrl> +#include <QtXmlPatterns/QXmlNamePool> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractMessageHandler; +class QAbstractUriResolver; +class QIODevice; +class QNetworkAccessManager; +class QUrl; +class QXmlNamePool; +class QXmlSchema; +class QXmlSchemaValidatorPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlSchemaValidator +{ + public: + QXmlSchemaValidator(); + QXmlSchemaValidator(const QXmlSchema &schema); + ~QXmlSchemaValidator(); + + void setSchema(const QXmlSchema &schema); + + bool validate(const QUrl &source) const; + bool validate(QIODevice *source, const QUrl &documentUri = QUrl()) const; + bool validate(const QByteArray &data, const QUrl &documentUri = QUrl()) const; + + QXmlNamePool namePool() const; + QXmlSchema schema() const; + + void setMessageHandler(QAbstractMessageHandler *handler); + QAbstractMessageHandler *messageHandler() const; + + void setUriResolver(const QAbstractUriResolver *resolver); + const QAbstractUriResolver *uriResolver() const; + + void setNetworkAccessManager(QNetworkAccessManager *networkmanager); + QNetworkAccessManager *networkAccessManager() const; + + private: + QXmlSchemaValidatorPrivate* const d; + + Q_DISABLE_COPY(QXmlSchemaValidator) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlserializer.h b/qtinterface/qt4/Qt/qxmlserializer.h new file mode 100644 index 0000000..5cda794 --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlserializer.h @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLSERIALIZER_H +#define QXMLSERIALIZER_H + +#include <QtXmlPatterns/QAbstractXmlReceiver> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QIODevice; +class QTextCodec; +class QXmlQuery; +class QXmlSerializerPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlSerializer : public QAbstractXmlReceiver +{ +public: + QXmlSerializer(const QXmlQuery &query, + QIODevice *outputDevice); + + virtual void namespaceBinding(const QXmlName &nb); + + virtual void characters(const QStringRef &value); + virtual void comment(const QString &value); + + virtual void startElement(const QXmlName &name); + + virtual void endElement(); + + virtual void attribute(const QXmlName &name, + const QStringRef &value); + + virtual void processingInstruction(const QXmlName &name, + const QString &value); + + virtual void atomicValue(const QVariant &value); + + virtual void startDocument(); + virtual void endDocument(); + virtual void startOfSequence(); + virtual void endOfSequence(); + + QIODevice *outputDevice() const; + + void setCodec(const QTextCodec *codec); + const QTextCodec *codec() const; + + /* The members below are internal, not part of the public API, and + * unsupported. Using them leads to undefined behavior. */ + virtual void item(const QPatternist::Item &item); +protected: + QXmlSerializer(QAbstractXmlReceiverPrivate *d); + +private: + inline bool isBindingInScope(const QXmlName nb) const; + + /** + * Where in the document the QXmlSerializer is currently working. + */ + enum State + { + /** + * Before the document element. This is the XML prolog where the + * XML declaration, and possibly comments and processing + * instructions are found. + */ + BeforeDocumentElement, + + /** + * This is inside the document element, at any level. + */ + InsideDocumentElement + }; + + /** + * If the current state is neither BeforeDocumentElement or + * AfterDocumentElement. + */ + inline bool atDocumentRoot() const; + + /** + * Closes any open element start tag. Must be called before outputting + * any element content. + */ + inline void startContent(); + + /** + * Escapes content intended as text nodes for elements. + */ + void writeEscaped(const QString &toEscape); + + /** + * Identical to writeEscaped(), but also escapes quotes. + */ + inline void writeEscapedAttribute(const QString &toEscape); + + /** + * Writes out @p name. + */ + inline void write(const QXmlName &name); + + inline void write(const char *const chars); + /** + * Encodes and writes out @p content. + */ + inline void write(const QString &content); + + Q_DECLARE_PRIVATE(QXmlSerializer) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/qtinterface/qt4/Qt/qxmlstream.h b/qtinterface/qt4/Qt/qxmlstream.h new file mode 100644 index 0000000..e76381a --- /dev/null +++ b/qtinterface/qt4/Qt/qxmlstream.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OLD_QXMLSTREAM_H +#define OLD_QXMLSTREAM_H + +#include <QtCore/qxmlstream.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Xml) + +#if 0 +// make syncqt generate forwarding headers for this file too +#pragma qt_class(QXmlStreamAttribute) +#pragma qt_class(QXmlStreamAttributes) +#pragma qt_class(QXmlStreamEntityDeclaration) +#pragma qt_class(QXmlStreamEntityDeclarations) +#pragma qt_class(QXmlStreamEntityResolver) +#pragma qt_class(QXmlStreamNamespaceDeclaration) +#pragma qt_class(QXmlStreamNamespaceDeclarations) +#pragma qt_class(QXmlStreamNotationDeclaration) +#pragma qt_class(QXmlStreamNotationDeclarations) +#pragma qt_class(QXmlStreamReader) +#pragma qt_class(QXmlStreamStringRef) +#pragma qt_class(QXmlStreamWriter) +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // OLD_QXMLSTREAM_H |
