rock-qtbindings 4.8.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (768) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.txt +85 -0
  3. data/COPYING.LIB.txt +510 -0
  4. data/COPYING.txt +286 -0
  5. data/KNOWN_ISSUES.txt +17 -0
  6. data/Rakefile +121 -0
  7. data/TODO.txt +2 -0
  8. data/bin/rbqtapi +152 -0
  9. data/bin/rbrcc +14 -0
  10. data/bin/rbuic4 +14 -0
  11. data/bin/smokeapi +14 -0
  12. data/bin/smokedeptool +14 -0
  13. data/examples/designer/calculatorbuilder/calculatorbuilder.qrc +5 -0
  14. data/examples/designer/calculatorbuilder/calculatorform.rb +60 -0
  15. data/examples/designer/calculatorbuilder/calculatorform.ui +299 -0
  16. data/examples/designer/calculatorbuilder/main.rb +34 -0
  17. data/examples/designer/calculatorbuilder/makefile +2 -0
  18. data/examples/designer/calculatorform/calculatorform.rb +46 -0
  19. data/examples/designer/calculatorform/calculatorform.ui +277 -0
  20. data/examples/designer/calculatorform/main.rb +32 -0
  21. data/examples/designer/calculatorform/makefile +3 -0
  22. data/examples/desktop/screenshot/main.rb +32 -0
  23. data/examples/desktop/screenshot/screenshot.rb +157 -0
  24. data/examples/desktop/systray/images/bad.svg +64 -0
  25. data/examples/desktop/systray/images/heart.svg +55 -0
  26. data/examples/desktop/systray/images/trash.svg +58 -0
  27. data/examples/desktop/systray/main.rb +41 -0
  28. data/examples/desktop/systray/makefile +2 -0
  29. data/examples/desktop/systray/systray.qrc +7 -0
  30. data/examples/desktop/systray/window.rb +219 -0
  31. data/examples/dialogs/complexwizard/complexwizard.rb +140 -0
  32. data/examples/dialogs/complexwizard/licensewizard.rb +294 -0
  33. data/examples/dialogs/complexwizard/main.rb +31 -0
  34. data/examples/dialogs/configdialog/configdialog.rb +109 -0
  35. data/examples/dialogs/configdialog/images/config.png +0 -0
  36. data/examples/dialogs/configdialog/images/query.png +0 -0
  37. data/examples/dialogs/configdialog/images/update.png +0 -0
  38. data/examples/dialogs/configdialog/main.rb +31 -0
  39. data/examples/dialogs/configdialog/pages.rb +140 -0
  40. data/examples/dialogs/extension/finddialog.rb +89 -0
  41. data/examples/dialogs/extension/main.rb +31 -0
  42. data/examples/dialogs/findfiles/main.rb +32 -0
  43. data/examples/dialogs/findfiles/window.rb +177 -0
  44. data/examples/dialogs/simplewizard/classwizard.rb +374 -0
  45. data/examples/dialogs/simplewizard/main.rb +31 -0
  46. data/examples/dialogs/simplewizard/simplewizard.rb +110 -0
  47. data/examples/dialogs/standarddialogs/dialog.rb +340 -0
  48. data/examples/dialogs/standarddialogs/main.rb +31 -0
  49. data/examples/dialogs/tabdialog/main.rb +38 -0
  50. data/examples/dialogs/tabdialog/tabdialog.rb +178 -0
  51. data/examples/draganddrop/draggableicons/dragwidget.rb +125 -0
  52. data/examples/draganddrop/draggableicons/images/boat.png +0 -0
  53. data/examples/draganddrop/draggableicons/images/car.png +0 -0
  54. data/examples/draganddrop/draggableicons/images/house.png +0 -0
  55. data/examples/draganddrop/draggableicons/main.rb +41 -0
  56. data/examples/draganddrop/draggabletext/draglabel.rb +51 -0
  57. data/examples/draganddrop/draggabletext/dragwidget.rb +94 -0
  58. data/examples/draganddrop/draggabletext/main.rb +33 -0
  59. data/examples/draganddrop/draggabletext/words.txt +41 -0
  60. data/examples/draganddrop/dropsite/dropsitewidget.rb +99 -0
  61. data/examples/draganddrop/dropsite/dropsitewindow.rb +114 -0
  62. data/examples/draganddrop/dropsite/main.rb +33 -0
  63. data/examples/draganddrop/fridgemagnets/draglabel.rb +78 -0
  64. data/examples/draganddrop/fridgemagnets/dragwidget.rb +130 -0
  65. data/examples/draganddrop/fridgemagnets/main.rb +33 -0
  66. data/examples/draganddrop/fridgemagnets/words.txt +48 -0
  67. data/examples/draganddrop/puzzle/example.jpg +0 -0
  68. data/examples/draganddrop/puzzle/main.rb +33 -0
  69. data/examples/draganddrop/puzzle/mainwindow.rb +136 -0
  70. data/examples/draganddrop/puzzle/pieceslist.rb +95 -0
  71. data/examples/draganddrop/puzzle/puzzlewidget.rb +190 -0
  72. data/examples/graphicsview/collidingmice/images/cheese.jpg +0 -0
  73. data/examples/graphicsview/collidingmice/main.rb +53 -0
  74. data/examples/graphicsview/collidingmice/makefile +2 -0
  75. data/examples/graphicsview/collidingmice/mice.qrc +5 -0
  76. data/examples/graphicsview/collidingmice/mouse.rb +176 -0
  77. data/examples/graphicsview/dragdroprobot/coloritem.rb +86 -0
  78. data/examples/graphicsview/dragdroprobot/images/head.png +0 -0
  79. data/examples/graphicsview/dragdroprobot/main.rb +57 -0
  80. data/examples/graphicsview/dragdroprobot/makefile +2 -0
  81. data/examples/graphicsview/dragdroprobot/robot.qrc +5 -0
  82. data/examples/graphicsview/dragdroprobot/robot.rb +246 -0
  83. data/examples/itemviews/chart/chart.qrc +5 -0
  84. data/examples/itemviews/chart/main.rb +33 -0
  85. data/examples/itemviews/chart/mainwindow.rb +151 -0
  86. data/examples/itemviews/chart/makefile +2 -0
  87. data/examples/itemviews/chart/mydata.cht +8 -0
  88. data/examples/itemviews/chart/pieview.rb +516 -0
  89. data/examples/itemviews/chart/qtdata.cht +14 -0
  90. data/examples/itemviews/dirview/main.rb +39 -0
  91. data/examples/itemviews/pixelator/imagemodel.rb +51 -0
  92. data/examples/itemviews/pixelator/images/qt.png +0 -0
  93. data/examples/itemviews/pixelator/images.qrc +5 -0
  94. data/examples/itemviews/pixelator/main.rb +34 -0
  95. data/examples/itemviews/pixelator/mainwindow.rb +218 -0
  96. data/examples/itemviews/pixelator/makefile +3 -0
  97. data/examples/itemviews/pixelator/pixeldelegate.rb +67 -0
  98. data/examples/itemviews/puzzle/example.jpg +0 -0
  99. data/examples/itemviews/puzzle/main.rb +36 -0
  100. data/examples/itemviews/puzzle/mainwindow.rb +143 -0
  101. data/examples/itemviews/puzzle/piecesmodel.rb +174 -0
  102. data/examples/itemviews/puzzle/puzzlewidget.rb +192 -0
  103. data/examples/itemviews/simpledommodel/domitem.rb +62 -0
  104. data/examples/itemviews/simpledommodel/dommodel.rb +139 -0
  105. data/examples/itemviews/simpledommodel/main.rb +33 -0
  106. data/examples/itemviews/simpledommodel/mainwindow.rb +66 -0
  107. data/examples/itemviews/simpletreemodel/default.txt +40 -0
  108. data/examples/itemviews/simpletreemodel/main.rb +41 -0
  109. data/examples/itemviews/simpletreemodel/makefile +2 -0
  110. data/examples/itemviews/simpletreemodel/simpletreemodel.qrc +5 -0
  111. data/examples/itemviews/simpletreemodel/treeitem.rb +67 -0
  112. data/examples/itemviews/simpletreemodel/treemodel.rb +164 -0
  113. data/examples/itemviews/sortingmodel/default.txt +40 -0
  114. data/examples/itemviews/sortingmodel/main.rb +53 -0
  115. data/examples/itemviews/sortingmodel/treeitem.rb +73 -0
  116. data/examples/itemviews/sortingmodel/treemodel.rb +166 -0
  117. data/examples/itemviews/spinboxdelegate/main.rb +47 -0
  118. data/examples/itemviews/spinboxdelegate/spinboxdelegate.rb +62 -0
  119. data/examples/killerfilter/killerfilter.rb +55 -0
  120. data/examples/layouts/basiclayouts/dialog.rb +110 -0
  121. data/examples/layouts/basiclayouts/main.rb +31 -0
  122. data/examples/layouts/borderlayout/borderlayout.rb +190 -0
  123. data/examples/layouts/borderlayout/main.rb +32 -0
  124. data/examples/layouts/borderlayout/window.rb +52 -0
  125. data/examples/layouts/flowlayouts/flowlayout.rb +108 -0
  126. data/examples/layouts/flowlayouts/main.rb +32 -0
  127. data/examples/layouts/flowlayouts/window.rb +43 -0
  128. data/examples/mainwindows/application/images/copy.png +0 -0
  129. data/examples/mainwindows/application/images/cut.png +0 -0
  130. data/examples/mainwindows/application/images/new.png +0 -0
  131. data/examples/mainwindows/application/images/open.png +0 -0
  132. data/examples/mainwindows/application/images/paste.png +0 -0
  133. data/examples/mainwindows/application/images/save.png +0 -0
  134. data/examples/mainwindows/application/main.rb +32 -0
  135. data/examples/mainwindows/application/mainwindow.rb +285 -0
  136. data/examples/mainwindows/dockwidgets/images/new.png +0 -0
  137. data/examples/mainwindows/dockwidgets/images/print.png +0 -0
  138. data/examples/mainwindows/dockwidgets/images/save.png +0 -0
  139. data/examples/mainwindows/dockwidgets/images/undo.png +0 -0
  140. data/examples/mainwindows/dockwidgets/main.rb +32 -0
  141. data/examples/mainwindows/dockwidgets/mainwindow.rb +302 -0
  142. data/examples/mainwindows/mdi/images/copy.png +0 -0
  143. data/examples/mainwindows/mdi/images/cut.png +0 -0
  144. data/examples/mainwindows/mdi/images/new.png +0 -0
  145. data/examples/mainwindows/mdi/images/open.png +0 -0
  146. data/examples/mainwindows/mdi/images/paste.png +0 -0
  147. data/examples/mainwindows/mdi/images/save.png +0 -0
  148. data/examples/mainwindows/mdi/main.rb +32 -0
  149. data/examples/mainwindows/mdi/mainwindow.rb +363 -0
  150. data/examples/mainwindows/mdi/mdichild.rb +152 -0
  151. data/examples/mainwindows/menus/main.rb +32 -0
  152. data/examples/mainwindows/menus/mainwindow.rb +327 -0
  153. data/examples/mainwindows/recentfiles/main.rb +32 -0
  154. data/examples/mainwindows/recentfiles/mainwindow.rb +258 -0
  155. data/examples/mainwindows/sdi/images/copy.png +0 -0
  156. data/examples/mainwindows/sdi/images/cut.png +0 -0
  157. data/examples/mainwindows/sdi/images/new.png +0 -0
  158. data/examples/mainwindows/sdi/images/open.png +0 -0
  159. data/examples/mainwindows/sdi/images/paste.png +0 -0
  160. data/examples/mainwindows/sdi/images/save.png +0 -0
  161. data/examples/mainwindows/sdi/main.rb +32 -0
  162. data/examples/mainwindows/sdi/mainwindow.rb +335 -0
  163. data/examples/network/broadcastreceiver/main.rb +32 -0
  164. data/examples/network/broadcastreceiver/receiver.rb +64 -0
  165. data/examples/network/broadcastsender/main.rb +32 -0
  166. data/examples/network/broadcastsender/sender.rb +72 -0
  167. data/examples/network/fortuneclient/client.rb +149 -0
  168. data/examples/network/fortuneclient/main.rb +32 -0
  169. data/examples/network/fortuneserver/main.rb +32 -0
  170. data/examples/network/fortuneserver/server.rb +88 -0
  171. data/examples/network/ftp/ftpwindow.rb +259 -0
  172. data/examples/network/ftp/images/cdtoparent.png +0 -0
  173. data/examples/network/ftp/images/dir.png +0 -0
  174. data/examples/network/ftp/images/file.png +0 -0
  175. data/examples/network/ftp/main.rb +32 -0
  176. data/examples/network/http/httpwindow.rb +187 -0
  177. data/examples/network/http/main.rb +32 -0
  178. data/examples/network/loopback/dialog.rb +163 -0
  179. data/examples/network/loopback/main.rb +32 -0
  180. data/examples/opengl/grabber/glwidget.rb +265 -0
  181. data/examples/opengl/grabber/main.rb +32 -0
  182. data/examples/opengl/grabber/mainwindow.rb +189 -0
  183. data/examples/opengl/hellogl/glwidget.rb +226 -0
  184. data/examples/opengl/hellogl/main.rb +32 -0
  185. data/examples/opengl/hellogl/window.rb +66 -0
  186. data/examples/opengl/textures/glwidget.rb +151 -0
  187. data/examples/opengl/textures/images/side1.png +0 -0
  188. data/examples/opengl/textures/images/side2.png +0 -0
  189. data/examples/opengl/textures/images/side3.png +0 -0
  190. data/examples/opengl/textures/images/side4.png +0 -0
  191. data/examples/opengl/textures/images/side5.png +0 -0
  192. data/examples/opengl/textures/images/side6.png +0 -0
  193. data/examples/opengl/textures/main.rb +32 -0
  194. data/examples/opengl/textures/window.rb +77 -0
  195. data/examples/painting/basicdrawing/images/brick.png +0 -0
  196. data/examples/painting/basicdrawing/images/qt-logo.png +0 -0
  197. data/examples/painting/basicdrawing/main.rb +32 -0
  198. data/examples/painting/basicdrawing/renderarea.rb +166 -0
  199. data/examples/painting/basicdrawing/window.rb +215 -0
  200. data/examples/painting/concentriccircles/circlewidget.rb +88 -0
  201. data/examples/painting/concentriccircles/main.rb +32 -0
  202. data/examples/painting/concentriccircles/window.rb +72 -0
  203. data/examples/painting/fontsampler/main.rb +32 -0
  204. data/examples/painting/fontsampler/mainwindow.rb +369 -0
  205. data/examples/painting/fontsampler/mainwindowbase.ui +136 -0
  206. data/examples/painting/fontsampler/makefile +8 -0
  207. data/examples/painting/fontsampler/previewdialog.rb +257 -0
  208. data/examples/painting/fontsampler/previewdialogbase.ui +224 -0
  209. data/examples/painting/fontsampler/previewlabel.rb +43 -0
  210. data/examples/painting/imagecomposition/imagecomposer.rb +152 -0
  211. data/examples/painting/imagecomposition/imagecomposition.qrc +6 -0
  212. data/examples/painting/imagecomposition/images/background.png +0 -0
  213. data/examples/painting/imagecomposition/images/blackrectangle.png +0 -0
  214. data/examples/painting/imagecomposition/images/butterfly.png +0 -0
  215. data/examples/painting/imagecomposition/images/checker.png +0 -0
  216. data/examples/painting/imagecomposition/main.rb +33 -0
  217. data/examples/painting/imagecomposition/makefile +2 -0
  218. data/examples/painting/painterpaths/main.rb +32 -0
  219. data/examples/painting/painterpaths/renderarea.rb +97 -0
  220. data/examples/painting/painterpaths/window.rb +247 -0
  221. data/examples/painting/svgviewer/files/bubbles.svg +212 -0
  222. data/examples/painting/svgviewer/files/cubic.svg +77 -0
  223. data/examples/painting/svgviewer/files/spheres.svg +79 -0
  224. data/examples/painting/svgviewer/main.rb +38 -0
  225. data/examples/painting/svgviewer/mainwindow.rb +99 -0
  226. data/examples/painting/svgviewer/makefile +2 -0
  227. data/examples/painting/svgviewer/svgview.rb +156 -0
  228. data/examples/painting/svgviewer/svgviewer.qrc +6 -0
  229. data/examples/painting/svgviewer/svgwindow.rb +87 -0
  230. data/examples/painting/transformations/main.rb +32 -0
  231. data/examples/painting/transformations/renderarea.rb +127 -0
  232. data/examples/painting/transformations/window.rb +153 -0
  233. data/examples/passivepopup/passivepopup.rb +38 -0
  234. data/examples/qdbus/chat/chat.rb +146 -0
  235. data/examples/qdbus/chat/chat_adaptor.rb +12 -0
  236. data/examples/qdbus/chat/chat_interface.rb +13 -0
  237. data/examples/qdbus/chat/chatmainwindow.ui +184 -0
  238. data/examples/qdbus/chat/chatsetnickname.ui +145 -0
  239. data/examples/qdbus/chat/makefile +8 -0
  240. data/examples/qdbus/complexpingpong/complexping.rb +92 -0
  241. data/examples/qdbus/complexpingpong/complexpong.rb +83 -0
  242. data/examples/qdbus/complexpingpong/ping-common.rb +1 -0
  243. data/examples/qdbus/listnames/listnames.rb +69 -0
  244. data/examples/qdbus/pingpong/ping-common.rb +1 -0
  245. data/examples/qdbus/pingpong/ping.rb +52 -0
  246. data/examples/qdbus/pingpong/pong.rb +55 -0
  247. data/examples/qdbus/remotecontrolledcar/car/car.rb +151 -0
  248. data/examples/qdbus/remotecontrolledcar/car/main.rb +50 -0
  249. data/examples/qdbus/remotecontrolledcar/controller/controller.rb +66 -0
  250. data/examples/qdbus/remotecontrolledcar/controller/controller.ui +61 -0
  251. data/examples/qdbus/remotecontrolledcar/controller/main.rb +32 -0
  252. data/examples/qdbus/remotecontrolledcar/controller/makefile +2 -0
  253. data/examples/qtscribble/scribble.rb +270 -0
  254. data/examples/richtext/calendar/main.rb +33 -0
  255. data/examples/richtext/calendar/mainwindow.rb +173 -0
  256. data/examples/richtext/orderform/detailsdialog.rb +130 -0
  257. data/examples/richtext/orderform/main.rb +34 -0
  258. data/examples/richtext/orderform/mainwindow.rb +194 -0
  259. data/examples/richtext/syntaxhighlighter/examples/example +79 -0
  260. data/examples/richtext/syntaxhighlighter/highlighter.rb +90 -0
  261. data/examples/richtext/syntaxhighlighter/main.rb +34 -0
  262. data/examples/richtext/syntaxhighlighter/mainwindow.rb +105 -0
  263. data/examples/ruboids/LICENSE.txt +58 -0
  264. data/examples/ruboids/Manifest +26 -0
  265. data/examples/ruboids/README +53 -0
  266. data/examples/ruboids/TODO +29 -0
  267. data/examples/ruboids/boids.properties +33 -0
  268. data/examples/ruboids/generateManifest.rb +42 -0
  269. data/examples/ruboids/index.html +147 -0
  270. data/examples/ruboids/release.rb +152 -0
  271. data/examples/ruboids/ruboids/Boid.rb +141 -0
  272. data/examples/ruboids/ruboids/BoidView.rb +159 -0
  273. data/examples/ruboids/ruboids/Camera.rb +24 -0
  274. data/examples/ruboids/ruboids/CameraDialog.rb +218 -0
  275. data/examples/ruboids/ruboids/Canvas.rb +143 -0
  276. data/examples/ruboids/ruboids/Cloud.rb +61 -0
  277. data/examples/ruboids/ruboids/CloudView.rb +54 -0
  278. data/examples/ruboids/ruboids/Flock.rb +47 -0
  279. data/examples/ruboids/ruboids/Graphics.rb +278 -0
  280. data/examples/ruboids/ruboids/Params.rb +87 -0
  281. data/examples/ruboids/ruboids/Point.rb +153 -0
  282. data/examples/ruboids/ruboids/Thing.rb +34 -0
  283. data/examples/ruboids/ruboids/Triangle.rb +21 -0
  284. data/examples/ruboids/ruboids/View.rb +88 -0
  285. data/examples/ruboids/ruboids/World.rb +82 -0
  286. data/examples/ruboids/ruboids/WorldWindow.rb +52 -0
  287. data/examples/ruboids/ruboids/info.rb +12 -0
  288. data/examples/ruboids/ruboids/ruboids.rb +29 -0
  289. data/examples/run_all.rb +15 -0
  290. data/examples/threading/main_thread.rb +19 -0
  291. data/examples/tutorial/t1/t1.rb +10 -0
  292. data/examples/tutorial/t10/cannon.rb +72 -0
  293. data/examples/tutorial/t10/lcdrange.rb +45 -0
  294. data/examples/tutorial/t10/t10.rb +55 -0
  295. data/examples/tutorial/t11/cannon.rb +123 -0
  296. data/examples/tutorial/t11/lcdrange.rb +45 -0
  297. data/examples/tutorial/t11/t11.rb +65 -0
  298. data/examples/tutorial/t12/cannon.rb +157 -0
  299. data/examples/tutorial/t12/lcdrange.rb +58 -0
  300. data/examples/tutorial/t12/t12.rb +65 -0
  301. data/examples/tutorial/t13/cannon.rb +206 -0
  302. data/examples/tutorial/t13/gamebrd.rb +112 -0
  303. data/examples/tutorial/t13/lcdrange.rb +59 -0
  304. data/examples/tutorial/t13/t13.rb +11 -0
  305. data/examples/tutorial/t14/cannon.rb +262 -0
  306. data/examples/tutorial/t14/gamebrd.rb +122 -0
  307. data/examples/tutorial/t14/lcdrange.rb +61 -0
  308. data/examples/tutorial/t14/t14.rb +11 -0
  309. data/examples/tutorial/t2/t2.rb +16 -0
  310. data/examples/tutorial/t3/t3.rb +17 -0
  311. data/examples/tutorial/t4/t4.rb +23 -0
  312. data/examples/tutorial/t5/t5.rb +35 -0
  313. data/examples/tutorial/t6/t6.rb +48 -0
  314. data/examples/tutorial/t7/lcdrange.rb +32 -0
  315. data/examples/tutorial/t7/t7.rb +40 -0
  316. data/examples/tutorial/t8/cannon.rb +37 -0
  317. data/examples/tutorial/t8/lcdrange.rb +45 -0
  318. data/examples/tutorial/t8/t8.rb +43 -0
  319. data/examples/tutorial/t9/cannon.rb +44 -0
  320. data/examples/tutorial/t9/lcdrange.rb +46 -0
  321. data/examples/tutorial/t9/t9.rb +43 -0
  322. data/examples/widgets/analogclock/analogclock.rb +94 -0
  323. data/examples/widgets/analogclock/main.rb +9 -0
  324. data/examples/widgets/calculator/button.rb +45 -0
  325. data/examples/widgets/calculator/calculator.rb +382 -0
  326. data/examples/widgets/calculator/main.rb +32 -0
  327. data/examples/widgets/charactermap/characterwidget.rb +110 -0
  328. data/examples/widgets/charactermap/main.rb +32 -0
  329. data/examples/widgets/charactermap/mainwindow.rb +118 -0
  330. data/examples/widgets/digitalclock/digitalclock.rb +30 -0
  331. data/examples/widgets/digitalclock/main.rb +9 -0
  332. data/examples/widgets/groupbox/main.rb +32 -0
  333. data/examples/widgets/groupbox/window.rb +134 -0
  334. data/examples/widgets/icons/iconpreviewarea.rb +111 -0
  335. data/examples/widgets/icons/iconsizespinbox.rb +39 -0
  336. data/examples/widgets/icons/imagedelegate.rb +73 -0
  337. data/examples/widgets/icons/images/designer.png +0 -0
  338. data/examples/widgets/icons/images/find_disabled.png +0 -0
  339. data/examples/widgets/icons/images/find_normal.png +0 -0
  340. data/examples/widgets/icons/images/monkey_off_128x128.png +0 -0
  341. data/examples/widgets/icons/images/monkey_off_16x16.png +0 -0
  342. data/examples/widgets/icons/images/monkey_off_32x32.png +0 -0
  343. data/examples/widgets/icons/images/monkey_off_64x64.png +0 -0
  344. data/examples/widgets/icons/images/monkey_on_128x128.png +0 -0
  345. data/examples/widgets/icons/images/monkey_on_16x16.png +0 -0
  346. data/examples/widgets/icons/images/monkey_on_32x32.png +0 -0
  347. data/examples/widgets/icons/images/monkey_on_64x64.png +0 -0
  348. data/examples/widgets/icons/images/qtopia_16x16.png +0 -0
  349. data/examples/widgets/icons/images/qtopia_32x32.png +0 -0
  350. data/examples/widgets/icons/images/qtopia_48x48.png +0 -0
  351. data/examples/widgets/icons/main.rb +32 -0
  352. data/examples/widgets/icons/mainwindow.rb +351 -0
  353. data/examples/widgets/imageviewer/imageviewer.rb +219 -0
  354. data/examples/widgets/imageviewer/main.rb +32 -0
  355. data/examples/widgets/lineedits/main.rb +32 -0
  356. data/examples/widgets/lineedits/window.rb +199 -0
  357. data/examples/widgets/movie/images/open.png +0 -0
  358. data/examples/widgets/movie/images/pause.png +0 -0
  359. data/examples/widgets/movie/images/play.png +0 -0
  360. data/examples/widgets/movie/images/quit.png +0 -0
  361. data/examples/widgets/movie/images/stop.png +0 -0
  362. data/examples/widgets/movie/main.rb +32 -0
  363. data/examples/widgets/movie/movieplayer.rb +201 -0
  364. data/examples/widgets/movie/movies/fire.mng +0 -0
  365. data/examples/widgets/screenshot/main.rb +32 -0
  366. data/examples/widgets/screenshot/screenshot.rb +155 -0
  367. data/examples/widgets/scribble/main.rb +32 -0
  368. data/examples/widgets/scribble/mainwindow.rb +202 -0
  369. data/examples/widgets/scribble/scribblearea.rb +154 -0
  370. data/examples/widgets/sliders/main.rb +32 -0
  371. data/examples/widgets/sliders/slidersgroup.rb +97 -0
  372. data/examples/widgets/sliders/window.rb +124 -0
  373. data/examples/widgets/spinboxes/main.rb +32 -0
  374. data/examples/widgets/spinboxes/window.rb +213 -0
  375. data/examples/widgets/tetrix/main.rb +33 -0
  376. data/examples/widgets/tetrix/tetrixboard.rb +346 -0
  377. data/examples/widgets/tetrix/tetrixpiece.rb +135 -0
  378. data/examples/widgets/tetrix/tetrixwindow.rb +88 -0
  379. data/examples/widgets/tooltips/images/circle.png +0 -0
  380. data/examples/widgets/tooltips/images/square.png +0 -0
  381. data/examples/widgets/tooltips/images/triangle.png +0 -0
  382. data/examples/widgets/tooltips/main.rb +32 -0
  383. data/examples/widgets/tooltips/shapeitem.rb +31 -0
  384. data/examples/widgets/tooltips/sortingbox.rb +222 -0
  385. data/examples/widgets/wiggly/dialog.rb +48 -0
  386. data/examples/widgets/wiggly/main.rb +9 -0
  387. data/examples/widgets/wiggly/wigglywidget.rb +76 -0
  388. data/examples/widgets/windowflags/controllerwindow.rb +195 -0
  389. data/examples/widgets/windowflags/main.rb +32 -0
  390. data/examples/widgets/windowflags/previewwindow.rb +103 -0
  391. data/examples/xml/dombookmarks/frank.xbel +230 -0
  392. data/examples/xml/dombookmarks/jennifer.xbel +93 -0
  393. data/examples/xml/dombookmarks/main.rb +34 -0
  394. data/examples/xml/dombookmarks/mainwindow.rb +129 -0
  395. data/examples/xml/dombookmarks/xbeltree.rb +172 -0
  396. data/examples/xml/saxbookmarks/frank.xbel +230 -0
  397. data/examples/xml/saxbookmarks/jennifer.xbel +93 -0
  398. data/examples/xml/saxbookmarks/main.rb +34 -0
  399. data/examples/xml/saxbookmarks/mainwindow.rb +144 -0
  400. data/examples/xml/saxbookmarks/xbelgenerator.rb +95 -0
  401. data/examples/xml/saxbookmarks/xbelhandler.rb +122 -0
  402. data/ext/CMakeLists.txt +28 -0
  403. data/ext/cmake/modules/BasicFindPackageVersion.cmake.in +30 -0
  404. data/ext/cmake/modules/CMakeCSharpCompiler.cmake.in +7 -0
  405. data/ext/cmake/modules/CMakeCSharpInformation.cmake +366 -0
  406. data/ext/cmake/modules/CMakeDetermineCSharpCompiler.cmake +85 -0
  407. data/ext/cmake/modules/CMakeTestCSharpCompiler.cmake +1 -0
  408. data/ext/cmake/modules/CheckCXXSourceCompiles.cmake +68 -0
  409. data/ext/cmake/modules/FindLibraryWithDebug.cmake +113 -0
  410. data/ext/cmake/modules/FindMono.cmake +36 -0
  411. data/ext/cmake/modules/FindPHP5.cmake +179 -0
  412. data/ext/cmake/modules/FindPerlMore.cmake +78 -0
  413. data/ext/cmake/modules/FindPhonon.cmake +71 -0
  414. data/ext/cmake/modules/FindQImageBlitz.cmake +51 -0
  415. data/ext/cmake/modules/FindQScintilla.cmake +57 -0
  416. data/ext/cmake/modules/FindQt4.cmake +1275 -0
  417. data/ext/cmake/modules/FindQwt5.cmake +104 -0
  418. data/ext/cmake/modules/FindRuby.cmake +279 -0
  419. data/ext/cmake/modules/FindSmoke.cmake +78 -0
  420. data/ext/cmake/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
  421. data/ext/cmake/modules/MacroLogFeature.cmake +146 -0
  422. data/ext/cmake/modules/MacroOptionalAddBindings.cmake +47 -0
  423. data/ext/cmake/modules/MacroOptionalFindPackage.cmake +28 -0
  424. data/ext/cmake/modules/MacroPushRequiredVars.cmake +47 -0
  425. data/ext/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake +22 -0
  426. data/ext/cmake/modules/Qt4ConfigDependentSettings.cmake +384 -0
  427. data/ext/cmake/modules/Qt4Macros.cmake +414 -0
  428. data/ext/cmake/modules/SmokeConfig.cmake.in +109 -0
  429. data/ext/generator/CMakeLists.txt +38 -0
  430. data/ext/generator/cmake/BasicFindPackageVersion.cmake.in +30 -0
  431. data/ext/generator/cmake/CMakeLists.txt +24 -0
  432. data/ext/generator/cmake/FindLibraryWithDebug.cmake +113 -0
  433. data/ext/generator/cmake/FindPhonon.cmake +71 -0
  434. data/ext/generator/cmake/FindQImageBlitz.cmake +51 -0
  435. data/ext/generator/cmake/FindQScintilla.cmake +57 -0
  436. data/ext/generator/cmake/FindQwt5.cmake +104 -0
  437. data/ext/generator/cmake/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
  438. data/ext/generator/cmake/MacroLogFeature.cmake +146 -0
  439. data/ext/generator/cmake/MacroOptionalAddBindings.cmake +47 -0
  440. data/ext/generator/cmake/MacroOptionalFindPackage.cmake +28 -0
  441. data/ext/generator/cmake/MacroWriteBasicCMakeVersionFile.cmake +22 -0
  442. data/ext/generator/cmake/SmokeConfig.cmake.in +109 -0
  443. data/ext/generator/config.h +25 -0
  444. data/ext/generator/generator_export.h +31 -0
  445. data/ext/generator/generatorenvironment.cpp +52 -0
  446. data/ext/generator/generatorenvironment.h +35 -0
  447. data/ext/generator/generatorpreprocessor.cpp +303 -0
  448. data/ext/generator/generatorpreprocessor.h +83 -0
  449. data/ext/generator/generators/CMakeLists.txt +4 -0
  450. data/ext/generator/generators/dump/CMakeLists.txt +15 -0
  451. data/ext/generator/generators/dump/generator_dump.cpp +36 -0
  452. data/ext/generator/generators/smoke/CMakeLists.txt +18 -0
  453. data/ext/generator/generators/smoke/generator_smoke.cpp +240 -0
  454. data/ext/generator/generators/smoke/globals.h +140 -0
  455. data/ext/generator/generators/smoke/helpers.cpp +793 -0
  456. data/ext/generator/generators/smoke/writeClasses.cpp +502 -0
  457. data/ext/generator/generators/smoke/writeSmokeDataFile.cpp +754 -0
  458. data/ext/generator/generatorvisitor.cpp +922 -0
  459. data/ext/generator/generatorvisitor.h +119 -0
  460. data/ext/generator/main.cpp +243 -0
  461. data/ext/generator/name_compiler.cpp +205 -0
  462. data/ext/generator/name_compiler.h +76 -0
  463. data/ext/generator/options.cpp +33 -0
  464. data/ext/generator/options.h +46 -0
  465. data/ext/generator/parser/CMakeLists.txt +50 -0
  466. data/ext/generator/parser/ast.cpp +21 -0
  467. data/ext/generator/parser/ast.h +923 -0
  468. data/ext/generator/parser/astutilities.h +65 -0
  469. data/ext/generator/parser/codegenerator.cpp +867 -0
  470. data/ext/generator/parser/codegenerator.h +180 -0
  471. data/ext/generator/parser/codemodel_fwd.h +76 -0
  472. data/ext/generator/parser/commentformatter.cpp +54 -0
  473. data/ext/generator/parser/commentformatter.h +45 -0
  474. data/ext/generator/parser/commentparser.cpp +109 -0
  475. data/ext/generator/parser/commentparser.h +84 -0
  476. data/ext/generator/parser/control.cpp +40 -0
  477. data/ext/generator/parser/control.h +51 -0
  478. data/ext/generator/parser/cppparser_export.h +33 -0
  479. data/ext/generator/parser/default_visitor.cpp +470 -0
  480. data/ext/generator/parser/default_visitor.h +116 -0
  481. data/ext/generator/parser/dumptree.cpp +146 -0
  482. data/ext/generator/parser/dumptree.h +50 -0
  483. data/ext/generator/parser/indexedstring.cpp +213 -0
  484. data/ext/generator/parser/indexedstring.h +147 -0
  485. data/ext/generator/parser/kdevelop-parser-rev +1 -0
  486. data/ext/generator/parser/kdevvarlengtharray.h +346 -0
  487. data/ext/generator/parser/lexer.cpp +964 -0
  488. data/ext/generator/parser/lexer.h +308 -0
  489. data/ext/generator/parser/listnode.cpp +20 -0
  490. data/ext/generator/parser/listnode.h +97 -0
  491. data/ext/generator/parser/memorypool.cpp +20 -0
  492. data/ext/generator/parser/memorypool.h +41 -0
  493. data/ext/generator/parser/name_compiler.cpp +190 -0
  494. data/ext/generator/parser/name_compiler.h +77 -0
  495. data/ext/generator/parser/parser.cpp +4708 -0
  496. data/ext/generator/parser/parser.h +290 -0
  497. data/ext/generator/parser/parsesession.cpp +106 -0
  498. data/ext/generator/parser/parsesession.h +87 -0
  499. data/ext/generator/parser/problem.h +21 -0
  500. data/ext/generator/parser/rpp/CMakeLists.txt +45 -0
  501. data/ext/generator/parser/rpp/Makefile.am +13 -0
  502. data/ext/generator/parser/rpp/anchor.h +51 -0
  503. data/ext/generator/parser/rpp/appendedlist.h +363 -0
  504. data/ext/generator/parser/rpp/chartools.cpp +146 -0
  505. data/ext/generator/parser/rpp/chartools.h +99 -0
  506. data/ext/generator/parser/rpp/macrorepository.cpp +44 -0
  507. data/ext/generator/parser/rpp/macrorepository.h +59 -0
  508. data/ext/generator/parser/rpp/pp-configuration +86 -0
  509. data/ext/generator/parser/rpp/pp-engine.cpp +1216 -0
  510. data/ext/generator/parser/rpp/pp-engine.h +267 -0
  511. data/ext/generator/parser/rpp/pp-environment.cpp +271 -0
  512. data/ext/generator/parser/rpp/pp-environment.h +119 -0
  513. data/ext/generator/parser/rpp/pp-internal.cpp +38 -0
  514. data/ext/generator/parser/rpp/pp-internal.h +37 -0
  515. data/ext/generator/parser/rpp/pp-location.cpp +191 -0
  516. data/ext/generator/parser/rpp/pp-location.h +89 -0
  517. data/ext/generator/parser/rpp/pp-macro-expander.cpp +568 -0
  518. data/ext/generator/parser/rpp/pp-macro-expander.cpp.orig +558 -0
  519. data/ext/generator/parser/rpp/pp-macro-expander.h +130 -0
  520. data/ext/generator/parser/rpp/pp-macro.cpp +153 -0
  521. data/ext/generator/parser/rpp/pp-macro.h +176 -0
  522. data/ext/generator/parser/rpp/pp-scanner.cpp +311 -0
  523. data/ext/generator/parser/rpp/pp-scanner.h +97 -0
  524. data/ext/generator/parser/rpp/pp-stream.cpp +425 -0
  525. data/ext/generator/parser/rpp/pp-stream.h +183 -0
  526. data/ext/generator/parser/rpp/preprocessor.cpp +65 -0
  527. data/ext/generator/parser/rpp/preprocessor.h +80 -0
  528. data/ext/generator/parser/rpp/rpp.pri +2 -0
  529. data/ext/generator/parser/rpp/test/t001.cpp +23 -0
  530. data/ext/generator/parser/rpp/test/t002.cpp +15 -0
  531. data/ext/generator/parser/rpp/test/t003.cpp +10 -0
  532. data/ext/generator/parser/rpp/test/t004.cpp +9 -0
  533. data/ext/generator/parser/rpp/test/t005.cpp +10 -0
  534. data/ext/generator/parser/rpp/test/t006.cpp +10 -0
  535. data/ext/generator/parser/rpp/test/t007.cpp +6 -0
  536. data/ext/generator/parser/rpp/test/t008.cpp +6 -0
  537. data/ext/generator/parser/rpp/test/t009.cpp +5 -0
  538. data/ext/generator/parser/rpp/test/t010.cpp +15 -0
  539. data/ext/generator/parser/rpp/test/t011.cpp +9 -0
  540. data/ext/generator/parser/rpp/tests/CMakeLists.txt +17 -0
  541. data/ext/generator/parser/rpp/tests/main.cpp +69 -0
  542. data/ext/generator/parser/rxx.pri +50 -0
  543. data/ext/generator/parser/rxx_allocator.h +128 -0
  544. data/ext/generator/parser/safetycounter.h +57 -0
  545. data/ext/generator/parser/simplecursor.h +74 -0
  546. data/ext/generator/parser/stringhelpers.cpp +577 -0
  547. data/ext/generator/parser/stringhelpers.h +118 -0
  548. data/ext/generator/parser/symbol.h +140 -0
  549. data/ext/generator/parser/tests/CMakeLists.txt +46 -0
  550. data/ext/generator/parser/tests/test_generator.cpp +259 -0
  551. data/ext/generator/parser/tests/test_parser.cpp +474 -0
  552. data/ext/generator/parser/tests/test_pool.cpp +109 -0
  553. data/ext/generator/parser/tests/test_pool.h +35 -0
  554. data/ext/generator/parser/tests/testconfig.h.cmake +4 -0
  555. data/ext/generator/parser/tokens.cpp +367 -0
  556. data/ext/generator/parser/tokens.h +148 -0
  557. data/ext/generator/parser/type_compiler.cpp +135 -0
  558. data/ext/generator/parser/type_compiler.h +68 -0
  559. data/ext/generator/parser/visitor.cpp +115 -0
  560. data/ext/generator/parser/visitor.h +138 -0
  561. data/ext/generator/smoke.h +557 -0
  562. data/ext/generator/smokegen_string.h +43 -0
  563. data/ext/generator/type.cpp +204 -0
  564. data/ext/generator/type.h +497 -0
  565. data/ext/generator/type_compiler.cpp +277 -0
  566. data/ext/generator/type_compiler.h +80 -0
  567. data/ext/ruby/CMakeLists.txt +64 -0
  568. data/ext/ruby/qtdeclarative/CMakeLists.txt +17 -0
  569. data/ext/ruby/qtdeclarative/qtdeclarative.cpp +67 -0
  570. data/ext/ruby/qtdeclarative/qtdeclarative.rb +17 -0
  571. data/ext/ruby/qtdeclarative/qtdeclarativehandlers.cpp +36 -0
  572. data/ext/ruby/qtruby/AUTHORS +54 -0
  573. data/ext/ruby/qtruby/CMakeLists.txt +4 -0
  574. data/ext/ruby/qtruby/COPYING +355 -0
  575. data/ext/ruby/qtruby/COPYING.LIB +510 -0
  576. data/ext/ruby/qtruby/ChangeLog +3732 -0
  577. data/ext/ruby/qtruby/INSTALL +79 -0
  578. data/ext/ruby/qtruby/README +264 -0
  579. data/ext/ruby/qtruby/TODO +8 -0
  580. data/ext/ruby/qtruby/bin/CMakeLists.txt +1 -0
  581. data/ext/ruby/qtruby/bin/rbqtapi +152 -0
  582. data/ext/ruby/qtruby/rails_support/CMakeLists.txt +1 -0
  583. data/ext/ruby/qtruby/rails_support/active_item_model.rb +234 -0
  584. data/ext/ruby/qtruby/rails_support/active_table_model.rb +122 -0
  585. data/ext/ruby/qtruby/src/CMakeLists.txt +103 -0
  586. data/ext/ruby/qtruby/src/Qt.cpp +1327 -0
  587. data/ext/ruby/qtruby/src/handlers.cpp +2668 -0
  588. data/ext/ruby/qtruby/src/marshall.h +66 -0
  589. data/ext/ruby/qtruby/src/marshall_basetypes.h +208 -0
  590. data/ext/ruby/qtruby/src/marshall_complex.h +175 -0
  591. data/ext/ruby/qtruby/src/marshall_macros.h +647 -0
  592. data/ext/ruby/qtruby/src/marshall_primitives.h +306 -0
  593. data/ext/ruby/qtruby/src/marshall_types.cpp +815 -0
  594. data/ext/ruby/qtruby/src/marshall_types.h +240 -0
  595. data/ext/ruby/qtruby/src/qtruby.cpp +2627 -0
  596. data/ext/ruby/qtruby/src/qtruby.h +198 -0
  597. data/ext/ruby/qtruby/src/smokeruby.h +164 -0
  598. data/ext/ruby/qtruby/test/opoverloading.rb +46 -0
  599. data/ext/ruby/qtruby/test/unittests.rb +151 -0
  600. data/ext/ruby/qtruby/tools/CMakeLists.txt +2 -0
  601. data/ext/ruby/qtruby/tools/rbrcc/CMakeLists.txt +6 -0
  602. data/ext/ruby/qtruby/tools/rbrcc/Messages.sh +7 -0
  603. data/ext/ruby/qtruby/tools/rbrcc/main.cpp +173 -0
  604. data/ext/ruby/qtruby/tools/rbrcc/rbrcc.pro +14 -0
  605. data/ext/ruby/qtruby/tools/rbrcc/rcc.cpp +648 -0
  606. data/ext/ruby/qtruby/tools/rbrcc/rcc.h +165 -0
  607. data/ext/ruby/qtruby/tools/rbuic/CMakeLists.txt +35 -0
  608. data/ext/ruby/qtruby/tools/rbuic/LICENSE.GPL +280 -0
  609. data/ext/ruby/qtruby/tools/rbuic/Messages.sh +7 -0
  610. data/ext/ruby/qtruby/tools/rbuic/TODO +4 -0
  611. data/ext/ruby/qtruby/tools/rbuic/customwidgetsinfo.cpp +106 -0
  612. data/ext/ruby/qtruby/tools/rbuic/customwidgetsinfo.h +95 -0
  613. data/ext/ruby/qtruby/tools/rbuic/databaseinfo.cpp +102 -0
  614. data/ext/ruby/qtruby/tools/rbuic/databaseinfo.h +85 -0
  615. data/ext/ruby/qtruby/tools/rbuic/driver.cpp +384 -0
  616. data/ext/ruby/qtruby/tools/rbuic/driver.h +141 -0
  617. data/ext/ruby/qtruby/tools/rbuic/globaldefs.h +60 -0
  618. data/ext/ruby/qtruby/tools/rbuic/main.cpp +201 -0
  619. data/ext/ruby/qtruby/tools/rbuic/option.h +110 -0
  620. data/ext/ruby/qtruby/tools/rbuic/rbuic.pri +23 -0
  621. data/ext/ruby/qtruby/tools/rbuic/rbuic4.pro +43 -0
  622. data/ext/ruby/qtruby/tools/rbuic/ruby/rbextractimages.cpp +150 -0
  623. data/ext/ruby/qtruby/tools/rbuic/ruby/rbextractimages.h +83 -0
  624. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwritedeclaration.cpp +217 -0
  625. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwritedeclaration.h +85 -0
  626. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondata.cpp +185 -0
  627. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondata.h +86 -0
  628. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondeclaration.cpp +88 -0
  629. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteicondeclaration.h +83 -0
  630. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteiconinitialization.cpp +126 -0
  631. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteiconinitialization.h +87 -0
  632. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteinitialization.cpp +2478 -0
  633. data/ext/ruby/qtruby/tools/rbuic/ruby/rbwriteinitialization.h +314 -0
  634. data/ext/ruby/qtruby/tools/rbuic/ruby/ruby.pri +18 -0
  635. data/ext/ruby/qtruby/tools/rbuic/treewalker.cpp +318 -0
  636. data/ext/ruby/qtruby/tools/rbuic/treewalker.h +139 -0
  637. data/ext/ruby/qtruby/tools/rbuic/ui4.cpp +7623 -0
  638. data/ext/ruby/qtruby/tools/rbuic/ui4.h +3180 -0
  639. data/ext/ruby/qtruby/tools/rbuic/uic.cpp +438 -0
  640. data/ext/ruby/qtruby/tools/rbuic/uic.h +154 -0
  641. data/ext/ruby/qtruby/tools/rbuic/utils.h +125 -0
  642. data/ext/ruby/qtruby/tools/rbuic/validator.cpp +100 -0
  643. data/ext/ruby/qtruby/tools/rbuic/validator.h +80 -0
  644. data/ext/ruby/qtscript/CMakeLists.txt +19 -0
  645. data/ext/ruby/qtscript/qtscript.cpp +83 -0
  646. data/ext/ruby/qtscript/qtscript.rb +40 -0
  647. data/ext/ruby/qtscript/qtscripthandlers.cpp +37 -0
  648. data/ext/ruby/qtscript/smokedata.cpp +1403 -0
  649. data/ext/ruby/qttest/CMakeLists.txt +18 -0
  650. data/ext/ruby/qttest/ChangeLog +9 -0
  651. data/ext/ruby/qttest/examples/myfirsttest.rb +30 -0
  652. data/ext/ruby/qttest/qttest.cpp +83 -0
  653. data/ext/ruby/qttest/qttest.rb +166 -0
  654. data/ext/ruby/qttest/qttesthandlers.cpp +37 -0
  655. data/ext/ruby/qtuitools/CMakeLists.txt +16 -0
  656. data/ext/ruby/qtuitools/qtuitools.cpp +83 -0
  657. data/ext/ruby/qtuitools/qtuitools.rb +17 -0
  658. data/ext/ruby/qtuitools/qtuitoolshandlers.cpp +32 -0
  659. data/ext/ruby/qtwebkit/CMakeLists.txt +17 -0
  660. data/ext/ruby/qtwebkit/qtwebkit.cpp +67 -0
  661. data/ext/ruby/qtwebkit/qtwebkit.rb +17 -0
  662. data/ext/ruby/qtwebkit/qtwebkithandlers.cpp +40 -0
  663. data/ext/smoke/CMakeLists.txt +39 -0
  664. data/ext/smoke/deptool/CMakeLists.txt +7 -0
  665. data/ext/smoke/deptool/main.cpp +128 -0
  666. data/ext/smoke/qt_smoke.h +16 -0
  667. data/ext/smoke/qtcore/CMakeLists.txt +88 -0
  668. data/ext/smoke/qtcore/QtGuess.txt +180 -0
  669. data/ext/smoke/qtcore/config.xml.cmake +10 -0
  670. data/ext/smoke/qtcore/qt-config.xml.cmake +21 -0
  671. data/ext/smoke/qtcore/qtcore_includes.h +1 -0
  672. data/ext/smoke/qtcore/smokeconfig.xml +193 -0
  673. data/ext/smoke/qtcore/tests/CMakeLists.txt +13 -0
  674. data/ext/smoke/qtcore/tests/test.cpp +846 -0
  675. data/ext/smoke/qtcore_smoke.h +16 -0
  676. data/ext/smoke/qtdbus/CMakeLists.txt +38 -0
  677. data/ext/smoke/qtdbus/config.xml.cmake +11 -0
  678. data/ext/smoke/qtdbus/qtdbus_includes.h +2 -0
  679. data/ext/smoke/qtdbus/smokeconfig.xml +65 -0
  680. data/ext/smoke/qtdbus_smoke.h +16 -0
  681. data/ext/smoke/qtdeclarative/CMakeLists.txt +45 -0
  682. data/ext/smoke/qtdeclarative/config.xml.cmake +12 -0
  683. data/ext/smoke/qtdeclarative/qtdeclarative_includes.h +3 -0
  684. data/ext/smoke/qtdeclarative/smokeconfig.xml +59 -0
  685. data/ext/smoke/qtdeclarative_smoke.h +16 -0
  686. data/ext/smoke/qtgui/CMakeLists.txt +76 -0
  687. data/ext/smoke/qtgui/config.xml.cmake +11 -0
  688. data/ext/smoke/qtgui/qtgui_includes.h +7 -0
  689. data/ext/smoke/qtgui/smokeconfig.xml +500 -0
  690. data/ext/smoke/qtgui_smoke.h +16 -0
  691. data/ext/smoke/qthelp/CMakeLists.txt +45 -0
  692. data/ext/smoke/qthelp/config.xml.cmake +13 -0
  693. data/ext/smoke/qthelp/qthelp_includes.h +3 -0
  694. data/ext/smoke/qthelp/smokeconfig.xml +54 -0
  695. data/ext/smoke/qthelp_smoke.h +16 -0
  696. data/ext/smoke/qtmultimedia/CMakeLists.txt +42 -0
  697. data/ext/smoke/qtmultimedia/config.xml.cmake +12 -0
  698. data/ext/smoke/qtmultimedia/qtmultimedia_includes.h +3 -0
  699. data/ext/smoke/qtmultimedia/smokeconfig.xml +51 -0
  700. data/ext/smoke/qtmultimedia_smoke.h +16 -0
  701. data/ext/smoke/qtnetwork/CMakeLists.txt +38 -0
  702. data/ext/smoke/qtnetwork/config.xml.cmake +11 -0
  703. data/ext/smoke/qtnetwork/qtnetwork_includes.h +2 -0
  704. data/ext/smoke/qtnetwork/smokeconfig.xml +81 -0
  705. data/ext/smoke/qtnetwork_smoke.h +16 -0
  706. data/ext/smoke/qtopengl/CMakeLists.txt +43 -0
  707. data/ext/smoke/qtopengl/config.xml.cmake +13 -0
  708. data/ext/smoke/qtopengl/qtopengl_includes.h +3 -0
  709. data/ext/smoke/qtopengl/smokeconfig.xml +58 -0
  710. data/ext/smoke/qtopengl_smoke.h +16 -0
  711. data/ext/smoke/qtscript/CMakeLists.txt +31 -0
  712. data/ext/smoke/qtscript/config.xml.cmake +11 -0
  713. data/ext/smoke/qtscript/qtscript_includes.h +14 -0
  714. data/ext/smoke/qtscript/smokeconfig.xml +39 -0
  715. data/ext/smoke/qtscript_smoke.h +16 -0
  716. data/ext/smoke/qtsql/CMakeLists.txt +45 -0
  717. data/ext/smoke/qtsql/config.xml.cmake +11 -0
  718. data/ext/smoke/qtsql/qtsql_includes.h +3 -0
  719. data/ext/smoke/qtsql/smokeconfig.xml +60 -0
  720. data/ext/smoke/qtsql_smoke.h +16 -0
  721. data/ext/smoke/qtsvg/CMakeLists.txt +43 -0
  722. data/ext/smoke/qtsvg/config.xml.cmake +12 -0
  723. data/ext/smoke/qtsvg/qtsvg_includes.h +3 -0
  724. data/ext/smoke/qtsvg/smokeconfig.xml +46 -0
  725. data/ext/smoke/qtsvg_smoke.h +16 -0
  726. data/ext/smoke/qttest/CMakeLists.txt +35 -0
  727. data/ext/smoke/qttest/config.xml.cmake +12 -0
  728. data/ext/smoke/qttest/qttest_includes.h +14 -0
  729. data/ext/smoke/qttest/smokeconfig.xml +36 -0
  730. data/ext/smoke/qttest_smoke.h +16 -0
  731. data/ext/smoke/qtuitools/CMakeLists.txt +30 -0
  732. data/ext/smoke/qtuitools/config.xml.cmake +12 -0
  733. data/ext/smoke/qtuitools/qtuitools_includes.h +1 -0
  734. data/ext/smoke/qtuitools/smokeconfig.xml +20 -0
  735. data/ext/smoke/qtuitools_smoke.h +16 -0
  736. data/ext/smoke/qtwebkit/CMakeLists.txt +36 -0
  737. data/ext/smoke/qtwebkit/config.xml.cmake +11 -0
  738. data/ext/smoke/qtwebkit/qtwebkit_includes.h +1 -0
  739. data/ext/smoke/qtwebkit/smokeconfig.xml +48 -0
  740. data/ext/smoke/qtwebkit_smoke.h +16 -0
  741. data/ext/smoke/qtxml/CMakeLists.txt +41 -0
  742. data/ext/smoke/qtxml/config.xml.cmake +11 -0
  743. data/ext/smoke/qtxml/qtxml_includes.h +2 -0
  744. data/ext/smoke/qtxml/smokeconfig.xml +70 -0
  745. data/ext/smoke/qtxml_smoke.h +16 -0
  746. data/ext/smoke/qtxmlpatterns/CMakeLists.txt +42 -0
  747. data/ext/smoke/qtxmlpatterns/config.xml.cmake +12 -0
  748. data/ext/smoke/qtxmlpatterns/qtxmlpatterns_includes.h +3 -0
  749. data/ext/smoke/qtxmlpatterns/smokeconfig.xml +80 -0
  750. data/ext/smoke/qtxmlpatterns_smoke.h +16 -0
  751. data/ext/smoke/smoke.h +559 -0
  752. data/ext/smoke/smokeapi/CMakeLists.txt +9 -0
  753. data/ext/smoke/smokeapi/main.cpp +309 -0
  754. data/ext/smoke/smokebase/CMakeLists.txt +11 -0
  755. data/ext/smoke/smokebase/smokebase.cpp +6 -0
  756. data/ext/smoke/solid_smoke.h +16 -0
  757. data/extconf.rb +256 -0
  758. data/lib/Qt/qtruby4.rb +3268 -0
  759. data/lib/Qt.rb +1 -0
  760. data/lib/Qt4.rb +119 -0
  761. data/lib/qtbindings_version.rb +2 -0
  762. data/lib/qtdeclarative/qtdeclarative.rb +17 -0
  763. data/lib/qtscript/qtscript.rb +40 -0
  764. data/lib/qttest/qttest.rb +166 -0
  765. data/lib/qtuitools/qtuitools.rb +17 -0
  766. data/lib/qtwebkit/qtwebkit.rb +17 -0
  767. data/rock-qtbindings.gemspec +18 -0
  768. metadata +819 -0
