rock-qtbindings 4.8.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.txt +85 -0
- data/COPYING.LIB.txt +510 -0
- data/COPYING.txt +286 -0
- data/KNOWN_ISSUES.txt +17 -0
- data/Rakefile +121 -0
- data/TODO.txt +2 -0
- data/bin/rbqtapi +152 -0
- data/bin/rbrcc +14 -0
- data/bin/rbuic4 +14 -0
- data/bin/smokeapi +14 -0
- data/bin/smokedeptool +14 -0
- data/examples/designer/calculatorbuilder/calculatorbuilder.qrc +5 -0
- data/examples/designer/calculatorbuilder/calculatorform.rb +60 -0
- data/examples/designer/calculatorbuilder/calculatorform.ui +299 -0
- data/examples/designer/calculatorbuilder/main.rb +34 -0
- data/examples/designer/calculatorbuilder/makefile +2 -0
- data/examples/designer/calculatorform/calculatorform.rb +46 -0
- data/examples/designer/calculatorform/calculatorform.ui +277 -0
- data/examples/designer/calculatorform/main.rb +32 -0
- data/examples/designer/calculatorform/makefile +3 -0
- data/examples/desktop/screenshot/main.rb +32 -0
- data/examples/desktop/screenshot/screenshot.rb +157 -0
- data/examples/desktop/systray/images/bad.svg +64 -0
- data/examples/desktop/systray/images/heart.svg +55 -0
- data/examples/desktop/systray/images/trash.svg +58 -0
- data/examples/desktop/systray/main.rb +41 -0
- data/examples/desktop/systray/makefile +2 -0
- data/examples/desktop/systray/systray.qrc +7 -0
- data/examples/desktop/systray/window.rb +219 -0
- data/examples/dialogs/complexwizard/complexwizard.rb +140 -0
- data/examples/dialogs/complexwizard/licensewizard.rb +294 -0
- data/examples/dialogs/complexwizard/main.rb +31 -0
- data/examples/dialogs/configdialog/configdialog.rb +109 -0
- data/examples/dialogs/configdialog/images/config.png +0 -0
- data/examples/dialogs/configdialog/images/query.png +0 -0
- data/examples/dialogs/configdialog/images/update.png +0 -0
- data/examples/dialogs/configdialog/main.rb +31 -0
- data/examples/dialogs/configdialog/pages.rb +140 -0
- data/examples/dialogs/extension/finddialog.rb +89 -0
- data/examples/dialogs/extension/main.rb +31 -0
- data/examples/dialogs/findfiles/main.rb +32 -0
- data/examples/dialogs/findfiles/window.rb +177 -0
- data/examples/dialogs/simplewizard/classwizard.rb +374 -0
- data/examples/dialogs/simplewizard/main.rb +31 -0
- data/examples/dialogs/simplewizard/simplewizard.rb +110 -0
- data/examples/dialogs/standarddialogs/dialog.rb +340 -0
- data/examples/dialogs/standarddialogs/main.rb +31 -0
- data/examples/dialogs/tabdialog/main.rb +38 -0
- data/examples/dialogs/tabdialog/tabdialog.rb +178 -0
- data/examples/draganddrop/draggableicons/dragwidget.rb +125 -0
- data/examples/draganddrop/draggableicons/images/boat.png +0 -0
- data/examples/draganddrop/draggableicons/images/car.png +0 -0
- data/examples/draganddrop/draggableicons/images/house.png +0 -0
- data/examples/draganddrop/draggableicons/main.rb +41 -0
- data/examples/draganddrop/draggabletext/draglabel.rb +51 -0
- data/examples/draganddrop/draggabletext/dragwidget.rb +94 -0
- data/examples/draganddrop/draggabletext/main.rb +33 -0
- data/examples/draganddrop/draggabletext/words.txt +41 -0
- data/examples/draganddrop/dropsite/dropsitewidget.rb +99 -0
- data/examples/draganddrop/dropsite/dropsitewindow.rb +114 -0
- data/examples/draganddrop/dropsite/main.rb +33 -0
- data/examples/draganddrop/fridgemagnets/draglabel.rb +78 -0
- data/examples/draganddrop/fridgemagnets/dragwidget.rb +130 -0
- data/examples/draganddrop/fridgemagnets/main.rb +33 -0
- data/examples/draganddrop/fridgemagnets/words.txt +48 -0
- data/examples/draganddrop/puzzle/example.jpg +0 -0
- data/examples/draganddrop/puzzle/main.rb +33 -0
- data/examples/draganddrop/puzzle/mainwindow.rb +136 -0
- data/examples/draganddrop/puzzle/pieceslist.rb +95 -0
- data/examples/draganddrop/puzzle/puzzlewidget.rb +190 -0
- data/examples/graphicsview/collidingmice/images/cheese.jpg +0 -0
- data/examples/graphicsview/collidingmice/main.rb +53 -0
- data/examples/graphicsview/collidingmice/makefile +2 -0
- data/examples/graphicsview/collidingmice/mice.qrc +5 -0
- data/examples/graphicsview/collidingmice/mouse.rb +176 -0
- data/examples/graphicsview/dragdroprobot/coloritem.rb +86 -0
- data/examples/graphicsview/dragdroprobot/images/head.png +0 -0
- data/examples/graphicsview/dragdroprobot/main.rb +57 -0
- data/examples/graphicsview/dragdroprobot/makefile +2 -0
- data/examples/graphicsview/dragdroprobot/robot.qrc +5 -0
- data/examples/graphicsview/dragdroprobot/robot.rb +246 -0
- data/examples/itemviews/chart/chart.qrc +5 -0
- data/examples/itemviews/chart/main.rb +33 -0
- data/examples/itemviews/chart/mainwindow.rb +151 -0
- data/examples/itemviews/chart/makefile +2 -0
- data/examples/itemviews/chart/mydata.cht +8 -0
- data/examples/itemviews/chart/pieview.rb +516 -0
- data/examples/itemviews/chart/qtdata.cht +14 -0
- data/examples/itemviews/dirview/main.rb +39 -0
- data/examples/itemviews/pixelator/imagemodel.rb +51 -0
- data/examples/itemviews/pixelator/images/qt.png +0 -0
- data/examples/itemviews/pixelator/images.qrc +5 -0
- data/examples/itemviews/pixelator/main.rb +34 -0
- data/examples/itemviews/pixelator/mainwindow.rb +218 -0
- data/examples/itemviews/pixelator/makefile +3 -0
- data/examples/itemviews/pixelator/pixeldelegate.rb +67 -0
- data/examples/itemviews/puzzle/example.jpg +0 -0
- data/examples/itemviews/puzzle/main.rb +36 -0
- data/examples/itemviews/puzzle/mainwindow.rb +143 -0
- data/examples/itemviews/puzzle/piecesmodel.rb +174 -0
- data/examples/itemviews/puzzle/puzzlewidget.rb +192 -0
- data/examples/itemviews/simpledommodel/domitem.rb +62 -0
- data/examples/itemviews/simpledommodel/dommodel.rb +139 -0
- data/examples/itemviews/simpledommodel/main.rb +33 -0
- data/examples/itemviews/simpledommodel/mainwindow.rb +66 -0
- data/examples/itemviews/simpletreemodel/default.txt +40 -0
- data/examples/itemviews/simpletreemodel/main.rb +41 -0
- data/examples/itemviews/simpletreemodel/makefile +2 -0
- data/examples/itemviews/simpletreemodel/simpletreemodel.qrc +5 -0
- data/examples/itemviews/simpletreemodel/treeitem.rb +67 -0
- data/examples/itemviews/simpletreemodel/treemodel.rb +164 -0
- data/examples/itemviews/sortingmodel/default.txt +40 -0
- data/examples/itemviews/sortingmodel/main.rb +53 -0
- data/examples/itemviews/sortingmodel/treeitem.rb +73 -0
- data/examples/itemviews/sortingmodel/treemodel.rb +166 -0
- data/examples/itemviews/spinboxdelegate/main.rb +47 -0
- data/examples/itemviews/spinboxdelegate/spinboxdelegate.rb +62 -0
- data/examples/killerfilter/killerfilter.rb +55 -0
- data/examples/layouts/basiclayouts/dialog.rb +110 -0
- data/examples/layouts/basiclayouts/main.rb +31 -0
- data/examples/layouts/borderlayout/borderlayout.rb +190 -0
- data/examples/layouts/borderlayout/main.rb +32 -0
- data/examples/layouts/borderlayout/window.rb +52 -0
- data/examples/layouts/flowlayouts/flowlayout.rb +108 -0
- data/examples/layouts/flowlayouts/main.rb +32 -0
- data/examples/layouts/flowlayouts/window.rb +43 -0
- data/examples/mainwindows/application/images/copy.png +0 -0
- data/examples/mainwindows/application/images/cut.png +0 -0
- data/examples/mainwindows/application/images/new.png +0 -0
- data/examples/mainwindows/application/images/open.png +0 -0
- data/examples/mainwindows/application/images/paste.png +0 -0
- data/examples/mainwindows/application/images/save.png +0 -0
- data/examples/mainwindows/application/main.rb +32 -0
- data/examples/mainwindows/application/mainwindow.rb +285 -0
- data/examples/mainwindows/dockwidgets/images/new.png +0 -0
- data/examples/mainwindows/dockwidgets/images/print.png +0 -0
- data/examples/mainwindows/dockwidgets/images/save.png +0 -0
- data/examples/mainwindows/dockwidgets/images/undo.png +0 -0
- data/examples/mainwindows/dockwidgets/main.rb +32 -0
- data/examples/mainwindows/dockwidgets/mainwindow.rb +302 -0
- data/examples/mainwindows/mdi/images/copy.png +0 -0
- data/examples/mainwindows/mdi/images/cut.png +0 -0
- data/examples/mainwindows/mdi/images/new.png +0 -0
- data/examples/mainwindows/mdi/images/open.png +0 -0
- data/examples/mainwindows/mdi/images/paste.png +0 -0
- data/examples/mainwindows/mdi/images/save.png +0 -0
- data/examples/mainwindows/mdi/main.rb +32 -0
- data/examples/mainwindows/mdi/mainwindow.rb +363 -0
- data/examples/mainwindows/mdi/mdichild.rb +152 -0
- data/examples/mainwindows/menus/main.rb +32 -0
- data/examples/mainwindows/menus/mainwindow.rb +327 -0
- data/examples/mainwindows/recentfiles/main.rb +32 -0
- data/examples/mainwindows/recentfiles/mainwindow.rb +258 -0
- data/examples/mainwindows/sdi/images/copy.png +0 -0
- data/examples/mainwindows/sdi/images/cut.png +0 -0
- data/examples/mainwindows/sdi/images/new.png +0 -0
- data/examples/mainwindows/sdi/images/open.png +0 -0
- data/examples/mainwindows/sdi/images/paste.png +0 -0
- data/examples/mainwindows/sdi/images/save.png +0 -0
- data/examples/mainwindows/sdi/main.rb +32 -0
- data/examples/mainwindows/sdi/mainwindow.rb +335 -0
- data/examples/network/broadcastreceiver/main.rb +32 -0
- data/examples/network/broadcastreceiver/receiver.rb +64 -0
- data/examples/network/broadcastsender/main.rb +32 -0
- data/examples/network/broadcastsender/sender.rb +72 -0
- data/examples/network/fortuneclient/client.rb +149 -0
- data/examples/network/fortuneclient/main.rb +32 -0
- data/examples/network/fortuneserver/main.rb +32 -0
- data/examples/network/fortuneserver/server.rb +88 -0
- data/examples/network/ftp/ftpwindow.rb +259 -0
- data/examples/network/ftp/images/cdtoparent.png +0 -0
- data/examples/network/ftp/images/dir.png +0 -0
- data/examples/network/ftp/images/file.png +0 -0
- data/examples/network/ftp/main.rb +32 -0
- data/examples/network/http/httpwindow.rb +187 -0
- data/examples/network/http/main.rb +32 -0
- data/examples/network/loopback/dialog.rb +163 -0
- data/examples/network/loopback/main.rb +32 -0
- data/examples/opengl/grabber/glwidget.rb +265 -0
- data/examples/opengl/grabber/main.rb +32 -0
- data/examples/opengl/grabber/mainwindow.rb +189 -0
- data/examples/opengl/hellogl/glwidget.rb +226 -0
- data/examples/opengl/hellogl/main.rb +32 -0
- data/examples/opengl/hellogl/window.rb +66 -0
- data/examples/opengl/textures/glwidget.rb +151 -0
- data/examples/opengl/textures/images/side1.png +0 -0
- data/examples/opengl/textures/images/side2.png +0 -0
- data/examples/opengl/textures/images/side3.png +0 -0
- data/examples/opengl/textures/images/side4.png +0 -0
- data/examples/opengl/textures/images/side5.png +0 -0
- data/examples/opengl/textures/images/side6.png +0 -0
- data/examples/opengl/textures/main.rb +32 -0
- data/examples/opengl/textures/window.rb +77 -0
- data/examples/painting/basicdrawing/images/brick.png +0 -0
- data/examples/painting/basicdrawing/images/qt-logo.png +0 -0
- data/examples/painting/basicdrawing/main.rb +32 -0
- data/examples/painting/basicdrawing/renderarea.rb +166 -0
- data/examples/painting/basicdrawing/window.rb +215 -0
- data/examples/painting/concentriccircles/circlewidget.rb +88 -0
- data/examples/painting/concentriccircles/main.rb +32 -0
- data/examples/painting/concentriccircles/window.rb +72 -0
- data/examples/painting/fontsampler/main.rb +32 -0
- data/examples/painting/fontsampler/mainwindow.rb +369 -0
- data/examples/painting/fontsampler/mainwindowbase.ui +136 -0
- data/examples/painting/fontsampler/makefile +8 -0
- data/examples/painting/fontsampler/previewdialog.rb +257 -0
- data/examples/painting/fontsampler/previewdialogbase.ui +224 -0
- data/examples/painting/fontsampler/previewlabel.rb +43 -0
- data/examples/painting/imagecomposition/imagecomposer.rb +152 -0
- data/examples/painting/imagecomposition/imagecomposition.qrc +6 -0
- data/examples/painting/imagecomposition/images/background.png +0 -0
- data/examples/painting/imagecomposition/images/blackrectangle.png +0 -0
- data/examples/painting/imagecomposition/images/butterfly.png +0 -0
- data/examples/painting/imagecomposition/images/checker.png +0 -0
- data/examples/painting/imagecomposition/main.rb +33 -0
- data/examples/painting/imagecomposition/makefile +2 -0
- data/examples/painting/painterpaths/main.rb +32 -0
- data/examples/painting/painterpaths/renderarea.rb +97 -0
- data/examples/painting/painterpaths/window.rb +247 -0
- data/examples/painting/svgviewer/files/bubbles.svg +212 -0
- data/examples/painting/svgviewer/files/cubic.svg +77 -0
- data/examples/painting/svgviewer/files/spheres.svg +79 -0
- data/examples/painting/svgviewer/main.rb +38 -0
- data/examples/painting/svgviewer/mainwindow.rb +99 -0
- data/examples/painting/svgviewer/makefile +2 -0
- data/examples/painting/svgviewer/svgview.rb +156 -0
- data/examples/painting/svgviewer/svgviewer.qrc +6 -0
- data/examples/painting/svgviewer/svgwindow.rb +87 -0
- data/examples/painting/transformations/main.rb +32 -0
- data/examples/painting/transformations/renderarea.rb +127 -0
- data/examples/painting/transformations/window.rb +153 -0
- data/examples/passivepopup/passivepopup.rb +38 -0
- data/examples/qdbus/chat/chat.rb +146 -0
- data/examples/qdbus/chat/chat_adaptor.rb +12 -0
- data/examples/qdbus/chat/chat_interface.rb +13 -0
- data/examples/qdbus/chat/chatmainwindow.ui +184 -0
- data/examples/qdbus/chat/chatsetnickname.ui +145 -0
- data/examples/qdbus/chat/makefile +8 -0
- data/examples/qdbus/complexpingpong/complexping.rb +92 -0
- data/examples/qdbus/complexpingpong/complexpong.rb +83 -0
- data/examples/qdbus/complexpingpong/ping-common.rb +1 -0
- data/examples/qdbus/listnames/listnames.rb +69 -0
- data/examples/qdbus/pingpong/ping-common.rb +1 -0
- data/examples/qdbus/pingpong/ping.rb +52 -0
- data/examples/qdbus/pingpong/pong.rb +55 -0
- data/examples/qdbus/remotecontrolledcar/car/car.rb +151 -0
- data/examples/qdbus/remotecontrolledcar/car/main.rb +50 -0
- data/examples/qdbus/remotecontrolledcar/controller/controller.rb +66 -0
- data/examples/qdbus/remotecontrolledcar/controller/controller.ui +61 -0
- data/examples/qdbus/remotecontrolledcar/controller/main.rb +32 -0
- data/examples/qdbus/remotecontrolledcar/controller/makefile +2 -0
- data/examples/qtscribble/scribble.rb +270 -0
- data/examples/richtext/calendar/main.rb +33 -0
- data/examples/richtext/calendar/mainwindow.rb +173 -0
- data/examples/richtext/orderform/detailsdialog.rb +130 -0
- data/examples/richtext/orderform/main.rb +34 -0
- data/examples/richtext/orderform/mainwindow.rb +194 -0
- data/examples/richtext/syntaxhighlighter/examples/example +79 -0
- data/examples/richtext/syntaxhighlighter/highlighter.rb +90 -0
- data/examples/richtext/syntaxhighlighter/main.rb +34 -0
- data/examples/richtext/syntaxhighlighter/mainwindow.rb +105 -0
- data/examples/ruboids/LICENSE.txt +58 -0
- data/examples/ruboids/Manifest +26 -0
- data/examples/ruboids/README +53 -0
- data/examples/ruboids/TODO +29 -0
- data/examples/ruboids/boids.properties +33 -0
- data/examples/ruboids/generateManifest.rb +42 -0
- data/examples/ruboids/index.html +147 -0
- data/examples/ruboids/release.rb +152 -0
- data/examples/ruboids/ruboids/Boid.rb +141 -0
- data/examples/ruboids/ruboids/BoidView.rb +159 -0
- data/examples/ruboids/ruboids/Camera.rb +24 -0
- data/examples/ruboids/ruboids/CameraDialog.rb +218 -0
- data/examples/ruboids/ruboids/Canvas.rb +143 -0
- data/examples/ruboids/ruboids/Cloud.rb +61 -0
- data/examples/ruboids/ruboids/CloudView.rb +54 -0
- data/examples/ruboids/ruboids/Flock.rb +47 -0
- data/examples/ruboids/ruboids/Graphics.rb +278 -0
- data/examples/ruboids/ruboids/Params.rb +87 -0
- data/examples/ruboids/ruboids/Point.rb +153 -0
- data/examples/ruboids/ruboids/Thing.rb +34 -0
- data/examples/ruboids/ruboids/Triangle.rb +21 -0
- data/examples/ruboids/ruboids/View.rb +88 -0
- data/examples/ruboids/ruboids/World.rb +82 -0
- data/examples/ruboids/ruboids/WorldWindow.rb +52 -0
- data/examples/ruboids/ruboids/info.rb +12 -0
- data/examples/ruboids/ruboids/ruboids.rb +29 -0
- data/examples/run_all.rb +15 -0
- data/examples/threading/main_thread.rb +19 -0
- data/examples/tutorial/t1/t1.rb +10 -0
- data/examples/tutorial/t10/cannon.rb +72 -0
- data/examples/tutorial/t10/lcdrange.rb +45 -0
- data/examples/tutorial/t10/t10.rb +55 -0
- data/examples/tutorial/t11/cannon.rb +123 -0
- data/examples/tutorial/t11/lcdrange.rb +45 -0
- data/examples/tutorial/t11/t11.rb +65 -0
- data/examples/tutorial/t12/cannon.rb +157 -0
- data/examples/tutorial/t12/lcdrange.rb +58 -0
- data/examples/tutorial/t12/t12.rb +65 -0
- data/examples/tutorial/t13/cannon.rb +206 -0
- data/examples/tutorial/t13/gamebrd.rb +112 -0
- data/examples/tutorial/t13/lcdrange.rb +59 -0
- data/examples/tutorial/t13/t13.rb +11 -0
- data/examples/tutorial/t14/cannon.rb +262 -0
- data/examples/tutorial/t14/gamebrd.rb +122 -0
- data/examples/tutorial/t14/lcdrange.rb +61 -0
- data/examples/tutorial/t14/t14.rb +11 -0
- data/examples/tutorial/t2/t2.rb +16 -0
- data/examples/tutorial/t3/t3.rb +17 -0
- data/examples/tutorial/t4/t4.rb +23 -0
- data/examples/tutorial/t5/t5.rb +35 -0
- data/examples/tutorial/t6/t6.rb +48 -0
- data/examples/tutorial/t7/lcdrange.rb +32 -0
- data/examples/tutorial/t7/t7.rb +40 -0
- data/examples/tutorial/t8/cannon.rb +37 -0
- data/examples/tutorial/t8/lcdrange.rb +45 -0
- data/examples/tutorial/t8/t8.rb +43 -0
- data/examples/tutorial/t9/cannon.rb +44 -0
- data/examples/tutorial/t9/lcdrange.rb +46 -0
- data/examples/tutorial/t9/t9.rb +43 -0
- data/examples/widgets/analogclock/analogclock.rb +94 -0
- data/examples/widgets/analogclock/main.rb +9 -0
- data/examples/widgets/calculator/button.rb +45 -0
- data/examples/widgets/calculator/calculator.rb +382 -0
- data/examples/widgets/calculator/main.rb +32 -0
- data/examples/widgets/charactermap/characterwidget.rb +110 -0
- data/examples/widgets/charactermap/main.rb +32 -0
- data/examples/widgets/charactermap/mainwindow.rb +118 -0
- data/examples/widgets/digitalclock/digitalclock.rb +30 -0
- data/examples/widgets/digitalclock/main.rb +9 -0
- data/examples/widgets/groupbox/main.rb +32 -0
- data/examples/widgets/groupbox/window.rb +134 -0
- data/examples/widgets/icons/iconpreviewarea.rb +111 -0
- data/examples/widgets/icons/iconsizespinbox.rb +39 -0
- data/examples/widgets/icons/imagedelegate.rb +73 -0
- data/examples/widgets/icons/images/designer.png +0 -0
- data/examples/widgets/icons/images/find_disabled.png +0 -0
- data/examples/widgets/icons/images/find_normal.png +0 -0
- data/examples/widgets/icons/images/monkey_off_128x128.png +0 -0
- data/examples/widgets/icons/images/monkey_off_16x16.png +0 -0
- data/examples/widgets/icons/images/monkey_off_32x32.png +0 -0
- data/examples/widgets/icons/images/monkey_off_64x64.png +0 -0
- data/examples/widgets/icons/images/monkey_on_128x128.png +0 -0
- data/examples/widgets/icons/images/monkey_on_16x16.png +0 -0
- data/examples/widgets/icons/images/monkey_on_32x32.png +0 -0
- data/examples/widgets/icons/images/monkey_on_64x64.png +0 -0
- data/examples/widgets/icons/images/qtopia_16x16.png +0 -0
- data/examples/widgets/icons/images/qtopia_32x32.png +0 -0
- data/examples/widgets/icons/images/qtopia_48x48.png +0 -0
- data/examples/widgets/icons/main.rb +32 -0
- data/examples/widgets/icons/mainwindow.rb +351 -0
- data/examples/widgets/imageviewer/imageviewer.rb +219 -0
- data/examples/widgets/imageviewer/main.rb +32 -0
- data/examples/widgets/lineedits/main.rb +32 -0
- data/examples/widgets/lineedits/window.rb +199 -0
- data/examples/widgets/movie/images/open.png +0 -0
- data/examples/widgets/movie/images/pause.png +0 -0
- data/examples/widgets/movie/images/play.png +0 -0
- data/examples/widgets/movie/images/quit.png +0 -0
- data/examples/widgets/movie/images/stop.png +0 -0
- data/examples/widgets/movie/main.rb +32 -0
- data/examples/widgets/movie/movieplayer.rb +201 -0
- data/examples/widgets/movie/movies/fire.mng +0 -0
- data/examples/widgets/screenshot/main.rb +32 -0
- data/examples/widgets/screenshot/screenshot.rb +155 -0
- data/examples/widgets/scribble/main.rb +32 -0
- data/examples/widgets/scribble/mainwindow.rb +202 -0
- data/examples/widgets/scribble/scribblearea.rb +154 -0
- data/examples/widgets/sliders/main.rb +32 -0
- data/examples/widgets/sliders/slidersgroup.rb +97 -0
- data/examples/widgets/sliders/window.rb +124 -0
- data/examples/widgets/spinboxes/main.rb +32 -0
- data/examples/widgets/spinboxes/window.rb +213 -0
- data/examples/widgets/tetrix/main.rb +33 -0
- data/examples/widgets/tetrix/tetrixboard.rb +346 -0
- data/examples/widgets/tetrix/tetrixpiece.rb +135 -0
- data/examples/widgets/tetrix/tetrixwindow.rb +88 -0
- data/examples/widgets/tooltips/images/circle.png +0 -0
- data/examples/widgets/tooltips/images/square.png +0 -0
- data/examples/widgets/tooltips/images/triangle.png +0 -0
- data/examples/widgets/tooltips/main.rb +32 -0
- data/examples/widgets/tooltips/shapeitem.rb +31 -0
- data/examples/widgets/tooltips/sortingbox.rb +222 -0
- data/examples/widgets/wiggly/dialog.rb +48 -0
- data/examples/widgets/wiggly/main.rb +9 -0
- data/examples/widgets/wiggly/wigglywidget.rb +76 -0
- data/examples/widgets/windowflags/controllerwindow.rb +195 -0
- data/examples/widgets/windowflags/main.rb +32 -0
- data/examples/widgets/windowflags/previewwindow.rb +103 -0
- data/examples/xml/dombookmarks/frank.xbel +230 -0
- data/examples/xml/dombookmarks/jennifer.xbel +93 -0
- data/examples/xml/dombookmarks/main.rb +34 -0
- data/examples/xml/dombookmarks/mainwindow.rb +129 -0
- data/examples/xml/dombookmarks/xbeltree.rb +172 -0
- data/examples/xml/saxbookmarks/frank.xbel +230 -0
- data/examples/xml/saxbookmarks/jennifer.xbel +93 -0
- data/examples/xml/saxbookmarks/main.rb +34 -0
- data/examples/xml/saxbookmarks/mainwindow.rb +144 -0
- data/examples/xml/saxbookmarks/xbelgenerator.rb +95 -0
- data/examples/xml/saxbookmarks/xbelhandler.rb +122 -0
- data/ext/CMakeLists.txt +28 -0
- data/ext/cmake/modules/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/cmake/modules/CMakeCSharpCompiler.cmake.in +7 -0
- data/ext/cmake/modules/CMakeCSharpInformation.cmake +366 -0
- data/ext/cmake/modules/CMakeDetermineCSharpCompiler.cmake +85 -0
- data/ext/cmake/modules/CMakeTestCSharpCompiler.cmake +1 -0
- data/ext/cmake/modules/CheckCXXSourceCompiles.cmake +68 -0
- data/ext/cmake/modules/FindLibraryWithDebug.cmake +113 -0
- data/ext/cmake/modules/FindMono.cmake +36 -0
- data/ext/cmake/modules/FindPHP5.cmake +179 -0
- data/ext/cmake/modules/FindPerlMore.cmake +78 -0
- data/ext/cmake/modules/FindPhonon.cmake +71 -0
- data/ext/cmake/modules/FindQImageBlitz.cmake +51 -0
- data/ext/cmake/modules/FindQScintilla.cmake +57 -0
- data/ext/cmake/modules/FindQt4.cmake +1275 -0
- data/ext/cmake/modules/FindQwt5.cmake +104 -0
- data/ext/cmake/modules/FindRuby.cmake +279 -0
- data/ext/cmake/modules/FindSmoke.cmake +78 -0
- data/ext/cmake/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
- data/ext/cmake/modules/MacroLogFeature.cmake +146 -0
- data/ext/cmake/modules/MacroOptionalAddBindings.cmake +47 -0
- data/ext/cmake/modules/MacroOptionalFindPackage.cmake +28 -0
- data/ext/cmake/modules/MacroPushRequiredVars.cmake +47 -0
- data/ext/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/cmake/modules/Qt4ConfigDependentSettings.cmake +384 -0
- data/ext/cmake/modules/Qt4Macros.cmake +414 -0
- data/ext/cmake/modules/SmokeConfig.cmake.in +109 -0
- data/ext/generator/CMakeLists.txt +38 -0
- data/ext/generator/cmake/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/generator/cmake/CMakeLists.txt +24 -0
- data/ext/generator/cmake/FindLibraryWithDebug.cmake +113 -0
- data/ext/generator/cmake/FindPhonon.cmake +71 -0
- data/ext/generator/cmake/FindQImageBlitz.cmake +51 -0
- data/ext/generator/cmake/FindQScintilla.cmake +57 -0
- data/ext/generator/cmake/FindQwt5.cmake +104 -0
- data/ext/generator/cmake/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
- data/ext/generator/cmake/MacroLogFeature.cmake +146 -0
- data/ext/generator/cmake/MacroOptionalAddBindings.cmake +47 -0
- data/ext/generator/cmake/MacroOptionalFindPackage.cmake +28 -0
- data/ext/generator/cmake/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/generator/cmake/SmokeConfig.cmake.in +109 -0
- data/ext/generator/config.h +25 -0
- data/ext/generator/generator_export.h +31 -0
- data/ext/generator/generatorenvironment.cpp +52 -0
- data/ext/generator/generatorenvironment.h +35 -0
- data/ext/generator/generatorpreprocessor.cpp +303 -0
- data/ext/generator/generatorpreprocessor.h +83 -0
- data/ext/generator/generators/CMakeLists.txt +4 -0
- data/ext/generator/generators/dump/CMakeLists.txt +15 -0
- data/ext/generator/generators/dump/generator_dump.cpp +36 -0
- data/ext/generator/generators/smoke/CMakeLists.txt +18 -0
- data/ext/generator/generators/smoke/generator_smoke.cpp +240 -0
- data/ext/generator/generators/smoke/globals.h +140 -0
- data/ext/generator/generators/smoke/helpers.cpp +793 -0
- data/ext/generator/generators/smoke/writeClasses.cpp +502 -0
- data/ext/generator/generators/smoke/writeSmokeDataFile.cpp +754 -0
- data/ext/generator/generatorvisitor.cpp +922 -0
- data/ext/generator/generatorvisitor.h +119 -0
- data/ext/generator/main.cpp +243 -0
- data/ext/generator/name_compiler.cpp +205 -0
- data/ext/generator/name_compiler.h +76 -0
- data/ext/generator/options.cpp +33 -0
- data/ext/generator/options.h +46 -0
- data/ext/generator/parser/CMakeLists.txt +50 -0
- data/ext/generator/parser/ast.cpp +21 -0
- data/ext/generator/parser/ast.h +923 -0
- data/ext/generator/parser/astutilities.h +65 -0
- data/ext/generator/parser/codegenerator.cpp +867 -0
- data/ext/generator/parser/codegenerator.h +180 -0
- data/ext/generator/parser/codemodel_fwd.h +76 -0
- data/ext/generator/parser/commentformatter.cpp +54 -0
- data/ext/generator/parser/commentformatter.h +45 -0
- data/ext/generator/parser/commentparser.cpp +109 -0
- data/ext/generator/parser/commentparser.h +84 -0
- data/ext/generator/parser/control.cpp +40 -0
- data/ext/generator/parser/control.h +51 -0
- data/ext/generator/parser/cppparser_export.h +33 -0
- data/ext/generator/parser/default_visitor.cpp +470 -0
- data/ext/generator/parser/default_visitor.h +116 -0
- data/ext/generator/parser/dumptree.cpp +146 -0
- data/ext/generator/parser/dumptree.h +50 -0
- data/ext/generator/parser/indexedstring.cpp +213 -0
- data/ext/generator/parser/indexedstring.h +147 -0
- data/ext/generator/parser/kdevelop-parser-rev +1 -0
- data/ext/generator/parser/kdevvarlengtharray.h +346 -0
- data/ext/generator/parser/lexer.cpp +964 -0
- data/ext/generator/parser/lexer.h +308 -0
- data/ext/generator/parser/listnode.cpp +20 -0
- data/ext/generator/parser/listnode.h +97 -0
- data/ext/generator/parser/memorypool.cpp +20 -0
- data/ext/generator/parser/memorypool.h +41 -0
- data/ext/generator/parser/name_compiler.cpp +190 -0
- data/ext/generator/parser/name_compiler.h +77 -0
- data/ext/generator/parser/parser.cpp +4708 -0
- data/ext/generator/parser/parser.h +290 -0
- data/ext/generator/parser/parsesession.cpp +106 -0
- data/ext/generator/parser/parsesession.h +87 -0
- data/ext/generator/parser/problem.h +21 -0
- data/ext/generator/parser/rpp/CMakeLists.txt +45 -0
- data/ext/generator/parser/rpp/Makefile.am +13 -0
- data/ext/generator/parser/rpp/anchor.h +51 -0
- data/ext/generator/parser/rpp/appendedlist.h +363 -0
- data/ext/generator/parser/rpp/chartools.cpp +146 -0
- data/ext/generator/parser/rpp/chartools.h +99 -0
- data/ext/generator/parser/rpp/macrorepository.cpp +44 -0
- data/ext/generator/parser/rpp/macrorepository.h +59 -0
- data/ext/generator/parser/rpp/pp-configuration +86 -0
- data/ext/generator/parser/rpp/pp-engine.cpp +1216 -0
- data/ext/generator/parser/rpp/pp-engine.h +267 -0
- data/ext/generator/parser/rpp/pp-environment.cpp +271 -0
- data/ext/generator/parser/rpp/pp-environment.h +119 -0
- data/ext/generator/parser/rpp/pp-internal.cpp +38 -0
- data/ext/generator/parser/rpp/pp-internal.h +37 -0
- data/ext/generator/parser/rpp/pp-location.cpp +191 -0
- data/ext/generator/parser/rpp/pp-location.h +89 -0
- data/ext/generator/parser/rpp/pp-macro-expander.cpp +568 -0
- data/ext/generator/parser/rpp/pp-macro-expander.cpp.orig +558 -0
- data/ext/generator/parser/rpp/pp-macro-expander.h +130 -0
- data/ext/generator/parser/rpp/pp-macro.cpp +153 -0
- data/ext/generator/parser/rpp/pp-macro.h +176 -0
- data/ext/generator/parser/rpp/pp-scanner.cpp +311 -0
- data/ext/generator/parser/rpp/pp-scanner.h +97 -0
- data/ext/generator/parser/rpp/pp-stream.cpp +425 -0
- data/ext/generator/parser/rpp/pp-stream.h +183 -0
- data/ext/generator/parser/rpp/preprocessor.cpp +65 -0
- data/ext/generator/parser/rpp/preprocessor.h +80 -0
- data/ext/generator/parser/rpp/rpp.pri +2 -0
- data/ext/generator/parser/rpp/test/t001.cpp +23 -0
- data/ext/generator/parser/rpp/test/t002.cpp +15 -0
- data/ext/generator/parser/rpp/test/t003.cpp +10 -0
- data/ext/generator/parser/rpp/test/t004.cpp +9 -0
- data/ext/generator/parser/rpp/test/t005.cpp +10 -0
- data/ext/generator/parser/rpp/test/t006.cpp +10 -0
- data/ext/generator/parser/rpp/test/t007.cpp +6 -0
- data/ext/generator/parser/rpp/test/t008.cpp +6 -0
- data/ext/generator/parser/rpp/test/t009.cpp +5 -0
- data/ext/generator/parser/rpp/test/t010.cpp +15 -0
- data/ext/generator/parser/rpp/test/t011.cpp +9 -0
- data/ext/generator/parser/rpp/tests/CMakeLists.txt +17 -0
- data/ext/generator/parser/rpp/tests/main.cpp +69 -0
- data/ext/generator/parser/rxx.pri +50 -0
- data/ext/generator/parser/rxx_allocator.h +128 -0
- data/ext/generator/parser/safetycounter.h +57 -0
- data/ext/generator/parser/simplecursor.h +74 -0
- data/ext/generator/parser/stringhelpers.cpp +577 -0
- data/ext/generator/parser/stringhelpers.h +118 -0
- data/ext/generator/parser/symbol.h +140 -0
- data/ext/generator/parser/tests/CMakeLists.txt +46 -0
- data/ext/generator/parser/tests/test_generator.cpp +259 -0
- data/ext/generator/parser/tests/test_parser.cpp +474 -0
- data/ext/generator/parser/tests/test_pool.cpp +109 -0
- data/ext/generator/parser/tests/test_pool.h +35 -0
- data/ext/generator/parser/tests/testconfig.h.cmake +4 -0
- data/ext/generator/parser/tokens.cpp +367 -0
- data/ext/generator/parser/tokens.h +148 -0
- data/ext/generator/parser/type_compiler.cpp +135 -0
- data/ext/generator/parser/type_compiler.h +68 -0
- data/ext/generator/parser/visitor.cpp +115 -0
- data/ext/generator/parser/visitor.h +138 -0
- data/ext/generator/smoke.h +557 -0
- data/ext/generator/smokegen_string.h +43 -0
- data/ext/generator/type.cpp +204 -0
- data/ext/generator/type.h +497 -0
- data/ext/generator/type_compiler.cpp +277 -0
- data/ext/generator/type_compiler.h +80 -0
- data/ext/ruby/CMakeLists.txt +64 -0
- data/ext/ruby/qtdeclarative/CMakeLists.txt +17 -0
- data/ext/ruby/qtdeclarative/qtdeclarative.cpp +67 -0
- data/ext/ruby/qtdeclarative/qtdeclarative.rb +17 -0
- data/ext/ruby/qtdeclarative/qtdeclarativehandlers.cpp +36 -0
- data/ext/ruby/qtruby/AUTHORS +54 -0
- data/ext/ruby/qtruby/CMakeLists.txt +4 -0
- data/ext/ruby/qtruby/COPYING +355 -0
- data/ext/ruby/qtruby/COPYING.LIB +510 -0
- data/ext/ruby/qtruby/ChangeLog +3732 -0
- data/ext/ruby/qtruby/INSTALL +79 -0
- data/ext/ruby/qtruby/README +264 -0
- data/ext/ruby/qtruby/TODO +8 -0
- data/ext/ruby/qtruby/bin/CMakeLists.txt +1 -0
- data/ext/ruby/qtruby/bin/rbqtapi +152 -0
- data/ext/ruby/qtruby/rails_support/CMakeLists.txt +1 -0
- data/ext/ruby/qtruby/rails_support/active_item_model.rb +234 -0
- data/ext/ruby/qtruby/rails_support/active_table_model.rb +122 -0
- data/ext/ruby/qtruby/src/CMakeLists.txt +103 -0
- data/ext/ruby/qtruby/src/Qt.cpp +1327 -0
- data/ext/ruby/qtruby/src/handlers.cpp +2668 -0
- data/ext/ruby/qtruby/src/marshall.h +66 -0
- data/ext/ruby/qtruby/src/marshall_basetypes.h +208 -0
- data/ext/ruby/qtruby/src/marshall_complex.h +175 -0
- data/ext/ruby/qtruby/src/marshall_macros.h +647 -0
- data/ext/ruby/qtruby/src/marshall_primitives.h +306 -0
- data/ext/ruby/qtruby/src/marshall_types.cpp +815 -0
- data/ext/ruby/qtruby/src/marshall_types.h +240 -0
- data/ext/ruby/qtruby/src/qtruby.cpp +2627 -0
- data/ext/ruby/qtruby/src/qtruby.h +198 -0
- data/ext/ruby/qtruby/src/smokeruby.h +164 -0
- data/ext/ruby/qtruby/test/opoverloading.rb +46 -0
- data/ext/ruby/qtruby/test/unittests.rb +151 -0
- data/ext/ruby/qtruby/tools/CMakeLists.txt +2 -0
- data/ext/ruby/qtruby/tools/rbrcc/CMakeLists.txt +6 -0
- data/ext/ruby/qtruby/tools/rbrcc/Messages.sh +7 -0
- data/ext/ruby/qtruby/tools/rbrcc/main.cpp +173 -0
- data/ext/ruby/qtruby/tools/rbrcc/rbrcc.pro +14 -0
- data/ext/ruby/qtruby/tools/rbrcc/rcc.cpp +648 -0
- data/ext/ruby/qtruby/tools/rbrcc/rcc.h +165 -0
- data/ext/ruby/qtruby/tools/rbuic/CMakeLists.txt +35 -0
- data/ext/ruby/qtruby/tools/rbuic/LICENSE.GPL +280 -0
- data/ext/ruby/qtruby/tools/rbuic/Messages.sh +7 -0
- data/ext/ruby/qtruby/tools/rbuic/TODO +4 -0
- data/ext/ruby/qtruby/tools/rbuic/customwidgetsinfo.cpp +106 -0
- data/ext/ruby/qtruby/tools/rbuic/customwidgetsinfo.h +95 -0
- data/ext/ruby/qtruby/tools/rbuic/databaseinfo.cpp +102 -0
- data/ext/ruby/qtruby/tools/rbuic/databaseinfo.h +85 -0
- data/ext/ruby/qtruby/tools/rbuic/driver.cpp +384 -0
- data/ext/ruby/qtruby/tools/rbuic/driver.h +141 -0
- data/ext/ruby/qtruby/tools/rbuic/globaldefs.h +60 -0
- data/ext/ruby/qtruby/tools/rbuic/main.cpp +201 -0
- data/ext/ruby/qtruby/tools/rbuic/option.h +110 -0
- data/ext/ruby/qtruby/tools/rbuic/rbuic.pri +23 -0
- data/ext/ruby/qtruby/tools/rbuic/rbuic4.pro +43 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbextractimages.cpp +150 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbextractimages.h +83 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwritedeclaration.cpp +217 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwritedeclaration.h +85 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondata.cpp +185 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondata.h +86 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondeclaration.cpp +88 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondeclaration.h +83 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteiconinitialization.cpp +126 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteiconinitialization.h +87 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteinitialization.cpp +2478 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteinitialization.h +314 -0
- data/ext/ruby/qtruby/tools/rbuic/ruby/ruby.pri +18 -0
- data/ext/ruby/qtruby/tools/rbuic/treewalker.cpp +318 -0
- data/ext/ruby/qtruby/tools/rbuic/treewalker.h +139 -0
- data/ext/ruby/qtruby/tools/rbuic/ui4.cpp +7623 -0
- data/ext/ruby/qtruby/tools/rbuic/ui4.h +3180 -0
- data/ext/ruby/qtruby/tools/rbuic/uic.cpp +438 -0
- data/ext/ruby/qtruby/tools/rbuic/uic.h +154 -0
- data/ext/ruby/qtruby/tools/rbuic/utils.h +125 -0
- data/ext/ruby/qtruby/tools/rbuic/validator.cpp +100 -0
- data/ext/ruby/qtruby/tools/rbuic/validator.h +80 -0
- data/ext/ruby/qtscript/CMakeLists.txt +19 -0
- data/ext/ruby/qtscript/qtscript.cpp +83 -0
- data/ext/ruby/qtscript/qtscript.rb +40 -0
- data/ext/ruby/qtscript/qtscripthandlers.cpp +37 -0
- data/ext/ruby/qtscript/smokedata.cpp +1403 -0
- data/ext/ruby/qttest/CMakeLists.txt +18 -0
- data/ext/ruby/qttest/ChangeLog +9 -0
- data/ext/ruby/qttest/examples/myfirsttest.rb +30 -0
- data/ext/ruby/qttest/qttest.cpp +83 -0
- data/ext/ruby/qttest/qttest.rb +166 -0
- data/ext/ruby/qttest/qttesthandlers.cpp +37 -0
- data/ext/ruby/qtuitools/CMakeLists.txt +16 -0
- data/ext/ruby/qtuitools/qtuitools.cpp +83 -0
- data/ext/ruby/qtuitools/qtuitools.rb +17 -0
- data/ext/ruby/qtuitools/qtuitoolshandlers.cpp +32 -0
- data/ext/ruby/qtwebkit/CMakeLists.txt +17 -0
- data/ext/ruby/qtwebkit/qtwebkit.cpp +67 -0
- data/ext/ruby/qtwebkit/qtwebkit.rb +17 -0
- data/ext/ruby/qtwebkit/qtwebkithandlers.cpp +40 -0
- data/ext/smoke/CMakeLists.txt +39 -0
- data/ext/smoke/deptool/CMakeLists.txt +7 -0
- data/ext/smoke/deptool/main.cpp +128 -0
- data/ext/smoke/qt_smoke.h +16 -0
- data/ext/smoke/qtcore/CMakeLists.txt +88 -0
- data/ext/smoke/qtcore/QtGuess.txt +180 -0
- data/ext/smoke/qtcore/config.xml.cmake +10 -0
- data/ext/smoke/qtcore/qt-config.xml.cmake +21 -0
- data/ext/smoke/qtcore/qtcore_includes.h +1 -0
- data/ext/smoke/qtcore/smokeconfig.xml +193 -0
- data/ext/smoke/qtcore/tests/CMakeLists.txt +13 -0
- data/ext/smoke/qtcore/tests/test.cpp +846 -0
- data/ext/smoke/qtcore_smoke.h +16 -0
- data/ext/smoke/qtdbus/CMakeLists.txt +38 -0
- data/ext/smoke/qtdbus/config.xml.cmake +11 -0
- data/ext/smoke/qtdbus/qtdbus_includes.h +2 -0
- data/ext/smoke/qtdbus/smokeconfig.xml +65 -0
- data/ext/smoke/qtdbus_smoke.h +16 -0
- data/ext/smoke/qtdeclarative/CMakeLists.txt +45 -0
- data/ext/smoke/qtdeclarative/config.xml.cmake +12 -0
- data/ext/smoke/qtdeclarative/qtdeclarative_includes.h +3 -0
- data/ext/smoke/qtdeclarative/smokeconfig.xml +59 -0
- data/ext/smoke/qtdeclarative_smoke.h +16 -0
- data/ext/smoke/qtgui/CMakeLists.txt +76 -0
- data/ext/smoke/qtgui/config.xml.cmake +11 -0
- data/ext/smoke/qtgui/qtgui_includes.h +7 -0
- data/ext/smoke/qtgui/smokeconfig.xml +500 -0
- data/ext/smoke/qtgui_smoke.h +16 -0
- data/ext/smoke/qthelp/CMakeLists.txt +45 -0
- data/ext/smoke/qthelp/config.xml.cmake +13 -0
- data/ext/smoke/qthelp/qthelp_includes.h +3 -0
- data/ext/smoke/qthelp/smokeconfig.xml +54 -0
- data/ext/smoke/qthelp_smoke.h +16 -0
- data/ext/smoke/qtmultimedia/CMakeLists.txt +42 -0
- data/ext/smoke/qtmultimedia/config.xml.cmake +12 -0
- data/ext/smoke/qtmultimedia/qtmultimedia_includes.h +3 -0
- data/ext/smoke/qtmultimedia/smokeconfig.xml +51 -0
- data/ext/smoke/qtmultimedia_smoke.h +16 -0
- data/ext/smoke/qtnetwork/CMakeLists.txt +38 -0
- data/ext/smoke/qtnetwork/config.xml.cmake +11 -0
- data/ext/smoke/qtnetwork/qtnetwork_includes.h +2 -0
- data/ext/smoke/qtnetwork/smokeconfig.xml +81 -0
- data/ext/smoke/qtnetwork_smoke.h +16 -0
- data/ext/smoke/qtopengl/CMakeLists.txt +43 -0
- data/ext/smoke/qtopengl/config.xml.cmake +13 -0
- data/ext/smoke/qtopengl/qtopengl_includes.h +3 -0
- data/ext/smoke/qtopengl/smokeconfig.xml +58 -0
- data/ext/smoke/qtopengl_smoke.h +16 -0
- data/ext/smoke/qtscript/CMakeLists.txt +31 -0
- data/ext/smoke/qtscript/config.xml.cmake +11 -0
- data/ext/smoke/qtscript/qtscript_includes.h +14 -0
- data/ext/smoke/qtscript/smokeconfig.xml +39 -0
- data/ext/smoke/qtscript_smoke.h +16 -0
- data/ext/smoke/qtsql/CMakeLists.txt +45 -0
- data/ext/smoke/qtsql/config.xml.cmake +11 -0
- data/ext/smoke/qtsql/qtsql_includes.h +3 -0
- data/ext/smoke/qtsql/smokeconfig.xml +60 -0
- data/ext/smoke/qtsql_smoke.h +16 -0
- data/ext/smoke/qtsvg/CMakeLists.txt +43 -0
- data/ext/smoke/qtsvg/config.xml.cmake +12 -0
- data/ext/smoke/qtsvg/qtsvg_includes.h +3 -0
- data/ext/smoke/qtsvg/smokeconfig.xml +46 -0
- data/ext/smoke/qtsvg_smoke.h +16 -0
- data/ext/smoke/qttest/CMakeLists.txt +35 -0
- data/ext/smoke/qttest/config.xml.cmake +12 -0
- data/ext/smoke/qttest/qttest_includes.h +14 -0
- data/ext/smoke/qttest/smokeconfig.xml +36 -0
- data/ext/smoke/qttest_smoke.h +16 -0
- data/ext/smoke/qtuitools/CMakeLists.txt +30 -0
- data/ext/smoke/qtuitools/config.xml.cmake +12 -0
- data/ext/smoke/qtuitools/qtuitools_includes.h +1 -0
- data/ext/smoke/qtuitools/smokeconfig.xml +20 -0
- data/ext/smoke/qtuitools_smoke.h +16 -0
- data/ext/smoke/qtwebkit/CMakeLists.txt +36 -0
- data/ext/smoke/qtwebkit/config.xml.cmake +11 -0
- data/ext/smoke/qtwebkit/qtwebkit_includes.h +1 -0
- data/ext/smoke/qtwebkit/smokeconfig.xml +48 -0
- data/ext/smoke/qtwebkit_smoke.h +16 -0
- data/ext/smoke/qtxml/CMakeLists.txt +41 -0
- data/ext/smoke/qtxml/config.xml.cmake +11 -0
- data/ext/smoke/qtxml/qtxml_includes.h +2 -0
- data/ext/smoke/qtxml/smokeconfig.xml +70 -0
- data/ext/smoke/qtxml_smoke.h +16 -0
- data/ext/smoke/qtxmlpatterns/CMakeLists.txt +42 -0
- data/ext/smoke/qtxmlpatterns/config.xml.cmake +12 -0
- data/ext/smoke/qtxmlpatterns/qtxmlpatterns_includes.h +3 -0
- data/ext/smoke/qtxmlpatterns/smokeconfig.xml +80 -0
- data/ext/smoke/qtxmlpatterns_smoke.h +16 -0
- data/ext/smoke/smoke.h +559 -0
- data/ext/smoke/smokeapi/CMakeLists.txt +9 -0
- data/ext/smoke/smokeapi/main.cpp +309 -0
- data/ext/smoke/smokebase/CMakeLists.txt +11 -0
- data/ext/smoke/smokebase/smokebase.cpp +6 -0
- data/ext/smoke/solid_smoke.h +16 -0
- data/extconf.rb +256 -0
- data/lib/Qt/qtruby4.rb +3268 -0
- data/lib/Qt.rb +1 -0
- data/lib/Qt4.rb +119 -0
- data/lib/qtbindings_version.rb +2 -0
- data/lib/qtdeclarative/qtdeclarative.rb +17 -0
- data/lib/qtscript/qtscript.rb +40 -0
- data/lib/qttest/qttest.rb +166 -0
- data/lib/qtuitools/qtuitools.rb +17 -0
- data/lib/qtwebkit/qtwebkit.rb +17 -0
- data/rock-qtbindings.gemspec +18 -0
- metadata +819 -0
|
@@ -0,0 +1,2627 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
qtruby.cpp - description
|
|
3
|
+
-------------------
|
|
4
|
+
begin : Fri Jul 4 2003
|
|
5
|
+
copyright : (C) 2003-2006 by Richard Dale
|
|
6
|
+
email : Richard_Dale@tipitina.demon.co.uk
|
|
7
|
+
***************************************************************************/
|
|
8
|
+
|
|
9
|
+
/***************************************************************************
|
|
10
|
+
* *
|
|
11
|
+
* This program is free software; you can redistribute it and/or modify *
|
|
12
|
+
* it under the terms of the GNU Lesser General Public License as *
|
|
13
|
+
* published by the Free Software Foundation; either version 2 of the *
|
|
14
|
+
* License, or (at your option) any later version. *
|
|
15
|
+
* *
|
|
16
|
+
***************************************************************************/
|
|
17
|
+
|
|
18
|
+
#include <QtCore/qabstractitemmodel.h>
|
|
19
|
+
#include <QtCore/qglobal.h>
|
|
20
|
+
#include <QtCore/qhash.h>
|
|
21
|
+
#include <QtCore/qline.h>
|
|
22
|
+
#include <QtCore/qmetaobject.h>
|
|
23
|
+
#include <QtCore/qobject.h>
|
|
24
|
+
#include <QtCore/qrect.h>
|
|
25
|
+
#include <QtCore/qregexp.h>
|
|
26
|
+
#include <QtCore/qstring.h>
|
|
27
|
+
#include <QtCore/qvariant.h>
|
|
28
|
+
#include <QtGui/qapplication.h>
|
|
29
|
+
#include <QtGui/qbitmap.h>
|
|
30
|
+
#include <QtGui/qcolor.h>
|
|
31
|
+
#include <QtGui/qcursor.h>
|
|
32
|
+
#include <QtGui/qfont.h>
|
|
33
|
+
#include <QtGui/qicon.h>
|
|
34
|
+
#include <QtGui/qitemselectionmodel.h>
|
|
35
|
+
#include <QtGui/qpalette.h>
|
|
36
|
+
#include <QtGui/qpen.h>
|
|
37
|
+
#include <QtGui/qpixmap.h>
|
|
38
|
+
#include <QtGui/qpolygon.h>
|
|
39
|
+
#include <QtGui/qtextformat.h>
|
|
40
|
+
#include <QtGui/qwidget.h>
|
|
41
|
+
|
|
42
|
+
#ifdef QT_QTDBUS
|
|
43
|
+
#include <QtDBus/qdbusargument.h>
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#include <smoke/smoke.h>
|
|
47
|
+
|
|
48
|
+
#include <smoke/qtcore_smoke.h>
|
|
49
|
+
#include <smoke/qtgui_smoke.h>
|
|
50
|
+
#include <smoke/qtxml_smoke.h>
|
|
51
|
+
#include <smoke/qtsql_smoke.h>
|
|
52
|
+
#include <smoke/qtopengl_smoke.h>
|
|
53
|
+
#include <smoke/qtnetwork_smoke.h>
|
|
54
|
+
#include <smoke/qtsvg_smoke.h>
|
|
55
|
+
|
|
56
|
+
#ifdef QT_QTDBUS
|
|
57
|
+
#include <smoke/qtdbus_smoke.h>
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
#include <ruby.h>
|
|
61
|
+
#undef read
|
|
62
|
+
#undef write
|
|
63
|
+
#undef connect
|
|
64
|
+
#undef accept
|
|
65
|
+
|
|
66
|
+
#include "marshall_types.h"
|
|
67
|
+
#include "qtruby.h"
|
|
68
|
+
|
|
69
|
+
extern bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
|
|
70
|
+
extern bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
|
|
71
|
+
|
|
72
|
+
extern TypeHandler Qt_handlers[];
|
|
73
|
+
extern const char * resolve_classname_qt(smokeruby_object * o);
|
|
74
|
+
|
|
75
|
+
extern "C" {
|
|
76
|
+
|
|
77
|
+
static VALUE
|
|
78
|
+
qdebug(VALUE klass, VALUE msg)
|
|
79
|
+
{
|
|
80
|
+
qDebug("%s", StringValuePtr(msg));
|
|
81
|
+
return klass;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static VALUE
|
|
85
|
+
qfatal(VALUE klass, VALUE msg)
|
|
86
|
+
{
|
|
87
|
+
qFatal("%s", StringValuePtr(msg));
|
|
88
|
+
return klass;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static VALUE
|
|
92
|
+
qwarning(VALUE klass, VALUE msg)
|
|
93
|
+
{
|
|
94
|
+
qWarning("%s", StringValuePtr(msg));
|
|
95
|
+
return klass;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//---------- Ruby methods (for all functions except fully qualified statics & enums) ---------
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
// Takes a variable name and a QProperty with QVariant value, and returns a '
|
|
102
|
+
// variable=value' pair with the value in ruby inspect style
|
|
103
|
+
static QString
|
|
104
|
+
inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
105
|
+
{
|
|
106
|
+
if (property.isEnumType()) {
|
|
107
|
+
QMetaEnum e = property.enumerator();
|
|
108
|
+
return QString(" %1=%2::%3").arg(name).arg(e.scope()).arg(e.valueToKey(value.toInt()));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
switch (value.type()) {
|
|
112
|
+
case QVariant::String:
|
|
113
|
+
{
|
|
114
|
+
if (value.toString().isNull()) {
|
|
115
|
+
return QString(" %1=nil").arg(name);
|
|
116
|
+
} else {
|
|
117
|
+
return QString(" %1=%2").arg(name).arg(value.toString());
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
case QVariant::Bool:
|
|
122
|
+
{
|
|
123
|
+
QString rubyName;
|
|
124
|
+
QRegExp name_re("^(is|has)(.)(.*)");
|
|
125
|
+
|
|
126
|
+
if (name_re.indexIn(name) != -1) {
|
|
127
|
+
rubyName = name_re.cap(2).toLower() + name_re.cap(3) + "?";
|
|
128
|
+
} else {
|
|
129
|
+
rubyName = name;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return QString(" %1=%2").arg(rubyName).arg(value.toString());
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
case QVariant::Color:
|
|
136
|
+
{
|
|
137
|
+
QColor c = value.value<QColor>();
|
|
138
|
+
return QString(" %1=#<Qt::Color:0x0 %2>").arg(name).arg(c.name());
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
case QVariant::Cursor:
|
|
142
|
+
{
|
|
143
|
+
QCursor c = value.value<QCursor>();
|
|
144
|
+
return QString(" %1=#<Qt::Cursor:0x0 shape=%2>").arg(name).arg(c.shape());
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
case QVariant::Double:
|
|
148
|
+
{
|
|
149
|
+
return QString(" %1=%2").arg(name).arg(value.toDouble());
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
case QVariant::Font:
|
|
153
|
+
{
|
|
154
|
+
QFont f = value.value<QFont>();
|
|
155
|
+
return QString( " %1=#<Qt::Font:0x0 family=%2, pointSize=%3, weight=%4, italic=%5, bold=%6, underline=%7, strikeOut=%8>")
|
|
156
|
+
.arg(name)
|
|
157
|
+
.arg(f.family())
|
|
158
|
+
.arg(f.pointSize())
|
|
159
|
+
.arg(f.weight())
|
|
160
|
+
.arg(f.italic() ? "true" : "false")
|
|
161
|
+
.arg(f.bold() ? "true" : "false")
|
|
162
|
+
.arg(f.underline() ? "true" : "false")
|
|
163
|
+
.arg(f.strikeOut() ? "true" : "false");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
case QVariant::Line:
|
|
167
|
+
{
|
|
168
|
+
QLine l = value.toLine();
|
|
169
|
+
return QString(" %1=#<Qt::Line:0x0 x1=%2, y1=%3, x2=%4, y2=%5>")
|
|
170
|
+
.arg(name)
|
|
171
|
+
.arg(l.x1())
|
|
172
|
+
.arg(l.y1())
|
|
173
|
+
.arg(l.x2())
|
|
174
|
+
.arg(l.y2());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
case QVariant::LineF:
|
|
178
|
+
{
|
|
179
|
+
QLineF l = value.toLineF();
|
|
180
|
+
return QString(" %1=#<Qt::LineF:0x0 x1=%2, y1=%3, x2=%4, y2=%5>")
|
|
181
|
+
.arg(name)
|
|
182
|
+
.arg(l.x1())
|
|
183
|
+
.arg(l.y1())
|
|
184
|
+
.arg(l.x2())
|
|
185
|
+
.arg(l.y2());
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
case QVariant::Point:
|
|
189
|
+
{
|
|
190
|
+
QPoint p = value.toPoint();
|
|
191
|
+
return QString(" %1=#<Qt::Point:0x0 x=%2, y=%3>").arg(name).arg(p.x()).arg(p.y());
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
case QVariant::PointF:
|
|
195
|
+
{
|
|
196
|
+
QPointF p = value.toPointF();
|
|
197
|
+
return QString(" %1=#<Qt::PointF:0x0 x=%2, y=%3>").arg(name).arg(p.x()).arg(p.y());
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
case QVariant::Rect:
|
|
201
|
+
{
|
|
202
|
+
QRect r = value.toRect();
|
|
203
|
+
return QString(" %1=#<Qt::Rect:0x0 left=%2, right=%3, top=%4, bottom=%5>")
|
|
204
|
+
.arg(name)
|
|
205
|
+
.arg(r.left()).arg(r.right()).arg(r.top()).arg(r.bottom());
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
case QVariant::RectF:
|
|
209
|
+
{
|
|
210
|
+
QRectF r = value.toRectF();
|
|
211
|
+
return QString(" %1=#<Qt::RectF:0x0 left=%2, right=%3, top=%4, bottom=%5>")
|
|
212
|
+
.arg(name)
|
|
213
|
+
.arg(r.left()).arg(r.right()).arg(r.top()).arg(r.bottom());
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
case QVariant::Size:
|
|
217
|
+
{
|
|
218
|
+
QSize s = value.toSize();
|
|
219
|
+
return QString(" %1=#<Qt::Size:0x0 width=%2, height=%3>")
|
|
220
|
+
.arg(name)
|
|
221
|
+
.arg(s.width()).arg(s.height());
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
case QVariant::SizeF:
|
|
225
|
+
{
|
|
226
|
+
QSizeF s = value.toSizeF();
|
|
227
|
+
return QString(" %1=#<Qt::SizeF:0x0 width=%2, height=%3>")
|
|
228
|
+
.arg(name)
|
|
229
|
+
.arg(s.width()).arg(s.height());
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
case QVariant::SizePolicy:
|
|
233
|
+
{
|
|
234
|
+
QSizePolicy s = value.value<QSizePolicy>();
|
|
235
|
+
return QString(" %1=#<Qt::SizePolicy:0x0 horizontalPolicy=%2, verticalPolicy=%3>")
|
|
236
|
+
.arg(name)
|
|
237
|
+
.arg(s.horizontalPolicy())
|
|
238
|
+
.arg(s.verticalPolicy());
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
case QVariant::Brush:
|
|
242
|
+
// case QVariant::ColorGroup:
|
|
243
|
+
case QVariant::Image:
|
|
244
|
+
case QVariant::Palette:
|
|
245
|
+
case QVariant::Pixmap:
|
|
246
|
+
case QVariant::Region:
|
|
247
|
+
{
|
|
248
|
+
return QString(" %1=#<Qt::%2:0x0>").arg(name).arg(value.typeName() + 1);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
default:
|
|
252
|
+
return QString(" %1=%2").arg(name)
|
|
253
|
+
.arg((value.isNull() || value.toString().isNull()) ? "nil" : value.toString() );
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Retrieves the properties for a QObject and returns them as 'name=value' pairs
|
|
258
|
+
// in a ruby inspect string. For example:
|
|
259
|
+
//
|
|
260
|
+
// #<Qt::HBoxLayout:0x30139030 name=unnamed, margin=0, spacing=0, resizeMode=3>
|
|
261
|
+
//
|
|
262
|
+
static VALUE
|
|
263
|
+
inspect_qobject(VALUE self)
|
|
264
|
+
{
|
|
265
|
+
if (TYPE(self) != T_DATA) {
|
|
266
|
+
return Qnil;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Start with #<Qt::HBoxLayout:0x30139030> from the original inspect() call
|
|
270
|
+
// Drop the closing '>'
|
|
271
|
+
VALUE inspect_str = rb_call_super(0, 0);
|
|
272
|
+
rb_str_resize(inspect_str, RSTRING_LEN(inspect_str) - 1);
|
|
273
|
+
|
|
274
|
+
smokeruby_object * o = 0;
|
|
275
|
+
Data_Get_Struct(self, smokeruby_object, o);
|
|
276
|
+
QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
277
|
+
|
|
278
|
+
QString value_list;
|
|
279
|
+
value_list.append(QString(" objectName=\"%1\"").arg(qobject->objectName()));
|
|
280
|
+
|
|
281
|
+
if (qobject->isWidgetType()) {
|
|
282
|
+
QWidget * w = (QWidget *) qobject;
|
|
283
|
+
value_list.append(QString(", x=%1, y=%2, width=%3, height=%4")
|
|
284
|
+
.arg(w->x())
|
|
285
|
+
.arg(w->y())
|
|
286
|
+
.arg(w->width())
|
|
287
|
+
.arg(w->height()) );
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
value_list.append(">");
|
|
291
|
+
rb_str_cat2(inspect_str, value_list.toLatin1());
|
|
292
|
+
|
|
293
|
+
return inspect_str;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Retrieves the properties for a QObject and pretty_prints them as 'name=value' pairs
|
|
297
|
+
// For example:
|
|
298
|
+
//
|
|
299
|
+
// #<Qt::HBoxLayout:0x30139030
|
|
300
|
+
// name=unnamed,
|
|
301
|
+
// margin=0,
|
|
302
|
+
// spacing=0,
|
|
303
|
+
// resizeMode=3>
|
|
304
|
+
//
|
|
305
|
+
static VALUE
|
|
306
|
+
pretty_print_qobject(VALUE self, VALUE pp)
|
|
307
|
+
{
|
|
308
|
+
if (TYPE(self) != T_DATA) {
|
|
309
|
+
return Qnil;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Start with #<Qt::HBoxLayout:0x30139030>
|
|
313
|
+
// Drop the closing '>'
|
|
314
|
+
VALUE inspect_str = rb_funcall(self, rb_intern("to_s"), 0, 0);
|
|
315
|
+
rb_str_resize(inspect_str, RSTRING_LEN(inspect_str) - 1);
|
|
316
|
+
rb_funcall(pp, rb_intern("text"), 1, inspect_str);
|
|
317
|
+
rb_funcall(pp, rb_intern("breakable"), 0);
|
|
318
|
+
|
|
319
|
+
smokeruby_object * o = 0;
|
|
320
|
+
Data_Get_Struct(self, smokeruby_object, o);
|
|
321
|
+
QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
322
|
+
|
|
323
|
+
QString value_list;
|
|
324
|
+
|
|
325
|
+
if (qobject->parent() != 0) {
|
|
326
|
+
QString parentInspectString;
|
|
327
|
+
VALUE obj = getPointerObject(qobject->parent());
|
|
328
|
+
if (obj != Qnil) {
|
|
329
|
+
VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0);
|
|
330
|
+
rb_str_resize(parent_inspect_str, RSTRING_LEN(parent_inspect_str) - 1);
|
|
331
|
+
parentInspectString = StringValuePtr(parent_inspect_str);
|
|
332
|
+
} else {
|
|
333
|
+
parentInspectString.sprintf("#<%s:0x0", qobject->parent()->metaObject()->className());
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (qobject->parent()->isWidgetType()) {
|
|
337
|
+
QWidget * w = (QWidget *) qobject->parent();
|
|
338
|
+
value_list = QString(" parent=%1 objectName=\"%2\", x=%3, y=%4, width=%5, height=%6>,\n")
|
|
339
|
+
.arg(parentInspectString)
|
|
340
|
+
.arg(w->objectName())
|
|
341
|
+
.arg(w->x())
|
|
342
|
+
.arg(w->y())
|
|
343
|
+
.arg(w->width())
|
|
344
|
+
.arg(w->height());
|
|
345
|
+
} else {
|
|
346
|
+
value_list = QString(" parent=%1 objectName=\"%2\">,\n")
|
|
347
|
+
.arg(parentInspectString)
|
|
348
|
+
.arg(qobject->parent()->objectName());
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (qobject->children().count() != 0) {
|
|
355
|
+
value_list = QString(" children=Array (%1 element(s)),\n")
|
|
356
|
+
.arg(qobject->children().count());
|
|
357
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
value_list = QString(" metaObject=#<Qt::MetaObject:0x0");
|
|
361
|
+
value_list.append(QString(" className=%1").arg(qobject->metaObject()->className()));
|
|
362
|
+
|
|
363
|
+
if (qobject->metaObject()->superClass() != 0) {
|
|
364
|
+
value_list.append( QString(", superClass=#<Qt::MetaObject:0x0 className=%1>")
|
|
365
|
+
.arg(qobject->metaObject()->superClass()->className()) );
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
value_list.append(">,\n");
|
|
369
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
|
370
|
+
|
|
371
|
+
QMetaProperty property = qobject->metaObject()->property(0);
|
|
372
|
+
QVariant value = property.read(qobject);
|
|
373
|
+
value_list = " " + inspectProperty(property, property.name(), value);
|
|
374
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
|
375
|
+
|
|
376
|
+
for (int index = 1; index < qobject->metaObject()->propertyCount(); index++) {
|
|
377
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(",\n"));
|
|
378
|
+
|
|
379
|
+
property = qobject->metaObject()->property(index);
|
|
380
|
+
value = property.read(qobject);
|
|
381
|
+
value_list = " " + inspectProperty(property, property.name(), value);
|
|
382
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(">"));
|
|
386
|
+
|
|
387
|
+
return self;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
static VALUE
|
|
391
|
+
q_register_resource_data(VALUE /*self*/, VALUE version, VALUE tree_value, VALUE name_value, VALUE data_value)
|
|
392
|
+
{
|
|
393
|
+
const unsigned char * tree = (const unsigned char *) malloc(RSTRING_LEN(tree_value));
|
|
394
|
+
memcpy((void *) tree, (const void *) RSTRING_PTR(tree_value), RSTRING_LEN(tree_value));
|
|
395
|
+
|
|
396
|
+
const unsigned char * name = (const unsigned char *) malloc(RSTRING_LEN(name_value));
|
|
397
|
+
memcpy((void *) name, (const void *) RSTRING_PTR(name_value), RSTRING_LEN(name_value));
|
|
398
|
+
|
|
399
|
+
const unsigned char * data = (const unsigned char *) malloc(RSTRING_LEN(data_value));
|
|
400
|
+
memcpy((void *) data, (const void *) RSTRING_PTR(data_value), RSTRING_LEN(data_value));
|
|
401
|
+
|
|
402
|
+
return qRegisterResourceData(NUM2INT(version), tree, name, data) ? Qtrue : Qfalse;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
static VALUE
|
|
406
|
+
q_unregister_resource_data(VALUE /*self*/, VALUE version, VALUE tree_value, VALUE name_value, VALUE data_value)
|
|
407
|
+
{
|
|
408
|
+
const unsigned char * tree = (const unsigned char *) malloc(RSTRING_LEN(tree_value));
|
|
409
|
+
memcpy((void *) tree, (const void *) RSTRING_PTR(tree_value), RSTRING_LEN(tree_value));
|
|
410
|
+
|
|
411
|
+
const unsigned char * name = (const unsigned char *) malloc(RSTRING_LEN(name_value));
|
|
412
|
+
memcpy((void *) name, (const void *) RSTRING_PTR(name_value), RSTRING_LEN(name_value));
|
|
413
|
+
|
|
414
|
+
const unsigned char * data = (const unsigned char *) malloc(RSTRING_LEN(data_value));
|
|
415
|
+
memcpy((void *) data, (const void *) RSTRING_PTR(data_value), RSTRING_LEN(data_value));
|
|
416
|
+
|
|
417
|
+
return qUnregisterResourceData(NUM2INT(version), tree, name, data) ? Qtrue : Qfalse;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
static VALUE
|
|
421
|
+
qabstract_item_model_rowcount(int argc, VALUE * argv, VALUE self)
|
|
422
|
+
{
|
|
423
|
+
smokeruby_object *o = value_obj_info(self);
|
|
424
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
425
|
+
if (argc == 0) {
|
|
426
|
+
return INT2NUM(model->rowCount());
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (argc == 1) {
|
|
430
|
+
smokeruby_object * mi = value_obj_info(argv[0]);
|
|
431
|
+
QModelIndex * modelIndex = (QModelIndex *) mi->ptr;
|
|
432
|
+
return INT2NUM(model->rowCount(*modelIndex));
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
static VALUE
|
|
439
|
+
qabstract_item_model_columncount(int argc, VALUE * argv, VALUE self)
|
|
440
|
+
{
|
|
441
|
+
smokeruby_object *o = value_obj_info(self);
|
|
442
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
443
|
+
if (argc == 0) {
|
|
444
|
+
return INT2NUM(model->columnCount());
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if (argc == 1) {
|
|
448
|
+
smokeruby_object * mi = value_obj_info(argv[0]);
|
|
449
|
+
QModelIndex * modelIndex = (QModelIndex *) mi->ptr;
|
|
450
|
+
return INT2NUM(model->columnCount(*modelIndex));
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
static VALUE
|
|
457
|
+
qabstract_item_model_data(int argc, VALUE * argv, VALUE self)
|
|
458
|
+
{
|
|
459
|
+
smokeruby_object * o = value_obj_info(self);
|
|
460
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
461
|
+
smokeruby_object * mi = value_obj_info(argv[0]);
|
|
462
|
+
QModelIndex * modelIndex = (QModelIndex *) mi->ptr;
|
|
463
|
+
QVariant value;
|
|
464
|
+
if (argc == 1) {
|
|
465
|
+
value = model->data(*modelIndex);
|
|
466
|
+
} else if (argc == 2) {
|
|
467
|
+
value = model->data(*modelIndex, NUM2INT(rb_funcall(argv[1], rb_intern("to_i"), 0)));
|
|
468
|
+
} else {
|
|
469
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
|
474
|
+
o->smoke,
|
|
475
|
+
o->smoke->findClass("QVariant").index,
|
|
476
|
+
new QVariant(value) );
|
|
477
|
+
return set_obj_info("Qt::Variant", result);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
static VALUE
|
|
481
|
+
qabstract_item_model_setdata(int argc, VALUE * argv, VALUE self)
|
|
482
|
+
{
|
|
483
|
+
smokeruby_object *o = value_obj_info(self);
|
|
484
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
485
|
+
smokeruby_object * mi = value_obj_info(argv[0]);
|
|
486
|
+
QModelIndex * modelIndex = (QModelIndex *) mi->ptr;
|
|
487
|
+
smokeruby_object * v = value_obj_info(argv[1]);
|
|
488
|
+
QVariant * variant = (QVariant *) v->ptr;
|
|
489
|
+
|
|
490
|
+
if (argc == 2) {
|
|
491
|
+
return (model->setData(*modelIndex, *variant) ? Qtrue : Qfalse);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (argc == 3) {
|
|
495
|
+
return (model->setData( *modelIndex,
|
|
496
|
+
*variant,
|
|
497
|
+
NUM2INT(rb_funcall(argv[2], rb_intern("to_i"), 0)) ) ? Qtrue : Qfalse);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
static VALUE
|
|
504
|
+
qabstract_item_model_flags(VALUE self, VALUE model_index)
|
|
505
|
+
{
|
|
506
|
+
smokeruby_object *o = value_obj_info(self);
|
|
507
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
508
|
+
smokeruby_object * mi = value_obj_info(model_index);
|
|
509
|
+
const QModelIndex * modelIndex = (const QModelIndex *) mi->ptr;
|
|
510
|
+
return INT2NUM((int) model->flags(*modelIndex));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
static VALUE
|
|
514
|
+
qabstract_item_model_insertrows(int argc, VALUE * argv, VALUE self)
|
|
515
|
+
{
|
|
516
|
+
smokeruby_object *o = value_obj_info(self);
|
|
517
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
518
|
+
|
|
519
|
+
if (argc == 2) {
|
|
520
|
+
return (model->insertRows(NUM2INT(argv[0]), NUM2INT(argv[1])) ? Qtrue : Qfalse);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (argc == 3) {
|
|
524
|
+
smokeruby_object * mi = value_obj_info(argv[2]);
|
|
525
|
+
const QModelIndex * modelIndex = (const QModelIndex *) mi->ptr;
|
|
526
|
+
return (model->insertRows(NUM2INT(argv[0]), NUM2INT(argv[1]), *modelIndex) ? Qtrue : Qfalse);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
static VALUE
|
|
533
|
+
qabstract_item_model_insertcolumns(int argc, VALUE * argv, VALUE self)
|
|
534
|
+
{
|
|
535
|
+
smokeruby_object *o = value_obj_info(self);
|
|
536
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
537
|
+
|
|
538
|
+
if (argc == 2) {
|
|
539
|
+
return (model->insertColumns(NUM2INT(argv[0]), NUM2INT(argv[1])) ? Qtrue : Qfalse);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (argc == 3) {
|
|
543
|
+
smokeruby_object * mi = value_obj_info(argv[2]);
|
|
544
|
+
const QModelIndex * modelIndex = (const QModelIndex *) mi->ptr;
|
|
545
|
+
return (model->insertColumns(NUM2INT(argv[0]), NUM2INT(argv[1]), *modelIndex) ? Qtrue : Qfalse);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
static VALUE
|
|
552
|
+
qabstract_item_model_removerows(int argc, VALUE * argv, VALUE self)
|
|
553
|
+
{
|
|
554
|
+
smokeruby_object *o = value_obj_info(self);
|
|
555
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
556
|
+
|
|
557
|
+
if (argc == 2) {
|
|
558
|
+
return (model->removeRows(NUM2INT(argv[0]), NUM2INT(argv[1])) ? Qtrue : Qfalse);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (argc == 3) {
|
|
562
|
+
smokeruby_object * mi = value_obj_info(argv[2]);
|
|
563
|
+
const QModelIndex * modelIndex = (const QModelIndex *) mi->ptr;
|
|
564
|
+
return (model->removeRows(NUM2INT(argv[0]), NUM2INT(argv[1]), *modelIndex) ? Qtrue : Qfalse);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
static VALUE
|
|
571
|
+
qabstract_item_model_removecolumns(int argc, VALUE * argv, VALUE self)
|
|
572
|
+
{
|
|
573
|
+
smokeruby_object *o = value_obj_info(self);
|
|
574
|
+
QAbstractItemModel * model = (QAbstractItemModel *) o->ptr;
|
|
575
|
+
|
|
576
|
+
if (argc == 2) {
|
|
577
|
+
return (model->removeColumns(NUM2INT(argv[0]), NUM2INT(argv[1])) ? Qtrue : Qfalse);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (argc == 3) {
|
|
581
|
+
smokeruby_object * mi = value_obj_info(argv[2]);
|
|
582
|
+
const QModelIndex * modelIndex = (const QModelIndex *) mi->ptr;
|
|
583
|
+
return (model->removeRows(NUM2INT(argv[0]), NUM2INT(argv[1]), *modelIndex) ? Qtrue : Qfalse);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// There is a QByteArray operator method in the Smoke lib that takes a QString
|
|
590
|
+
// arg and returns a QString. This is normally the desired behaviour, so
|
|
591
|
+
// special case a '+' method here.
|
|
592
|
+
static VALUE
|
|
593
|
+
qbytearray_append(VALUE self, VALUE str)
|
|
594
|
+
{
|
|
595
|
+
smokeruby_object *o = value_obj_info(self);
|
|
596
|
+
QByteArray * bytes = (QByteArray *) o->ptr;
|
|
597
|
+
(*bytes) += (const char *) StringValuePtr(str);
|
|
598
|
+
return self;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
static VALUE
|
|
602
|
+
qbytearray_data(VALUE self)
|
|
603
|
+
{
|
|
604
|
+
smokeruby_object *o = value_obj_info(self);
|
|
605
|
+
QByteArray * bytes = (QByteArray *) o->ptr;
|
|
606
|
+
return rb_str_new(bytes->data(), bytes->size());
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
static VALUE
|
|
610
|
+
qimage_bits(VALUE self)
|
|
611
|
+
{
|
|
612
|
+
smokeruby_object *o = value_obj_info(self);
|
|
613
|
+
QImage * image = static_cast<QImage *>(o->ptr);
|
|
614
|
+
const uchar * bytes = image->bits();
|
|
615
|
+
return rb_str_new((const char *) bytes, image->numBytes());
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
static VALUE
|
|
619
|
+
qimage_scan_line(VALUE self, VALUE ix)
|
|
620
|
+
{
|
|
621
|
+
smokeruby_object *o = value_obj_info(self);
|
|
622
|
+
QImage * image = static_cast<QImage *>(o->ptr);
|
|
623
|
+
const uchar * bytes = image->scanLine(NUM2INT(ix));
|
|
624
|
+
return rb_str_new((const char *) bytes, image->bytesPerLine());
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
#ifdef QT_QTDBUS
|
|
628
|
+
static VALUE
|
|
629
|
+
qdbusargument_endarraywrite(VALUE self)
|
|
630
|
+
{
|
|
631
|
+
smokeruby_object *o = value_obj_info(self);
|
|
632
|
+
QDBusArgument * arg = (QDBusArgument *) o->ptr;
|
|
633
|
+
arg->endArray();
|
|
634
|
+
return self;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
static VALUE
|
|
638
|
+
qdbusargument_endmapwrite(VALUE self)
|
|
639
|
+
{
|
|
640
|
+
smokeruby_object *o = value_obj_info(self);
|
|
641
|
+
QDBusArgument * arg = (QDBusArgument *) o->ptr;
|
|
642
|
+
arg->endMap();
|
|
643
|
+
return self;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
static VALUE
|
|
647
|
+
qdbusargument_endmapentrywrite(VALUE self)
|
|
648
|
+
{
|
|
649
|
+
smokeruby_object *o = value_obj_info(self);
|
|
650
|
+
QDBusArgument * arg = (QDBusArgument *) o->ptr;
|
|
651
|
+
arg->endMapEntry();
|
|
652
|
+
return self;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
static VALUE
|
|
656
|
+
qdbusargument_endstructurewrite(VALUE self)
|
|
657
|
+
{
|
|
658
|
+
smokeruby_object *o = value_obj_info(self);
|
|
659
|
+
QDBusArgument * arg = (QDBusArgument *) o->ptr;
|
|
660
|
+
arg->endStructure();
|
|
661
|
+
return self;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
#endif
|
|
665
|
+
|
|
666
|
+
// The QtRuby runtime's overloaded method resolution mechanism can't currently
|
|
667
|
+
// distinguish between Ruby Arrays containing different sort of instances.
|
|
668
|
+
// Unfortunately Qt::Painter.drawLines() and Qt::Painter.drawRects() methods can
|
|
669
|
+
// be passed a Ruby Array as an argument containing either Qt::Points or Qt::PointFs
|
|
670
|
+
// for instance. These methods need to call the correct Qt C++ methods, so special case
|
|
671
|
+
// the overload method resolution for now..
|
|
672
|
+
static VALUE
|
|
673
|
+
qpainter_drawlines(int argc, VALUE * argv, VALUE self)
|
|
674
|
+
{
|
|
675
|
+
static Smoke::Index drawlines_pointf_vector = 0;
|
|
676
|
+
static Smoke::Index drawlines_point_vector = 0;
|
|
677
|
+
static Smoke::Index drawlines_linef_vector = 0;
|
|
678
|
+
static Smoke::Index drawlines_line_vector = 0;
|
|
679
|
+
|
|
680
|
+
if (argc == 1 && TYPE(argv[0]) == T_ARRAY && RARRAY_LEN(argv[0]) > 0) {
|
|
681
|
+
if (drawlines_point_vector == 0) {
|
|
682
|
+
Smoke::ModuleIndex nameId = qtcore_Smoke->findMethodName("QPainter", "drawLines?");
|
|
683
|
+
Smoke::ModuleIndex meth = qtcore_Smoke->findMethod(qtcore_Smoke->findClass("QPainter"), nameId);
|
|
684
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
685
|
+
i = -i; // turn into ambiguousMethodList index
|
|
686
|
+
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
|
687
|
+
const char * argType = meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name;
|
|
688
|
+
|
|
689
|
+
if (qstrcmp(argType, "const QVector<QPointF>&" ) == 0) {
|
|
690
|
+
drawlines_pointf_vector = meth.smoke->ambiguousMethodList[i];
|
|
691
|
+
} else if (qstrcmp(argType, "const QVector<QPoint>&" ) == 0) {
|
|
692
|
+
drawlines_point_vector = meth.smoke->ambiguousMethodList[i];
|
|
693
|
+
} else if (qstrcmp(argType, "const QVector<QLineF>&" ) == 0) {
|
|
694
|
+
drawlines_linef_vector = meth.smoke->ambiguousMethodList[i];
|
|
695
|
+
} else if (qstrcmp(argType, "const QVector<QLine>&" ) == 0) {
|
|
696
|
+
drawlines_line_vector = meth.smoke->ambiguousMethodList[i];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
i++;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
smokeruby_object * o = value_obj_info(rb_ary_entry(argv[0], 0));
|
|
704
|
+
|
|
705
|
+
if (qstrcmp(o->smoke->classes[o->classId].className, "QPointF") == 0) {
|
|
706
|
+
_current_method.smoke = qtcore_Smoke;
|
|
707
|
+
_current_method.index = drawlines_pointf_vector;
|
|
708
|
+
} else if (qstrcmp(o->smoke->classes[o->classId].className, "QPoint") == 0) {
|
|
709
|
+
_current_method.smoke = qtcore_Smoke;
|
|
710
|
+
_current_method.index = drawlines_point_vector;
|
|
711
|
+
} else if (qstrcmp(o->smoke->classes[o->classId].className, "QLineF") == 0) {
|
|
712
|
+
_current_method.smoke = qtcore_Smoke;
|
|
713
|
+
_current_method.index = drawlines_linef_vector;
|
|
714
|
+
} else if (qstrcmp(o->smoke->classes[o->classId].className, "QLine") == 0) {
|
|
715
|
+
_current_method.smoke = qtcore_Smoke;
|
|
716
|
+
_current_method.index = drawlines_line_vector;
|
|
717
|
+
} else {
|
|
718
|
+
return rb_call_super(argc, argv);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
QtRuby::MethodCall c(qtcore_Smoke, _current_method.index, self, argv, argc-1);
|
|
722
|
+
c.next();
|
|
723
|
+
return self;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
return rb_call_super(argc, argv);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
static VALUE
|
|
730
|
+
qpainter_drawrects(int argc, VALUE * argv, VALUE self)
|
|
731
|
+
{
|
|
732
|
+
static Smoke::Index drawlines_rectf_vector = 0;
|
|
733
|
+
static Smoke::Index drawlines_rect_vector = 0;
|
|
734
|
+
|
|
735
|
+
if (argc == 1 && TYPE(argv[0]) == T_ARRAY && RARRAY_LEN(argv[0]) > 0) {
|
|
736
|
+
if (drawlines_rectf_vector == 0) {
|
|
737
|
+
Smoke::ModuleIndex nameId = qtcore_Smoke->findMethodName("QPainter", "drawRects?");
|
|
738
|
+
Smoke::ModuleIndex meth = qtcore_Smoke->findMethod(qtcore_Smoke->findClass("QPainter"), nameId);
|
|
739
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
740
|
+
i = -i; // turn into ambiguousMethodList index
|
|
741
|
+
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
|
742
|
+
const char * argType = meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name;
|
|
743
|
+
|
|
744
|
+
if (qstrcmp(argType, "const QVector<QRectF>&" ) == 0) {
|
|
745
|
+
drawlines_rectf_vector = meth.smoke->ambiguousMethodList[i];
|
|
746
|
+
} else if (qstrcmp(argType, "const QVector<QRect>&" ) == 0) {
|
|
747
|
+
drawlines_rect_vector = meth.smoke->ambiguousMethodList[i];
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
i++;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
smokeruby_object * o = value_obj_info(rb_ary_entry(argv[0], 0));
|
|
755
|
+
|
|
756
|
+
if (qstrcmp(o->smoke->classes[o->classId].className, "QRectF") == 0) {
|
|
757
|
+
_current_method.smoke = qtcore_Smoke;
|
|
758
|
+
_current_method.index = drawlines_rectf_vector;
|
|
759
|
+
} else if (qstrcmp(o->smoke->classes[o->classId].className, "QRect") == 0) {
|
|
760
|
+
_current_method.smoke = qtcore_Smoke;
|
|
761
|
+
_current_method.index = drawlines_rect_vector;
|
|
762
|
+
} else {
|
|
763
|
+
return rb_call_super(argc, argv);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
QtRuby::MethodCall c(qtcore_Smoke, _current_method.index, self, argv, argc-1);
|
|
767
|
+
c.next();
|
|
768
|
+
return self;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
return rb_call_super(argc, argv);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
static VALUE
|
|
775
|
+
qabstractitemmodel_createindex(int argc, VALUE * argv, VALUE self)
|
|
776
|
+
{
|
|
777
|
+
if (argc == 2 || argc == 3) {
|
|
778
|
+
smokeruby_object * o = value_obj_info(self);
|
|
779
|
+
Smoke::ModuleIndex nameId = o->smoke->idMethodName("createIndex$$$");
|
|
780
|
+
Smoke::ModuleIndex meth = o->smoke->findMethod(qtcore_Smoke->findClass("QAbstractItemModel"), nameId);
|
|
781
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
782
|
+
i = -i; // turn into ambiguousMethodList index
|
|
783
|
+
while (o->smoke->ambiguousMethodList[i] != 0) {
|
|
784
|
+
if ( qstrcmp( o->smoke->types[o->smoke->argumentList[o->smoke->methods[o->smoke->ambiguousMethodList[i]].args + 2]].name,
|
|
785
|
+
"void*" ) == 0 )
|
|
786
|
+
{
|
|
787
|
+
const Smoke::Method &m = o->smoke->methods[o->smoke->ambiguousMethodList[i]];
|
|
788
|
+
Smoke::ClassFn fn = o->smoke->classes[m.classId].classFn;
|
|
789
|
+
Smoke::StackItem stack[4];
|
|
790
|
+
stack[1].s_int = NUM2INT(argv[0]);
|
|
791
|
+
stack[2].s_int = NUM2INT(argv[1]);
|
|
792
|
+
if (argc == 2) {
|
|
793
|
+
stack[3].s_voidp = (void*) Qnil;
|
|
794
|
+
} else {
|
|
795
|
+
stack[3].s_voidp = (void*) argv[2];
|
|
796
|
+
}
|
|
797
|
+
(*fn)(m.method, o->ptr, stack);
|
|
798
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
|
799
|
+
o->smoke,
|
|
800
|
+
o->smoke->idClass("QModelIndex").index,
|
|
801
|
+
stack[0].s_voidp );
|
|
802
|
+
|
|
803
|
+
return set_obj_info("Qt::ModelIndex", result);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
i++;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
return rb_call_super(argc, argv);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
#if QT_VERSION >= 0x040600
|
|
814
|
+
// copy the role names defined on the model instance into a ruby hash and return it
|
|
815
|
+
static VALUE
|
|
816
|
+
qabstractitemmodel_rolenames(int argc, VALUE * argv, VALUE self)
|
|
817
|
+
{
|
|
818
|
+
smokeruby_object *o = value_obj_info(self);
|
|
819
|
+
if( !o->ptr )
|
|
820
|
+
{
|
|
821
|
+
// not ok
|
|
822
|
+
rb_raise(rb_eArgError, "NULL given, expected subclass of QAbstractItemModel");
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
QAbstractItemModel* model = (QAbstractItemModel*) o->ptr;
|
|
826
|
+
|
|
827
|
+
// convert QHash<int,QByteArray> to a ruby hash
|
|
828
|
+
VALUE result = rb_hash_new();
|
|
829
|
+
QHash<int, QByteArray>::const_iterator i;
|
|
830
|
+
for( i = model->roleNames().constBegin(); i != model->roleNames().constEnd(); i++)
|
|
831
|
+
{
|
|
832
|
+
rb_hash_aset(result,
|
|
833
|
+
INT2NUM(i.key()),
|
|
834
|
+
rb_str_new2(i.value().data()));
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
return result;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// let C++ call a protected member function from outside
|
|
841
|
+
// NOTE: a little hacky, but setRoleNames is deprecated in Qt 5.0, anyway...
|
|
842
|
+
struct SetRoleNamesExposer : QAbstractItemModel {
|
|
843
|
+
using QAbstractItemModel::setRoleNames;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
// set the role names on the given model instance from the given hash
|
|
847
|
+
static VALUE
|
|
848
|
+
qabstractitemmodel_setrolenames(int argc, VALUE * argv, VALUE self)
|
|
849
|
+
{
|
|
850
|
+
if( argc != 1 || TYPE(argv[0]) != T_HASH )
|
|
851
|
+
{
|
|
852
|
+
rb_raise(rb_eArgError, "Invalid arguments");
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// convert the ruby hash to a QHash<int,QByteArray>
|
|
856
|
+
QHash<int,QByteArray> rnames;
|
|
857
|
+
VALUE tmp = rb_funcall(argv[0], rb_intern("to_a"), 0);
|
|
858
|
+
for( long i=0; i<RARRAY_LEN(tmp); i++)
|
|
859
|
+
{
|
|
860
|
+
VALUE key = rb_ary_entry(rb_ary_entry(tmp, i), 0);
|
|
861
|
+
VALUE val = rb_ary_entry(rb_ary_entry(tmp, i), 1);
|
|
862
|
+
rnames[NUM2INT(key)] = QByteArray(StringValuePtr(val));
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
smokeruby_object *o = value_obj_info(self);
|
|
866
|
+
if( !o->ptr )
|
|
867
|
+
{
|
|
868
|
+
// not ok
|
|
869
|
+
rb_raise(rb_eArgError, "NULL given, expected subclass of QAbstractItemModel");
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
QAbstractItemModel* model = (QAbstractItemModel*) o->ptr;
|
|
873
|
+
(model->*&SetRoleNamesExposer::setRoleNames)(rnames); // just a little hacky, since
|
|
874
|
+
// 'setRoleNames' is protected
|
|
875
|
+
|
|
876
|
+
return Qnil;
|
|
877
|
+
}
|
|
878
|
+
#endif
|
|
879
|
+
|
|
880
|
+
static VALUE
|
|
881
|
+
qmodelindex_internalpointer(VALUE self)
|
|
882
|
+
{
|
|
883
|
+
smokeruby_object *o = value_obj_info(self);
|
|
884
|
+
QModelIndex * index = (QModelIndex *) o->ptr;
|
|
885
|
+
void * ptr = index->internalPointer();
|
|
886
|
+
return ptr != 0 ? (VALUE) ptr : Qnil;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
static VALUE
|
|
890
|
+
qitemselection_at(VALUE self, VALUE i)
|
|
891
|
+
{
|
|
892
|
+
smokeruby_object *o = value_obj_info(self);
|
|
893
|
+
QItemSelection * item = (QItemSelection *) o->ptr;
|
|
894
|
+
QItemSelectionRange range = item->at(NUM2INT(i));
|
|
895
|
+
|
|
896
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
|
897
|
+
o->smoke,
|
|
898
|
+
o->smoke->idClass("QItemSelectionRange").index,
|
|
899
|
+
new QItemSelectionRange(range) );
|
|
900
|
+
|
|
901
|
+
return set_obj_info("Qt::ItemSelectionRange", result);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
static VALUE
|
|
905
|
+
qitemselection_count(VALUE self)
|
|
906
|
+
{
|
|
907
|
+
smokeruby_object *o = value_obj_info(self);
|
|
908
|
+
QItemSelection * item = (QItemSelection *) o->ptr;
|
|
909
|
+
return INT2NUM(item->count());
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
static VALUE
|
|
913
|
+
qpolygon_at(VALUE self, VALUE i)
|
|
914
|
+
{
|
|
915
|
+
smokeruby_object *o = value_obj_info(self);
|
|
916
|
+
QPolygon * item = (QPolygon *) o->ptr;
|
|
917
|
+
QPoint point = item->at(NUM2INT(i));
|
|
918
|
+
|
|
919
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
|
920
|
+
qtcore_Smoke,
|
|
921
|
+
qtcore_Smoke->idClass("QPoint").index,
|
|
922
|
+
new QPoint(point) );
|
|
923
|
+
|
|
924
|
+
return set_obj_info("Qt::Point", result);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
static VALUE
|
|
928
|
+
qpolygon_count(VALUE self)
|
|
929
|
+
{
|
|
930
|
+
smokeruby_object *o = value_obj_info(self);
|
|
931
|
+
QPolygon * item = (QPolygon *) o->ptr;
|
|
932
|
+
return INT2NUM(item->count());
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
static VALUE
|
|
936
|
+
qpolygonf_at(VALUE self, VALUE i)
|
|
937
|
+
{
|
|
938
|
+
smokeruby_object *o = value_obj_info(self);
|
|
939
|
+
QPolygonF * item = (QPolygonF *) o->ptr;
|
|
940
|
+
QPointF point = item->at(NUM2INT(i));
|
|
941
|
+
|
|
942
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
|
943
|
+
qtcore_Smoke,
|
|
944
|
+
qtcore_Smoke->idClass("QPointF").index,
|
|
945
|
+
new QPointF(point) );
|
|
946
|
+
|
|
947
|
+
return set_obj_info("Qt::PointF", result);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
static VALUE
|
|
951
|
+
qpolygonf_count(VALUE self)
|
|
952
|
+
{
|
|
953
|
+
smokeruby_object *o = value_obj_info(self);
|
|
954
|
+
QPolygonF * item = (QPolygonF *) o->ptr;
|
|
955
|
+
return INT2NUM(item->count());
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
static VALUE
|
|
959
|
+
metaObject(VALUE self)
|
|
960
|
+
{
|
|
961
|
+
VALUE metaObject = rb_funcall(qt_internal_module, rb_intern("getMetaObject"), 2, Qnil, self);
|
|
962
|
+
return metaObject;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/* This shouldn't be needed, but kalyptus doesn't generate a staticMetaObject
|
|
966
|
+
method for QObject::staticMetaObject, although it does for all the other
|
|
967
|
+
classes, and it isn't obvious what the problem with it is.
|
|
968
|
+
So add this as a hack to work round the bug.
|
|
969
|
+
*/
|
|
970
|
+
static VALUE
|
|
971
|
+
qobject_staticmetaobject(VALUE /*klass*/)
|
|
972
|
+
{
|
|
973
|
+
QMetaObject * meta = new QMetaObject(QObject::staticMetaObject);
|
|
974
|
+
|
|
975
|
+
smokeruby_object * m = alloc_smokeruby_object( true,
|
|
976
|
+
qtcore_Smoke,
|
|
977
|
+
qtcore_Smoke->idClass("QMetaObject").index,
|
|
978
|
+
meta );
|
|
979
|
+
|
|
980
|
+
VALUE obj = set_obj_info("Qt::MetaObject", m);
|
|
981
|
+
return obj;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
static VALUE
|
|
985
|
+
cast_object_to(VALUE /*self*/, VALUE object, VALUE new_klass)
|
|
986
|
+
{
|
|
987
|
+
smokeruby_object *o = value_obj_info(object);
|
|
988
|
+
|
|
989
|
+
VALUE new_klassname = rb_funcall(new_klass, rb_intern("name"), 0);
|
|
990
|
+
|
|
991
|
+
Smoke::ModuleIndex * cast_to_id = classcache.value(StringValuePtr(new_klassname));
|
|
992
|
+
if (cast_to_id == 0) {
|
|
993
|
+
rb_raise(rb_eArgError, "unable to find class \"%s\" to cast to\n", StringValuePtr(new_klassname));
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
smokeruby_object * o_cast = alloc_smokeruby_object(o->allocated,
|
|
997
|
+
cast_to_id->smoke,
|
|
998
|
+
(int) cast_to_id->index,
|
|
999
|
+
o->smoke->cast(o->ptr, o->classId, (int) cast_to_id->index) );
|
|
1000
|
+
|
|
1001
|
+
VALUE obj = Data_Wrap_Struct(new_klass, smokeruby_mark, smokeruby_free, (void *) o_cast);
|
|
1002
|
+
mapPointer(obj, o_cast, o_cast->classId, 0);
|
|
1003
|
+
return obj;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
static VALUE
|
|
1007
|
+
qobject_qt_metacast(VALUE self, VALUE klass)
|
|
1008
|
+
{
|
|
1009
|
+
smokeruby_object *o = value_obj_info(self);
|
|
1010
|
+
if (o == 0 || o->ptr == 0) {
|
|
1011
|
+
return Qnil;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
const char * classname = rb_class2name(klass);
|
|
1015
|
+
Smoke::ModuleIndex * mi = classcache.value(classname);
|
|
1016
|
+
if (mi == 0) {
|
|
1017
|
+
return Qnil;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
QObject* qobj = (QObject*) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
1021
|
+
if (qobj == 0) {
|
|
1022
|
+
return Qnil;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
void* ret = qobj->qt_metacast(mi->smoke->classes[mi->index].className);
|
|
1026
|
+
|
|
1027
|
+
if (ret == 0) {
|
|
1028
|
+
return Qnil;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
smokeruby_object * o_cast = alloc_smokeruby_object( o->allocated,
|
|
1032
|
+
mi->smoke,
|
|
1033
|
+
(int) mi->index,
|
|
1034
|
+
ret );
|
|
1035
|
+
|
|
1036
|
+
VALUE obj = Data_Wrap_Struct(klass, smokeruby_mark, smokeruby_free, (void *) o_cast);
|
|
1037
|
+
mapPointer(obj, o_cast, o_cast->classId, 0);
|
|
1038
|
+
return obj;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
static VALUE
|
|
1042
|
+
qsignalmapper_mapping(int argc, VALUE * argv, VALUE self)
|
|
1043
|
+
{
|
|
1044
|
+
if (argc == 1 && TYPE(argv[0]) == T_DATA) {
|
|
1045
|
+
smokeruby_object *o = value_obj_info(self);
|
|
1046
|
+
smokeruby_object *a = value_obj_info(argv[0]);
|
|
1047
|
+
|
|
1048
|
+
Smoke::ModuleIndex nameId = Smoke::NullModuleIndex;
|
|
1049
|
+
nameId = o->smoke->idMethodName("mapping#");
|
|
1050
|
+
Smoke::ModuleIndex ci(o->smoke, o->classId);
|
|
1051
|
+
Smoke::ModuleIndex meth = o->smoke->findMethod(ci, nameId);
|
|
1052
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
1053
|
+
i = -i; // turn into ambiguousMethodList index
|
|
1054
|
+
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
|
1055
|
+
if ((qstrcmp(meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name, "QObject*" ) == 0
|
|
1056
|
+
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QObject")
|
|
1057
|
+
&& !Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") )
|
|
1058
|
+
|| (qstrcmp(meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name, "QWidget*" ) == 0
|
|
1059
|
+
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") ) )
|
|
1060
|
+
{
|
|
1061
|
+
_current_method.smoke = meth.smoke;
|
|
1062
|
+
_current_method.index = meth.smoke->ambiguousMethodList[i];
|
|
1063
|
+
QtRuby::MethodCall c(meth.smoke, _current_method.index, self, argv, 1);
|
|
1064
|
+
c.next();
|
|
1065
|
+
return *(c.var());
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
i++;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
return rb_call_super(argc, argv);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
static VALUE
|
|
1076
|
+
qsignalmapper_set_mapping(int argc, VALUE * argv, VALUE self)
|
|
1077
|
+
{
|
|
1078
|
+
if (argc == 2 && TYPE(argv[0]) == T_DATA && TYPE(argv[1]) == T_DATA) {
|
|
1079
|
+
smokeruby_object *o = value_obj_info(self);
|
|
1080
|
+
smokeruby_object *a = value_obj_info(argv[1]);
|
|
1081
|
+
|
|
1082
|
+
Smoke::ModuleIndex nameId = Smoke::NullModuleIndex;
|
|
1083
|
+
nameId = o->smoke->idMethodName("setMapping##");
|
|
1084
|
+
Smoke::ModuleIndex ci(o->smoke, o->classId);
|
|
1085
|
+
Smoke::ModuleIndex meth = o->smoke->findMethod(ci, nameId);
|
|
1086
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
1087
|
+
i = -i; // turn into ambiguousMethodList index
|
|
1088
|
+
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
|
1089
|
+
if ((qstrcmp(meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args + 1]].name, "QObject*" ) == 0
|
|
1090
|
+
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QObject")
|
|
1091
|
+
&& !Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") )
|
|
1092
|
+
|| (qstrcmp(meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args + 1]].name, "QWidget*" ) == 0
|
|
1093
|
+
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") ) )
|
|
1094
|
+
{
|
|
1095
|
+
_current_method.smoke = meth.smoke;
|
|
1096
|
+
_current_method.index = meth.smoke->ambiguousMethodList[i];
|
|
1097
|
+
QtRuby::MethodCall c(meth.smoke, _current_method.index, self, argv, 2);
|
|
1098
|
+
c.next();
|
|
1099
|
+
return *(c.var());
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
i++;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
return rb_call_super(argc, argv);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
static int rObject_typeId;
|
|
1110
|
+
|
|
1111
|
+
// QMetaType helpers
|
|
1112
|
+
static void delete_ruby_object(void *ptr)
|
|
1113
|
+
{
|
|
1114
|
+
rb_gc_unregister_address((VALUE*) ptr);
|
|
1115
|
+
delete (VALUE*) ptr;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
static void *create_ruby_object(const void *copyFrom)
|
|
1119
|
+
{
|
|
1120
|
+
VALUE *object;
|
|
1121
|
+
|
|
1122
|
+
if (copyFrom) {
|
|
1123
|
+
object = new VALUE(*(VALUE*) copyFrom);
|
|
1124
|
+
} else {
|
|
1125
|
+
object = new VALUE(Qnil);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
rb_gc_register_address(object);
|
|
1129
|
+
return object;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
static VALUE
|
|
1133
|
+
qvariant_value(VALUE /*self*/, VALUE variant_value_klass, VALUE variant_value)
|
|
1134
|
+
{
|
|
1135
|
+
void * value_ptr = 0;
|
|
1136
|
+
VALUE result = Qnil;
|
|
1137
|
+
smokeruby_object * vo = 0;
|
|
1138
|
+
|
|
1139
|
+
smokeruby_object *o = value_obj_info(variant_value);
|
|
1140
|
+
if (o == 0 || o->ptr == 0) {
|
|
1141
|
+
return Qnil;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
QVariant * variant = (QVariant*) o->ptr;
|
|
1145
|
+
|
|
1146
|
+
if (variant->userType() == rObject_typeId) {
|
|
1147
|
+
return *(VALUE*) variant->data();
|
|
1148
|
+
#ifdef QT_QTDBUS
|
|
1149
|
+
} else if (variant->userType() == qMetaTypeId<QDBusObjectPath>()) {
|
|
1150
|
+
QString s = qVariantValue<QDBusObjectPath>(*variant).path();
|
|
1151
|
+
return rb_str_new2(s.toLatin1());
|
|
1152
|
+
} else if (variant->userType() == qMetaTypeId<QDBusSignature>()) {
|
|
1153
|
+
QString s = qVariantValue<QDBusSignature>(*variant).signature();
|
|
1154
|
+
return rb_str_new2(s.toLatin1());
|
|
1155
|
+
} else if (variant->userType() == qMetaTypeId<QDBusVariant>()) {
|
|
1156
|
+
QVariant *ptr = new QVariant(qVariantValue<QDBusVariant>(*variant).variant());
|
|
1157
|
+
vo = alloc_smokeruby_object(true, qtcore_Smoke, qtcore_Smoke->idClass("QVariant").index, ptr);
|
|
1158
|
+
return set_obj_info("Qt::Variant", vo);
|
|
1159
|
+
#endif
|
|
1160
|
+
} else if (variant->type() >= QVariant::UserType) {
|
|
1161
|
+
// If the QVariant contains a user type, don't bother to look at the Ruby class argument
|
|
1162
|
+
value_ptr = QMetaType::construct(QMetaType::type(variant->typeName()), (void *) variant->constData());
|
|
1163
|
+
Smoke::ModuleIndex mi = o->smoke->findClass(variant->typeName());
|
|
1164
|
+
vo = alloc_smokeruby_object(true, mi.smoke, mi.index, value_ptr);
|
|
1165
|
+
return set_obj_info(qtruby_modules[mi.smoke].binding->className(mi.index), vo);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
const char * classname = rb_class2name(variant_value_klass);
|
|
1169
|
+
Smoke::ModuleIndex * value_class_id = classcache.value(classname);
|
|
1170
|
+
if (value_class_id == 0) {
|
|
1171
|
+
return Qnil;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
if (qstrcmp(classname, "Qt::Pixmap") == 0) {
|
|
1175
|
+
QPixmap v = qVariantValue<QPixmap>(*variant);
|
|
1176
|
+
value_ptr = (void *) new QPixmap(v);
|
|
1177
|
+
} else if (qstrcmp(classname, "Qt::Font") == 0) {
|
|
1178
|
+
QFont v = qVariantValue<QFont>(*variant);
|
|
1179
|
+
value_ptr = (void *) new QFont(v);
|
|
1180
|
+
} else if (qstrcmp(classname, "Qt::Brush") == 0) {
|
|
1181
|
+
QBrush v = qVariantValue<QBrush>(*variant);
|
|
1182
|
+
value_ptr = (void *) new QBrush(v);
|
|
1183
|
+
} else if (qstrcmp(classname, "Qt::Color") == 0) {
|
|
1184
|
+
QColor v = qVariantValue<QColor>(*variant);
|
|
1185
|
+
value_ptr = (void *) new QColor(v);
|
|
1186
|
+
} else if (qstrcmp(classname, "Qt::Palette") == 0) {
|
|
1187
|
+
QPalette v = qVariantValue<QPalette>(*variant);
|
|
1188
|
+
value_ptr = (void *) new QPalette(v);
|
|
1189
|
+
} else if (qstrcmp(classname, "Qt::Icon") == 0) {
|
|
1190
|
+
QIcon v = qVariantValue<QIcon>(*variant);
|
|
1191
|
+
value_ptr = (void *) new QIcon(v);
|
|
1192
|
+
} else if (qstrcmp(classname, "Qt::Image") == 0) {
|
|
1193
|
+
QImage v = qVariantValue<QImage>(*variant);
|
|
1194
|
+
value_ptr = (void *) new QImage(v);
|
|
1195
|
+
} else if (qstrcmp(classname, "Qt::Polygon") == 0) {
|
|
1196
|
+
QPolygon v = qVariantValue<QPolygon>(*variant);
|
|
1197
|
+
value_ptr = (void *) new QPolygon(v);
|
|
1198
|
+
} else if (qstrcmp(classname, "Qt::Region") == 0) {
|
|
1199
|
+
QRegion v = qVariantValue<QRegion>(*variant);
|
|
1200
|
+
value_ptr = (void *) new QRegion(v);
|
|
1201
|
+
} else if (qstrcmp(classname, "Qt::Bitmap") == 0) {
|
|
1202
|
+
QBitmap v = qVariantValue<QBitmap>(*variant);
|
|
1203
|
+
value_ptr = (void *) new QBitmap(v);
|
|
1204
|
+
} else if (qstrcmp(classname, "Qt::Cursor") == 0) {
|
|
1205
|
+
QCursor v = qVariantValue<QCursor>(*variant);
|
|
1206
|
+
value_ptr = (void *) new QCursor(v);
|
|
1207
|
+
} else if (qstrcmp(classname, "Qt::SizePolicy") == 0) {
|
|
1208
|
+
QSizePolicy v = qVariantValue<QSizePolicy>(*variant);
|
|
1209
|
+
value_ptr = (void *) new QSizePolicy(v);
|
|
1210
|
+
} else if (qstrcmp(classname, "Qt::KeySequence") == 0) {
|
|
1211
|
+
QKeySequence v = qVariantValue<QKeySequence>(*variant);
|
|
1212
|
+
value_ptr = (void *) new QKeySequence(v);
|
|
1213
|
+
} else if (qstrcmp(classname, "Qt::Pen") == 0) {
|
|
1214
|
+
QPen v = qVariantValue<QPen>(*variant);
|
|
1215
|
+
value_ptr = (void *) new QPen(v);
|
|
1216
|
+
} else if (qstrcmp(classname, "Qt::TextLength") == 0) {
|
|
1217
|
+
QTextLength v = qVariantValue<QTextLength>(*variant);
|
|
1218
|
+
value_ptr = (void *) new QTextLength(v);
|
|
1219
|
+
} else if (qstrcmp(classname, "Qt::TextFormat") == 0) {
|
|
1220
|
+
QTextFormat v = qVariantValue<QTextFormat>(*variant);
|
|
1221
|
+
value_ptr = (void *) new QTextFormat(v);
|
|
1222
|
+
} else if (qstrcmp(classname, "Qt::Variant") == 0) {
|
|
1223
|
+
value_ptr = (void *) new QVariant(*((QVariant *) variant->constData()));
|
|
1224
|
+
} else {
|
|
1225
|
+
// Assume the value of the Qt::Variant can be obtained
|
|
1226
|
+
// with a call such as Qt::Variant.toPoint()
|
|
1227
|
+
QByteArray toValueMethodName(classname);
|
|
1228
|
+
if (toValueMethodName.startsWith("Qt::")) {
|
|
1229
|
+
toValueMethodName.remove(0, strlen("Qt::"));
|
|
1230
|
+
}
|
|
1231
|
+
toValueMethodName.prepend("to");
|
|
1232
|
+
return rb_funcall(variant_value, rb_intern(toValueMethodName), 1, variant_value);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
vo = alloc_smokeruby_object(true, value_class_id->smoke, value_class_id->index, value_ptr);
|
|
1236
|
+
result = set_obj_info(classname, vo);
|
|
1237
|
+
|
|
1238
|
+
return result;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
static VALUE create_qvariant_one_arg(VALUE arg)
|
|
1242
|
+
{
|
|
1243
|
+
return rb_funcall(qvariant_class, rb_intern("new"), 1, arg);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
static VALUE
|
|
1247
|
+
qvariant_from_value(int argc, VALUE * argv, VALUE self)
|
|
1248
|
+
{
|
|
1249
|
+
if (argc == 2) {
|
|
1250
|
+
Smoke::ModuleIndex nameId = Smoke::NullModuleIndex;
|
|
1251
|
+
const char *typeName = StringValuePtr(argv[1]);
|
|
1252
|
+
|
|
1253
|
+
if (TYPE(argv[0]) == T_DATA) {
|
|
1254
|
+
nameId = qtcore_Smoke->idMethodName("QVariant#");
|
|
1255
|
+
} else if (TYPE(argv[0]) == T_ARRAY || qstrcmp(typeName, "long long") == 0 || qstrcmp(typeName, "unsigned long long") == 0) {
|
|
1256
|
+
nameId = qtcore_Smoke->idMethodName("QVariant?");
|
|
1257
|
+
} else {
|
|
1258
|
+
nameId = qtcore_Smoke->idMethodName("QVariant$");
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
Smoke::ModuleIndex meth = qtcore_Smoke->findMethod(qtcore_Smoke->idClass("QVariant"), nameId);
|
|
1262
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
1263
|
+
i = -i; // turn into ambiguousMethodList index
|
|
1264
|
+
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
|
1265
|
+
if (qstrcmp(meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name, typeName ) == 0 )
|
|
1266
|
+
{
|
|
1267
|
+
_current_method.smoke = meth.smoke;
|
|
1268
|
+
_current_method.index = meth.smoke->ambiguousMethodList[i];
|
|
1269
|
+
QtRuby::MethodCall c(meth.smoke, _current_method.index, self, argv, 0);
|
|
1270
|
+
c.next();
|
|
1271
|
+
return *(c.var());
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
i++;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
if(do_debug & qtdb_gc) printf("No suitable method for signature QVariant::QVariant(%s) found - looking for another suitable constructor\n", StringValuePtr(argv[1]));
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
QVariant * v = 0;
|
|
1281
|
+
|
|
1282
|
+
const char * classname = rb_obj_classname(argv[0]);
|
|
1283
|
+
smokeruby_object *o = value_obj_info(argv[0]);
|
|
1284
|
+
int type = 0;
|
|
1285
|
+
|
|
1286
|
+
if (qstrcmp(classname, "Qt::Enum") == 0) {
|
|
1287
|
+
return rb_funcall(qvariant_class, rb_intern("new"), 1, rb_funcall(argv[0], rb_intern("to_i"), 0));
|
|
1288
|
+
} else if (o && o->ptr && (type = QVariant::nameToType(o->smoke->className(o->classId)))) {
|
|
1289
|
+
v = new QVariant(type, o->ptr);
|
|
1290
|
+
} else {
|
|
1291
|
+
int error = 0;
|
|
1292
|
+
VALUE result = rb_protect(&create_qvariant_one_arg, argv[0], &error);
|
|
1293
|
+
if (!error) {
|
|
1294
|
+
return result;
|
|
1295
|
+
} else {
|
|
1296
|
+
VALUE lasterr = rb_gv_get("$!");
|
|
1297
|
+
VALUE klass = rb_class_name(CLASS_OF(lasterr));
|
|
1298
|
+
if (qstrcmp(StringValuePtr(klass), "ArgumentError") == 0) {
|
|
1299
|
+
// ArgumentError - no suitable constructor found
|
|
1300
|
+
// Create a QVariant that contains an rObject
|
|
1301
|
+
v = new QVariant(rObject_typeId, &argv[0]);
|
|
1302
|
+
} else {
|
|
1303
|
+
rb_raise(lasterr, "while creating the QVariant");
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
smokeruby_object * vo = alloc_smokeruby_object(true, qtcore_Smoke, qtcore_Smoke->idClass("QVariant").index, v);
|
|
1309
|
+
VALUE result = set_obj_info("Qt::Variant", vo);
|
|
1310
|
+
|
|
1311
|
+
return result;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
static VALUE
|
|
1315
|
+
new_qvariant(int argc, VALUE * argv, VALUE self)
|
|
1316
|
+
{
|
|
1317
|
+
static Smoke::Index new_qvariant_qlist = 0;
|
|
1318
|
+
static Smoke::Index new_qvariant_qmap = 0;
|
|
1319
|
+
|
|
1320
|
+
if (new_qvariant_qlist == 0) {
|
|
1321
|
+
Smoke::ModuleIndex nameId = qtcore_Smoke->findMethodName("Qvariant", "QVariant?");
|
|
1322
|
+
Smoke::ModuleIndex meth = qtcore_Smoke->findMethod(qtcore_Smoke->findClass("QVariant"), nameId);
|
|
1323
|
+
Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
|
|
1324
|
+
i = -i; // turn into ambiguousMethodList index
|
|
1325
|
+
while (qtcore_Smoke->ambiguousMethodList[i] != 0) {
|
|
1326
|
+
const char * argType = meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name;
|
|
1327
|
+
|
|
1328
|
+
if (qstrcmp(argType, "const QList<QVariant>&" ) == 0) {
|
|
1329
|
+
new_qvariant_qlist = meth.smoke->ambiguousMethodList[i];
|
|
1330
|
+
} else if (qstrcmp(argType, "const QMap<QString,QVariant>&" ) == 0) {
|
|
1331
|
+
new_qvariant_qmap = meth.smoke->ambiguousMethodList[i];
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
i++;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
if (argc == 1 && TYPE(argv[0]) == T_HASH) {
|
|
1339
|
+
_current_method.smoke = qtcore_Smoke;
|
|
1340
|
+
_current_method.index = new_qvariant_qmap;
|
|
1341
|
+
QtRuby::MethodCall c(qtcore_Smoke, _current_method.index, self, argv, argc-1);
|
|
1342
|
+
c.next();
|
|
1343
|
+
return *(c.var());
|
|
1344
|
+
} else if ( argc == 1
|
|
1345
|
+
&& TYPE(argv[0]) == T_ARRAY
|
|
1346
|
+
&& RARRAY_LEN(argv[0]) > 0
|
|
1347
|
+
&& TYPE(rb_ary_entry(argv[0], 0)) != T_STRING )
|
|
1348
|
+
{
|
|
1349
|
+
_current_method.smoke = qtcore_Smoke;
|
|
1350
|
+
_current_method.index = new_qvariant_qlist;
|
|
1351
|
+
QtRuby::MethodCall c(qtcore_Smoke, _current_method.index, self, argv, argc-1);
|
|
1352
|
+
c.next();
|
|
1353
|
+
return *(c.var());
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
return rb_call_super(argc, argv);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
static VALUE module_method_missing(int argc, VALUE * argv, VALUE klass)
|
|
1360
|
+
{
|
|
1361
|
+
return class_method_missing(argc, argv, klass);
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/*
|
|
1365
|
+
|
|
1366
|
+
class LCDRange < Qt::Widget
|
|
1367
|
+
|
|
1368
|
+
def initialize(s, parent, name)
|
|
1369
|
+
super(parent, name)
|
|
1370
|
+
init()
|
|
1371
|
+
...
|
|
1372
|
+
|
|
1373
|
+
For a case such as the above, the QWidget can't be instantiated until
|
|
1374
|
+
the initializer has been run up to the point where 'super(parent, name)'
|
|
1375
|
+
is called. Only then, can the number and type of arguments passed to the
|
|
1376
|
+
constructor be known. However, the rest of the intializer
|
|
1377
|
+
can't be run until 'self' is a proper T_DATA object with a wrapped C++
|
|
1378
|
+
instance.
|
|
1379
|
+
|
|
1380
|
+
The solution is to run the initialize code twice. First, only up to the
|
|
1381
|
+
'super(parent, name)' call, where the QWidget would get instantiated in
|
|
1382
|
+
initialize_qt(). And then rb_throw() jumps out of the
|
|
1383
|
+
initializer returning the wrapped object as a result.
|
|
1384
|
+
|
|
1385
|
+
The second time round 'self' will be the wrapped instance of type T_DATA,
|
|
1386
|
+
so initialize() can be allowed to proceed to the end.
|
|
1387
|
+
*/
|
|
1388
|
+
static VALUE
|
|
1389
|
+
initialize_qt(int argc, VALUE * argv, VALUE self)
|
|
1390
|
+
{
|
|
1391
|
+
VALUE retval = Qnil;
|
|
1392
|
+
VALUE temp_obj;
|
|
1393
|
+
static VALUE mainThread = Qnil;
|
|
1394
|
+
if (mainThread == Qnil) {
|
|
1395
|
+
mainThread = rb_thread_main();
|
|
1396
|
+
}
|
|
1397
|
+
if (TYPE(self) == T_DATA) {
|
|
1398
|
+
// If a ruby block was passed then run that now
|
|
1399
|
+
if (rb_block_given_p()) {
|
|
1400
|
+
rb_funcall(qt_internal_module, rb_intern("run_initializer_block"), 2, self, rb_block_proc());
|
|
1401
|
+
}
|
|
1402
|
+
return self;
|
|
1403
|
+
} else {
|
|
1404
|
+
if (rb_thread_current() != mainThread) {
|
|
1405
|
+
rb_raise(rb_eRuntimeError, "Qt methods cannot be called from outside of the main thread");
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
VALUE klass = rb_funcall(self, rb_intern("class"), 0);
|
|
1410
|
+
VALUE constructor_name = rb_str_new2("new");
|
|
1411
|
+
|
|
1412
|
+
VALUE * temp_stack = ALLOCA_N(VALUE, argc+4);
|
|
1413
|
+
|
|
1414
|
+
temp_stack[0] = rb_str_new2("Qt");
|
|
1415
|
+
temp_stack[1] = constructor_name;
|
|
1416
|
+
temp_stack[2] = klass;
|
|
1417
|
+
temp_stack[3] = self;
|
|
1418
|
+
|
|
1419
|
+
for (int count = 0; count < argc; count++) {
|
|
1420
|
+
temp_stack[count+4] = argv[count];
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
{
|
|
1424
|
+
QByteArray * mcid = find_cached_selector(argc+4, temp_stack, klass, rb_class2name(klass));
|
|
1425
|
+
|
|
1426
|
+
if (_current_method.index == -1) {
|
|
1427
|
+
retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+4, temp_stack);
|
|
1428
|
+
if (_current_method.index != -1) {
|
|
1429
|
+
// Success. Cache result.
|
|
1430
|
+
methcache.insert(*mcid, new Smoke::ModuleIndex(_current_method));
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
if (_current_method.index == -1) {
|
|
1436
|
+
// Another longjmp here..
|
|
1437
|
+
rb_raise(rb_eArgError, "unresolved constructor call %s\n", rb_class2name(klass));
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
{
|
|
1441
|
+
// Allocate the MethodCall within a C block. Otherwise, because the continue_new_instance()
|
|
1442
|
+
// call below will longjmp out, it wouldn't give C++ an opportunity to clean up
|
|
1443
|
+
QtRuby::MethodCall c(_current_method.smoke, _current_method.index, self, temp_stack+4, argc);
|
|
1444
|
+
c.next();
|
|
1445
|
+
temp_obj = *(c.var());
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
smokeruby_object * p = 0;
|
|
1449
|
+
Data_Get_Struct(temp_obj, smokeruby_object, p);
|
|
1450
|
+
|
|
1451
|
+
smokeruby_object * o = alloc_smokeruby_object( true,
|
|
1452
|
+
p->smoke,
|
|
1453
|
+
p->classId,
|
|
1454
|
+
p->ptr );
|
|
1455
|
+
p->ptr = 0;
|
|
1456
|
+
p->allocated = false;
|
|
1457
|
+
|
|
1458
|
+
VALUE result = Data_Wrap_Struct(klass, smokeruby_mark, smokeruby_free, o);
|
|
1459
|
+
mapObject(result, result);
|
|
1460
|
+
// Off with a longjmp, never to return..
|
|
1461
|
+
rb_throw("newqt", result);
|
|
1462
|
+
/*NOTREACHED*/
|
|
1463
|
+
return self;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
VALUE
|
|
1467
|
+
new_qt(int argc, VALUE * argv, VALUE klass)
|
|
1468
|
+
{
|
|
1469
|
+
VALUE * temp_stack = ALLOCA_N(VALUE, argc + 1);
|
|
1470
|
+
temp_stack[0] = rb_obj_alloc(klass);
|
|
1471
|
+
|
|
1472
|
+
for (int count = 0; count < argc; count++) {
|
|
1473
|
+
temp_stack[count+1] = argv[count];
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
VALUE result = rb_funcall2(qt_internal_module, rb_intern("try_initialize"), argc+1, temp_stack);
|
|
1477
|
+
rb_obj_call_init(result, argc, argv);
|
|
1478
|
+
|
|
1479
|
+
return result;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
// Returns $qApp.ARGV() - the original ARGV array with Qt command line options removed
|
|
1484
|
+
static VALUE
|
|
1485
|
+
qapplication_argv(VALUE /*self*/)
|
|
1486
|
+
{
|
|
1487
|
+
VALUE result = rb_ary_new();
|
|
1488
|
+
// Drop argv[0], as it isn't included in the ruby global ARGV
|
|
1489
|
+
for (int index = 1; index < qApp->argc(); index++) {
|
|
1490
|
+
rb_ary_push(result, rb_str_new2(qApp->argv()[index]));
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
return result;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
//----------------- Sig/Slot ------------------
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
static VALUE
|
|
1500
|
+
qt_signal(int argc, VALUE * argv, VALUE self)
|
|
1501
|
+
{
|
|
1502
|
+
smokeruby_object *o = value_obj_info(self);
|
|
1503
|
+
QObject *qobj = (QObject*)o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
1504
|
+
if (qobj->signalsBlocked()) {
|
|
1505
|
+
return Qfalse;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
#if RUBY_VERSION >= 0x20000
|
|
1509
|
+
QLatin1String signalname(rb_id2name(rb_frame_this_func()));
|
|
1510
|
+
#elif RUBY_VERSION >= 0x10900
|
|
1511
|
+
QLatin1String signalname(rb_id2name(rb_frame_callee()));
|
|
1512
|
+
#else
|
|
1513
|
+
QLatin1String signalname(rb_id2name(rb_frame_last_func()));
|
|
1514
|
+
#endif
|
|
1515
|
+
|
|
1516
|
+
VALUE metaObject_value = rb_funcall(qt_internal_module, rb_intern("getMetaObject"), 2, Qnil, self);
|
|
1517
|
+
|
|
1518
|
+
smokeruby_object *ometa = value_obj_info(metaObject_value);
|
|
1519
|
+
if (ometa == 0) {
|
|
1520
|
+
return Qnil;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
int i = -1;
|
|
1524
|
+
const QMetaObject * m = (QMetaObject*) ometa->ptr;
|
|
1525
|
+
for (i = m->methodCount() - 1; i > -1; i--) {
|
|
1526
|
+
if (m->method(i).methodType() == QMetaMethod::Signal) {
|
|
1527
|
+
QString name(m->method(i).signature());
|
|
1528
|
+
static QRegExp * rx = 0;
|
|
1529
|
+
if (rx == 0) {
|
|
1530
|
+
rx = new QRegExp("\\(.*");
|
|
1531
|
+
}
|
|
1532
|
+
name.replace(*rx, "");
|
|
1533
|
+
|
|
1534
|
+
if (name == signalname) {
|
|
1535
|
+
break;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
if (i == -1) {
|
|
1541
|
+
return Qnil;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
QList<MocArgument*> args = get_moc_arguments(o->smoke, m->method(i).typeName(), m->method(i).parameterTypes());
|
|
1545
|
+
|
|
1546
|
+
VALUE result = Qnil;
|
|
1547
|
+
// Okay, we have the signal info. *whew*
|
|
1548
|
+
QtRuby::EmitSignal signal(qobj, i, argc, args, argv, &result);
|
|
1549
|
+
signal.next();
|
|
1550
|
+
|
|
1551
|
+
return result;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
static VALUE
|
|
1555
|
+
qt_metacall(int /*argc*/, VALUE * argv, VALUE self)
|
|
1556
|
+
{
|
|
1557
|
+
// Arguments: QMetaObject::Call _c, int id, void ** _o
|
|
1558
|
+
QMetaObject::Call _c = (QMetaObject::Call) NUM2INT( rb_funcall( qt_internal_module,
|
|
1559
|
+
rb_intern("get_qinteger"),
|
|
1560
|
+
1,
|
|
1561
|
+
argv[0] ) );
|
|
1562
|
+
int id = NUM2INT(argv[1]);
|
|
1563
|
+
void ** _o = 0;
|
|
1564
|
+
|
|
1565
|
+
// Note that for a slot with no args and no return type,
|
|
1566
|
+
// it isn't an error to get a NULL value of _o here.
|
|
1567
|
+
Data_Get_Struct(argv[2], void*, _o);
|
|
1568
|
+
// Assume the target slot is a C++ one
|
|
1569
|
+
smokeruby_object *o = value_obj_info(self);
|
|
1570
|
+
Smoke::ModuleIndex nameId = o->smoke->idMethodName("qt_metacall$$?");
|
|
1571
|
+
Smoke::ModuleIndex classIdx(o->smoke, o->classId);
|
|
1572
|
+
Smoke::ModuleIndex meth = nameId.smoke->findMethod(classIdx, nameId);
|
|
1573
|
+
if (meth.index > 0) {
|
|
1574
|
+
const Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
|
|
1575
|
+
Smoke::ClassFn fn = meth.smoke->classes[m.classId].classFn;
|
|
1576
|
+
Smoke::StackItem i[4];
|
|
1577
|
+
i[1].s_enum = _c;
|
|
1578
|
+
i[2].s_int = id;
|
|
1579
|
+
i[3].s_voidp = _o;
|
|
1580
|
+
(*fn)(m.method, o->ptr, i);
|
|
1581
|
+
int ret = i[0].s_int;
|
|
1582
|
+
if (ret < 0) {
|
|
1583
|
+
return INT2NUM(ret);
|
|
1584
|
+
}
|
|
1585
|
+
} else {
|
|
1586
|
+
// Should never happen..
|
|
1587
|
+
rb_raise(rb_eRuntimeError, "Cannot find %s::qt_metacall() method\n",
|
|
1588
|
+
o->smoke->classes[o->classId].className );
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
if (_c != QMetaObject::InvokeMetaMethod) {
|
|
1592
|
+
return argv[1];
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
QObject * qobj = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
1596
|
+
// get obj metaobject with a virtual call
|
|
1597
|
+
const QMetaObject *metaobject = qobj->metaObject();
|
|
1598
|
+
|
|
1599
|
+
// get method/property count
|
|
1600
|
+
int count = 0;
|
|
1601
|
+
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
1602
|
+
count = metaobject->methodCount();
|
|
1603
|
+
} else {
|
|
1604
|
+
count = metaobject->propertyCount();
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
1608
|
+
QMetaMethod method = metaobject->method(id);
|
|
1609
|
+
|
|
1610
|
+
if (method.methodType() == QMetaMethod::Signal) {
|
|
1611
|
+
metaobject->activate(qobj, id, (void**) _o);
|
|
1612
|
+
return INT2NUM(id - count);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
QList<MocArgument*> mocArgs = get_moc_arguments(o->smoke, method.typeName(), method.parameterTypes());
|
|
1616
|
+
|
|
1617
|
+
QString name(method.signature());
|
|
1618
|
+
static QRegExp * rx = 0;
|
|
1619
|
+
if (rx == 0) {
|
|
1620
|
+
rx = new QRegExp("\\(.*");
|
|
1621
|
+
}
|
|
1622
|
+
name.replace(*rx, "");
|
|
1623
|
+
QtRuby::InvokeSlot slot(self, rb_intern(name.toLatin1()), mocArgs, _o);
|
|
1624
|
+
slot.next();
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
return INT2NUM(id - count);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
static VALUE
|
|
1631
|
+
qobject_connect(int argc, VALUE * argv, VALUE self)
|
|
1632
|
+
{
|
|
1633
|
+
if (rb_block_given_p()) {
|
|
1634
|
+
if (argc == 1) {
|
|
1635
|
+
return rb_funcall(qt_internal_module, rb_intern("signal_connect"), 3, self, argv[0], rb_block_proc());
|
|
1636
|
+
} else if (argc == 2) {
|
|
1637
|
+
return rb_funcall(qt_internal_module, rb_intern("connect"), 4, argv[0], argv[1], self, rb_block_proc());
|
|
1638
|
+
} else if (argc == 3) {
|
|
1639
|
+
return rb_funcall(qt_internal_module, rb_intern("connect"), 4, argv[0], argv[1], argv[2], rb_block_proc());
|
|
1640
|
+
} else {
|
|
1641
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
1642
|
+
}
|
|
1643
|
+
} else {
|
|
1644
|
+
if (argc == 3 && TYPE(argv[1]) != T_STRING) {
|
|
1645
|
+
return rb_funcall(qt_internal_module, rb_intern("method_connect"), 4, self, argv[0], argv[1], argv[2]);
|
|
1646
|
+
} else {
|
|
1647
|
+
return rb_call_super(argc, argv);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
static VALUE
|
|
1653
|
+
qtimer_single_shot(int argc, VALUE * argv, VALUE /*self*/)
|
|
1654
|
+
{
|
|
1655
|
+
if (rb_block_given_p()) {
|
|
1656
|
+
if (argc == 2) {
|
|
1657
|
+
return rb_funcall(qt_internal_module, rb_intern("single_shot_timer_connect"), 3, argv[0], argv[1], rb_block_proc());
|
|
1658
|
+
} else {
|
|
1659
|
+
rb_raise(rb_eArgError, "Invalid argument list");
|
|
1660
|
+
}
|
|
1661
|
+
} else {
|
|
1662
|
+
return rb_call_super(argc, argv);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
// --------------- Ruby C functions for Qt::_internal.* helpers ----------------
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
static VALUE
|
|
1670
|
+
getMethStat(VALUE /*self*/)
|
|
1671
|
+
{
|
|
1672
|
+
VALUE result_list = rb_ary_new();
|
|
1673
|
+
rb_ary_push(result_list, INT2NUM((int)methcache.size()));
|
|
1674
|
+
rb_ary_push(result_list, INT2NUM((int)methcache.count()));
|
|
1675
|
+
return result_list;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
static VALUE
|
|
1679
|
+
getClassStat(VALUE /*self*/)
|
|
1680
|
+
{
|
|
1681
|
+
VALUE result_list = rb_ary_new();
|
|
1682
|
+
rb_ary_push(result_list, INT2NUM((int)classcache.size()));
|
|
1683
|
+
rb_ary_push(result_list, INT2NUM((int)classcache.count()));
|
|
1684
|
+
return result_list;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
static VALUE
|
|
1688
|
+
getIsa(VALUE /*self*/, VALUE classId)
|
|
1689
|
+
{
|
|
1690
|
+
VALUE parents_list = rb_ary_new();
|
|
1691
|
+
|
|
1692
|
+
int id = NUM2INT(rb_funcall(classId, rb_intern("index"), 0));
|
|
1693
|
+
Smoke* smoke = smokeList[NUM2INT(rb_funcall(classId, rb_intern("smoke"), 0))];
|
|
1694
|
+
|
|
1695
|
+
Smoke::Index *parents =
|
|
1696
|
+
smoke->inheritanceList +
|
|
1697
|
+
smoke->classes[id].parents;
|
|
1698
|
+
|
|
1699
|
+
while(*parents) {
|
|
1700
|
+
//logger("\tparent: %s", qtcore_Smoke->classes[*parents].className);
|
|
1701
|
+
rb_ary_push(parents_list, rb_str_new2(smoke->classes[*parents++].className));
|
|
1702
|
+
}
|
|
1703
|
+
return parents_list;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
// Return the class name of a QObject. Note that the name will be in the
|
|
1707
|
+
// form of Qt::Widget rather than QWidget. Is this a bug or a feature?
|
|
1708
|
+
static VALUE
|
|
1709
|
+
class_name(VALUE self)
|
|
1710
|
+
{
|
|
1711
|
+
VALUE klass = rb_funcall(self, rb_intern("class"), 0);
|
|
1712
|
+
return rb_funcall(klass, rb_intern("name"), 0);
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
// Allow classnames in both 'Qt::Widget' and 'QWidget' formats to be
|
|
1716
|
+
// used as an argument to Qt::Object.inherits()
|
|
1717
|
+
static VALUE
|
|
1718
|
+
inherits_qobject(int argc, VALUE * argv, VALUE /*self*/)
|
|
1719
|
+
{
|
|
1720
|
+
if (argc != 1) {
|
|
1721
|
+
return rb_call_super(argc, argv);
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
Smoke::ModuleIndex * classId = classcache.value(StringValuePtr(argv[0]));
|
|
1725
|
+
|
|
1726
|
+
if (classId == 0) {
|
|
1727
|
+
return rb_call_super(argc, argv);
|
|
1728
|
+
} else {
|
|
1729
|
+
VALUE super_class = rb_str_new2(classId->smoke->classes[classId->index].className);
|
|
1730
|
+
return rb_call_super(argc, &super_class);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
/* Adapted from the internal function qt_qFindChildren() in qobject.cpp */
|
|
1735
|
+
static void
|
|
1736
|
+
rb_qFindChildren_helper(VALUE parent, const QString &name, VALUE re,
|
|
1737
|
+
const QMetaObject &mo, VALUE list)
|
|
1738
|
+
{
|
|
1739
|
+
if (parent == Qnil || list == Qnil)
|
|
1740
|
+
return;
|
|
1741
|
+
VALUE children = rb_funcall(parent, rb_intern("children"), 0);
|
|
1742
|
+
VALUE rv = Qnil;
|
|
1743
|
+
for (int i = 0; i < RARRAY_LEN(children); ++i) {
|
|
1744
|
+
rv = RARRAY_PTR(children)[i];
|
|
1745
|
+
smokeruby_object *o = value_obj_info(rv);
|
|
1746
|
+
QObject * obj = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
1747
|
+
|
|
1748
|
+
// The original code had 'if (mo.cast(obj))' as a test, but it doesn't work here
|
|
1749
|
+
if (obj->qt_metacast(mo.className()) != 0) {
|
|
1750
|
+
if (re != Qnil) {
|
|
1751
|
+
VALUE re_test = rb_funcall(re, rb_intern("=~"), 1, rb_funcall(rv, rb_intern("objectName"), 0));
|
|
1752
|
+
if (re_test != Qnil && re_test != Qfalse) {
|
|
1753
|
+
rb_ary_push(list, rv);
|
|
1754
|
+
}
|
|
1755
|
+
} else {
|
|
1756
|
+
if (name.isNull() || obj->objectName() == name) {
|
|
1757
|
+
rb_ary_push(list, rv);
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
rb_qFindChildren_helper(rv, name, re, mo, list);
|
|
1762
|
+
}
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
/* Should mimic Qt4's QObject::findChildren method with this syntax:
|
|
1767
|
+
obj.findChildren(Qt::Widget, "Optional Widget Name")
|
|
1768
|
+
*/
|
|
1769
|
+
static VALUE
|
|
1770
|
+
find_qobject_children(int argc, VALUE *argv, VALUE self)
|
|
1771
|
+
{
|
|
1772
|
+
if (argc < 1 || argc > 2) rb_raise(rb_eArgError, "Invalid argument list");
|
|
1773
|
+
Check_Type(argv[0], T_CLASS);
|
|
1774
|
+
|
|
1775
|
+
QString name;
|
|
1776
|
+
VALUE re = Qnil;
|
|
1777
|
+
if (argc == 2) {
|
|
1778
|
+
// If the second arg isn't a String, assume it's a regular expression
|
|
1779
|
+
if (TYPE(argv[1]) == T_STRING) {
|
|
1780
|
+
name = QString::fromLatin1(StringValuePtr(argv[1]));
|
|
1781
|
+
} else {
|
|
1782
|
+
re = argv[1];
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
VALUE metaObject = rb_funcall(argv[0], rb_intern("staticMetaObject"), 0);
|
|
1787
|
+
smokeruby_object *o = value_obj_info(metaObject);
|
|
1788
|
+
QMetaObject * mo = (QMetaObject*) o->ptr;
|
|
1789
|
+
VALUE result = rb_ary_new();
|
|
1790
|
+
rb_qFindChildren_helper(self, name, re, *mo, result);
|
|
1791
|
+
return result;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
/* Adapted from the internal function qt_qFindChild() in qobject.cpp */
|
|
1795
|
+
static VALUE
|
|
1796
|
+
rb_qFindChild_helper(VALUE parent, const QString &name, const QMetaObject &mo)
|
|
1797
|
+
{
|
|
1798
|
+
if (parent == Qnil)
|
|
1799
|
+
return Qnil;
|
|
1800
|
+
VALUE children = rb_funcall(parent, rb_intern("children"), 0);
|
|
1801
|
+
VALUE rv;
|
|
1802
|
+
int i;
|
|
1803
|
+
for (i = 0; i < RARRAY_LEN(children); ++i) {
|
|
1804
|
+
rv = RARRAY_PTR(children)[i];
|
|
1805
|
+
smokeruby_object *o = value_obj_info(rv);
|
|
1806
|
+
QObject * obj = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
|
1807
|
+
if (obj->qt_metacast(mo.className()) != 0 && (name.isNull() || obj->objectName() == name))
|
|
1808
|
+
return rv;
|
|
1809
|
+
}
|
|
1810
|
+
for (i = 0; i < RARRAY_LEN(children); ++i) {
|
|
1811
|
+
rv = rb_qFindChild_helper(RARRAY_PTR(children)[i], name, mo);
|
|
1812
|
+
if (rv != Qnil)
|
|
1813
|
+
return rv;
|
|
1814
|
+
}
|
|
1815
|
+
return Qnil;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
static VALUE
|
|
1819
|
+
find_qobject_child(int argc, VALUE *argv, VALUE self)
|
|
1820
|
+
{
|
|
1821
|
+
if (argc < 1 || argc > 2) rb_raise(rb_eArgError, "Invalid argument list");
|
|
1822
|
+
Check_Type(argv[0], T_CLASS);
|
|
1823
|
+
|
|
1824
|
+
QString name;
|
|
1825
|
+
if (argc == 2) {
|
|
1826
|
+
name = QString::fromLatin1(StringValuePtr(argv[1]));
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
VALUE metaObject = rb_funcall(argv[0], rb_intern("staticMetaObject"), 0);
|
|
1830
|
+
smokeruby_object *o = value_obj_info(metaObject);
|
|
1831
|
+
QMetaObject * mo = (QMetaObject*) o->ptr;
|
|
1832
|
+
return rb_qFindChild_helper(self, name, *mo);
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
static VALUE
|
|
1836
|
+
setDebug(VALUE self, VALUE on_value)
|
|
1837
|
+
{
|
|
1838
|
+
int on = NUM2INT(on_value);
|
|
1839
|
+
do_debug = on;
|
|
1840
|
+
return self;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
static VALUE
|
|
1844
|
+
debugging(VALUE /*self*/)
|
|
1845
|
+
{
|
|
1846
|
+
return INT2NUM(do_debug);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
static VALUE
|
|
1850
|
+
get_arg_type_name(VALUE /*self*/, VALUE method_value, VALUE idx_value)
|
|
1851
|
+
{
|
|
1852
|
+
int method = NUM2INT(rb_funcall(method_value, rb_intern("index"), 0));
|
|
1853
|
+
int smokeIndex = NUM2INT(rb_funcall(method_value, rb_intern("smoke"), 0));
|
|
1854
|
+
Smoke * smoke = smokeList[smokeIndex];
|
|
1855
|
+
int idx = NUM2INT(idx_value);
|
|
1856
|
+
const Smoke::Method &m = smoke->methods[method];
|
|
1857
|
+
Smoke::Index *args = smoke->argumentList + m.args;
|
|
1858
|
+
return rb_str_new2((char*)smoke->types[args[idx]].name);
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
static VALUE
|
|
1862
|
+
classIsa(VALUE /*self*/, VALUE className_value, VALUE base_value)
|
|
1863
|
+
{
|
|
1864
|
+
char *className = StringValuePtr(className_value);
|
|
1865
|
+
char *base = StringValuePtr(base_value);
|
|
1866
|
+
return Smoke::isDerivedFrom(className, base) ? Qtrue : Qfalse;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
static VALUE
|
|
1870
|
+
isEnum(VALUE /*self*/, VALUE enumName_value)
|
|
1871
|
+
{
|
|
1872
|
+
char *enumName = StringValuePtr(enumName_value);
|
|
1873
|
+
Smoke::Index typeId = 0;
|
|
1874
|
+
Smoke* s = 0;
|
|
1875
|
+
for (int i = 0; i < smokeList.count(); i++) {
|
|
1876
|
+
typeId = smokeList[i]->idType(enumName);
|
|
1877
|
+
if (typeId > 0) {
|
|
1878
|
+
s = smokeList[i];
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return typeId > 0
|
|
1883
|
+
&& ( (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_enum
|
|
1884
|
+
|| (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_ulong
|
|
1885
|
+
|| (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_long
|
|
1886
|
+
|| (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_uint
|
|
1887
|
+
|| (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_int ) ? Qtrue : Qfalse;
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
static VALUE
|
|
1891
|
+
insert_pclassid(VALUE self, VALUE p_value, VALUE mi_value)
|
|
1892
|
+
{
|
|
1893
|
+
char *p = StringValuePtr(p_value);
|
|
1894
|
+
int ix = NUM2INT(rb_funcall(mi_value, rb_intern("index"), 0));
|
|
1895
|
+
int smokeidx = NUM2INT(rb_funcall(mi_value, rb_intern("smoke"), 0));
|
|
1896
|
+
Smoke::ModuleIndex mi(smokeList[smokeidx], ix);
|
|
1897
|
+
classcache.insert(QByteArray(p), new Smoke::ModuleIndex(mi));
|
|
1898
|
+
IdToClassNameMap.insert(mi, new QByteArray(p));
|
|
1899
|
+
return self;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
static VALUE
|
|
1903
|
+
classid2name(VALUE /*self*/, VALUE mi_value)
|
|
1904
|
+
{
|
|
1905
|
+
int ix = NUM2INT(rb_funcall(mi_value, rb_intern("index"), 0));
|
|
1906
|
+
int smokeidx = NUM2INT(rb_funcall(mi_value, rb_intern("smoke"), 0));
|
|
1907
|
+
Smoke::ModuleIndex mi(smokeList[smokeidx], ix);
|
|
1908
|
+
return rb_str_new2(IdToClassNameMap[mi]->constData());
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
static VALUE
|
|
1912
|
+
find_pclassid(VALUE /*self*/, VALUE p_value)
|
|
1913
|
+
{
|
|
1914
|
+
if (NIL_P(p_value)) {
|
|
1915
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, 0, 0);
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
char *p = StringValuePtr(p_value);
|
|
1919
|
+
Smoke::ModuleIndex *r = classcache.value(QByteArray(p));
|
|
1920
|
+
if (r != 0) {
|
|
1921
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(r->smoke)), INT2NUM(r->index));
|
|
1922
|
+
} else {
|
|
1923
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, Qnil, Qnil);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
static VALUE
|
|
1928
|
+
get_value_type(VALUE /*self*/, VALUE ruby_value)
|
|
1929
|
+
{
|
|
1930
|
+
return rb_str_new2(value_to_type_flag(ruby_value));
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
static QMetaObject*
|
|
1934
|
+
parent_meta_object(VALUE obj)
|
|
1935
|
+
{
|
|
1936
|
+
smokeruby_object* o = value_obj_info(obj);
|
|
1937
|
+
Smoke::ModuleIndex nameId = o->smoke->idMethodName("metaObject");
|
|
1938
|
+
Smoke::ModuleIndex classIdx(o->smoke, o->classId);
|
|
1939
|
+
Smoke::ModuleIndex meth = o->smoke->findMethod(classIdx, nameId);
|
|
1940
|
+
if (meth.index <= 0) {
|
|
1941
|
+
// Should never happen..
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
const Smoke::Method &methodId = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
|
|
1945
|
+
Smoke::ClassFn fn = o->smoke->classes[methodId.classId].classFn;
|
|
1946
|
+
Smoke::StackItem i[1];
|
|
1947
|
+
(*fn)(methodId.method, o->ptr, i);
|
|
1948
|
+
return (QMetaObject*) i[0].s_voidp;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
static VALUE
|
|
1952
|
+
make_metaObject(VALUE /*self*/, VALUE obj, VALUE parentMeta, VALUE stringdata_value, VALUE data_value)
|
|
1953
|
+
{
|
|
1954
|
+
QMetaObject* superdata = 0;
|
|
1955
|
+
|
|
1956
|
+
if (parentMeta == Qnil) {
|
|
1957
|
+
// The parent class is a Smoke class, so call metaObject() on the
|
|
1958
|
+
// instance to get it via a smoke library call
|
|
1959
|
+
superdata = parent_meta_object(obj);
|
|
1960
|
+
} else {
|
|
1961
|
+
// The parent class is a custom Ruby class whose metaObject
|
|
1962
|
+
// was constructed at runtime
|
|
1963
|
+
smokeruby_object* p = value_obj_info(parentMeta);
|
|
1964
|
+
superdata = (QMetaObject *) p->ptr;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
char *stringdata = new char[RSTRING_LEN(stringdata_value)];
|
|
1968
|
+
|
|
1969
|
+
int count = RARRAY_LEN(data_value);
|
|
1970
|
+
uint * data = new uint[count];
|
|
1971
|
+
|
|
1972
|
+
memcpy( (void *) stringdata, RSTRING_PTR(stringdata_value), RSTRING_LEN(stringdata_value) );
|
|
1973
|
+
|
|
1974
|
+
for (long i = 0; i < count; i++) {
|
|
1975
|
+
VALUE rv = rb_ary_entry(data_value, i);
|
|
1976
|
+
data[i] = NUM2UINT(rv);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
QMetaObject ob = {
|
|
1980
|
+
{ superdata, stringdata, data, 0 }
|
|
1981
|
+
} ;
|
|
1982
|
+
|
|
1983
|
+
QMetaObject * meta = new QMetaObject;
|
|
1984
|
+
*meta = ob;
|
|
1985
|
+
|
|
1986
|
+
#ifdef DEBUG
|
|
1987
|
+
printf("make_metaObject() superdata: %p %s\n", meta->d.superdata, superdata->className());
|
|
1988
|
+
|
|
1989
|
+
printf(
|
|
1990
|
+
" // content:\n"
|
|
1991
|
+
" %d, // revision\n"
|
|
1992
|
+
" %d, // classname\n"
|
|
1993
|
+
" %d, %d, // classinfo\n"
|
|
1994
|
+
" %d, %d, // methods\n"
|
|
1995
|
+
" %d, %d, // properties\n"
|
|
1996
|
+
" %d, %d, // enums/sets\n",
|
|
1997
|
+
data[0], data[1], data[2], data[3],
|
|
1998
|
+
data[4], data[5], data[6], data[7], data[8], data[9]);
|
|
1999
|
+
|
|
2000
|
+
int s = data[3];
|
|
2001
|
+
|
|
2002
|
+
if (data[2] > 0) {
|
|
2003
|
+
printf("\n // classinfo: key, value\n");
|
|
2004
|
+
for (uint j = 0; j < data[2]; j++) {
|
|
2005
|
+
printf(" %d, %d\n", data[s + (j * 2)], data[s + (j * 2) + 1]);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
s = data[5];
|
|
2010
|
+
bool signal_headings = true;
|
|
2011
|
+
bool slot_headings = true;
|
|
2012
|
+
|
|
2013
|
+
for (uint j = 0; j < data[4]; j++) {
|
|
2014
|
+
if (signal_headings && (data[s + (j * 5) + 4] & 0x04) != 0) {
|
|
2015
|
+
printf("\n // signals: signature, parameters, type, tag, flags\n");
|
|
2016
|
+
signal_headings = false;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
if (slot_headings && (data[s + (j * 5) + 4] & 0x08) != 0) {
|
|
2020
|
+
printf("\n // slots: signature, parameters, type, tag, flags\n");
|
|
2021
|
+
slot_headings = false;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
printf(" %d, %d, %d, %d, 0x%2.2x\n",
|
|
2025
|
+
data[s + (j * 5)], data[s + (j * 5) + 1], data[s + (j * 5) + 2],
|
|
2026
|
+
data[s + (j * 5) + 3], data[s + (j * 5) + 4]);
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
s += (data[4] * 5);
|
|
2030
|
+
for (uint j = 0; j < data[6]; j++) {
|
|
2031
|
+
printf("\n // properties: name, type, flags\n");
|
|
2032
|
+
printf(" %d, %d, 0x%8.8x\n",
|
|
2033
|
+
data[s + (j * 3)], data[s + (j * 3) + 1], data[s + (j * 3) + 2]);
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
s += (data[6] * 3);
|
|
2037
|
+
for (int i = s; i < count; i++) {
|
|
2038
|
+
printf("\n %d // eod\n", data[i]);
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
printf("\nqt_meta_stringdata:\n \"");
|
|
2042
|
+
|
|
2043
|
+
int strlength = 0;
|
|
2044
|
+
for (int j = 0; j < RSTRING_LEN(stringdata_value); j++) {
|
|
2045
|
+
strlength++;
|
|
2046
|
+
if (meta->d.stringdata[j] == 0) {
|
|
2047
|
+
printf("\\0");
|
|
2048
|
+
if (strlength > 40) {
|
|
2049
|
+
printf("\"\n \"");
|
|
2050
|
+
strlength = 0;
|
|
2051
|
+
}
|
|
2052
|
+
} else {
|
|
2053
|
+
printf("%c", meta->d.stringdata[j]);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
printf("\"\n\n");
|
|
2057
|
+
|
|
2058
|
+
#endif
|
|
2059
|
+
smokeruby_object * m = alloc_smokeruby_object( true,
|
|
2060
|
+
qtcore_Smoke,
|
|
2061
|
+
qtcore_Smoke->idClass("QMetaObject").index,
|
|
2062
|
+
meta );
|
|
2063
|
+
|
|
2064
|
+
return Data_Wrap_Struct(qmetaobject_class, smokeruby_mark, smokeruby_free, m);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
static VALUE
|
|
2068
|
+
add_metaobject_methods(VALUE self, VALUE klass)
|
|
2069
|
+
{
|
|
2070
|
+
rb_define_method(klass, "qt_metacall", (VALUE (*) (...)) qt_metacall, -1);
|
|
2071
|
+
rb_define_method(klass, "metaObject", (VALUE (*) (...)) metaObject, 0);
|
|
2072
|
+
return self;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
static VALUE
|
|
2076
|
+
add_signal_methods(VALUE self, VALUE klass, VALUE signalNames)
|
|
2077
|
+
{
|
|
2078
|
+
for (long index = 0; index < RARRAY_LEN(signalNames); index++) {
|
|
2079
|
+
VALUE signal = rb_ary_entry(signalNames, index);
|
|
2080
|
+
rb_define_method(klass, StringValuePtr(signal), (VALUE (*) (...)) qt_signal, -1);
|
|
2081
|
+
}
|
|
2082
|
+
return self;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
static VALUE
|
|
2086
|
+
dispose(VALUE self)
|
|
2087
|
+
{
|
|
2088
|
+
smokeruby_object *o = value_obj_info(self);
|
|
2089
|
+
if (o == 0 || o->ptr == 0) { return Qnil; }
|
|
2090
|
+
|
|
2091
|
+
const char *className = o->smoke->classes[o->classId].className;
|
|
2092
|
+
if(do_debug & qtdb_gc) printf("Deleting (%s*)%p\n", className, o->ptr);
|
|
2093
|
+
|
|
2094
|
+
unmapPointer(o, o->classId, 0);
|
|
2095
|
+
object_count--;
|
|
2096
|
+
|
|
2097
|
+
char *methodName = new char[strlen(className) + 2];
|
|
2098
|
+
methodName[0] = '~';
|
|
2099
|
+
strcpy(methodName + 1, className);
|
|
2100
|
+
Smoke::ModuleIndex nameId = o->smoke->findMethodName(className, methodName);
|
|
2101
|
+
Smoke::ModuleIndex classIdx(o->smoke, o->classId);
|
|
2102
|
+
Smoke::ModuleIndex meth = nameId.smoke->findMethod(classIdx, nameId);
|
|
2103
|
+
if(meth.index > 0) {
|
|
2104
|
+
const Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
|
|
2105
|
+
Smoke::ClassFn fn = meth.smoke->classes[m.classId].classFn;
|
|
2106
|
+
Smoke::StackItem i[1];
|
|
2107
|
+
(*fn)(m.method, o->ptr, i);
|
|
2108
|
+
}
|
|
2109
|
+
delete[] methodName;
|
|
2110
|
+
o->ptr = 0;
|
|
2111
|
+
o->allocated = false;
|
|
2112
|
+
|
|
2113
|
+
return Qnil;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
static VALUE
|
|
2117
|
+
is_disposed(VALUE self)
|
|
2118
|
+
{
|
|
2119
|
+
smokeruby_object *o = value_obj_info(self);
|
|
2120
|
+
return (o != 0 && o->ptr != 0) ? Qfalse : Qtrue;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
VALUE
|
|
2124
|
+
isQObject(VALUE /*self*/, VALUE c)
|
|
2125
|
+
{
|
|
2126
|
+
return Smoke::isDerivedFrom(StringValuePtr(c), "QObject");
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
// Returns the Smoke classId of a ruby instance
|
|
2130
|
+
static VALUE
|
|
2131
|
+
idInstance(VALUE /*self*/, VALUE instance)
|
|
2132
|
+
{
|
|
2133
|
+
smokeruby_object *o = value_obj_info(instance);
|
|
2134
|
+
if(!o)
|
|
2135
|
+
return Qnil;
|
|
2136
|
+
|
|
2137
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(o->smoke)), INT2NUM(o->classId));
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
static VALUE
|
|
2141
|
+
findClass(VALUE /*self*/, VALUE name_value)
|
|
2142
|
+
{
|
|
2143
|
+
char *name = StringValuePtr(name_value);
|
|
2144
|
+
Smoke::ModuleIndex mi = Smoke::findClass(name);
|
|
2145
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(mi.smoke)), INT2NUM(mi.index));
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
// static VALUE
|
|
2149
|
+
// idMethodName(VALUE /*self*/, VALUE name_value)
|
|
2150
|
+
// {
|
|
2151
|
+
// char *name = StringValuePtr(name_value);
|
|
2152
|
+
// return INT2NUM(qtcore_Smoke->idMethodName(name).index);
|
|
2153
|
+
// }
|
|
2154
|
+
//
|
|
2155
|
+
// static VALUE
|
|
2156
|
+
// idMethod(VALUE /*self*/, VALUE idclass_value, VALUE idmethodname_value)
|
|
2157
|
+
// {
|
|
2158
|
+
// int idclass = NUM2INT(idclass_value);
|
|
2159
|
+
// int idmethodname = NUM2INT(idmethodname_value);
|
|
2160
|
+
// return INT2NUM(qtcore_Smoke->idMethod(idclass, idmethodname).index);
|
|
2161
|
+
// }
|
|
2162
|
+
|
|
2163
|
+
static VALUE
|
|
2164
|
+
dumpCandidates(VALUE /*self*/, VALUE rmeths)
|
|
2165
|
+
{
|
|
2166
|
+
VALUE errmsg = rb_str_new2("");
|
|
2167
|
+
if(rmeths != Qnil) {
|
|
2168
|
+
int count = RARRAY_LEN(rmeths);
|
|
2169
|
+
for(int i = 0; i < count; i++) {
|
|
2170
|
+
qt_rb_str_catf(errmsg, "\t");
|
|
2171
|
+
int id = NUM2INT(rb_funcall(rb_ary_entry(rmeths, i), rb_intern("index"), 0));
|
|
2172
|
+
Smoke* smoke = smokeList[NUM2INT(rb_funcall(rb_ary_entry(rmeths, i), rb_intern("smoke"), 0))];
|
|
2173
|
+
const Smoke::Method &meth = smoke->methods[id];
|
|
2174
|
+
const char *tname = smoke->types[meth.ret].name;
|
|
2175
|
+
if(meth.flags & Smoke::mf_enum) {
|
|
2176
|
+
qt_rb_str_catf(errmsg, "enum ");
|
|
2177
|
+
qt_rb_str_catf(errmsg, "%s::%s", smoke->classes[meth.classId].className, smoke->methodNames[meth.name]);
|
|
2178
|
+
qt_rb_str_catf(errmsg, "\n");
|
|
2179
|
+
} else {
|
|
2180
|
+
if(meth.flags & Smoke::mf_static) qt_rb_str_catf(errmsg, "static ");
|
|
2181
|
+
qt_rb_str_catf(errmsg, "%s ", (tname ? tname:"void"));
|
|
2182
|
+
qt_rb_str_catf(errmsg, "%s::%s(", smoke->classes[meth.classId].className, smoke->methodNames[meth.name]);
|
|
2183
|
+
for(int i = 0; i < meth.numArgs; i++) {
|
|
2184
|
+
if(i) qt_rb_str_catf(errmsg, ", ");
|
|
2185
|
+
tname = smoke->types[smoke->argumentList[meth.args+i]].name;
|
|
2186
|
+
qt_rb_str_catf(errmsg, "%s", (tname ? tname:"void"));
|
|
2187
|
+
}
|
|
2188
|
+
qt_rb_str_catf(errmsg, ")");
|
|
2189
|
+
if(meth.flags & Smoke::mf_const) qt_rb_str_catf(errmsg, " const");
|
|
2190
|
+
qt_rb_str_catf(errmsg, "\n");
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
return errmsg;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
static VALUE
|
|
2198
|
+
isConstMethod(VALUE /*self*/, VALUE idx)
|
|
2199
|
+
{
|
|
2200
|
+
int id = NUM2INT(rb_funcall(idx, rb_intern("index"), 0));
|
|
2201
|
+
Smoke* smoke = smokeList[NUM2INT(rb_funcall(idx, rb_intern("smoke"), 0))];
|
|
2202
|
+
const Smoke::Method &meth = smoke->methods[id];
|
|
2203
|
+
return (meth.flags & Smoke::mf_const) ? Qtrue : Qfalse;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
static VALUE
|
|
2207
|
+
isObject(VALUE /*self*/, VALUE obj)
|
|
2208
|
+
{
|
|
2209
|
+
void * ptr = 0;
|
|
2210
|
+
ptr = value_to_ptr(obj);
|
|
2211
|
+
return (ptr > (void *)0 ? Qtrue : Qfalse);
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
static VALUE
|
|
2215
|
+
setCurrentMethod(VALUE self, VALUE meth_value)
|
|
2216
|
+
{
|
|
2217
|
+
int smokeidx = NUM2INT(rb_funcall(meth_value, rb_intern("smoke"), 0));
|
|
2218
|
+
int meth = NUM2INT(rb_funcall(meth_value, rb_intern("index"), 0));
|
|
2219
|
+
// FIXME: damn, this is lame, and it doesn't handle ambiguous methods
|
|
2220
|
+
_current_method.smoke = smokeList[smokeidx]; //qtcore_Smoke->methodMaps[meth].method;
|
|
2221
|
+
_current_method.index = meth;
|
|
2222
|
+
return self;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
static VALUE
|
|
2226
|
+
getClassList(VALUE /*self*/)
|
|
2227
|
+
{
|
|
2228
|
+
VALUE class_list = rb_ary_new();
|
|
2229
|
+
|
|
2230
|
+
for (int i = 1; i <= qtcore_Smoke->numClasses; i++) {
|
|
2231
|
+
if (qtcore_Smoke->classes[i].className && !qtcore_Smoke->classes[i].external)
|
|
2232
|
+
rb_ary_push(class_list, rb_str_new2(qtcore_Smoke->classes[i].className));
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
for (int i = 1; i <= qtgui_Smoke->numClasses; i++) {
|
|
2236
|
+
if (qtgui_Smoke->classes[i].className && !qtgui_Smoke->classes[i].external)
|
|
2237
|
+
rb_ary_push(class_list, rb_str_new2(qtgui_Smoke->classes[i].className));
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
for (int i = 1; i <= qtxml_Smoke->numClasses; i++) {
|
|
2241
|
+
if (qtxml_Smoke->classes[i].className && !qtxml_Smoke->classes[i].external)
|
|
2242
|
+
rb_ary_push(class_list, rb_str_new2(qtxml_Smoke->classes[i].className));
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
for (int i = 1; i <= qtsql_Smoke->numClasses; i++) {
|
|
2246
|
+
if (qtsql_Smoke->classes[i].className && !qtsql_Smoke->classes[i].external)
|
|
2247
|
+
rb_ary_push(class_list, rb_str_new2(qtsql_Smoke->classes[i].className));
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
for (int i = 1; i <= qtopengl_Smoke->numClasses; i++) {
|
|
2251
|
+
if (qtopengl_Smoke->classes[i].className && !qtopengl_Smoke->classes[i].external)
|
|
2252
|
+
rb_ary_push(class_list, rb_str_new2(qtopengl_Smoke->classes[i].className));
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
for (int i = 1; i <= qtnetwork_Smoke->numClasses; i++) {
|
|
2256
|
+
if (qtnetwork_Smoke->classes[i].className && !qtnetwork_Smoke->classes[i].external)
|
|
2257
|
+
rb_ary_push(class_list, rb_str_new2(qtnetwork_Smoke->classes[i].className));
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
for (int i = 1; i <= qtsvg_Smoke->numClasses; i++) {
|
|
2261
|
+
if (qtsvg_Smoke->classes[i].className && !qtsvg_Smoke->classes[i].external)
|
|
2262
|
+
rb_ary_push(class_list, rb_str_new2(qtsvg_Smoke->classes[i].className));
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
#ifdef QT_QTDBUS
|
|
2266
|
+
for (int i = 1; i <= qtdbus_Smoke->numClasses; i++) {
|
|
2267
|
+
if (qtdbus_Smoke->classes[i].className && !qtdbus_Smoke->classes[i].external)
|
|
2268
|
+
rb_ary_push(class_list, rb_str_new2(qtdbus_Smoke->classes[i].className));
|
|
2269
|
+
}
|
|
2270
|
+
#endif
|
|
2271
|
+
|
|
2272
|
+
return class_list;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
static VALUE
|
|
2276
|
+
create_qobject_class(VALUE /*self*/, VALUE package_value, VALUE module_value)
|
|
2277
|
+
{
|
|
2278
|
+
const char *package = strdup(StringValuePtr(package_value));
|
|
2279
|
+
// this won't work:
|
|
2280
|
+
// strdup(StringValuePtr(rb_funcall(module_value, rb_intern("name"), 0)))
|
|
2281
|
+
// any ideas why?
|
|
2282
|
+
VALUE value_moduleName = rb_funcall(module_value, rb_intern("name"), 0);
|
|
2283
|
+
const char *moduleName = strdup(StringValuePtr(value_moduleName));
|
|
2284
|
+
VALUE klass = module_value;
|
|
2285
|
+
|
|
2286
|
+
QString packageName(package);
|
|
2287
|
+
|
|
2288
|
+
foreach(QString s, packageName.mid(strlen(moduleName) + 2).split("::")) {
|
|
2289
|
+
klass = rb_define_class_under(klass, (const char*) s.toLatin1(), qt_base_class);
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
if (packageName == "Qt::Application" || packageName == "Qt::CoreApplication" ) {
|
|
2293
|
+
rb_define_method(klass, "ARGV", (VALUE (*) (...)) qapplication_argv, 0);
|
|
2294
|
+
} else if (packageName == "Qt::Object") {
|
|
2295
|
+
rb_define_singleton_method(klass, "staticMetaObject", (VALUE (*) (...)) qobject_staticmetaobject, 0);
|
|
2296
|
+
} else if (packageName == "Qt::AbstractTableModel") {
|
|
2297
|
+
qtablemodel_class = rb_define_class_under(qt_module, "TableModel", klass);
|
|
2298
|
+
rb_define_method(qtablemodel_class, "rowCount", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
|
|
2299
|
+
rb_define_method(qtablemodel_class, "row_count", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
|
|
2300
|
+
rb_define_method(qtablemodel_class, "columnCount", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
|
|
2301
|
+
rb_define_method(qtablemodel_class, "column_count", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
|
|
2302
|
+
rb_define_method(qtablemodel_class, "data", (VALUE (*) (...)) qabstract_item_model_data, -1);
|
|
2303
|
+
rb_define_method(qtablemodel_class, "setData", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
|
|
2304
|
+
rb_define_method(qtablemodel_class, "set_data", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
|
|
2305
|
+
rb_define_method(qtablemodel_class, "flags", (VALUE (*) (...)) qabstract_item_model_flags, 1);
|
|
2306
|
+
rb_define_method(qtablemodel_class, "insertRows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
|
|
2307
|
+
rb_define_method(qtablemodel_class, "insert_rows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
|
|
2308
|
+
rb_define_method(qtablemodel_class, "insertColumns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
|
|
2309
|
+
rb_define_method(qtablemodel_class, "insert_columns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
|
|
2310
|
+
rb_define_method(qtablemodel_class, "removeRows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
|
|
2311
|
+
rb_define_method(qtablemodel_class, "remove_rows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
|
|
2312
|
+
rb_define_method(qtablemodel_class, "removeColumns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
|
|
2313
|
+
rb_define_method(qtablemodel_class, "remove_columns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
|
|
2314
|
+
|
|
2315
|
+
qlistmodel_class = rb_define_class_under(qt_module, "ListModel", klass);
|
|
2316
|
+
rb_define_method(qlistmodel_class, "rowCount", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
|
|
2317
|
+
rb_define_method(qlistmodel_class, "row_count", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
|
|
2318
|
+
rb_define_method(qlistmodel_class, "columnCount", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
|
|
2319
|
+
rb_define_method(qlistmodel_class, "column_count", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
|
|
2320
|
+
rb_define_method(qlistmodel_class, "data", (VALUE (*) (...)) qabstract_item_model_data, -1);
|
|
2321
|
+
rb_define_method(qlistmodel_class, "setData", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
|
|
2322
|
+
rb_define_method(qlistmodel_class, "set_data", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
|
|
2323
|
+
rb_define_method(qlistmodel_class, "flags", (VALUE (*) (...)) qabstract_item_model_flags, 1);
|
|
2324
|
+
rb_define_method(qlistmodel_class, "insertRows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
|
|
2325
|
+
rb_define_method(qlistmodel_class, "insert_rows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
|
|
2326
|
+
rb_define_method(qlistmodel_class, "insertColumns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
|
|
2327
|
+
rb_define_method(qlistmodel_class, "insert_columns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
|
|
2328
|
+
rb_define_method(qlistmodel_class, "removeRows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
|
|
2329
|
+
rb_define_method(qlistmodel_class, "remove_rows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
|
|
2330
|
+
rb_define_method(qlistmodel_class, "removeColumns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
|
|
2331
|
+
rb_define_method(qlistmodel_class, "remove_columns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
|
|
2332
|
+
#if QT_VERSION >= 0x040600
|
|
2333
|
+
// make it work with qml
|
|
2334
|
+
rb_define_method(qlistmodel_class, "roleNames", (VALUE (*) (...)) qabstractitemmodel_rolenames, -1);
|
|
2335
|
+
rb_define_method(qlistmodel_class, "role_names", (VALUE (*) (...)) qabstractitemmodel_rolenames, -1);
|
|
2336
|
+
rb_define_method(qlistmodel_class, "setRoleNames", (VALUE (*) (...)) qabstractitemmodel_setrolenames, -1);
|
|
2337
|
+
rb_define_method(qlistmodel_class, "set_role_names", (VALUE (*) (...)) qabstractitemmodel_setrolenames, -1);
|
|
2338
|
+
#endif
|
|
2339
|
+
}
|
|
2340
|
+
else if (packageName == "Qt::AbstractItemModel") {
|
|
2341
|
+
rb_define_method(klass, "createIndex", (VALUE (*) (...)) qabstractitemmodel_createindex, -1);
|
|
2342
|
+
rb_define_method(klass, "create_index", (VALUE (*) (...)) qabstractitemmodel_createindex, -1);
|
|
2343
|
+
} else if (packageName == "Qt::Timer") {
|
|
2344
|
+
rb_define_singleton_method(klass, "singleShot", (VALUE (*) (...)) qtimer_single_shot, -1);
|
|
2345
|
+
rb_define_singleton_method(klass, "single_shot", (VALUE (*) (...)) qtimer_single_shot, -1);
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
rb_define_method(klass, "qobject_cast", (VALUE (*) (...)) qobject_qt_metacast, 1);
|
|
2350
|
+
rb_define_method(klass, "inspect", (VALUE (*) (...)) inspect_qobject, 0);
|
|
2351
|
+
rb_define_method(klass, "pretty_print", (VALUE (*) (...)) pretty_print_qobject, 1);
|
|
2352
|
+
rb_define_method(klass, "className", (VALUE (*) (...)) class_name, 0);
|
|
2353
|
+
rb_define_method(klass, "class_name", (VALUE (*) (...)) class_name, 0);
|
|
2354
|
+
rb_define_method(klass, "inherits", (VALUE (*) (...)) inherits_qobject, -1);
|
|
2355
|
+
rb_define_method(klass, "findChildren", (VALUE (*) (...)) find_qobject_children, -1);
|
|
2356
|
+
rb_define_method(klass, "find_children", (VALUE (*) (...)) find_qobject_children, -1);
|
|
2357
|
+
rb_define_method(klass, "findChild", (VALUE (*) (...)) find_qobject_child, -1);
|
|
2358
|
+
rb_define_method(klass, "find_child", (VALUE (*) (...)) find_qobject_child, -1);
|
|
2359
|
+
rb_define_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
|
|
2360
|
+
rb_define_singleton_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
|
|
2361
|
+
|
|
2362
|
+
foreach(QtRubyModule m, qtruby_modules.values()) {
|
|
2363
|
+
if (m.class_created)
|
|
2364
|
+
m.class_created(package, module_value, klass);
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
free((void *) package);
|
|
2368
|
+
return klass;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
static VALUE
|
|
2372
|
+
create_qt_class(VALUE /*self*/, VALUE package_value, VALUE module_value)
|
|
2373
|
+
{
|
|
2374
|
+
const char *package = strdup(StringValuePtr(package_value));
|
|
2375
|
+
// this won't work:
|
|
2376
|
+
// strdup(StringValuePtr(rb_funcall(module_value, rb_intern("name"), 0)))
|
|
2377
|
+
// any ideas why?
|
|
2378
|
+
VALUE value_moduleName = rb_funcall(module_value, rb_intern("name"), 0);
|
|
2379
|
+
const char *moduleName = strdup(StringValuePtr(value_moduleName));
|
|
2380
|
+
VALUE klass = module_value;
|
|
2381
|
+
QString packageName(package);
|
|
2382
|
+
|
|
2383
|
+
/*
|
|
2384
|
+
rb_define_singleton_method(module_value, "method_missing", (VALUE (*) (...)) module_method_missing, -1);
|
|
2385
|
+
rb_define_singleton_method(module_value, "const_missing", (VALUE (*) (...)) module_method_missing, -1);
|
|
2386
|
+
*/
|
|
2387
|
+
foreach(QString s, packageName.mid(strlen(moduleName) + 2).split("::")) {
|
|
2388
|
+
klass = rb_define_class_under(klass, (const char*) s.toLatin1(), qt_base_class);
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
if (packageName == "Qt::MetaObject") {
|
|
2392
|
+
qmetaobject_class = klass;
|
|
2393
|
+
} else if (packageName == "Qt::Variant") {
|
|
2394
|
+
qvariant_class = klass;
|
|
2395
|
+
rb_define_singleton_method(qvariant_class, "fromValue", (VALUE (*) (...)) qvariant_from_value, -1);
|
|
2396
|
+
rb_define_singleton_method(qvariant_class, "from_value", (VALUE (*) (...)) qvariant_from_value, -1);
|
|
2397
|
+
rb_define_singleton_method(qvariant_class, "new", (VALUE (*) (...)) new_qvariant, -1);
|
|
2398
|
+
} else if (packageName == "Qt::ByteArray") {
|
|
2399
|
+
rb_define_method(klass, "+", (VALUE (*) (...)) qbytearray_append, 1);
|
|
2400
|
+
rb_define_method(klass, "data", (VALUE (*) (...)) qbytearray_data, 0);
|
|
2401
|
+
rb_define_method(klass, "constData", (VALUE (*) (...)) qbytearray_data, 0);
|
|
2402
|
+
rb_define_method(klass, "const_data", (VALUE (*) (...)) qbytearray_data, 0);
|
|
2403
|
+
} else if (packageName == "Qt::Char") {
|
|
2404
|
+
rb_define_method(klass, "to_s", (VALUE (*) (...)) qchar_to_s, 0);
|
|
2405
|
+
} else if (packageName == "Qt::Image") {
|
|
2406
|
+
rb_define_method(klass, "bits", (VALUE (*) (...)) qimage_bits, 0);
|
|
2407
|
+
rb_define_method(klass, "scanLine", (VALUE (*) (...)) qimage_scan_line, 1);
|
|
2408
|
+
} else if (packageName == "Qt::ItemSelection") {
|
|
2409
|
+
rb_define_method(klass, "[]", (VALUE (*) (...)) qitemselection_at, 1);
|
|
2410
|
+
rb_define_method(klass, "at", (VALUE (*) (...)) qitemselection_at, 1);
|
|
2411
|
+
rb_define_method(klass, "count", (VALUE (*) (...)) qitemselection_count, 0);
|
|
2412
|
+
rb_define_method(klass, "length", (VALUE (*) (...)) qitemselection_count, 0);
|
|
2413
|
+
} else if (packageName == "Qt::Polygon") {
|
|
2414
|
+
rb_define_method(klass, "[]", (VALUE (*) (...)) qpolygon_at, 1);
|
|
2415
|
+
rb_define_method(klass, "at", (VALUE (*) (...)) qpolygon_at, 1);
|
|
2416
|
+
rb_define_method(klass, "count", (VALUE (*) (...)) qpolygon_count, 0);
|
|
2417
|
+
rb_define_method(klass, "length", (VALUE (*) (...)) qpolygon_count, 0);
|
|
2418
|
+
} else if (packageName == "Qt::PolygonF") {
|
|
2419
|
+
rb_define_method(klass, "[]", (VALUE (*) (...)) qpolygonf_at, 1);
|
|
2420
|
+
rb_define_method(klass, "at", (VALUE (*) (...)) qpolygonf_at, 1);
|
|
2421
|
+
rb_define_method(klass, "count", (VALUE (*) (...)) qpolygonf_count, 0);
|
|
2422
|
+
rb_define_method(klass, "length", (VALUE (*) (...)) qpolygonf_count, 0);
|
|
2423
|
+
rb_define_method(klass, "point", (VALUE (*) (...)) qpolygonf_at, 1);
|
|
2424
|
+
} else if (packageName == "Qt::Painter") {
|
|
2425
|
+
rb_define_method(klass, "drawLines", (VALUE (*) (...)) qpainter_drawlines, -1);
|
|
2426
|
+
rb_define_method(klass, "draw_lines", (VALUE (*) (...)) qpainter_drawlines, -1);
|
|
2427
|
+
rb_define_method(klass, "drawRects", (VALUE (*) (...)) qpainter_drawrects, -1);
|
|
2428
|
+
rb_define_method(klass, "draw_rects", (VALUE (*) (...)) qpainter_drawrects, -1);
|
|
2429
|
+
} else if (packageName == "Qt::ModelIndex") {
|
|
2430
|
+
rb_define_method(klass, "internalPointer", (VALUE (*) (...)) qmodelindex_internalpointer, 0);
|
|
2431
|
+
rb_define_method(klass, "internal_pointer", (VALUE (*) (...)) qmodelindex_internalpointer, 0);
|
|
2432
|
+
} else if (packageName == "Qt::SignalMapper") {
|
|
2433
|
+
rb_define_method(klass, "mapping", (VALUE (*) (...)) qsignalmapper_mapping, -1);
|
|
2434
|
+
rb_define_method(klass, "setMapping", (VALUE (*) (...)) qsignalmapper_set_mapping, -1);
|
|
2435
|
+
rb_define_method(klass, "set_mapping", (VALUE (*) (...)) qsignalmapper_set_mapping, -1);
|
|
2436
|
+
#ifdef QT_QTDBUS
|
|
2437
|
+
} else if (packageName == "Qt::DBusArgument") {
|
|
2438
|
+
rb_define_method(klass, "endArrayWrite", (VALUE (*) (...)) qdbusargument_endarraywrite, 0);
|
|
2439
|
+
rb_define_method(klass, "end_array_write", (VALUE (*) (...)) qdbusargument_endarraywrite, 0);
|
|
2440
|
+
rb_define_method(klass, "endMapEntryWrite", (VALUE (*) (...)) qdbusargument_endmapentrywrite, 0);
|
|
2441
|
+
rb_define_method(klass, "end_map_entry_write", (VALUE (*) (...)) qdbusargument_endmapentrywrite, 0);
|
|
2442
|
+
rb_define_method(klass, "endMapWrite", (VALUE (*) (...)) qdbusargument_endmapwrite, 0);
|
|
2443
|
+
rb_define_method(klass, "end_map_write", (VALUE (*) (...)) qdbusargument_endmapwrite, 0);
|
|
2444
|
+
rb_define_method(klass, "endStructureWrite", (VALUE (*) (...)) qdbusargument_endstructurewrite, 0);
|
|
2445
|
+
rb_define_method(klass, "end_structure_write", (VALUE (*) (...)) qdbusargument_endstructurewrite, 0);
|
|
2446
|
+
#endif
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
foreach(QtRubyModule m, qtruby_modules.values()) {
|
|
2450
|
+
if (m.class_created)
|
|
2451
|
+
m.class_created(package, module_value, klass);
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
free((void *) package);
|
|
2455
|
+
return klass;
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
static VALUE
|
|
2459
|
+
version(VALUE /*self*/)
|
|
2460
|
+
{
|
|
2461
|
+
return rb_str_new2(QT_VERSION_STR);
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
static VALUE
|
|
2465
|
+
qtruby_version(VALUE /*self*/)
|
|
2466
|
+
{
|
|
2467
|
+
return rb_str_new2(QTRUBY_VERSION);
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
static VALUE
|
|
2471
|
+
set_application_terminated(VALUE /*self*/, VALUE yn)
|
|
2472
|
+
{
|
|
2473
|
+
application_terminated = (yn == Qtrue ? true : false);
|
|
2474
|
+
return Qnil;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
static VALUE
|
|
2478
|
+
set_qtruby_embedded_wrapped(VALUE /*self*/, VALUE yn)
|
|
2479
|
+
{
|
|
2480
|
+
set_qtruby_embedded( yn == Qtrue );
|
|
2481
|
+
return Qnil;
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
#define INIT_BINDING(module) \
|
|
2485
|
+
static QtRuby::Binding module##_binding = QtRuby::Binding(module##_Smoke); \
|
|
2486
|
+
QtRubyModule module = { "QtRuby_" #module, resolve_classname_qt, 0, &module##_binding }; \
|
|
2487
|
+
qtruby_modules[module##_Smoke] = module; \
|
|
2488
|
+
smokeList << module##_Smoke;
|
|
2489
|
+
|
|
2490
|
+
extern Q_DECL_EXPORT void
|
|
2491
|
+
Init_qtruby4()
|
|
2492
|
+
{
|
|
2493
|
+
init_qtcore_Smoke();
|
|
2494
|
+
init_qtgui_Smoke();
|
|
2495
|
+
init_qtxml_Smoke();
|
|
2496
|
+
init_qtsql_Smoke();
|
|
2497
|
+
init_qtopengl_Smoke();
|
|
2498
|
+
init_qtnetwork_Smoke();
|
|
2499
|
+
init_qtsvg_Smoke();
|
|
2500
|
+
#ifdef QT_QTDBUS
|
|
2501
|
+
init_qtdbus_Smoke();
|
|
2502
|
+
#endif
|
|
2503
|
+
install_handlers(Qt_handlers);
|
|
2504
|
+
|
|
2505
|
+
INIT_BINDING(qtcore)
|
|
2506
|
+
INIT_BINDING(qtgui)
|
|
2507
|
+
INIT_BINDING(qtxml)
|
|
2508
|
+
INIT_BINDING(qtsql)
|
|
2509
|
+
INIT_BINDING(qtopengl)
|
|
2510
|
+
INIT_BINDING(qtnetwork)
|
|
2511
|
+
INIT_BINDING(qtsvg)
|
|
2512
|
+
#ifdef QT_QTDBUS
|
|
2513
|
+
INIT_BINDING(qtdbus)
|
|
2514
|
+
#endif
|
|
2515
|
+
|
|
2516
|
+
if (qt_module == Qnil) {
|
|
2517
|
+
qt_module = rb_define_module("Qt");
|
|
2518
|
+
qt_internal_module = rb_define_module_under(qt_module, "Internal");
|
|
2519
|
+
qt_base_class = rb_define_class_under(qt_module, "Base", rb_cObject);
|
|
2520
|
+
moduleindex_class = rb_define_class_under(qt_internal_module, "ModuleIndex", rb_cObject);
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
rb_define_singleton_method(qt_base_class, "new", (VALUE (*) (...)) new_qt, -1);
|
|
2524
|
+
rb_define_method(qt_base_class, "initialize", (VALUE (*) (...)) initialize_qt, -1);
|
|
2525
|
+
rb_define_singleton_method(qt_base_class, "method_missing", (VALUE (*) (...)) class_method_missing, -1);
|
|
2526
|
+
rb_define_singleton_method(qt_module, "method_missing", (VALUE (*) (...)) module_method_missing, -1);
|
|
2527
|
+
rb_define_method(qt_base_class, "method_missing", (VALUE (*) (...)) method_missing, -1);
|
|
2528
|
+
|
|
2529
|
+
rb_define_singleton_method(qt_base_class, "const_missing", (VALUE (*) (...)) class_method_missing, -1);
|
|
2530
|
+
rb_define_singleton_method(qt_module, "const_missing", (VALUE (*) (...)) module_method_missing, -1);
|
|
2531
|
+
rb_define_method(qt_base_class, "const_missing", (VALUE (*) (...)) method_missing, -1);
|
|
2532
|
+
|
|
2533
|
+
rb_define_method(qt_base_class, "dispose", (VALUE (*) (...)) dispose, 0);
|
|
2534
|
+
rb_define_method(qt_base_class, "isDisposed", (VALUE (*) (...)) is_disposed, 0);
|
|
2535
|
+
rb_define_method(qt_base_class, "disposed?", (VALUE (*) (...)) is_disposed, 0);
|
|
2536
|
+
|
|
2537
|
+
rb_define_method(qt_base_class, "qVariantValue", (VALUE (*) (...)) qvariant_value, 2);
|
|
2538
|
+
rb_define_method(qt_base_class, "qVariantFromValue", (VALUE (*) (...)) qvariant_from_value, -1);
|
|
2539
|
+
|
|
2540
|
+
rb_define_method(rb_cObject, "qDebug", (VALUE (*) (...)) qdebug, 1);
|
|
2541
|
+
rb_define_method(rb_cObject, "qFatal", (VALUE (*) (...)) qfatal, 1);
|
|
2542
|
+
rb_define_method(rb_cObject, "qWarning", (VALUE (*) (...)) qwarning, 1);
|
|
2543
|
+
|
|
2544
|
+
rb_define_module_function(qt_internal_module, "getMethStat", (VALUE (*) (...)) getMethStat, 0);
|
|
2545
|
+
rb_define_module_function(qt_internal_module, "getClassStat", (VALUE (*) (...)) getClassStat, 0);
|
|
2546
|
+
rb_define_module_function(qt_internal_module, "getIsa", (VALUE (*) (...)) getIsa, 1);
|
|
2547
|
+
rb_define_module_function(qt_internal_module, "setDebug", (VALUE (*) (...)) setDebug, 1);
|
|
2548
|
+
rb_define_module_function(qt_internal_module, "debug", (VALUE (*) (...)) debugging, 0);
|
|
2549
|
+
rb_define_module_function(qt_internal_module, "get_arg_type_name", (VALUE (*) (...)) get_arg_type_name, 2);
|
|
2550
|
+
rb_define_module_function(qt_internal_module, "classIsa", (VALUE (*) (...)) classIsa, 2);
|
|
2551
|
+
rb_define_module_function(qt_internal_module, "isEnum", (VALUE (*) (...)) isEnum, 1);
|
|
2552
|
+
rb_define_module_function(qt_internal_module, "insert_pclassid", (VALUE (*) (...)) insert_pclassid, 2);
|
|
2553
|
+
rb_define_module_function(qt_internal_module, "classid2name", (VALUE (*) (...)) classid2name, 1);
|
|
2554
|
+
rb_define_module_function(qt_internal_module, "find_pclassid", (VALUE (*) (...)) find_pclassid, 1);
|
|
2555
|
+
rb_define_module_function(qt_internal_module, "get_value_type", (VALUE (*) (...)) get_value_type, 1);
|
|
2556
|
+
|
|
2557
|
+
rb_define_module_function(qt_internal_module, "make_metaObject", (VALUE (*) (...)) make_metaObject, 4);
|
|
2558
|
+
rb_define_module_function(qt_internal_module, "addMetaObjectMethods", (VALUE (*) (...)) add_metaobject_methods, 1);
|
|
2559
|
+
rb_define_module_function(qt_internal_module, "addSignalMethods", (VALUE (*) (...)) add_signal_methods, 2);
|
|
2560
|
+
rb_define_module_function(qt_internal_module, "mapObject", (VALUE (*) (...)) mapObject, 1);
|
|
2561
|
+
|
|
2562
|
+
rb_define_module_function(qt_internal_module, "isQObject", (VALUE (*) (...)) isQObject, 1);
|
|
2563
|
+
rb_define_module_function(qt_internal_module, "idInstance", (VALUE (*) (...)) idInstance, 1);
|
|
2564
|
+
rb_define_module_function(qt_internal_module, "findClass", (VALUE (*) (...)) findClass, 1);
|
|
2565
|
+
// rb_define_module_function(qt_internal_module, "idMethodName", (VALUE (*) (...)) idMethodName, 1);
|
|
2566
|
+
// rb_define_module_function(qt_internal_module, "idMethod", (VALUE (*) (...)) idMethod, 2);
|
|
2567
|
+
rb_define_module_function(qt_internal_module, "findMethod", (VALUE (*) (...)) findMethod, 2);
|
|
2568
|
+
rb_define_module_function(qt_internal_module, "findAllMethods", (VALUE (*) (...)) findAllMethods, -1);
|
|
2569
|
+
rb_define_module_function(qt_internal_module, "findAllMethodNames", (VALUE (*) (...)) findAllMethodNames, 3);
|
|
2570
|
+
rb_define_module_function(qt_internal_module, "dumpCandidates", (VALUE (*) (...)) dumpCandidates, 1);
|
|
2571
|
+
rb_define_module_function(qt_internal_module, "isConstMethod", (VALUE (*) (...)) isConstMethod, 1);
|
|
2572
|
+
rb_define_module_function(qt_internal_module, "isObject", (VALUE (*) (...)) isObject, 1);
|
|
2573
|
+
rb_define_module_function(qt_internal_module, "setCurrentMethod", (VALUE (*) (...)) setCurrentMethod, 1);
|
|
2574
|
+
rb_define_module_function(qt_internal_module, "getClassList", (VALUE (*) (...)) getClassList, 0);
|
|
2575
|
+
rb_define_module_function(qt_internal_module, "create_qt_class", (VALUE (*) (...)) create_qt_class, 2);
|
|
2576
|
+
rb_define_module_function(qt_internal_module, "create_qobject_class", (VALUE (*) (...)) create_qobject_class, 2);
|
|
2577
|
+
rb_define_module_function(qt_internal_module, "cast_object_to", (VALUE (*) (...)) cast_object_to, 2);
|
|
2578
|
+
rb_define_module_function(qt_module, "dynamic_cast", (VALUE (*) (...)) cast_object_to, 2);
|
|
2579
|
+
rb_define_module_function(qt_internal_module, "kross2smoke", (VALUE (*) (...)) kross2smoke, 2);
|
|
2580
|
+
rb_define_module_function(qt_internal_module, "set_qtruby_embedded", (VALUE (*) (...)) set_qtruby_embedded_wrapped, 1);
|
|
2581
|
+
|
|
2582
|
+
rb_define_module_function(qt_internal_module, "application_terminated=", (VALUE (*) (...)) set_application_terminated, 1);
|
|
2583
|
+
|
|
2584
|
+
rb_define_module_function(qt_module, "version", (VALUE (*) (...)) version, 0);
|
|
2585
|
+
rb_define_module_function(qt_module, "qtruby_version", (VALUE (*) (...)) qtruby_version, 0);
|
|
2586
|
+
|
|
2587
|
+
rb_define_module_function(qt_module, "qRegisterResourceData", (VALUE (*) (...)) q_register_resource_data, 4);
|
|
2588
|
+
rb_define_module_function(qt_module, "qUnregisterResourceData", (VALUE (*) (...)) q_unregister_resource_data, 4);
|
|
2589
|
+
|
|
2590
|
+
// A problem has been found with QtRuby when it is run with Ruby 1.9.1
|
|
2591
|
+
// and GC.stess is true.
|
|
2592
|
+
// In the smokeruby_mark() function called during garbage collection,
|
|
2593
|
+
// any virtual methods which are called on the instances being checked
|
|
2594
|
+
// could have overriden by Ruby methods. So the Wt::Ruby runtime uses
|
|
2595
|
+
// 'respond_to()' to find out whether they have been overriden.
|
|
2596
|
+
// However, this involves calling 'rb_intern()' on the method name,
|
|
2597
|
+
// which means memory could be allocated, giving an error when running under
|
|
2598
|
+
// GC.stress mode. So workround it by pre-allocating any strings with
|
|
2599
|
+
// rb_intern() for all the C++ methods used in smokeruby_mark()
|
|
2600
|
+
rb_intern("children");
|
|
2601
|
+
rb_intern("childItems");
|
|
2602
|
+
rb_intern("childCount");
|
|
2603
|
+
rb_intern("child");
|
|
2604
|
+
rb_intern("hasChildren");
|
|
2605
|
+
rb_intern("parent");
|
|
2606
|
+
rb_intern("parentItem");
|
|
2607
|
+
rb_intern("item");
|
|
2608
|
+
rb_intern("items");
|
|
2609
|
+
rb_intern("rowCount");
|
|
2610
|
+
rb_intern("rowAt");
|
|
2611
|
+
rb_intern("columnCount");
|
|
2612
|
+
rb_intern("elementAt");
|
|
2613
|
+
rb_intern("columnAt");
|
|
2614
|
+
rb_intern("topLevelItem");
|
|
2615
|
+
rb_intern("itemAt");
|
|
2616
|
+
rb_intern("internalPointer");
|
|
2617
|
+
|
|
2618
|
+
rb_require("Qt/qtruby4.rb");
|
|
2619
|
+
|
|
2620
|
+
rObject_typeId = QMetaType::registerType("rObject", &delete_ruby_object, &create_ruby_object);
|
|
2621
|
+
|
|
2622
|
+
// Do package initialization
|
|
2623
|
+
rb_funcall(qt_internal_module, rb_intern("init_all_classes"), 0);
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
}
|
|
2627
|
+
// kate: space-indent false;
|