@@ -0,0 +1,1327 @@
1
+ /***************************************************************************
2
+ Qt.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
+ #ifndef _GNU_SOURCE
19
+ #define _GNU_SOURCE
20
+ #endif
21
+ #include <stdio.h>
22
+ #include <stdarg.h>
23
+
24
+ #include <QtCore/qabstractitemmodel.h>
25
+ #include <QtCore/qglobal.h>
26
+ #include <QtCore/qhash.h>
27
+ #include <QtCore/qline.h>
28
+ #include <QtCore/qmetaobject.h>
29
+ #include <QtCore/qobject.h>
30
+ #include <QtCore/qrect.h>
31
+ #include <QtCore/qregexp.h>
32
+ #include <QtCore/qstring.h>
33
+ #include <QtCore/qvariant.h>
34
+ #include <QtCore/qmutex.h>
35
+ #include <QtGui/qapplication.h>
36
+ #include <QtGui/qbitmap.h>
37
+ #include <QtGui/qcolor.h>
38
+ #include <QtGui/qcursor.h>
39
+ #include <QtGui/qfont.h>
40
+ #include <QtGui/qicon.h>
41
+ #include <QtGui/qitemselectionmodel.h>
42
+ #include <QtGui/qpalette.h>
43
+ #include <QtGui/qpen.h>
44
+ #include <QtGui/qpixmap.h>
45
+ #include <QtGui/qpolygon.h>
46
+ #include <QtGui/qtextformat.h>
47
+ #include <QtGui/qwidget.h>
48
+
49
+ #ifdef QT_QTDBUS
50
+ #include <QtDBus/qdbusargument.h>
51
+ #endif
52
+
53
+ #undef DEBUG
54
+ #ifndef __USE_POSIX
55
+ #define __USE_POSIX
56
+ #endif
57
+ #ifndef __USE_XOPEN
58
+ #define __USE_XOPEN
59
+ #endif
60
+ #ifdef _BOOL
61
+ #define HAS_BOOL
62
+ #endif
63
+
64
+ #include <ruby.h>
65
+
66
+ #include <smoke/smoke.h>
67
+ #include <smoke/qtcore_smoke.h>
68
+
69
+ #undef free
70
+ #undef malloc
71
+
72
+ #include "marshall.h"
73
+ #include "qtruby.h"
74
+ #include "smokeruby.h"
75
+ #include "smoke.h"
76
+ #include "marshall_types.h"
77
+ // #define DEBUG
78
+
79
+ extern "C" {
80
+ VALUE qt_internal_module = Qnil;
81
+ VALUE qt_module = Qnil;
82
+
83
+ VALUE qlistmodel_class = Qnil;
84
+ VALUE qmetaobject_class = Qnil;
85
+ VALUE qtablemodel_class = Qnil;
86
+ VALUE qt_base_class = Qnil;
87
+ VALUE qvariant_class = Qnil;
88
+
89
+ VALUE moduleindex_class = Qnil;
90
+
91
+ bool application_terminated = false;
92
+ }
93
+
94
+ QList<Smoke*> smokeList;
95
+ QHash<Smoke*, QtRubyModule> qtruby_modules;
96
+
97
+ #ifdef DEBUG
98
+ int do_debug = qtdb_gc;
99
+ #else
100
+ int do_debug = qtdb_none;
101
+ #endif
102
+
103
+ typedef QHash<void *, SmokeValue> PointerMap;
104
+ static QMutex pointer_map_mutex;
105
+ Q_GLOBAL_STATIC(PointerMap, pointer_map)
106
+ int object_count = 0;
107
+
108
+ // FIXME:
109
+ // Don't the two following hashs create memory leaks by using pointers to Smoke::(Module)Index ?
110
+ QHash<QByteArray, Smoke::ModuleIndex *> methcache;
111
+ QHash<QByteArray, Smoke::ModuleIndex *> classcache;
112
+
113
+ QHash<Smoke::ModuleIndex, QByteArray*> IdToClassNameMap;
114
+
115
+ #define logger logger_backend
116
+
117
+ Smoke::ModuleIndex _current_method;
118
+
119
+ smokeruby_object *
120
+ alloc_smokeruby_object(bool allocated, Smoke * smoke, int classId, void * ptr)
121
+ {
122
+ smokeruby_object * o = ALLOC(smokeruby_object);
123
+ o->classId = classId;
124
+ o->smoke = smoke;
125
+ o->ptr = ptr;
126
+ o->allocated = allocated;
127
+ return o;
128
+ }
129
+
130
+ void
131
+ free_smokeruby_object(smokeruby_object * o)
132
+ {
133
+ o->ptr = 0;
134
+ xfree(o);
135
+ return;
136
+ }
137
+
138
+ smokeruby_object *value_obj_info(VALUE ruby_value) { // ptr on success, null on fail
139
+ if (TYPE(ruby_value) != T_DATA) {
140
+ return 0;
141
+ }
142
+
143
+ smokeruby_object * o = 0;
144
+ Data_Get_Struct(ruby_value, smokeruby_object, o);
145
+ return o;
146
+ }
147
+
148
+ void *value_to_ptr(VALUE ruby_value) { // ptr on success, null on fail
149
+ smokeruby_object *o = value_obj_info(ruby_value);
150
+ return o;
151
+ }
152
+
153
+ VALUE getPointerObject(void *ptr) {
154
+ return getSmokeValue(ptr).value;
155
+ }
156
+
157
+ SmokeValue getSmokeValue(void *ptr) {
158
+ pointer_map_mutex.lock();
159
+
160
+ if (!pointer_map() || !pointer_map()->contains(ptr)) {
161
+ if (do_debug & qtdb_gc) {
162
+ qWarning("getPointerObject %p -> nil", ptr);
163
+ if (!pointer_map()) {
164
+ qWarning("getPointerObject pointer_map deleted");
165
+ }
166
+ }
167
+ pointer_map_mutex.unlock();
168
+ return SmokeValue();
169
+ } else {
170
+ if (do_debug & qtdb_gc) {
171
+ qWarning("getPointerObject %p -> %p", ptr, (void *) pointer_map()->operator[](ptr).value);
172
+ }
173
+ pointer_map_mutex.unlock();
174
+ return pointer_map()->operator[](ptr);
175
+ }
176
+ }
177
+
178
+ void unmapPointer(void *ptr, Smoke *smoke, Smoke::Index fromClassId, Smoke::Index toClassId, void *lastptr) {
179
+ pointer_map_mutex.lock();
180
+ ptr = smoke->cast(ptr, fromClassId, toClassId);
181
+
182
+ if (ptr != lastptr) {
183
+ lastptr = ptr;
184
+ if (pointer_map() && pointer_map()->contains(ptr)) {
185
+ VALUE obj_ptr = pointer_map()->operator[](ptr).value;
186
+
187
+ if (do_debug & qtdb_gc) {
188
+ const char *className = smoke->classes[fromClassId].className;
189
+ qWarning("unmapPointer (%s*)%p -> %p size: %d", className, ptr, (void*)(&obj_ptr), pointer_map()->size() - 1);
190
+ }
191
+
192
+ pointer_map()->remove(ptr);
193
+ }
194
+ }
195
+
196
+ if (smoke->classes[toClassId].external) {
197
+ // encountered external class
198
+ Smoke::ModuleIndex mi = Smoke::findClass(smoke->classes[toClassId].className);
199
+ if (!mi.index || !mi.smoke) return;
200
+
201
+ smoke = mi.smoke;
202
+ toClassId = mi.index;
203
+ }
204
+
205
+ pointer_map_mutex.unlock();
206
+ for (Smoke::Index *i = smoke->inheritanceList + smoke->classes[toClassId].parents; *i; i++) {
207
+ unmapPointer(ptr, smoke, toClassId, *i, lastptr);
208
+ }
209
+
210
+ }
211
+
212
+ void unmapPointer(smokeruby_object *o, Smoke::Index classId, void *lastptr) {
213
+ unmapPointer(o->ptr, o->smoke, o->classId, classId, lastptr);
214
+ }
215
+
216
+ // Store pointer in pointer_map hash : "pointer_to_Qt_object" => weak ref to associated Ruby object
217
+ // Recurse to store it also as casted to its parent classes.
218
+
219
+ void mapPointer(VALUE obj, smokeruby_object* o, void *ptr, Smoke *smoke, Smoke::Index fromClassId, Smoke::Index toClassId, void *lastptr) {
220
+ pointer_map_mutex.unlock();
221
+
222
+ ptr = smoke->cast(ptr, fromClassId, toClassId);
223
+
224
+ if (ptr != lastptr) {
225
+ lastptr = ptr;
226
+
227
+ if (do_debug & qtdb_gc) {
228
+ const char *className = smoke->classes[fromClassId].className;
229
+ qWarning("mapPointer (%s*)%p -> %p size: %d", className, ptr, (void*)obj, pointer_map()->size() + 1);
230
+ }
231
+
232
+ SmokeValue value(obj, o);
233
+ pointer_map()->insert(ptr, value);
234
+ }
235
+
236
+ if (smoke->classes[toClassId].external) {
237
+ // encountered external class
238
+ Smoke::ModuleIndex mi = Smoke::findClass(smoke->classes[toClassId].className);
239
+ if (!mi.index || !mi.smoke) return;
240
+
241
+ smoke = mi.smoke;
242
+ toClassId = mi.index;
243
+ }
244
+
245
+ pointer_map_mutex.unlock();
246
+ for (Smoke::Index *i = smoke->inheritanceList + smoke->classes[toClassId].parents; *i; i++) {
247
+ mapPointer(obj, o, ptr, smoke, toClassId, *i, lastptr);
248
+ }
249
+
250
+ return;
251
+ }
252
+
253
+ void mapPointer(VALUE obj, smokeruby_object *o, Smoke::Index classId, void *lastptr) {
254
+ mapPointer(obj, o, o->ptr, o->smoke, o->classId, classId, lastptr);
255
+ }
256
+
257
+ namespace QtRuby {
258
+
259
+ Binding::Binding() : SmokeBinding(0) {}
260
+ Binding::Binding(Smoke *s) : SmokeBinding(s) {}
261
+
262
+ void
263
+ Binding::deleted(Smoke::Index classId, void *ptr) {
264
+ if (!pointer_map()) {
265
+ return;
266
+ }
267
+
268
+ smokeruby_object *o = getSmokeValue(ptr).o;
269
+ if (do_debug & qtdb_gc) {
270
+ qWarning("unmapping: o = %p, ptr = %p\n", o, ptr);
271
+ qWarning("%p->~%s()", ptr, smoke->className(classId));
272
+ }
273
+ if (!o || !o->ptr) {
274
+ return;
275
+ }
276
+ unmapPointer(o, o->classId, 0);
277
+ o->ptr = 0;
278
+ }
279
+
280
+ bool
281
+ Binding::callMethod(Smoke::Index method, void *ptr, Smoke::Stack args, bool /*isAbstract*/) {
282
+ VALUE obj = getPointerObject(ptr);
283
+ smokeruby_object *o = value_obj_info(obj);
284
+
285
+ if (do_debug & qtdb_virtual) {
286
+ const Smoke::Method & meth = smoke->methods[method];
287
+ QByteArray signature(smoke->methodNames[meth.name]);
288
+ signature += "(";
289
+ for (int i = 0; i < meth.numArgs; i++) {
290
+ if (i != 0) signature += ", ";
291
+ signature += smoke->types[smoke->argumentList[meth.args + i]].name;
292
+ }
293
+ signature += ")";
294
+ if (meth.flags & Smoke::mf_const) {
295
+ signature += " const";
296
+ }
297
+ qWarning( "module: %s virtual %p->%s::%s called",
298
+ smoke->moduleName(),
299
+ ptr,
300
+ smoke->classes[smoke->methods[method].classId].className,
301
+ (const char *) signature );
302
+ }
303
+
304
+ if (o == 0) {
305
+ if( do_debug & qtdb_virtual ) // if not in global destruction
306
+ qWarning("Cannot find object for virtual method %p -> %p", ptr, &obj);
307
+ return false;
308
+ }
309
+ const char *methodName = smoke->methodNames[smoke->methods[method].name];
310
+ if (qstrncmp(methodName, "operator", sizeof("operator") - 1) == 0) {
311
+ methodName += (sizeof("operator") - 1);
312
+ }
313
+
314
+ // If not in a ruby thread, just call the C++ version
315
+ // During GC, avoid checking for override and just call the C++ version
316
+ // If the virtual method hasn't been overriden, just call the C++ one.
317
+ #ifdef HAVE_RUBY_RUBY_H
318
+ int ruby_thread = ruby_native_thread_p();
319
+ if ((ruby_thread == 0) || rb_during_gc() || rb_respond_to(obj, rb_intern(methodName)) == 0) {
320
+ return false;
321
+ }
322
+ #else
323
+ if (rb_during_gc() || ruby_stack_check() || rb_respond_to(obj, rb_intern(methodName)) == 0) {
324
+ return false;
325
+ }
326
+ #endif
327
+
328
+ QtRuby::VirtualMethodCall c(smoke, method, args, obj, ALLOCA_N(VALUE, smoke->methods[method].numArgs));
329
+ c.next();
330
+ return true;
331
+ }
332
+
333
+ char*
334
+ Binding::className(Smoke::Index classId) {
335
+ Smoke::ModuleIndex mi(smoke, classId);
336
+ return (char *) (const char *) *(IdToClassNameMap.value(mi));
337
+ }
338
+
339
+ /*
340
+ Converts a C++ value returned by a signal invocation to a Ruby
341
+ reply type
342
+ */
343
+ class SignalReturnValue : public Marshall {
344
+ QList<MocArgument*> _replyType;
345
+ Smoke::Stack _stack;
346
+ VALUE * _result;
347
+ public:
348
+ SignalReturnValue(void ** o, VALUE * result, QList<MocArgument*> replyType)
349
+ {
350
+ _result = result;
351
+ _replyType = replyType;
352
+ _stack = new Smoke::StackItem[1];
353
+ smokeStackFromQtStack(_stack, o, 0, 1, _replyType);
354
+ Marshall::HandlerFn fn = getMarshallFn(type());
355
+ (*fn)(this);
356
+ }
357
+
358
+ SmokeType type() {
359
+ return _replyType[0]->st;
360
+ }
361
+ Marshall::Action action() { return Marshall::ToVALUE; }
362
+ Smoke::StackItem &item() { return _stack[0]; }
363
+ VALUE * var() {
364
+ return _result;
365
+ }
366
+
367
+ void unsupported()
368
+ {
369
+ rb_raise(rb_eArgError, "Cannot handle '%s' as signal reply-type", type().name());
370
+ }
371
+ Smoke *smoke() { return type().smoke(); }
372
+
373
+ void next() {}
374
+
375
+ bool cleanup() { return false; }
376
+
377
+ ~SignalReturnValue() {
378
+ delete[] _stack;
379
+ }
380
+ };
381
+
382
+ /* Note that the SignalReturnValue and EmitSignal classes really belong in
383
+ marshall_types.cpp. However, for unknown reasons they don't link with certain
384
+ versions of gcc. So they were moved here in to work round that bug.
385
+ */
386
+ EmitSignal::EmitSignal(QObject *obj, int id, int /*items*/, QList<MocArgument*> args, VALUE *sp, VALUE * result) : SigSlotBase(args),
387
+ _obj(obj), _id(id)
388
+ {
389
+ _sp = sp;
390
+ _result = result;
391
+ }
392
+
393
+ Marshall::Action
394
+ EmitSignal::action()
395
+ {
396
+ return Marshall::FromVALUE;
397
+ }
398
+
399
+ Smoke::StackItem &
400
+ EmitSignal::item()
401
+ {
402
+ return _stack[_cur];
403
+ }
404
+
405
+ const char *
406
+ EmitSignal::mytype()
407
+ {
408
+ return "signal";
409
+ }
410
+
411
+ void
412
+ EmitSignal::emitSignal()
413
+ {
414
+ if (_called) return;
415
+ _called = true;
416
+ void ** o = new void*[_items];
417
+ smokeStackToQtStack(_stack, o + 1, 1, _items, _args);
418
+ void * ptr;
419
+ o[0] = &ptr;
420
+ prepareReturnValue(o);
421
+
422
+ _obj->metaObject()->activate(_obj, _id, o);
423
+
424
+ if (_args[0]->argType != xmoc_void) {
425
+ SignalReturnValue r(o, _result, _args);
426
+ }
427
+ delete[] o;
428
+ }
429
+
430
+ void
431
+ EmitSignal::mainfunction()
432
+ {
433
+ emitSignal();
434
+ }
435
+
436
+ bool
437
+ EmitSignal::cleanup()
438
+ {
439
+ return true;
440
+ }
441
+
442
+ InvokeNativeSlot::InvokeNativeSlot(QObject *obj, int id, int /*items*/, QList<MocArgument*> args, VALUE *sp, VALUE * result) : SigSlotBase(args),
443
+ _obj(obj), _id(id)
444
+ {
445
+ _sp = sp;
446
+ _result = result;
447
+ }
448
+
449
+ Marshall::Action
450
+ InvokeNativeSlot::action()
451
+ {
452
+ return Marshall::FromVALUE;
453
+ }
454
+
455
+ Smoke::StackItem &
456
+ InvokeNativeSlot::item()
457
+ {
458
+ return _stack[_cur];
459
+ }
460
+
461
+ const char *
462
+ InvokeNativeSlot::mytype()
463
+ {
464
+ return "slot";
465
+ }
466
+
467
+ void
468
+ InvokeNativeSlot::invokeSlot()
469
+ {
470
+ if (_called) return;
471
+ _called = true;
472
+ void ** o = new void*[_items];
473
+ smokeStackToQtStack(_stack, o + 1, 1, _items, _args);
474
+ void * ptr;
475
+ o[0] = &ptr;
476
+ prepareReturnValue(o);
477
+
478
+ _obj->qt_metacall(QMetaObject::InvokeMetaMethod, _id, o);
479
+
480
+ if (_args[0]->argType != xmoc_void) {
481
+ SignalReturnValue r(o, _result, _args);
482
+ }
483
+ delete[] o;
484
+ }
485
+
486
+ void
487
+ InvokeNativeSlot::mainfunction()
488
+ {
489
+ invokeSlot();
490
+ }
491
+
492
+ bool
493
+ InvokeNativeSlot::cleanup()
494
+ {
495
+ return true;
496
+ }
497
+
498
+ }
499
+
500
+ VALUE qt_rb_str_catf(VALUE self, const char *format, ...)
501
+ {
502
+ #define CAT_BUFFER_SIZE 2048
503
+ static char p[CAT_BUFFER_SIZE];
504
+ va_list ap;
505
+ va_start(ap, format);
506
+ qvsnprintf(p, CAT_BUFFER_SIZE, format, ap);
507
+ p[CAT_BUFFER_SIZE - 1] = '\0';
508
+ rb_str_cat2(self, p);
509
+ va_end(ap);
510
+ return self;
511
+ }
512
+
513
+ const char *
514
+ resolve_classname(smokeruby_object * o)
515
+ {
516
+ if (Smoke::isDerivedFrom(o->smoke->classes[o->classId].className, "QObject")) {
517
+ QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
518
+ const QMetaObject * meta = qobject->metaObject();
519
+
520
+ while (meta != 0) {
521
+ Smoke::ModuleIndex mi = o->smoke->findClass(meta->className());
522
+ o->smoke = mi.smoke;
523
+ o->classId = mi.index;
524
+ if (o->smoke != 0) {
525
+ if (o->classId != 0) {
526
+ return qtruby_modules[o->smoke].binding->className(o->classId);
527
+ }
528
+ }
529
+
530
+ meta = meta->superClass();
531
+ }
532
+ }
533
+
534
+ if (o->smoke->classes[o->classId].external) {
535
+ Smoke::ModuleIndex mi = o->smoke->findClass(o->smoke->className(o->classId));
536
+ o->smoke = mi.smoke;
537
+ o->classId = mi.index;
538
+ return qtruby_modules.value(mi.smoke).resolve_classname(o);
539
+ }
540
+ return qtruby_modules.value(o->smoke).resolve_classname(o);
541
+ }
542
+
543
+ VALUE
544
+ findMethod(VALUE /*self*/, VALUE c_value, VALUE name_value)
545
+ {
546
+ char *c = StringValuePtr(c_value);
547
+ char *name = StringValuePtr(name_value);
548
+ VALUE result = rb_ary_new();
549
+ Smoke::ModuleIndex classId = Smoke::findClass(c);
550
+ Smoke::ModuleIndex meth = Smoke::NullModuleIndex;
551
+ QList<Smoke::ModuleIndex> milist;
552
+ if (classId.smoke != 0) {
553
+ meth = classId.smoke->findMethod(c, name);
554
+ }
555
+ #ifdef DEBUG
556
+ if (do_debug & qtdb_calls) qWarning("Found method %s::%s => %d", c, name, meth.index);
557
+ #endif
558
+ if(!meth.index) {
559
+ // since every smoke module defines a class 'QGlobalSpace' we can't rely on the classMap,
560
+ // so we search for methods by hand
561
+ foreach (Smoke* s, smokeList) {
562
+ Smoke::ModuleIndex cid = s->idClass("QGlobalSpace");
563
+ Smoke::ModuleIndex mnid = s->idMethodName(name);
564
+ if (!cid.index || !mnid.index) continue;
565
+ meth = s->idMethod(cid.index, mnid.index);
566
+ if (meth.index) milist.append(meth);
567
+ }
568
+ #ifdef DEBUG
569
+ if (do_debug & qtdb_calls) qWarning("Found method QGlobalSpace::%s => %d", name, meth.index);
570
+ #endif
571
+ }
572
+ else
573
+ {
574
+ milist.append(meth);
575
+ }
576
+
577
+ if (milist.count() == 0) {
578
+ return result;
579
+ // empty list
580
+ } else {
581
+ foreach (Smoke::ModuleIndex meth, milist) {
582
+ if (meth.index > 0) {
583
+ Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
584
+ if (i == 0) { // shouldn't happen
585
+ rb_raise(rb_eArgError, "Corrupt method %s::%s", c, name);
586
+ } else if(i > 0) { // single match
587
+ const Smoke::Method &methodRef = meth.smoke->methods[i];
588
+ if ((methodRef.flags & Smoke::mf_internal) == 0) {
589
+ rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(i)));
590
+ }
591
+ } else { // multiple match
592
+ i = -i; // turn into ambiguousMethodList index
593
+ while (meth.smoke->ambiguousMethodList[i]) {
594
+ const Smoke::Method &methodRef = meth.smoke->methods[meth.smoke->ambiguousMethodList[i]];
595
+ if ((methodRef.flags & Smoke::mf_internal) == 0) {
596
+ rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(meth.smoke->ambiguousMethodList[i])));
597
+ //#ifdef DEBUG
598
+ if (do_debug & qtdb_calls) qWarning("Ambiguous Method %s::%s => %d", c, name, meth.smoke->ambiguousMethodList[i]);
599
+ //#endif
600
+
601
+ }
602
+ i++;
603
+ }
604
+ }
605
+ }
606
+ }
607
+ }
608
+ return result;
609
+ }
610
+
611
+ // findAllMethods(ModuleIndex [, startingWith]) : returns { "mungedName" => [index in methods, ...], ... }
612
+
613
+ VALUE
614
+ findAllMethods(int argc, VALUE * argv, VALUE /*self*/)
615
+ {
616
+ VALUE rb_mi = argv[0];
617
+ VALUE result = rb_hash_new();
618
+ if (rb_mi != Qnil) {
619
+ Smoke::Index c = (Smoke::Index) NUM2INT(rb_funcall(rb_mi, rb_intern("index"), 0));
620
+ Smoke *smoke = smokeList[NUM2INT(rb_funcall(rb_mi, rb_intern("smoke"), 0))];
621
+ if (c > smoke->numClasses) {
622
+ return Qnil;
623
+ }
624
+ char * pat = 0L;
625
+ if(argc > 1 && TYPE(argv[1]) == T_STRING)
626
+ pat = StringValuePtr(argv[1]);
627
+ #ifdef DEBUG
628
+ if (do_debug & qtdb_calls) qWarning("findAllMethods called with classid = %d, pat == %s", c, pat);
629
+ #endif
630
+ Smoke::Index imax = smoke->numMethodMaps;
631
+ Smoke::Index imin = 0, icur = -1, methmin, methmax;
632
+ methmin = -1; methmax = -1; // kill warnings
633
+ int icmp = -1;
634
+ while(imax >= imin) {
635
+ icur = (imin + imax) / 2;
636
+ icmp = smoke->leg(smoke->methodMaps[icur].classId, c);
637
+ if (icmp == 0) {
638
+ Smoke::Index pos = icur;
639
+ while (icur && smoke->methodMaps[icur-1].classId == c)
640
+ icur --;
641
+ methmin = icur;
642
+ icur = pos;
643
+ while(icur < imax && smoke->methodMaps[icur+1].classId == c)
644
+ icur ++;
645
+ methmax = icur;
646
+ break;
647
+ }
648
+ if (icmp > 0)
649
+ imax = icur - 1;
650
+ else
651
+ imin = icur + 1;
652
+ }
653
+ if (icmp == 0) {
654
+ for (Smoke::Index i = methmin; i <= methmax; i++) {
655
+ Smoke::Index m = smoke->methodMaps[i].name;
656
+ if (pat == 0L || strncmp(smoke->methodNames[m], pat, strlen(pat)) == 0) {
657
+ Smoke::Index ix = smoke->methodMaps[i].method;
658
+ VALUE meths = rb_ary_new();
659
+ if (ix >= 0) { // single match
660
+ const Smoke::Method &methodRef = smoke->methods[ix];
661
+ if ((methodRef.flags & Smoke::mf_internal) == 0) {
662
+ rb_ary_push(meths, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(smoke)), INT2NUM((int) ix)));
663
+ }
664
+ } else { // multiple match
665
+ ix = -ix; // turn into ambiguousMethodList index
666
+ while (smoke->ambiguousMethodList[ix]) {
667
+ const Smoke::Method &methodRef = smoke->methods[smoke->ambiguousMethodList[ix]];
668
+ if ((methodRef.flags & Smoke::mf_internal) == 0) {
669
+ rb_ary_push(meths, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(smoke)), INT2NUM((int)smoke->ambiguousMethodList[ix])));
670
+ }
671
+ ix++;
672
+ }
673
+ }
674
+ rb_hash_aset(result, rb_str_new2(smoke->methodNames[m]), meths);
675
+ }
676
+ }
677
+ }
678
+ }
679
+ return result;
680
+ }
681
+
682
+ /*
683
+ Flags values
684
+ 0 All methods, except enum values and protected non-static methods
685
+ mf_static Static methods only
686
+ mf_enum Enums only
687
+ mf_protected Protected non-static methods only
688
+ */
689
+
690
+ #define PUSH_QTRUBY_METHOD \
691
+ if ( (methodRef.flags & (Smoke::mf_internal|Smoke::mf_ctor|Smoke::mf_dtor)) == 0 \
692
+ && strcmp(s->methodNames[methodRef.name], "operator=") != 0 \
693
+ && strcmp(s->methodNames[methodRef.name], "operator!=") != 0 \
694
+ && strcmp(s->methodNames[methodRef.name], "operator--") != 0 \
695
+ && strcmp(s->methodNames[methodRef.name], "operator++") != 0 \
696
+ && strncmp(s->methodNames[methodRef.name], "operator ", strlen("operator ")) != 0 \
697
+ && ( (flags == 0 && (methodRef.flags & (Smoke::mf_static|Smoke::mf_enum|Smoke::mf_protected)) == 0) \
698
+ || ( flags == Smoke::mf_static \
699
+ && (methodRef.flags & Smoke::mf_enum) == 0 \
700
+ && (methodRef.flags & Smoke::mf_static) == Smoke::mf_static ) \
701
+ || (flags == Smoke::mf_enum && (methodRef.flags & Smoke::mf_enum) == Smoke::mf_enum) \
702
+ || ( flags == Smoke::mf_protected \
703
+ && (methodRef.flags & Smoke::mf_static) == 0 \
704
+ && (methodRef.flags & Smoke::mf_protected) == Smoke::mf_protected ) ) ) { \
705
+ if (strncmp(s->methodNames[methodRef.name], "operator", strlen("operator")) == 0) { \
706
+ if (op_re.indexIn(s->methodNames[methodRef.name]) != -1) { \
707
+ rb_ary_push(result, rb_str_new2((op_re.cap(1) + op_re.cap(2)).toLatin1())); \
708
+ } else { \
709
+ rb_ary_push(result, rb_str_new2(s->methodNames[methodRef.name] + strlen("operator"))); \
710
+ } \
711
+ } else if (predicate_re.indexIn(s->methodNames[methodRef.name]) != -1 && methodRef.numArgs == 0) { \
712
+ rb_ary_push(result, rb_str_new2((predicate_re.cap(2).toLower() + predicate_re.cap(3) + "?").toLatin1())); \
713
+ } else if (set_re.indexIn(s->methodNames[methodRef.name]) != -1 && methodRef.numArgs == 1) { \
714
+ rb_ary_push(result, rb_str_new2((set_re.cap(2).toLower() + set_re.cap(3) + "=").toLatin1())); \
715
+ } else { \
716
+ rb_ary_push(result, rb_str_new2(s->methodNames[methodRef.name])); \
717
+ } \
718
+ }
719
+
720
+ VALUE
721
+ findAllMethodNames(VALUE /*self*/, VALUE result, VALUE classid, VALUE flags_value)
722
+ {
723
+ QRegExp predicate_re("^(is|has)(.)(.*)");
724
+ QRegExp set_re("^(set)([A-Z])(.*)");
725
+ QRegExp op_re("operator(.*)(([-%~/+|&*])|(>>)|(<<)|(&&)|(\\|\\|)|(\\*\\*))=$");
726
+
727
+ unsigned short flags = (unsigned short) NUM2UINT(flags_value);
728
+ if (classid != Qnil) {
729
+ Smoke::Index c = (Smoke::Index) NUM2INT(rb_funcall(classid, rb_intern("index"), 0));
730
+ Smoke* s = smokeList[NUM2INT(rb_funcall(classid, rb_intern("smoke"), 0))];
731
+ if (c > s->numClasses) {
732
+ return Qnil;
733
+ }
734
+ #ifdef DEBUG
735
+ if (do_debug & qtdb_calls) qWarning("findAllMethodNames called with classid = %d in module %s", c, s->moduleName());
736
+ #endif
737
+ Smoke::Index imax = s->numMethodMaps;
738
+ Smoke::Index imin = 0, icur = -1, methmin, methmax;
739
+ methmin = -1; methmax = -1; // kill warnings
740
+ int icmp = -1;
741
+
742
+ while (imax >= imin) {
743
+ icur = (imin + imax) / 2;
744
+ icmp = s->leg(s->methodMaps[icur].classId, c);
745
+ if (icmp == 0) {
746
+ Smoke::Index pos = icur;
747
+ while(icur && s->methodMaps[icur-1].classId == c)
748
+ icur --;
749
+ methmin = icur;
750
+ icur = pos;
751
+ while(icur < imax && s->methodMaps[icur+1].classId == c)
752
+ icur ++;
753
+ methmax = icur;
754
+ break;
755
+ }
756
+ if (icmp > 0)
757
+ imax = icur - 1;
758
+ else
759
+ imin = icur + 1;
760
+ }
761
+
762
+ if (icmp == 0) {
763
+ for (Smoke::Index i=methmin ; i <= methmax ; i++) {
764
+ Smoke::Index ix= s->methodMaps[i].method;
765
+ if (ix > 0) { // single match
766
+ const Smoke::Method &methodRef = s->methods[ix];
767
+ PUSH_QTRUBY_METHOD
768
+ } else { // multiple match
769
+ ix = -ix; // turn into ambiguousMethodList index
770
+ while (s->ambiguousMethodList[ix]) {
771
+ const Smoke::Method &methodRef = s->methods[s->ambiguousMethodList[ix]];
772
+ PUSH_QTRUBY_METHOD
773
+ ix++;
774
+ }
775
+ }
776
+ }
777
+ }
778
+ }
779
+ return result;
780
+ }
781
+
782
+ QByteArray *
783
+ find_cached_selector(int argc, VALUE * argv, VALUE klass, const char * methodName)
784
+ {
785
+ // Look in the cache
786
+ static QByteArray * mcid = 0;
787
+ if (mcid == 0) {
788
+ mcid = new QByteArray();
789
+ }
790
+
791
+ *mcid = rb_class2name(klass);
792
+ *mcid += ';';
793
+ *mcid += methodName;
794
+ for(int i=4; i<argc ; i++)
795
+ {
796
+ *mcid += ';';
797
+ *mcid += value_to_type_flag(argv[i]);
798
+ }
799
+ Smoke::ModuleIndex *rcid = methcache.value(*mcid);
800
+ #ifdef DEBUG
801
+ if (do_debug & qtdb_calls) qWarning("method_missing mcid: %s", (const char *) *mcid);
802
+ #endif
803
+
804
+ if (rcid) {
805
+ // Got a hit
806
+ #ifdef DEBUG
807
+ if (do_debug & qtdb_calls) qWarning("method_missing cache hit, mcid: %s", (const char *) *mcid);
808
+ #endif
809
+ _current_method.smoke = rcid->smoke;
810
+ _current_method.index = rcid->index;
811
+ } else {
812
+ _current_method.smoke = 0;
813
+ _current_method.index = -1;
814
+ }
815
+
816
+ return mcid;
817
+ }
818
+
819
+ VALUE
820
+ method_missing(int argc, VALUE * argv, VALUE self)
821
+ {
822
+ const char * methodName = rb_id2name(SYM2ID(argv[0]));
823
+ VALUE klass = rb_funcall(self, rb_intern("class"), 0);
824
+
825
+ VALUE retval = Qnil;
826
+
827
+ // Look for 'thing?' methods, and try to match isThing() or hasThing() in the Smoke runtime
828
+ static QByteArray * pred = 0;
829
+ static VALUE mainThread = Qnil;
830
+ if (pred == 0) {
831
+ pred = new QByteArray();
832
+ }
833
+ if (mainThread == Qnil) {
834
+ mainThread = rb_thread_main();
835
+ }
836
+
837
+ if (rb_thread_current() != mainThread) {
838
+ rb_raise(rb_eRuntimeError, "Qt methods cannot be called from outside of the main thread");
839
+ }
840
+
841
+ *pred = methodName;
842
+ if (pred->endsWith("?")) {
843
+ smokeruby_object *o = value_obj_info(self);
844
+ if(!o || !o->ptr) {
845
+ return rb_call_super(argc, argv);
846
+ }
847
+
848
+ // Drop the trailing '?'
849
+ pred->replace(pred->length() - 1, 1, "");
850
+
851
+ pred->replace(0, 1, pred->mid(0, 1).toUpper());
852
+ pred->replace(0, 0, "is");
853
+ Smoke::ModuleIndex meth = o->smoke->findMethod(o->smoke->classes[o->classId].className, (const char *) *pred);
854
+
855
+ if (meth.index == 0) {
856
+ pred->replace(0, 2, "has");
857
+ meth = o->smoke->findMethod(o->smoke->classes[o->classId].className, *pred);
858
+ }
859
+
860
+ if (meth.index > 0) {
861
+ methodName = (char *) (const char *) *pred;
862
+ }
863
+ }
864
+
865
+ VALUE * temp_stack = ALLOCA_N(VALUE, argc+3);
866
+ temp_stack[0] = rb_str_new2("Qt");
867
+ temp_stack[1] = rb_str_new2(methodName);
868
+ temp_stack[2] = klass;
869
+ temp_stack[3] = self;
870
+ for (int count = 1; count < argc; count++) {
871
+ temp_stack[count+3] = argv[count];
872
+ }
873
+
874
+ {
875
+ QByteArray * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName);
876
+
877
+ if (_current_method.index == -1) {
878
+ // Find the C++ method to call. Do that from Ruby for now
879
+
880
+ retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack);
881
+ if (_current_method.index == -1) {
882
+ const char * op = rb_id2name(SYM2ID(argv[0]));
883
+ if ( qstrcmp(op, "-") == 0
884
+ || qstrcmp(op, "+") == 0
885
+ || qstrcmp(op, "/") == 0
886
+ || qstrcmp(op, "%") == 0
887
+ || qstrcmp(op, "|") == 0 )
888
+ {
889
+ // Look for operator methods of the form 'operator+=', 'operator-=' and so on..
890
+ char op1[3];
891
+ op1[0] = op[0];
892
+ op1[1] = '=';
893
+ op1[2] = '\0';
894
+ temp_stack[1] = rb_str_new2(op1);
895
+ retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack);
896
+ }
897
+
898
+ if (_current_method.index == -1) {
899
+ // Check for property getter/setter calls, and for slots in QObject classes
900
+ // not in the smoke library
901
+ smokeruby_object *o = value_obj_info(self);
902
+ if ( o != 0
903
+ && o->ptr != 0
904
+ && Smoke::isDerivedFrom(Smoke::ModuleIndex(o->smoke, o->classId), Smoke::findClass("QObject")) )
905
+ {
906
+ QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
907
+ static QByteArray * name = 0;
908
+ if (name == 0) {
909
+ name = new QByteArray();
910
+ }
911
+
912
+ *name = rb_id2name(SYM2ID(argv[0]));
913
+ const QMetaObject * meta = qobject->metaObject();
914
+
915
+ if (argc == 1) {
916
+ if (name->endsWith("?")) {
917
+ name->replace(0, 1, pred->mid(0, 1).toUpper());
918
+ name->replace(0, 0, "is");
919
+ if (meta->indexOfProperty(*name) == -1) {
920
+ name->replace(0, 2, "has");
921
+ }
922
+ }
923
+
924
+ if (meta->indexOfProperty(*name) != -1) {
925
+ VALUE qvariant = rb_funcall(self, rb_intern("property"), 1, rb_str_new2(*name));
926
+ return rb_funcall(qvariant, rb_intern("value"), 0);
927
+ }
928
+ }
929
+
930
+ if (argc == 2 && name->endsWith("=")) {
931
+ name->replace("=", "");
932
+ if (meta->indexOfProperty(*name) != -1) {
933
+ VALUE qvariant = rb_funcall(self, rb_intern("qVariantFromValue"), 1, argv[1]);
934
+ return rb_funcall(self, rb_intern("setProperty"), 2, rb_str_new2(*name), qvariant);
935
+ }
936
+ }
937
+
938
+ int classId = o->smoke->idClass(meta->className()).index;
939
+
940
+ // The class isn't in the Smoke lib. But if it is called 'local::Merged'
941
+ // it is from a QDBusInterface and the slots are remote, so don't try to
942
+ // those.
943
+ while ( classId == 0
944
+ && qstrcmp(meta->className(), "local::Merged") != 0
945
+ && qstrcmp(meta->superClass()->className(), "QDBusAbstractInterface") != 0 )
946
+ {
947
+ // Assume the QObject has slots which aren't in the Smoke library, so try
948
+ // and call the slot directly
949
+ for (int id = meta->methodOffset(); id < meta->methodCount(); id++) {
950
+ if (meta->method(id).methodType() == QMetaMethod::Slot) {
951
+ QByteArray signature(meta->method(id).signature());
952
+ QByteArray methodName = signature.mid(0, signature.indexOf('('));
953
+
954
+ // Don't check that the types of the ruby args match the c++ ones for now,
955
+ // only that the name and arg count is the same.
956
+ if (*name == methodName && meta->method(id).parameterTypes().count() == (argc - 1)) {
957
+ QList<MocArgument*> args = get_moc_arguments( o->smoke, meta->method(id).typeName(),
958
+ meta->method(id).parameterTypes() );
959
+ VALUE result = Qnil;
960
+ QtRuby::InvokeNativeSlot slot(qobject, id, argc - 1, args, argv + 1, &result);
961
+ slot.next();
962
+ return result;
963
+ }
964
+ }
965
+ }
966
+ meta = meta->superClass();
967
+ classId = o->smoke->idClass(meta->className()).index;
968
+ }
969
+ }
970
+
971
+ return rb_call_super(argc, argv);
972
+ }
973
+ }
974
+ // Success. Cache result.
975
+ methcache.insert(*mcid, new Smoke::ModuleIndex(_current_method));
976
+ }
977
+ }
978
+ QtRuby::MethodCall c(_current_method.smoke, _current_method.index, self, temp_stack+4, argc-1);
979
+ c.next();
980
+ VALUE result = *(c.var());
981
+ return result;
982
+ }
983
+
984
+ VALUE
985
+ class_method_missing(int argc, VALUE * argv, VALUE klass)
986
+ {
987
+ VALUE result = Qnil;
988
+ VALUE retval = Qnil;
989
+ const char * methodName = rb_id2name(SYM2ID(argv[0]));
990
+ VALUE * temp_stack = ALLOCA_N(VALUE, argc+3);
991
+ static VALUE mainThread = Qnil;
992
+ if (mainThread == Qnil) {
993
+ mainThread = rb_thread_main();
994
+ }
995
+ temp_stack[0] = rb_str_new2("Qt");
996
+ temp_stack[1] = rb_str_new2(methodName);
997
+ temp_stack[2] = klass;
998
+ temp_stack[3] = Qnil;
999
+
1000
+ if (rb_thread_current() != mainThread) {
1001
+ rb_raise(rb_eRuntimeError, "Qt methods cannot be called from outside of the main thread");
1002
+ }
1003
+
1004
+ for (int count = 1; count < argc; count++) {
1005
+ temp_stack[count+3] = argv[count];
1006
+ }
1007
+
1008
+ {
1009
+ QByteArray * mcid = find_cached_selector(argc+3, temp_stack, klass, methodName);
1010
+
1011
+ if (_current_method.index == -1) {
1012
+ retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack);
1013
+ if (_current_method.index != -1) {
1014
+ // Success. Cache result.
1015
+ methcache.insert(*mcid, new Smoke::ModuleIndex(_current_method));
1016
+ }
1017
+ }
1018
+ }
1019
+
1020
+ if (_current_method.index == -1) {
1021
+ static QRegExp * rx = 0;
1022
+ if (rx == 0) {
1023
+ rx = new QRegExp("[a-zA-Z]+");
1024
+ }
1025
+
1026
+ if (rx->indexIn(methodName) == -1) {
1027
+ // If an operator method hasn't been found as an instance method,
1028
+ // then look for a class method - after 'op(self,a)' try 'self.op(a)'
1029
+ VALUE * method_stack = ALLOCA_N(VALUE, argc - 1);
1030
+ method_stack[0] = argv[0];
1031
+ for (int count = 1; count < argc - 1; count++) {
1032
+ method_stack[count] = argv[count+1];
1033
+ }
1034
+ result = method_missing(argc-1, method_stack, argv[1]);
1035
+ return result;
1036
+ } else {
1037
+ return rb_call_super(argc, argv);
1038
+ }
1039
+ }
1040
+ QtRuby::MethodCall c(_current_method.smoke, _current_method.index, Qnil, temp_stack+4, argc-1);
1041
+ c.next();
1042
+ result = *(c.var());
1043
+ return result;
1044
+ }
1045
+
1046
+ QList<MocArgument*>
1047
+ get_moc_arguments(Smoke* smoke, const char * typeName, QList<QByteArray> methodTypes)
1048
+ {
1049
+ static QRegExp * rx = 0;
1050
+ if (rx == 0) {
1051
+ rx = new QRegExp("^(bool|int|uint|long|ulong|double|char\\*|QString)&?$");
1052
+ }
1053
+ methodTypes.prepend(QByteArray(typeName));
1054
+ QList<MocArgument*> result;
1055
+
1056
+ foreach (QByteArray name, methodTypes) {
1057
+ MocArgument *arg = new MocArgument;
1058
+ Smoke::Index typeId = 0;
1059
+
1060
+ if (name.isEmpty()) {
1061
+ arg->argType = xmoc_void;
1062
+ result.append(arg);
1063
+ } else {
1064
+ name.replace("const ", "");
1065
+ QString staticType = (rx->indexIn(name) != -1 ? rx->cap(1) : "ptr");
1066
+ if (staticType == "ptr") {
1067
+ arg->argType = xmoc_ptr;
1068
+ QByteArray targetType = name;
1069
+ typeId = smoke->idType(targetType.constData());
1070
+ if (typeId == 0 && !name.contains('*')) {
1071
+ if (!name.contains("&")) {
1072
+ targetType += "&";
1073
+ }
1074
+ typeId = smoke->idType(targetType.constData());
1075
+ }
1076
+
1077
+ // This shouldn't be necessary because the type of the slot arg should always be in the
1078
+ // smoke module of the slot being invoked. However, that isn't true for a dataUpdated()
1079
+ // slot in a PlasmaScripting::Applet
1080
+ if (typeId == 0) {
1081
+ QHash<Smoke*, QtRubyModule>::const_iterator it;
1082
+ for (it = qtruby_modules.constBegin(); it != qtruby_modules.constEnd(); ++it) {
1083
+ smoke = it.key();
1084
+ targetType = name;
1085
+ typeId = smoke->idType(targetType.constData());
1086
+ if (typeId != 0) {
1087
+ break;
1088
+ }
1089
+
1090
+ if (typeId == 0 && !name.contains('*')) {
1091
+ if (!name.contains("&")) {
1092
+ targetType += "&";
1093
+ }
1094
+
1095
+ typeId = smoke->idType(targetType.constData());
1096
+
1097
+ if (typeId != 0) {
1098
+ break;
1099
+ }
1100
+ }
1101
+ }
1102
+ }
1103
+ } else if (staticType == "bool") {
1104
+ arg->argType = xmoc_bool;
1105
+ smoke = qtcore_Smoke;
1106
+ typeId = smoke->idType(name.constData());
1107
+ } else if (staticType == "int") {
1108
+ arg->argType = xmoc_int;
1109
+ smoke = qtcore_Smoke;
1110
+ typeId = smoke->idType(name.constData());
1111
+ } else if (staticType == "uint") {
1112
+ arg->argType = xmoc_uint;
1113
+ smoke = qtcore_Smoke;
1114
+ typeId = smoke->idType("unsigned int");
1115
+ } else if (staticType == "long") {
1116
+ arg->argType = xmoc_long;
1117
+ smoke = qtcore_Smoke;
1118
+ typeId = smoke->idType(name.constData());
1119
+ } else if (staticType == "ulong") {
1120
+ arg->argType = xmoc_ulong;
1121
+ smoke = qtcore_Smoke;
1122
+ typeId = smoke->idType("unsigned long");
1123
+ } else if (staticType == "double") {
1124
+ arg->argType = xmoc_double;
1125
+ smoke = qtcore_Smoke;
1126
+ typeId = smoke->idType(name.constData());
1127
+ } else if (staticType == "char*") {
1128
+ arg->argType = xmoc_charstar;
1129
+ smoke = qtcore_Smoke;
1130
+ typeId = smoke->idType(name.constData());
1131
+ } else if (staticType == "QString") {
1132
+ arg->argType = xmoc_QString;
1133
+ name += "*";
1134
+ smoke = qtcore_Smoke;
1135
+ typeId = smoke->idType(name.constData());
1136
+ }
1137
+
1138
+ if (typeId == 0) {
1139
+ rb_raise(rb_eArgError, "Cannot handle '%s' as slot argument\n", name.constData());
1140
+ return result;
1141
+ }
1142
+
1143
+ arg->st.set(smoke, typeId);
1144
+ result.append(arg);
1145
+ }
1146
+ }
1147
+
1148
+ return result;
1149
+ }
1150
+
1151
+ extern "C"
1152
+ {
1153
+ // ---------------- Helpers -------------------
1154
+
1155
+ //---------- All functions except fully qualified statics & enums ---------
1156
+
1157
+ VALUE
1158
+ mapObject(VALUE self, VALUE obj)
1159
+ {
1160
+ smokeruby_object *o = value_obj_info(obj);
1161
+ if(!o)
1162
+ return Qnil;
1163
+ mapPointer(obj, o, o->classId, 0);
1164
+ return self;
1165
+ }
1166
+
1167
+ VALUE set_obj_info(const char * className, smokeruby_object * o);
1168
+
1169
+ VALUE
1170
+ qobject_metaobject(VALUE self)
1171
+ {
1172
+ smokeruby_object * o = value_obj_info(self);
1173
+ QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
1174
+ QMetaObject * meta = (QMetaObject *) qobject->metaObject();
1175
+ VALUE obj = getPointerObject(meta);
1176
+ if (obj != Qnil) {
1177
+ return obj;
1178
+ }
1179
+
1180
+ smokeruby_object * m = alloc_smokeruby_object( false,
1181
+ o->smoke,
1182
+ o->smoke->idClass("QMetaObject").index,
1183
+ meta );
1184
+
1185
+ obj = set_obj_info("Qt::MetaObject", m);
1186
+ return obj;
1187
+ }
1188
+
1189
+ VALUE
1190
+ set_obj_info(const char * className, smokeruby_object * o)
1191
+ {
1192
+ VALUE klass = rb_funcall(qt_internal_module,
1193
+ rb_intern("find_class"),
1194
+ 1,
1195
+ rb_str_new2(className) );
1196
+ if (klass == Qnil) {
1197
+ rb_raise(rb_eRuntimeError, "Class '%s' not found", className);
1198
+ }
1199
+
1200
+ Smoke::ModuleIndex *r = classcache.value(className);
1201
+ if (r != 0) {
1202
+ o->classId = (int) r->index;
1203
+ }
1204
+ // If the instance is a subclass of QObject, then check to see if the
1205
+ // className from its QMetaObject is in the Smoke library. If not then
1206
+ // create a Ruby class for it dynamically. Remove the first letter from
1207
+ // any class names beginning with 'Q' or 'K' and put them under the Qt::
1208
+ // or KDE:: modules respectively.
1209
+ if (o->smoke->isDerivedFrom(o->smoke, o->classId, o->smoke->idClass("QObject").smoke, o->smoke->idClass("QObject").index)) {
1210
+ QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
1211
+ const QMetaObject * meta = qobject->metaObject();
1212
+ int classId = o->smoke->idClass(meta->className()).index;
1213
+ // The class isn't in the Smoke lib..
1214
+ if (classId == 0) {
1215
+ VALUE new_klass = Qnil;
1216
+ QByteArray className(meta->className());
1217
+
1218
+ if (className == "QTableModel") {
1219
+ new_klass = qtablemodel_class;
1220
+ } else if (className == "QListModel") {
1221
+ new_klass = qlistmodel_class;
1222
+ } else if (className.startsWith("Q")) {
1223
+ className.replace("Q", "");
1224
+ className = className.mid(0, 1).toUpper() + className.mid(1);
1225
+ new_klass = rb_define_class_under(qt_module, className, klass);
1226
+ } else {
1227
+ new_klass = rb_define_class(className, klass);
1228
+ }
1229
+
1230
+ if (new_klass != Qnil) {
1231
+ klass = new_klass;
1232
+
1233
+ for (int id = meta->enumeratorOffset(); id < meta->enumeratorCount(); id++) {
1234
+ // If there are any enum keys with the same scope as the new class then
1235
+ // add them
1236
+ if (qstrcmp(meta->className(), meta->enumerator(id).scope()) == 0) {
1237
+ for (int i = 0; i < meta->enumerator(id).keyCount(); i++) {
1238
+ rb_define_const( klass,
1239
+ meta->enumerator(id).key(i),
1240
+ INT2NUM(meta->enumerator(id).value(i)) );
1241
+ }
1242
+ }
1243
+ }
1244
+ }
1245
+
1246
+ // Add a Qt::Object.metaObject method which will do dynamic despatch on the
1247
+ // metaObject() virtual method so that the true QMetaObject of the class
1248
+ // is returned, rather than for the one for the parent class that is in
1249
+ // the Smoke library.
1250
+ rb_define_method(klass, "metaObject", (VALUE (*) (...)) qobject_metaobject, 0);
1251
+ }
1252
+ }
1253
+
1254
+ VALUE obj = Data_Wrap_Struct(klass, smokeruby_mark, smokeruby_free, (void *) o);
1255
+ return obj;
1256
+ }
1257
+
1258
+ VALUE
1259
+ kross2smoke(VALUE /*self*/, VALUE krobject, VALUE new_klass)
1260
+ {
1261
+ VALUE new_klassname = rb_funcall(new_klass, rb_intern("name"), 0);
1262
+
1263
+ Smoke::ModuleIndex * cast_to_id = classcache.value(StringValuePtr(new_klassname));
1264
+ if (cast_to_id == 0) {
1265
+ rb_raise(rb_eArgError, "unable to find class \"%s\" to cast to\n", StringValuePtr(new_klassname));
1266
+ }
1267
+
1268
+ void* o;
1269
+ Data_Get_Struct(krobject, void, o);
1270
+
1271
+ smokeruby_object * o_cast = alloc_smokeruby_object(false, cast_to_id->smoke, (int) cast_to_id->index, o);
1272
+
1273
+ VALUE obj = Data_Wrap_Struct(new_klass, smokeruby_mark, smokeruby_free, (void *) o_cast);
1274
+ mapPointer(obj, o_cast, o_cast->classId, 0);
1275
+ return obj;
1276
+ }
1277
+
1278
+ const char *
1279
+ value_to_type_flag(VALUE ruby_value)
1280
+ {
1281
+ const char * classname = rb_obj_classname(ruby_value);
1282
+ const char *r = "";
1283
+ if (ruby_value == Qnil)
1284
+ r = "u";
1285
+ else if (TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || qstrcmp(classname, "Qt::Integer") == 0)
1286
+ r = "i";
1287
+ else if (TYPE(ruby_value) == T_FLOAT)
1288
+ r = "n";
1289
+ else if (TYPE(ruby_value) == T_STRING)
1290
+ r = "s";
1291
+ else if(ruby_value == Qtrue || ruby_value == Qfalse || qstrcmp(classname, "Qt::Boolean") == 0)
1292
+ r = "B";
1293
+ else if (qstrcmp(classname, "Qt::Enum") == 0) {
1294
+ VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qenum_type"), 1, ruby_value);
1295
+ r = StringValuePtr(temp);
1296
+ } else if (TYPE(ruby_value) == T_DATA) {
1297
+ smokeruby_object *o = value_obj_info(ruby_value);
1298
+ if (o == 0 || o->smoke == 0) {
1299
+ r = "a";
1300
+ } else {
1301
+ r = o->smoke->classes[o->classId].className;
1302
+ }
1303
+ } else {
1304
+ r = "U";
1305
+ }
1306
+
1307
+ return r;
1308
+ }
1309
+
1310
+ VALUE prettyPrintMethod(Smoke::Index id)
1311
+ {
1312
+ VALUE r = rb_str_new2("");
1313
+ const Smoke::Method &meth = qtcore_Smoke->methods[id];
1314
+ const char *tname = qtcore_Smoke->types[meth.ret].name;
1315
+ if(meth.flags & Smoke::mf_static) qt_rb_str_catf(r, "static ");
1316
+ qt_rb_str_catf(r, "%s ", (tname ? tname:"void"));
1317
+ qt_rb_str_catf(r, "%s::%s(", qtcore_Smoke->classes[meth.classId].className, qtcore_Smoke->methodNames[meth.name]);
1318
+ for(int i = 0; i < meth.numArgs; i++) {
1319
+ if(i) qt_rb_str_catf(r, ", ");
1320
+ tname = qtcore_Smoke->types[qtcore_Smoke->argumentList[meth.args+i]].name;
1321
+ qt_rb_str_catf(r, "%s", (tname ? tname:"void"));
1322
+ }
1323
+ qt_rb_str_catf(r, ")");
1324
+ if(meth.flags & Smoke::mf_const) qt_rb_str_catf(r, " const");
1325
+ return r;
1326
+ }
1327
+ }