From 0f98a95eadd170a7f4b81e05a167abe436340f1b Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Tue, 10 Jan 2012 12:27:37 +0100 Subject: [PATCH] Imported Upstream version 1.1.0 --- .gitignore | 8 + 3rdparty/kde/kfilterproxysearchline.h | 2 +- 3rdparty/kde/kidentityproxymodel.cpp | 2 +- 3rdparty/kde/kidentityproxymodel.h | 2 +- 3rdparty/kde/krecursivefilterproxymodel.h | 2 +- 3rdparty/qt/qguiplatformplugin_p.h | 2 +- .../qt/qobject_p_copy.h | 44 +- 3rdparty/qt/resourcemodel.cpp | 2 +- 3rdparty/qt/resourcemodel.h | 2 +- CHANGES | 21 + CMakeLists.txt | 200 ++-- CMakeQt4To5Porting.cmake | 173 +++ GammaRay.desktop | 2 +- Make-O-Matic/buildscript.py | 44 - ReadMe.txt | 4 +- add_license_blurb.sh | 7 +- attach/attachdialog.ui | 106 -- attach/processlist_unix.cpp | 177 --- attach/processlist_win.cpp | 171 --- cmake/FindGraphviz.cmake | 49 + cmake/GammaRayMacros.cmake | 15 + config-gammaray.h.cmake | 2 + connectionfilterproxymodel.h | 2 +- connectionmodel.cpp | 52 +- connectionmodel.h | 17 +- hooking/abstractfunctionoverwriter.cpp | 215 ++++ hooking/abstractfunctionoverwriter.h | 150 +++ .../functionoverwriterfactory.cpp | 39 +- .../functionoverwriterfactory.h | 31 +- hooking/unixfunctionoverwriter.cpp | 120 +++ hooking/unixfunctionoverwriter.h | 60 ++ hooking/winfunctionoverwriter.cpp | 114 ++ hooking/winfunctionoverwriter.h | 60 ++ injector/CMakeLists.txt | 9 +- injector/abstractinjector.cpp | 5 + injector/abstractinjector.h | 14 +- injector/gdbinjector.cpp | 5 + injector/gdbinjector.h | 1 + injector/injectorstyleplugin.cpp | 43 +- injector/interactiveprocess.cpp | 4 + injector/interactiveprocess.h | 4 +- injector/preloadinjector.cpp | 6 +- injector/styleinjector.cpp | 22 + injector/styleinjector.h | 1 + injector/windllinjector.cpp | 9 +- launcher/CMakeLists.txt | 51 + {attach => launcher}/attachdialog.cpp | 22 +- {attach => launcher}/attachdialog.h | 16 +- launcher/attachdialog.ui | 66 ++ launcher/launcherwindow.cpp | 92 ++ mainwindow.h => launcher/launcherwindow.h | 42 +- launcher/launcherwindow.ui | 192 ++++ launcher/launchpage.cpp | 126 +++ mainwindow.h => launcher/launchpage.h | 46 +- launcher/launchpage.ui | 89 ++ main.cpp => launcher/main.cpp | 16 +- probefinder.cpp => launcher/probefinder.cpp | 0 probefinder.h => launcher/probefinder.h | 0 {attach => launcher}/processfiltermodel.cpp | 1 + {attach => launcher}/processfiltermodel.h | 0 {attach => launcher}/processlist.h | 7 +- launcher/processlist_unix.cpp | 209 ++++ launcher/processlist_win.cpp | 183 ++++ {attach => launcher}/processmodel.cpp | 4 + {attach => launcher}/processmodel.h | 2 + promolabel.cpp => launcher/promolabel.cpp | 0 promolabel.h => launcher/promolabel.h | 4 +- launcher/selftestpage.cpp | 118 ++ mainwindow.h => launcher/selftestpage.h | 43 +- launcher/selftestpage.ui | 24 + splashscreen.cpp => launcher/splashscreen.cpp | 0 splashscreen.h => launcher/splashscreen.h | 4 +- mainwindow.cpp | 39 +- mainwindow.h | 4 +- mainwindow.ui | 10 +- metaobject.cpp | 94 ++ metaobject.h | 106 ++ metaobjectrepository.cpp | 261 +++++ metaobjectrepository.h | 76 ++ probefinder.h => metaproperty.cpp | 32 +- metaproperty.h | 128 +++ metapropertymodel.cpp | 157 +++ .../scenemodel.h => metapropertymodel.h | 44 +- metatypedeclarations.h | 49 + objectmodel.h | 3 +- objectmodelbase.h | 2 + objectstaticpropertymodel.cpp | 13 +- objecttreemodel.cpp | 76 +- objecttreemodel.h | 18 +- objecttypefilterproxymodel.h | 29 +- pluginmanager.cpp | 114 ++ sidepane.h => pluginmanager.h | 36 +- probe.cpp | 242 ++--- probe.h | 12 +- .../propertycoloreditor.cpp | 27 +- .../propertycoloreditor.h | 33 +- propertyeditor/propertydoublepaireditor.cpp | 67 ++ propertyeditor/propertydoublepaireditor.h | 68 ++ propertyeditor/propertydoublepaireditor.ui | 48 + propertyeditor/propertyeditorfactory.cpp | 54 + .../propertyeditorfactory.h | 34 +- .../propertyextendededitor.cpp | 44 +- .../propertyextendededitor.h | 44 +- propertyeditor/propertyextendededitor.ui | 37 + .../propertyfonteditor.cpp | 27 +- .../propertyfonteditor.h | 26 +- propertyeditor/propertyintpaireditor.cpp | 75 ++ propertyeditor/propertyintpaireditor.h | 76 ++ propertyeditor/propertyintpaireditor.ui | 54 + propertywidget.cpp | 53 +- propertywidget.h | 9 + propertywidget.ui | 36 +- splashscreen.cpp => proxydetacher.cpp | 46 +- promolabel.h => proxydetacher.h | 38 +- proxytoolfactory.cpp | 113 ++ proxytoolfactory.h | 65 ++ qmldebugcontrol/CMakeLists.txt | 43 - qmldebugcontrol/QmlProfiler.pluginspec.in | 22 - qmldebugcontrol/abstractqmlprofilerrunner.h | 64 -- qmldebugcontrol/canvas/CMakeLists.txt | 24 - qmldebugcontrol/canvas/canvas.pri | 11 - qmldebugcontrol/canvas/qdeclarativecanvas.cpp | 250 ----- qmldebugcontrol/canvas/qdeclarativecanvas.h | 115 -- qmldebugcontrol/canvas/qdeclarativecanvastimer.cpp | 90 -- qmldebugcontrol/canvas/qdeclarativecanvastimer.h | 71 -- qmldebugcontrol/canvas/qdeclarativecontext2d.cpp | 1132 -------------------- qmldebugcontrol/canvas/qdeclarativecontext2d.h | 327 ------ qmldebugcontrol/canvas/qdeclarativetiledcanvas.cpp | 166 --- qmldebugcontrol/canvas/qdeclarativetiledcanvas.h | 93 -- qmldebugcontrol/codaqmlprofilerrunner.cpp | 87 -- qmldebugcontrol/codaqmlprofilerrunner.h | 72 -- qmldebugcontrol/localqmlprofilerrunner.cpp | 91 -- qmldebugcontrol/localqmlprofilerrunner.h | 76 -- qmldebugcontrol/main.cpp | 24 - qmldebugcontrol/qml/Detail.qml | 70 -- qmldebugcontrol/qml/Label.qml | 55 - qmldebugcontrol/qml/MainView.js | 154 --- qmldebugcontrol/qml/MainView.qml | 503 --------- qmldebugcontrol/qml/RangeDetails.qml | 110 -- qmldebugcontrol/qml/RangeMover.qml | 151 --- qmldebugcontrol/qml/TimeDisplay.qml | 196 ---- qmldebugcontrol/qml/clean_pane_small.png | Bin 713 -> 0 bytes qmldebugcontrol/qml/magnifier-minus.png | Bin 423 -> 0 bytes qmldebugcontrol/qml/magnifier-plus.png | Bin 412 -> 0 bytes qmldebugcontrol/qml/next.png | Bin 908 -> 0 bytes qmldebugcontrol/qml/popup.png | Bin 1538 -> 0 bytes qmldebugcontrol/qml/prev.png | Bin 911 -> 0 bytes qmldebugcontrol/qml/qml.qrc | 19 - qmldebugcontrol/qml/recordOff.png | Bin 589 -> 0 bytes qmldebugcontrol/qml/recordOn.png | Bin 632 -> 0 bytes qmldebugcontrol/qmldbg_tcp/CMakeLists.txt | 20 - .../qmldbg_tcp/private/qdeclarativedebugserver_p.h | 88 -- .../qmldbg_tcp/private/qdeclarativeglobal_p.h | 110 -- .../qmldbg_tcp/private/qpacketprotocol_p.h | 125 --- qmldebugcontrol/qmldbg_tcp/qmldbg_tcp.pro | 18 - .../qmldbg_tcp/qtcpserverconnection.cpp | 180 ---- qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.h | 84 -- qmldebugcontrol/qmljsdebugclient/CMakeLists.txt | 27 - .../qmljsdebugclient/qdeclarativedebug.cpp | 1099 ------------------- .../qmljsdebugclient/qdeclarativedebug.h | 375 ------- .../qmljsdebugclient/qdeclarativedebugclient.cpp | 346 ------ .../qmljsdebugclient/qdeclarativedebugclient.h | 134 --- .../qmljsdebugclient/qmljsdebugclient-lib.pri | 15 - .../qmljsdebugclient/qpacketprotocol.cpp | 378 ------- qmldebugcontrol/qmljsdebugclient/qpacketprotocol.h | 221 ---- qmldebugcontrol/qmljsdebugger/CMakeLists.txt | 39 - .../qmljsdebugger/editor/CMakeLists.txt | 43 - .../qmljsdebugger/editor/abstractliveedittool.cpp | 190 ---- .../qmljsdebugger/editor/abstractliveedittool.h | 107 -- .../editor/boundingrecthighlighter.cpp | 232 ---- .../qmljsdebugger/editor/boundingrecthighlighter.h | 106 -- .../qmljsdebugger/editor/colorpickertool.cpp | 123 --- .../qmljsdebugger/editor/colorpickertool.h | 84 -- qmldebugcontrol/qmljsdebugger/editor/editor.qrc | 24 - .../editor/images/color-picker-24.png | Bin 3440 -> 0 bytes .../editor/images/color-picker-hicontrast.png | Bin 3192 -> 0 bytes .../qmljsdebugger/editor/images/color-picker.png | Bin 3173 -> 0 bytes .../qmljsdebugger/editor/images/from-qml-24.png | Bin 3395 -> 0 bytes .../qmljsdebugger/editor/images/from-qml.png | Bin 3205 -> 0 bytes .../editor/images/inspectormode-24.png | Bin 1283 -> 0 bytes .../qmljsdebugger/editor/images/inspectormode.png | Bin 3539 -> 0 bytes .../qmljsdebugger/editor/images/pause-24.png | Bin 3307 -> 0 bytes .../qmljsdebugger/editor/images/pause.png | Bin 3097 -> 0 bytes .../qmljsdebugger/editor/images/play-24.png | Bin 3655 -> 0 bytes .../qmljsdebugger/editor/images/play.png | Bin 3363 -> 0 bytes .../qmljsdebugger/editor/images/reload.png | Bin 3418 -> 0 bytes .../qmljsdebugger/editor/images/resize_handle.png | Bin 160 -> 0 bytes .../qmljsdebugger/editor/images/select-24.png | Bin 3510 -> 0 bytes .../editor/images/select-marquee-24.png | Bin 2891 -> 0 bytes .../qmljsdebugger/editor/images/select-marquee.png | Bin 2871 -> 0 bytes .../qmljsdebugger/editor/images/select.png | Bin 3308 -> 0 bytes .../qmljsdebugger/editor/images/to-qml-24.png | Bin 3407 -> 0 bytes .../qmljsdebugger/editor/images/to-qml.png | Bin 3227 -> 0 bytes .../qmljsdebugger/editor/images/zoom-24.png | Bin 3566 -> 0 bytes .../qmljsdebugger/editor/images/zoom.png | Bin 3347 -> 0 bytes .../qmljsdebugger/editor/livelayeritem.cpp | 84 -- .../qmljsdebugger/editor/livelayeritem.h | 59 - .../editor/liverubberbandselectionmanipulator.cpp | 155 --- .../editor/liverubberbandselectionmanipulator.h | 88 -- .../editor/liveselectionindicator.cpp | 107 -- .../qmljsdebugger/editor/liveselectionindicator.h | 71 -- .../editor/liveselectionrectangle.cpp | 104 -- .../qmljsdebugger/editor/liveselectionrectangle.h | 68 -- .../qmljsdebugger/editor/liveselectiontool.cpp | 431 -------- .../qmljsdebugger/editor/liveselectiontool.h | 112 -- .../editor/livesingleselectionmanipulator.cpp | 141 --- .../editor/livesingleselectionmanipulator.h | 80 -- .../qmljsdebugger/editor/qmltoolbar.cpp | 321 ------ qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.h | 123 --- .../editor/subcomponentmasklayeritem.cpp | 120 --- .../editor/subcomponentmasklayeritem.h | 62 -- .../qmljsdebugger/editor/toolbarcolorbox.cpp | 126 --- .../qmljsdebugger/editor/toolbarcolorbox.h | 71 -- qmldebugcontrol/qmljsdebugger/editor/zoomtool.cpp | 328 ------ qmldebugcontrol/qmljsdebugger/editor/zoomtool.h | 97 -- .../qmljsdebugger/include/jsdebuggeragent.h | 109 -- .../include/qdeclarativeinspectorservice.h | 105 -- .../include/qdeclarativeviewinspector.h | 120 --- .../include/qdeclarativeviewobserver.h | 53 - .../qmljsdebugger/include/qmlinspectorconstants.h | 71 -- .../qmljsdebugger/include/qmljsdebugger_global.h | 49 - .../include/qt_private/qdeclarativedebughelper_p.h | 62 -- .../qt_private/qdeclarativedebugservice_p.h | 83 -- .../include/qt_private/qdeclarativestate_p.h | 200 ---- qmldebugcontrol/qmljsdebugger/jsdebuggeragent.cpp | 670 ------------ qmldebugcontrol/qmljsdebugger/jsdebuggeragent.h | 109 -- .../qmljsdebugger/protocol/CMakeLists.txt | 19 - .../qmljsdebugger/protocol/inspectorprotocol.cpp | 3 - .../qmljsdebugger/protocol/inspectorprotocol.h | 128 --- .../qmljsdebugger/protocol/protocol.pri | 3 - .../qmljsdebugger/qdeclarativeinspectorservice.cpp | 289 ----- .../qmljsdebugger/qdeclarativeinspectorservice.h | 105 -- .../qmljsdebugger/qdeclarativeviewinspector.cpp | 4 - .../qmljsdebugger/qdeclarativeviewinspector.h | 120 --- .../qmljsdebugger/qdeclarativeviewinspector_p.cpp | 934 ---------------- .../qmljsdebugger/qdeclarativeviewinspector_p.h | 156 --- .../qmljsdebugger/qdeclarativeviewobserver.cpp | 4 - .../qmljsdebugger/qdeclarativeviewobserver.h | 53 - .../qmljsdebugger/qmlinspectorconstants.h | 71 -- .../qmljsdebugger/qmljsdebugger-lib.pri | 18 - .../qmljsdebugger/qmljsdebugger-src.pri | 51 - qmldebugcontrol/qmljsdebugger/qmljsdebugger.pro | 18 - .../qmljsdebugger/qmljsdebugger_global.h | 49 - qmldebugcontrol/qmlprofiler.pro | 65 -- qmldebugcontrol/qmlprofiler_global.h | 45 - qmldebugcontrol/qmlprofilerattachdialog.cpp | 72 -- qmldebugcontrol/qmlprofilerattachdialog.h | 66 -- qmldebugcontrol/qmlprofilerattachdialog.ui | 109 -- qmldebugcontrol/qmlprofilerconstants.h | 44 - qmldebugcontrol/qmlprofilerengine.cpp | 273 ----- qmldebugcontrol/qmlprofilerengine.h | 77 -- qmldebugcontrol/qmlprofilereventtypes.h | 52 - qmldebugcontrol/qmlprofilereventview.cpp | 545 ---------- qmldebugcontrol/qmlprofilereventview.h | 160 --- qmldebugcontrol/qmlprofilerplugin.cpp | 76 -- qmldebugcontrol/qmlprofilerplugin.h | 61 -- qmldebugcontrol/qmlprofilerruncontrolfactory.cpp | 158 --- qmldebugcontrol/qmlprofilerruncontrolfactory.h | 65 -- qmldebugcontrol/qmlprofilertool.cpp | 558 ---------- qmldebugcontrol/qmlprofilertool.h | 101 -- qmldebugcontrol/qmlprofilertraceclient.cpp | 169 --- qmldebugcontrol/qmlprofilertraceclient.h | 129 --- .../qt_private/qdeclarativedebughelper_p.h | 62 -- .../qt_private/qdeclarativedebugservice_p.h | 83 -- qmldebugcontrol/qt_private/qdeclarativestate_p.h | 200 ---- qmldebugcontrol/remotelinuxqmlprofilerrunner.cpp | 168 --- qmldebugcontrol/remotelinuxqmlprofilerrunner.h | 78 -- qmldebugcontrol/timelineview.cpp | 242 ----- qmldebugcontrol/timelineview.h | 149 --- qmldebugcontrol/tracewindow.cpp | 179 ---- qmldebugcontrol/tracewindow.h | 92 -- qmljsdebugger_global.h | 4 +- resources/classes/README | 1 + resources/classes/calendarwidget.png | Bin 0 -> 968 bytes resources/classes/checkbox.png | Bin 0 -> 817 bytes resources/classes/columnview.png | Bin 0 -> 518 bytes resources/classes/combobox.png | Bin 0 -> 853 bytes resources/classes/commandlinkbutton.png | Bin 0 -> 1208 bytes resources/classes/dateedit.png | Bin 0 -> 672 bytes resources/classes/datetimeedit.png | Bin 0 -> 1132 bytes resources/classes/dial.png | Bin 0 -> 978 bytes resources/classes/dialogbuttonbox.png | Bin 0 -> 1003 bytes resources/classes/dockwidget.png | Bin 0 -> 638 bytes resources/classes/doublespinbox.png | Bin 0 -> 749 bytes resources/classes/editform.png | Bin 0 -> 349 bytes resources/classes/editgrid.png | Bin 0 -> 349 bytes resources/classes/edithlayout.png | Bin 0 -> 455 bytes resources/classes/edithlayoutsplit.png | Bin 0 -> 860 bytes resources/classes/editvlayout.png | Bin 0 -> 340 bytes resources/classes/editvlayoutsplit.png | Bin 0 -> 740 bytes resources/classes/fontcombobox.png | Bin 0 -> 966 bytes resources/classes/frame.png | Bin 0 -> 721 bytes resources/classes/graphicsview.png | Bin 0 -> 1182 bytes resources/classes/groupbox.png | Bin 0 -> 439 bytes resources/classes/groupboxcollapsible.png | Bin 0 -> 702 bytes resources/classes/hscrollbar.png | Bin 0 -> 408 bytes resources/classes/hslider.png | Bin 0 -> 729 bytes resources/classes/hsplit.png | Bin 0 -> 164 bytes resources/classes/label.png | Bin 0 -> 953 bytes resources/classes/lcdnumber.png | Bin 0 -> 555 bytes resources/classes/line.png | Bin 0 -> 287 bytes resources/classes/lineedit.png | Bin 0 -> 405 bytes resources/classes/listbox.png | Bin 0 -> 797 bytes resources/classes/listview.png | Bin 0 -> 756 bytes resources/classes/mdiarea.png | Bin 0 -> 643 bytes resources/classes/plaintextedit.png | Bin 0 -> 807 bytes resources/classes/progress.png | Bin 0 -> 559 bytes resources/classes/pushbutton.png | Bin 0 -> 408 bytes resources/classes/radiobutton.png | Bin 0 -> 586 bytes resources/classes/scrollarea.png | Bin 0 -> 548 bytes resources/classes/spacer.png | Bin 0 -> 686 bytes resources/classes/spinbox.png | Bin 0 -> 680 bytes resources/classes/tabbar.png | Bin 0 -> 623 bytes resources/classes/table.png | Bin 0 -> 483 bytes resources/classes/tabwidget.png | Bin 0 -> 572 bytes resources/classes/textedit.png | Bin 0 -> 823 bytes resources/classes/timeedit.png | Bin 0 -> 1353 bytes resources/classes/toolbox.png | Bin 0 -> 783 bytes resources/classes/toolbutton.png | Bin 0 -> 1167 bytes resources/classes/vline.png | Bin 0 -> 314 bytes resources/classes/vscrollbar.png | Bin 0 -> 415 bytes resources/classes/vslider.png | Bin 0 -> 726 bytes resources/classes/vspacer.png | Bin 0 -> 677 bytes resources/classes/widget.png | Bin 0 -> 716 bytes resources/classes/widgetstack.png | Bin 0 -> 828 bytes resources/classes/wizard.png | Bin 0 -> 898 bytes resources/gammaray.qrc | 57 + sidepane.cpp | 28 +- sidepane.h | 13 +- tests/CMakeLists.txt | 51 +- tests/attachhelper.h | 4 +- tests/hooktest/main.cpp | 4 +- tests/hooktest/mainwindow.h | 4 +- tests/test_connections.cpp | 25 +- tests/test_connections.h | 11 +- toolmodel.cpp | 51 +- toolmodel.h | 3 - tools/CMakeLists.txt | 10 + tools/codecbrowser/codecmodel.h | 4 +- tools/connectioninspector/connectioninspector.cpp | 10 +- tools/fontbrowser/fontmodel.h | 6 +- tools/localeinspector/localeaccessormodel.cpp | 93 ++ .../localeaccessormodel.h} | 41 +- tools/localeinspector/localedataaccessor.cpp | 173 +++ tools/localeinspector/localedataaccessor.h | 115 ++ .../localeinspector/localeinspector.cpp | 48 +- .../localeinspector.h} | 36 +- tools/localeinspector/localeinspector.ui | 30 + tools/localeinspector/localemodel.cpp | 107 ++ .../localemodel.h} | 44 +- tools/messagehandler/backtrace.h | 4 +- .../messagehandler/backtrace_dummy.cpp | 20 +- tools/messagehandler/messagehandler.cpp | 2 +- tools/messagehandler/messagehandler.h | 6 +- tools/messagehandler/messagemodel.h | 4 +- tools/metatypebrowser/metatypesmodel.h | 4 +- tools/modelinspector/modelmodel.h | 4 +- tools/modelinspector/modeltest.cpp | 2 +- tools/modelinspector/modeltest.h | 4 +- tools/modelinspector/modeltester.cpp | 2 +- tools/objectvisualizer/CMakeLists.txt | 32 + .../gammaray_objectvisualizer.desktop | 4 + tools/objectvisualizer/objectvisualizer.cpp | 117 ++ .../objectvisualizer.h} | 49 +- .../objectvisualizer/vtkcontainer.cpp | 36 +- .../objectvisualizer/vtkcontainer.h | 36 +- tools/objectvisualizer/vtkpanel.cpp | 125 +++ sidepane.h => tools/objectvisualizer/vtkpanel.h | 34 +- tools/objectvisualizer/vtkwidget.cpp | 396 +++++++ tools/objectvisualizer/vtkwidget.h | 107 ++ tools/resourcebrowser/resourcefiltermodel.h | 4 +- tools/sceneinspector/sceneinspector.cpp | 29 +- tools/sceneinspector/sceneinspector.h | 3 + tools/sceneinspector/scenemodel.cpp | 37 +- tools/sceneinspector/scenemodel.h | 4 + tools/scriptenginedebugger/CMakeLists.txt | 20 + .../gammaray_scriptenginedebugger.desktop | 4 + .../scriptenginedebugger/scriptenginedebugger.cpp | 3 + tools/scriptenginedebugger/scriptenginedebugger.h | 3 +- .../statemachineinspector.cpp | 83 -- .../statemachineinspector/statemachineinspector.h | 68 -- .../statemachineinspector/statemachineinspector.ui | 31 - tools/statemachineviewer/CMakeLists.txt | 45 + .../gammaray_statemachineviewer.desktop | 4 + tools/statemachineviewer/gvgraph/gvgraph.cpp | 464 ++++++++ tools/statemachineviewer/gvgraph/gvgraph.h | 130 +++ tools/statemachineviewer/gvgraph/gvgraphelements.h | 140 +++ tools/statemachineviewer/gvgraph/gvgraphitems.cpp | 173 +++ tools/statemachineviewer/gvgraph/gvgraphitems.h | 117 ++ .../statemachineviewer/gvgraph/gvtypes.h | 19 +- tools/statemachineviewer/gvgraph/gvutils.h | 89 ++ .../statemachineviewer/statemachineview.cpp | 38 +- .../statemachineviewer/statemachineview.h | 26 +- tools/statemachineviewer/statemachineviewer.cpp | 552 ++++++++++ tools/statemachineviewer/statemachineviewer.h | 142 +++ tools/statemachineviewer/statemachineviewer.ui | 137 +++ .../statemachineviewer/statemachineviewerutil.h | 67 +- tools/statemachineviewer/statemachinewatcher.cpp | 139 +++ tools/statemachineviewer/statemachinewatcher.h | 74 ++ .../statemodel.cpp | 61 +- .../statemodel.h | 18 +- tools/statemachineviewer/test_main.cpp | 79 ++ .../transitionmodel.cpp | 7 +- .../transitionmodel.h | 7 +- tools/timertop/functioncalltimer.cpp | 79 ++ mainwindow.h => tools/timertop/functioncalltimer.h | 42 +- tools/timertop/timerinfo.cpp | 185 ++++ tools/timertop/timerinfo.h | 88 ++ tools/timertop/timermodel.cpp | 345 ++++++ tools/timertop/timermodel.h | 104 ++ tools/timertop/timertop.cpp | 94 ++ .../webinspector.h => timertop/timertop.h} | 36 +- tools/timertop/timertop.ui | 40 + tools/webinspector/CMakeLists.txt | 19 + tools/webinspector/gammaray_webinspector.desktop | 4 + tools/webinspector/webinspector.cpp | 4 + tools/webinspector/webinspector.h | 3 +- tools/widgetinspector/CMakeLists.txt | 13 + tools/widgetinspector/overlaywidget.cpp | 6 +- tools/widgetinspector/overlaywidget.h | 2 +- tools/widgetinspector/uiextractor.cpp | 67 ++ .../widgetinspector/uiextractor.h | 22 +- tools/widgetinspector/widgetinspector.cpp | 163 ++- tools/widgetinspector/widgetinspector.h | 12 + tools/widgetinspector/widgetinspector.ui | 32 + .../widgetinspector_export_actions.cpp | 58 + tools/widgetinspector/widgettreemodel.cpp | 59 + .../widgetinspector/widgettreemodel.h | 36 +- util.cpp | 249 ++++- util.h | 16 + 430 files changed, 10661 insertions(+), 20557 deletions(-) rename qmldebugcontrol/qmldbg_tcp/private/qdeclarativedebugserverconnection_p.h => 3rdparty/qt/qobject_p_copy.h (62%) create mode 100644 CHANGES create mode 100644 CMakeQt4To5Porting.cmake delete mode 100755 Make-O-Matic/buildscript.py delete mode 100644 attach/attachdialog.ui delete mode 100644 attach/processlist_unix.cpp delete mode 100644 attach/processlist_win.cpp create mode 100644 cmake/FindGraphviz.cmake create mode 100644 cmake/GammaRayMacros.cmake create mode 100644 hooking/abstractfunctionoverwriter.cpp create mode 100644 hooking/abstractfunctionoverwriter.h copy tests/hooktest/mainwindow.h => hooking/functionoverwriterfactory.cpp (65%) copy tests/hooktest/mainwindow.h => hooking/functionoverwriterfactory.h (71%) create mode 100644 hooking/unixfunctionoverwriter.cpp create mode 100644 hooking/unixfunctionoverwriter.h create mode 100644 hooking/winfunctionoverwriter.cpp create mode 100644 hooking/winfunctionoverwriter.h create mode 100644 launcher/CMakeLists.txt rename {attach => launcher}/attachdialog.cpp (83%) rename {attach => launcher}/attachdialog.h (82%) create mode 100644 launcher/attachdialog.ui create mode 100644 launcher/launcherwindow.cpp copy mainwindow.h => launcher/launcherwindow.h (57%) create mode 100644 launcher/launcherwindow.ui create mode 100644 launcher/launchpage.cpp copy mainwindow.h => launcher/launchpage.h (56%) create mode 100644 launcher/launchpage.ui rename main.cpp => launcher/main.cpp (92%) rename probefinder.cpp => launcher/probefinder.cpp (100%) copy probefinder.h => launcher/probefinder.h (100%) rename {attach => launcher}/processfiltermodel.cpp (99%) rename {attach => launcher}/processfiltermodel.h (100%) rename {attach => launcher}/processlist.h (92%) create mode 100644 launcher/processlist_unix.cpp create mode 100644 launcher/processlist_win.cpp rename {attach => launcher}/processmodel.cpp (98%) rename {attach => launcher}/processmodel.h (98%) rename promolabel.cpp => launcher/promolabel.cpp (100%) copy promolabel.h => launcher/promolabel.h (95%) create mode 100644 launcher/selftestpage.cpp copy mainwindow.h => launcher/selftestpage.h (56%) create mode 100644 launcher/selftestpage.ui copy splashscreen.cpp => launcher/splashscreen.cpp (100%) copy splashscreen.h => launcher/splashscreen.h (93%) create mode 100644 metaobject.cpp create mode 100644 metaobject.h create mode 100644 metaobjectrepository.cpp create mode 100644 metaobjectrepository.h copy probefinder.h => metaproperty.cpp (63%) create mode 100644 metaproperty.h create mode 100644 metapropertymodel.cpp copy tools/sceneinspector/scenemodel.h => metapropertymodel.h (55%) create mode 100644 metatypedeclarations.h create mode 100644 pluginmanager.cpp copy sidepane.h => pluginmanager.h (64%) copy probefinder.h => propertyeditor/propertycoloreditor.cpp (60%) copy mainwindow.h => propertyeditor/propertycoloreditor.h (63%) create mode 100644 propertyeditor/propertydoublepaireditor.cpp create mode 100644 propertyeditor/propertydoublepaireditor.h create mode 100644 propertyeditor/propertydoublepaireditor.ui create mode 100644 propertyeditor/propertyeditorfactory.cpp copy mainwindow.h => propertyeditor/propertyeditorfactory.h (60%) copy injector/abstractinjector.cpp => propertyeditor/propertyextendededitor.cpp (50%) copy tools/webinspector/webinspector.h => propertyeditor/propertyextendededitor.h (52%) create mode 100644 propertyeditor/propertyextendededitor.ui copy probefinder.h => propertyeditor/propertyfonteditor.cpp (61%) copy probefinder.h => propertyeditor/propertyfonteditor.h (64%) create mode 100644 propertyeditor/propertyintpaireditor.cpp create mode 100644 propertyeditor/propertyintpaireditor.h create mode 100644 propertyeditor/propertyintpaireditor.ui rename splashscreen.cpp => proxydetacher.cpp (50%) rename promolabel.h => proxydetacher.h (57%) create mode 100644 proxytoolfactory.cpp create mode 100644 proxytoolfactory.h delete mode 100644 qmldebugcontrol/CMakeLists.txt delete mode 100644 qmldebugcontrol/QmlProfiler.pluginspec.in delete mode 100644 qmldebugcontrol/abstractqmlprofilerrunner.h delete mode 100644 qmldebugcontrol/canvas/CMakeLists.txt delete mode 100644 qmldebugcontrol/canvas/canvas.pri delete mode 100644 qmldebugcontrol/canvas/qdeclarativecanvas.cpp delete mode 100644 qmldebugcontrol/canvas/qdeclarativecanvas.h delete mode 100644 qmldebugcontrol/canvas/qdeclarativecanvastimer.cpp delete mode 100644 qmldebugcontrol/canvas/qdeclarativecanvastimer.h delete mode 100644 qmldebugcontrol/canvas/qdeclarativecontext2d.cpp delete mode 100644 qmldebugcontrol/canvas/qdeclarativecontext2d.h delete mode 100644 qmldebugcontrol/canvas/qdeclarativetiledcanvas.cpp delete mode 100644 qmldebugcontrol/canvas/qdeclarativetiledcanvas.h delete mode 100644 qmldebugcontrol/codaqmlprofilerrunner.cpp delete mode 100644 qmldebugcontrol/codaqmlprofilerrunner.h delete mode 100644 qmldebugcontrol/localqmlprofilerrunner.cpp delete mode 100644 qmldebugcontrol/localqmlprofilerrunner.h delete mode 100644 qmldebugcontrol/main.cpp delete mode 100644 qmldebugcontrol/qml/Detail.qml delete mode 100644 qmldebugcontrol/qml/Label.qml delete mode 100644 qmldebugcontrol/qml/MainView.js delete mode 100644 qmldebugcontrol/qml/MainView.qml delete mode 100644 qmldebugcontrol/qml/RangeDetails.qml delete mode 100644 qmldebugcontrol/qml/RangeMover.qml delete mode 100644 qmldebugcontrol/qml/TimeDisplay.qml delete mode 100644 qmldebugcontrol/qml/clean_pane_small.png delete mode 100644 qmldebugcontrol/qml/magnifier-minus.png delete mode 100644 qmldebugcontrol/qml/magnifier-plus.png delete mode 100644 qmldebugcontrol/qml/next.png delete mode 100644 qmldebugcontrol/qml/popup.png delete mode 100644 qmldebugcontrol/qml/prev.png delete mode 100644 qmldebugcontrol/qml/qml.qrc delete mode 100644 qmldebugcontrol/qml/recordOff.png delete mode 100644 qmldebugcontrol/qml/recordOn.png delete mode 100644 qmldebugcontrol/qmldbg_tcp/CMakeLists.txt delete mode 100644 qmldebugcontrol/qmldbg_tcp/private/qdeclarativedebugserver_p.h delete mode 100644 qmldebugcontrol/qmldbg_tcp/private/qdeclarativeglobal_p.h delete mode 100644 qmldebugcontrol/qmldbg_tcp/private/qpacketprotocol_p.h delete mode 100644 qmldebugcontrol/qmldbg_tcp/qmldbg_tcp.pro delete mode 100644 qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.cpp delete mode 100644 qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.h delete mode 100644 qmldebugcontrol/qmljsdebugclient/CMakeLists.txt delete mode 100644 qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.cpp delete mode 100644 qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.h delete mode 100644 qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.cpp delete mode 100644 qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.h delete mode 100644 qmldebugcontrol/qmljsdebugclient/qmljsdebugclient-lib.pri delete mode 100644 qmldebugcontrol/qmljsdebugclient/qpacketprotocol.cpp delete mode 100644 qmldebugcontrol/qmljsdebugclient/qpacketprotocol.h delete mode 100644 qmldebugcontrol/qmljsdebugger/CMakeLists.txt delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/CMakeLists.txt delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/colorpickertool.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/colorpickertool.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/editor.qrc delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/color-picker-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/color-picker-hicontrast.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/color-picker.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/from-qml-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/from-qml.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/inspectormode-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/inspectormode.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/pause-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/pause.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/play-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/play.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/reload.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/resize_handle.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/select-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/select-marquee-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/select-marquee.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/select.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/to-qml-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/to-qml.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/zoom-24.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/images/zoom.png delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/livelayeritem.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/livelayeritem.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.h delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/zoomtool.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/editor/zoomtool.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/jsdebuggeragent.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qdeclarativeinspectorservice.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewinspector.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewobserver.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qmlinspectorconstants.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qmljsdebugger_global.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h delete mode 100644 qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativestate_p.h delete mode 100644 qmldebugcontrol/qmljsdebugger/jsdebuggeragent.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/jsdebuggeragent.h delete mode 100644 qmldebugcontrol/qmljsdebugger/protocol/CMakeLists.txt delete mode 100644 qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.h delete mode 100644 qmldebugcontrol/qmljsdebugger/protocol/protocol.pri delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.h delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.h delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.h delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.cpp delete mode 100644 qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.h delete mode 100644 qmldebugcontrol/qmljsdebugger/qmlinspectorconstants.h delete mode 100644 qmldebugcontrol/qmljsdebugger/qmljsdebugger-lib.pri delete mode 100644 qmldebugcontrol/qmljsdebugger/qmljsdebugger-src.pri delete mode 100644 qmldebugcontrol/qmljsdebugger/qmljsdebugger.pro delete mode 100644 qmldebugcontrol/qmljsdebugger/qmljsdebugger_global.h delete mode 100644 qmldebugcontrol/qmlprofiler.pro delete mode 100644 qmldebugcontrol/qmlprofiler_global.h delete mode 100644 qmldebugcontrol/qmlprofilerattachdialog.cpp delete mode 100644 qmldebugcontrol/qmlprofilerattachdialog.h delete mode 100644 qmldebugcontrol/qmlprofilerattachdialog.ui delete mode 100644 qmldebugcontrol/qmlprofilerconstants.h delete mode 100644 qmldebugcontrol/qmlprofilerengine.cpp delete mode 100644 qmldebugcontrol/qmlprofilerengine.h delete mode 100644 qmldebugcontrol/qmlprofilereventtypes.h delete mode 100644 qmldebugcontrol/qmlprofilereventview.cpp delete mode 100644 qmldebugcontrol/qmlprofilereventview.h delete mode 100644 qmldebugcontrol/qmlprofilerplugin.cpp delete mode 100644 qmldebugcontrol/qmlprofilerplugin.h delete mode 100644 qmldebugcontrol/qmlprofilerruncontrolfactory.cpp delete mode 100644 qmldebugcontrol/qmlprofilerruncontrolfactory.h delete mode 100644 qmldebugcontrol/qmlprofilertool.cpp delete mode 100644 qmldebugcontrol/qmlprofilertool.h delete mode 100644 qmldebugcontrol/qmlprofilertraceclient.cpp delete mode 100644 qmldebugcontrol/qmlprofilertraceclient.h delete mode 100644 qmldebugcontrol/qt_private/qdeclarativedebughelper_p.h delete mode 100644 qmldebugcontrol/qt_private/qdeclarativedebugservice_p.h delete mode 100644 qmldebugcontrol/qt_private/qdeclarativestate_p.h delete mode 100644 qmldebugcontrol/remotelinuxqmlprofilerrunner.cpp delete mode 100644 qmldebugcontrol/remotelinuxqmlprofilerrunner.h delete mode 100644 qmldebugcontrol/timelineview.cpp delete mode 100644 qmldebugcontrol/timelineview.h delete mode 100644 qmldebugcontrol/tracewindow.cpp delete mode 100644 qmldebugcontrol/tracewindow.h create mode 100644 resources/classes/README create mode 100644 resources/classes/calendarwidget.png create mode 100644 resources/classes/checkbox.png create mode 100644 resources/classes/columnview.png create mode 100644 resources/classes/combobox.png create mode 100644 resources/classes/commandlinkbutton.png create mode 100644 resources/classes/dateedit.png create mode 100644 resources/classes/datetimeedit.png create mode 100644 resources/classes/dial.png create mode 100644 resources/classes/dialogbuttonbox.png create mode 100644 resources/classes/dockwidget.png create mode 100644 resources/classes/doublespinbox.png create mode 100644 resources/classes/editform.png create mode 100644 resources/classes/editgrid.png create mode 100644 resources/classes/edithlayout.png create mode 100644 resources/classes/edithlayoutsplit.png create mode 100644 resources/classes/editvlayout.png create mode 100644 resources/classes/editvlayoutsplit.png create mode 100644 resources/classes/fontcombobox.png create mode 100644 resources/classes/frame.png create mode 100644 resources/classes/graphicsview.png create mode 100644 resources/classes/groupbox.png create mode 100644 resources/classes/groupboxcollapsible.png create mode 100644 resources/classes/hscrollbar.png create mode 100644 resources/classes/hslider.png create mode 100644 resources/classes/hsplit.png create mode 100644 resources/classes/label.png create mode 100644 resources/classes/lcdnumber.png create mode 100644 resources/classes/line.png create mode 100644 resources/classes/lineedit.png create mode 100644 resources/classes/listbox.png create mode 100644 resources/classes/listview.png create mode 100644 resources/classes/mdiarea.png create mode 100644 resources/classes/plaintextedit.png create mode 100644 resources/classes/progress.png create mode 100644 resources/classes/pushbutton.png create mode 100644 resources/classes/radiobutton.png create mode 100644 resources/classes/scrollarea.png create mode 100644 resources/classes/spacer.png create mode 100644 resources/classes/spinbox.png create mode 100644 resources/classes/tabbar.png create mode 100644 resources/classes/table.png create mode 100644 resources/classes/tabwidget.png create mode 100644 resources/classes/textedit.png create mode 100644 resources/classes/timeedit.png create mode 100644 resources/classes/toolbox.png create mode 100644 resources/classes/toolbutton.png create mode 100644 resources/classes/vline.png create mode 100644 resources/classes/vscrollbar.png create mode 100644 resources/classes/vslider.png create mode 100644 resources/classes/vspacer.png create mode 100644 resources/classes/widget.png create mode 100644 resources/classes/widgetstack.png create mode 100644 resources/classes/wizard.png rewrite tests/CMakeLists.txt (84%) create mode 100644 tools/CMakeLists.txt create mode 100644 tools/localeinspector/localeaccessormodel.cpp copy tools/{metatypebrowser/metatypesmodel.h => localeinspector/localeaccessormodel.h} (61%) create mode 100644 tools/localeinspector/localedataaccessor.cpp create mode 100644 tools/localeinspector/localedataaccessor.h copy injector/abstractinjector.cpp => tools/localeinspector/localeinspector.cpp (52%) copy tools/{webinspector/webinspector.h => localeinspector/localeinspector.h} (51%) create mode 100644 tools/localeinspector/localeinspector.ui create mode 100644 tools/localeinspector/localemodel.cpp copy tools/{metatypebrowser/metatypesmodel.h => localeinspector/localemodel.h} (64%) copy splashscreen.h => tools/messagehandler/backtrace_dummy.cpp (70%) create mode 100644 tools/objectvisualizer/CMakeLists.txt create mode 100644 tools/objectvisualizer/gammaray_objectvisualizer.desktop create mode 100644 tools/objectvisualizer/objectvisualizer.cpp copy tools/{widgetinspector/widgetinspector.h => objectvisualizer/objectvisualizer.h} (56%) copy sidepane.h => tools/objectvisualizer/vtkcontainer.cpp (64%) copy sidepane.h => tools/objectvisualizer/vtkcontainer.h (65%) create mode 100644 tools/objectvisualizer/vtkpanel.cpp copy sidepane.h => tools/objectvisualizer/vtkpanel.h (65%) create mode 100644 tools/objectvisualizer/vtkwidget.cpp create mode 100644 tools/objectvisualizer/vtkwidget.h create mode 100644 tools/scriptenginedebugger/CMakeLists.txt create mode 100644 tools/scriptenginedebugger/gammaray_scriptenginedebugger.desktop delete mode 100644 tools/statemachineinspector/statemachineinspector.cpp delete mode 100644 tools/statemachineinspector/statemachineinspector.h delete mode 100644 tools/statemachineinspector/statemachineinspector.ui create mode 100644 tools/statemachineviewer/CMakeLists.txt create mode 100644 tools/statemachineviewer/gammaray_statemachineviewer.desktop create mode 100644 tools/statemachineviewer/gvgraph/gvgraph.cpp create mode 100644 tools/statemachineviewer/gvgraph/gvgraph.h create mode 100644 tools/statemachineviewer/gvgraph/gvgraphelements.h create mode 100644 tools/statemachineviewer/gvgraph/gvgraphitems.cpp create mode 100644 tools/statemachineviewer/gvgraph/gvgraphitems.h rename splashscreen.h => tools/statemachineviewer/gvgraph/gvtypes.h (78%) create mode 100644 tools/statemachineviewer/gvgraph/gvutils.h copy sidepane.h => tools/statemachineviewer/statemachineview.cpp (58%) copy sidepane.h => tools/statemachineviewer/statemachineview.h (67%) create mode 100644 tools/statemachineviewer/statemachineviewer.cpp create mode 100644 tools/statemachineviewer/statemachineviewer.h create mode 100644 tools/statemachineviewer/statemachineviewer.ui copy sidepane.h => tools/statemachineviewer/statemachineviewerutil.h (53%) create mode 100644 tools/statemachineviewer/statemachinewatcher.cpp create mode 100644 tools/statemachineviewer/statemachinewatcher.h rename tools/{statemachineinspector => statemachineviewer}/statemodel.cpp (76%) rename tools/{statemachineinspector => statemachineviewer}/statemodel.h (80%) create mode 100644 tools/statemachineviewer/test_main.cpp rename tools/{statemachineinspector => statemachineviewer}/transitionmodel.cpp (98%) rename tools/{statemachineinspector => statemachineviewer}/transitionmodel.h (92%) create mode 100644 tools/timertop/functioncalltimer.cpp copy mainwindow.h => tools/timertop/functioncalltimer.h (66%) create mode 100644 tools/timertop/timerinfo.cpp create mode 100644 tools/timertop/timerinfo.h create mode 100644 tools/timertop/timermodel.cpp create mode 100644 tools/timertop/timermodel.h create mode 100644 tools/timertop/timertop.cpp copy tools/{webinspector/webinspector.h => timertop/timertop.h} (59%) create mode 100644 tools/timertop/timertop.ui create mode 100644 tools/webinspector/CMakeLists.txt create mode 100644 tools/webinspector/gammaray_webinspector.desktop create mode 100644 tools/widgetinspector/CMakeLists.txt create mode 100644 tools/widgetinspector/uiextractor.cpp rename probefinder.h => tools/widgetinspector/uiextractor.h (69%) create mode 100644 tools/widgetinspector/widgetinspector_export_actions.cpp create mode 100644 tools/widgetinspector/widgettreemodel.cpp copy mainwindow.h => tools/widgetinspector/widgettreemodel.h (57%) diff --git a/.gitignore b/.gitignore index 9d8de7c..b1d1a38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,13 @@ +# general *.kdev4 *~ *.rej *.orig .* +CMakeLists.txt.user + +# from git merge +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* diff --git a/3rdparty/kde/kfilterproxysearchline.h b/3rdparty/kde/kfilterproxysearchline.h index 7dfff85..44cc3ee 100644 --- a/3rdparty/kde/kfilterproxysearchline.h +++ b/3rdparty/kde/kfilterproxysearchline.h @@ -22,7 +22,7 @@ #include "kdeui_export.h" -#include +#include class QLineEdit; class QSortFilterProxyModel; diff --git a/3rdparty/kde/kidentityproxymodel.cpp b/3rdparty/kde/kidentityproxymodel.cpp index 0c65759..333e86a 100644 --- a/3rdparty/kde/kidentityproxymodel.cpp +++ b/3rdparty/kde/kidentityproxymodel.cpp @@ -21,7 +21,7 @@ #include "kidentityproxymodel.h" -#include +#include #include class KIdentityProxyModelPrivate diff --git a/3rdparty/kde/kidentityproxymodel.h b/3rdparty/kde/kidentityproxymodel.h index 3ad6d50..5ee1691 100644 --- a/3rdparty/kde/kidentityproxymodel.h +++ b/3rdparty/kde/kidentityproxymodel.h @@ -22,7 +22,7 @@ #ifndef KIDENTITYPROXYMODEL_H #define KIDENTITYPROXYMODEL_H -#include +#include #include "kdeui_export.h" diff --git a/3rdparty/kde/krecursivefilterproxymodel.h b/3rdparty/kde/krecursivefilterproxymodel.h index c16b621..f1e2245 100644 --- a/3rdparty/kde/krecursivefilterproxymodel.h +++ b/3rdparty/kde/krecursivefilterproxymodel.h @@ -21,7 +21,7 @@ #ifndef KRECURSIVEFILTERPROXYMODEL_H #define KRECURSIVEFILTERPROXYMODEL_H -#include +#include #include "kdeui_export.h" diff --git a/3rdparty/qt/qguiplatformplugin_p.h b/3rdparty/qt/qguiplatformplugin_p.h index 907b9bd..90a250d 100644 --- a/3rdparty/qt/qguiplatformplugin_p.h +++ b/3rdparty/qt/qguiplatformplugin_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include QT_BEGIN_HEADER diff --git a/qmldebugcontrol/qmldbg_tcp/private/qdeclarativedebugserverconnection_p.h b/3rdparty/qt/qobject_p_copy.h similarity index 62% rename from qmldebugcontrol/qmldbg_tcp/private/qdeclarativedebugserverconnection_p.h rename to 3rdparty/qt/qobject_p_copy.h index 716be6a..88ddd11 100644 --- a/qmldebugcontrol/qmldbg_tcp/private/qdeclarativedebugserverconnection_p.h +++ b/3rdparty/qt/qobject_p_copy.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -38,36 +38,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#ifndef QOBJECT_P_COPY_H +#define QOBJECT_P_COPY_H -#ifndef QDECLARATIVEDEBUGSERVERCONNECTION_H -#define QDECLARATIVEDEBUGSERVERCONNECTION_H +#include -#include +class QObject; -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeDebugServer; -class Q_DECLARATIVE_EXPORT QDeclarativeDebugServerConnection +struct QSignalSpyCallbackSet { -public: - QDeclarativeDebugServerConnection() {} - virtual ~QDeclarativeDebugServerConnection() {} - - virtual void setServer(QDeclarativeDebugServer *server) = 0; - virtual void setPort(int port, bool bock) = 0; - virtual bool isConnected() const = 0; - virtual void send(const QByteArray &message) = 0; - virtual void disconnect() = 0; + typedef void (*BeginCallback)(QObject *caller, int method_index, void **argv); + typedef void (*EndCallback)(QObject *caller, int method_index); + BeginCallback signal_begin_callback, + slot_begin_callback; + EndCallback signal_end_callback, + slot_end_callback; }; +void Q_CORE_EXPORT qt_register_signal_spy_callbacks(const QSignalSpyCallbackSet &callback_set); -Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, "com.trolltech.Qt.QDeclarativeDebugServerConnection/1.0") - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGSERVERCONNECTION_H +#endif diff --git a/3rdparty/qt/resourcemodel.cpp b/3rdparty/qt/resourcemodel.cpp index 083ec5b..e602486 100644 --- a/3rdparty/qt/resourcemodel.cpp +++ b/3rdparty/qt/resourcemodel.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/3rdparty/qt/resourcemodel.h b/3rdparty/qt/resourcemodel.h index 3843eab..9ed4548 100644 --- a/3rdparty/qt/resourcemodel.h +++ b/3rdparty/qt/resourcemodel.h @@ -44,7 +44,7 @@ #include #include -#include +#include QT_BEGIN_HEADER diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..f252bce --- /dev/null +++ b/CHANGES @@ -0,0 +1,21 @@ +Release Highlights: +------------------ + +Version 1.1: + - Plug-in system for tools + - Graphical state machine viewer + - Object hierarchy visualization plug-in + - New timer profiler plug-in + - New locale inspector plug-in + - New property view/editor for non-QObject types + (e.g. QGraphicsItem and many of its sub-classes) + - New widget export actions (image, PDF, SVG, Designer UI file) + - New launcher UI with support for starting new processes, self-testing, + and a much faster process list on Mac OSX + - Support more types in the property editor + - Improved widget tree model + - Fix unreliable attaching with MSVC + - MingW support + +Version 1.0: + - Initial Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 5501542..06bdc1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,12 +17,16 @@ if(NOT Prog_NAME) set(Prog_NAME "GammaRay") endif() +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ ${CMAKE_MODULE_PATH}) + set(GAMMARAY_VERSION_MAJOR "1") -set(GAMMARAY_VERSION_MINOR "0") -set(GAMMARAY_VERSION_PATCH "1") +set(GAMMARAY_VERSION_MINOR "1") +set(GAMMARAY_VERSION_PATCH "0") set(GAMMARAY_VERSION "${GAMMARAY_VERSION_MAJOR}.${GAMMARAY_VERSION_MINOR}.${GAMMARAY_VERSION_PATCH}") set(GAMMARAY_VERSION_STRING "${GAMMARAY_VERSION}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + enable_testing() if(EXISTS "${CMAKE_SOURCE_DIR}/.git") @@ -44,9 +48,29 @@ message(STATUS "Building ${Prog_NAME} ${GAMMARAY_VERSION_STRING} in ${CMAKE_BUIL add_definitions(-DPROGRAM_NAME=\"${Prog_NAME}\") include(CheckCXXCompilerFlag) +include(CheckLibraryExists) +include(GammaRayMacros) + +find_package(Qt5Core QUIET) + +if(Qt5Core_FOUND) + + find_package(Qt5Gui REQUIRED) + find_package(Qt5Designer REQUIRED) + find_package(Qt5Script REQUIRED) + find_package(Qt5Network REQUIRED) + find_package(Qt5ScriptTools REQUIRED) + find_package(Qt5Widgets REQUIRED) + find_package(Qt5Svg REQUIRED) + find_package(Qt5PrintSupport REQUIRED) + find_package(Qt5Test REQUIRED) + find_package(Qt5Xml REQUIRED) + include(CMakeQt4To5Porting.cmake) # TODO: Port away from this. -set(QT_MIN_VERSION "4.7.0") -find_package(Qt4 REQUIRED) +else() + set(QT_MIN_VERSION "4.7.0") + find_package(Qt4 REQUIRED) +endif() if(CMAKE_BUILD_TYPE MATCHES "^[Rr]elease$") add_definitions(-DQT_NO_DEBUG_OUTPUT) @@ -57,6 +81,7 @@ include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty + ${CMAKE_SOURCE_DIR}/3rdparty/kde ) set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)") @@ -70,6 +95,19 @@ set( ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT Devel ) +# TODO: Make this work on Windows, and test this on Mac +check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) +if(HAVE_CLOCK_GETTIME) + set(BUILD_TIMER_PLUGIN TRUE) + message(STATUS "clock_gettime in librt found, building timer plugin.") +elseif(WIN32) + set(BUILD_TIMER_PLUGIN TRUE) + message(STATUS "windows, building timer plugin.") +else() + set(BUILD_TIMER_PLUGIN FALSE) + message(STATUS "clock_gettime in librt not found, disabling timer plugin.") +endif() + if(WIN32) add_definitions(-DUNICODE -D_UNICODE) endif() @@ -121,51 +159,43 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() endif() -add_subdirectory(injector) - -set(gammaray_runner_srcs - injector/abstractinjector.cpp - injector/injectorfactory.cpp - injector/preloadinjector.cpp - injector/styleinjector.cpp - injector/windllinjector.cpp - injector/interactiveprocess.cpp - probefinder.cpp - main.cpp - promolabel.cpp - splashscreen.cpp - - attach/attachdialog.cpp - attach/processmodel.cpp - attach/processfiltermodel.cpp +if(MINGW) + # mingw will error out on the crazy casts in probe.cpp without this + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") +endif() - 3rdparty/kde/kidentityproxymodel.cpp - 3rdparty/kde/krecursivefilterproxymodel.cpp - 3rdparty/kde/kfilterproxysearchline.cpp -) -if(NOT WIN32) - set(gammaray_runner_srcs - ${gammaray_runner_srcs} - injector/gdbinjector.cpp - attach/processlist_unix.cpp - ) -else() - set(gammaray_runner_srcs - ${gammaray_runner_srcs} - attach/processlist_win.cpp - ) +# linker flags +if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}") + endif() endif() -qt4_wrap_ui(gammaray_runner_srcs attach/attachdialog.ui) -qt4_add_resources(gammaray_runner_srcs resources/gammaray.qrc) +add_subdirectory(injector) +add_subdirectory(launcher) -add_executable(gammaray ${gammaray_runner_srcs}) -target_link_libraries(gammaray ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) +find_package(Graphviz) +find_package(VTK) set(gammaray_srcs mainwindow.cpp + metaobject.cpp + metaobjectrepository.cpp + metaproperty.cpp + metapropertymodel.cpp + pluginmanager.cpp probe.cpp + propertywidget.cpp + propertyeditor/propertycoloreditor.cpp + propertyeditor/propertydoublepaireditor.cpp + propertyeditor/propertyeditorfactory.cpp + propertyeditor/propertyextendededitor.cpp + propertyeditor/propertyfonteditor.cpp + propertyeditor/propertyintpaireditor.cpp + + proxydetacher.cpp objectlistmodel.cpp objectpropertymodel.cpp objectdynamicpropertymodel.cpp @@ -177,8 +207,6 @@ set(gammaray_srcs connectionmodel.cpp connectionfilterproxymodel.cpp tools/sceneinspector/scenemodel.cpp - tools/statemachineinspector/statemodel.cpp - tools/statemachineinspector/transitionmodel.cpp util.cpp tools/widgetinspector/widgetpreviewwidget.cpp methodinvocationdialog.cpp @@ -192,6 +220,9 @@ set(gammaray_srcs tools/sceneinspector/graphicssceneview.cpp tools/metatypebrowser/metatypesmodel.cpp tools/fontbrowser/fontmodel.cpp + tools/localeinspector/localemodel.cpp + tools/localeinspector/localedataaccessor.cpp + tools/localeinspector/localeaccessormodel.cpp tools/codecbrowser/codecmodel.cpp tools/textdocumentinspector/textdocumentmodel.cpp tools/textdocumentinspector/textdocumentformatmodel.cpp @@ -199,12 +230,14 @@ set(gammaray_srcs tools/messagehandler/messagehandler.cpp tools/messagehandler/messagemodel.cpp toolmodel.cpp - promolabel.cpp + proxydetacher.cpp + proxytoolfactory.cpp sidepane.cpp tools/codecbrowser/codecbrowser.cpp tools/connectioninspector/connectioninspector.cpp tools/fontbrowser/fontbrowser.cpp + tools/localeinspector/localeinspector.cpp tools/metatypebrowser/metatypebrowser.cpp tools/modelinspector/modelinspector.cpp tools/modelinspector/modelinspectorwidget.cpp @@ -212,79 +245,101 @@ set(gammaray_srcs tools/resourcebrowser/resourcebrowser.cpp tools/resourcebrowser/resourcefiltermodel.cpp tools/sceneinspector/sceneinspector.cpp - tools/scriptenginedebugger/scriptenginedebugger.cpp tools/selectionmodelinspector/selectionmodelinspector.cpp - tools/statemachineinspector/statemachineinspector.cpp tools/textdocumentinspector/textdocumentinspector.cpp - tools/webinspector/webinspector.cpp tools/widgetinspector/widgetinspector.cpp tools/widgetinspector/overlaywidget.cpp + tools/widgetinspector/widgettreemodel.cpp 3rdparty/kde/kidentityproxymodel.cpp 3rdparty/kde/krecursivefilterproxymodel.cpp 3rdparty/kde/kfilterproxysearchline.cpp 3rdparty/qt/resourcemodel.cpp + + hooking/abstractfunctionoverwriter.cpp + hooking/functionoverwriterfactory.cpp + hooking/winfunctionoverwriter.cpp + hooking/unixfunctionoverwriter.cpp ) +if(BUILD_TIMER_PLUGIN) + set(gammaray_srcs + ${gammaray_srcs} + tools/timertop/timertop.cpp + tools/timertop/timermodel.cpp + tools/timertop/timerinfo.cpp + tools/timertop/functioncalltimer.cpp + ) +endif() + if(NOT WIN32) set(gammaray_srcs ${gammaray_srcs} tools/messagehandler/backtrace_unix.cpp) +elseif(MINGW) + set(gammaray_srcs ${gammaray_srcs} tools/messagehandler/backtrace_dummy.cpp) else() set(gammaray_srcs ${gammaray_srcs} tools/messagehandler/backtrace_win.cpp tools/messagehandler/StackWalker.cpp) endif() -qt4_automoc(${gammaray_srcs} ${gammaray_runner_srcs}) +qt4_automoc(${gammaray_srcs}) qt4_wrap_ui(gammaray_srcs mainwindow.ui propertywidget.ui methodinvocationdialog.ui + propertyeditor/propertydoublepaireditor.ui + propertyeditor/propertyextendededitor.ui + propertyeditor/propertyintpaireditor.ui tools/sceneinspector/graphicssceneview.ui - tools/codecbrowser/codecbrowser.ui tools/connectioninspector/connectioninspector.ui tools/fontbrowser/fontbrowser.ui + tools/localeinspector/localeinspector.ui tools/messagehandler/messagehandler.ui tools/metatypebrowser/metatypebrowser.ui tools/modelinspector/modelinspectorwidget.ui tools/objectinspector/objectinspector.ui tools/resourcebrowser/resourcebrowser.ui tools/sceneinspector/sceneinspector.ui - tools/scriptenginedebugger/scriptenginedebugger.ui tools/selectionmodelinspector/selectionmodelinspector.ui - tools/statemachineinspector/statemachineinspector.ui tools/textdocumentinspector/textdocumentinspector.ui - tools/webinspector/webinspector.ui tools/widgetinspector/widgetinspector.ui ) + +if(BUILD_TIMER_PLUGIN) + qt4_wrap_ui(gammaray_srcs + tools/timertop/timertop.ui + ) +endif() + qt4_add_resources(gammaray_srcs resources/gammaray.qrc) -add_library(gammaray_probe SHARED ${gammaray_srcs}) +add_library(gammaray_probe + SHARED ${gammaray_srcs} +) +if(BUILD_TIMER_PLUGIN AND NOT WIN32) + target_link_libraries(gammaray_probe rt) +endif() target_link_libraries(gammaray_probe - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTSCRIPT_LIBRARY} - ${QT_QTSCRIPTTOOLS_LIBRARY} - ${QT_QTWEBKIT_LIBRARY} + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} ) if(NOT WIN32) target_link_libraries(gammaray_probe dl) endif() set_target_properties(gammaray_probe PROPERTIES PREFIX "") -install(TARGETS gammaray gammaray_probe ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS gammaray_probe ${INSTALL_TARGETS_DEFAULT_ARGS}) if(UNIX AND NOT APPLE) set(XDG_APPS_INSTALL_DIR share/applications) install(FILES GammaRay.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) - install(FILES resources/GammaRay-16x16.png DESTINATION share/icons/hicolor/16x16/apps) - install(FILES resources/GammaRay-32x32.png DESTINATION share/icons/hicolor/32x32/apps) - install(FILES resources/GammaRay-48x48.png DESTINATION share/icons/hicolor/48x48/apps) - install(FILES resources/GammaRay-128x128.png DESTINATION share/icons/hicolor/128x128/apps) - install(FILES resources/GammaRay-256x256.png DESTINATION share/icons/hicolor/256x256/apps) - install(FILES resources/GammaRay-512x512.png DESTINATION share/icons/hicolor/512x512/apps) - - install(FILES resources/kdablogo160.png resources/kdabproducts.png resources/splashscreen.png DESTINATION share/icons/hicolor/apps) + install(FILES resources/GammaRay-16x16.png DESTINATION share/icons/hicolor/16x16/apps RENAME GammaRay.png) + install(FILES resources/GammaRay-32x32.png DESTINATION share/icons/hicolor/32x32/apps RENAME GammaRay.png) + install(FILES resources/GammaRay-48x48.png DESTINATION share/icons/hicolor/48x48/apps RENAME GammaRay.png) + install(FILES resources/GammaRay-128x128.png DESTINATION share/icons/hicolor/128x128/apps RENAME GammaRay.png) + install(FILES resources/GammaRay-256x256.png DESTINATION share/icons/hicolor/256x256/apps RENAME GammaRay.png) + install(FILES resources/GammaRay-512x512.png DESTINATION share/icons/hicolor/512x512/apps RENAME GammaRay.png) endif() set(LICENSE_FILE "License.txt") @@ -293,8 +348,6 @@ if(NOT APPLE) install(FILES "${LICENSE_FILE}" "${README_FILE}" DESTINATION ${DOC_INSTALL_DIR}) endif() -add_subdirectory(qmldebugcontrol) - find_program(CPPCHECK_EXECUTABLE cppcheck) if(CPPCHECK_EXECUTABLE) set(_cppcheck_flags "-I${CMAKE_CURRENT_BINARY_DIR}") @@ -302,8 +355,16 @@ if(CPPCHECK_EXECUTABLE) foreach(_current ${_inc_dirs}) set(_cppcheck_flags ${_cppcheck_flags} "-I${_current}") endforeach() + get_directory_property(_defs COMPILE_DEFINITIONS) + foreach(_current ${_defs}) + set(_cppcheck_flags ${_cppcheck_flags} "-D${_current}") + endforeach() + add_custom_target(cppcheck - COMMAND ${CPPCHECK_EXECUTABLE} --enable=all -j 4 --quiet ${_cppcheck_flags} ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CPPCHECK_EXECUTABLE} --enable=all -j 4 --suppress=*:${QT_INCLUDE_DIR}* ${_cppcheck_flags} + -i${CMAKE_CURRENT_SOURCE_DIR}/3rdparty + -i${CMAKE_CURRENT_SOURCE_DIR}/tests + ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running the cppcheck static code checker" ) @@ -323,3 +384,4 @@ endif() include(ExternalProject) add_subdirectory(tests) +add_subdirectory(tools) diff --git a/CMakeQt4To5Porting.cmake b/CMakeQt4To5Porting.cmake new file mode 100644 index 0000000..330e949 --- /dev/null +++ b/CMakeQt4To5Porting.cmake @@ -0,0 +1,173 @@ +#============================================================================= +# Copyright 2005-2011 Kitware, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Kitware, Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# The automoc_qt4 macro is superceded by CMAKE_AUTOMOC from CMake 2.8.6 +# A Qt 5 version is not provided by CMake or Qt. + +include(MacroAddFileDependencies) + +MACRO (QT4_GET_MOC_FLAGS _moc_flags) + SET(${_moc_flags}) + GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) + + FOREACH(_current ${_inc_DIRS}) + IF("${_current}" MATCHES "\\.framework/?$") + STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}") + SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") + ELSE("${_current}" MATCHES "\\.framework/?$") + SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") + ENDIF("${_current}" MATCHES "\\.framework/?$") + ENDFOREACH(_current ${_inc_DIRS}) + + GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) + FOREACH(_current ${_defines}) + SET(${_moc_flags} ${${_moc_flags}} "-D${_current}") + ENDFOREACH(_current ${_defines}) + + IF(Q_WS_WIN) + SET(${_moc_flags} ${${_moc_flags}} -DWIN32) + ENDIF(Q_WS_WIN) + +ENDMACRO(QT4_GET_MOC_FLAGS) + +# helper macro to set up a moc rule +MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) + # For Windows, create a parameters file to work around command line length limit + IF (WIN32) + # Pass the parameters in a file. Set the working directory to + # be that containing the parameters file and reference it by + # just the file name. This is necessary because the moc tool on + # MinGW builds does not seem to handle spaces in the path to the + # file given with the @ syntax. + GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME) + GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH) + IF(_moc_outfile_dir) + SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) + ENDIF(_moc_outfile_dir) + SET (_moc_parameters_file ${outfile}_parameters) + SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") + STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") + FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}") + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters + DEPENDS ${infile} + ${_moc_working_dir} + VERBATIM) + ELSE (WIN32) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} + DEPENDS ${infile} VERBATIM) + ENDIF (WIN32) +ENDMACRO (QT4_CREATE_MOC_COMMAND) + + +MACRO(QT4_AUTOMOC) + QT4_GET_MOC_FLAGS(_moc_INCS) + + SET(_matching_FILES ) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # This is required to make uic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) + + IF ( NOT _skip AND EXISTS ${_abs_FILE} ) + + FILE(READ ${_abs_FILE} _contents) + + GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) + + STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") + IF(_match) + FOREACH (_current_MOC_INC ${_match}) + STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + + GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) + IF(EXISTS ${_abs_PATH}/${_basename}.hpp) + SET(_header ${_abs_PATH}/${_basename}.hpp) + ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp) + SET(_header ${_abs_PATH}/${_basename}.h) + ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) + QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") + MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) + ENDFOREACH (_current_MOC_INC) + ENDIF(_match) + ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} ) + ENDFOREACH (_current_FILE) +ENDMACRO(QT4_AUTOMOC) + + +# Portability helpers. + +set(QT_QTCORE_LIBRARIES ${Qt5Core_LIBRARIES}) + +set(QT_QTGUI_LIBRARIES + ${Qt5Gui_LIBRARIES} + ${Qt5Widgets_LIBRARIES} + ${Qt5PrintSupport_LIBRARIES} + ${Qt5Svg_LIBRARIES} +) + +set(QT_QTSCRIPTTOOLS_LIBRARIES ${Qt5ScriptTools_LIBRARIES}) +set(QT_QTNETWORK_LIBRARIES ${Qt5Network_LIBRARIES}) +set(QT_QTTEST_LIBRARIES ${Qt5Test_LIBRARIES}) +set(QT_QTDESIGNER_LIBRARIES ${Qt5Designer_LIBRARIES}) +set(QT_QTXML_LIBRARIES ${Qt5Xml_LIBRARIES}) + +set(QT_INCLUDES + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${Qt5Designer_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Script_INCLUDE_DIRS} + ${Qt5ScriptTools_INCLUDE_DIRS} + ${Qt5PrintSupport_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${Qt5Tests_INCLUDE_DIRS} + ${Qt5Xml_INCLUDE_DIRS} +) + +macro(qt4_wrap_ui) + qt5_wrap_ui(${ARGN}) +endmacro() + +macro(qt4_add_resources) + qt5_add_resources(${ARGN}) +endmacro() diff --git a/GammaRay.desktop b/GammaRay.desktop index 3ce44ab..348bcf9 100644 --- a/GammaRay.desktop +++ b/GammaRay.desktop @@ -6,7 +6,7 @@ Comment[x-test]=xxQt-application inspection and manipulation toolxx GenericName=Qt Inspection Tool GenericName[x-test]=xxQt Inspection Toolxx Exec=gammaray -Icon=GammaRay-128x128 +Icon=GammaRay Type=Application Categories=Qt;Development; X-KDE-StartupNotify=true diff --git a/Make-O-Matic/buildscript.py b/Make-O-Matic/buildscript.py deleted file mode 100755 index 7b61436..0000000 --- a/Make-O-Matic/buildscript.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -from core.Configuration import Configuration -from core.environments.Environments import Environments -from core.helpers.BoilerPlate import BuildProject -from core.helpers.PathResolver import PathResolver -from core.plugins.Preprocessor import Preprocessor -from core.plugins.builders.generators.CMakeBuilder import CMakeBuilder, CMakeVariable -from core.plugins.packagers.CPack import CPack -from core.plugins.testers.CTest import CTest -from core.plugins.reporters.EmailReporter import EmailReporter -from core.helpers.GlobalMApp import mApp -from core.plugins.platforms.BlackLister import BlackLister - -build, project = BuildProject( name = 'GammaRay', version = '0.1.0', url = 'gitolite@git.kdab.com:gammaray.git' ) -build.addPlugin( BlackLister( variable = 'QMAKESPEC', pattern = 'win32-g\+\+' ) ) - -sharedDebug = Environments( [ 'Qt-4.7.?-Shared-Debug' ], 'Qt 4 Shared Debug', project ) -#sharedDebug = Environments( [], 'Qt 4 Shared Debug', project ) -sharedDebug.setOptional( True ) -debug = Configuration( 'Debug', sharedDebug, ) -cmakeDebug = CMakeBuilder() -cmakeDebug.addCMakeVariable( CMakeVariable( 'CMAKE_BUILD_TYPE', 'debug', 'STRING' ) ) -debug.addPlugin( cmakeDebug ) -debug.addPlugin( CTest() ) - -sharedRelease = Environments( [ 'Qt-4.7.?' ], 'Qt 4 Shared Release', project ) -#sharedRelease = Environments( [], 'Qt 4 Shared Release', project ) -release = Configuration( 'Release', sharedRelease ) -cmakeRelease = CMakeBuilder() -cmakeRelease.addCMakeVariable( CMakeVariable( 'CMAKE_BUILD_TYPE', 'release', 'STRING' ) ) - -release.addPlugin( cmakeRelease ) -release.addPlugin( CTest() ) -release.addPlugin( CPack() ) - -# add external contributor -#application = mApp() -#er = EmailReporter() -#application.addPlugin( er ) -#er.setRecipients( ["bla@blub.org"] ) -#er.setEnableFullReport( True ) - -build.build() diff --git a/ReadMe.txt b/ReadMe.txt index 1711b85..9fdd5cd 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -49,11 +49,13 @@ GammaRay can: * Browse all QTextDocuments, along with the ability to edit them and view their internal structures. + * Show all QTimers and their statistics (number of wakeups, wakeup time, ...) + Head Engineer for GammaRay is Volker Krause License ======= -Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, +Copyright (C) 2010-2012 Klarälvdalens Datakonsult AB, a KDAB Group company, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/add_license_blurb.sh b/add_license_blurb.sh index 8a25de1..0b25834 100755 --- a/add_license_blurb.sh +++ b/add_license_blurb.sh @@ -3,6 +3,9 @@ find "$@" -name '*.h' -o -name '*.cpp' | grep -v /3rdparty/ | grep -v /qmldebugcontrol/ | grep -v /build | while read FILE; do if grep -qiE "Copyright \(C\) [0-9, -]{4,} Klar.*lvdalens Datakonsult AB" "$FILE" ; then continue; fi thisfile=`basename $FILE` + authorName=`git config user.name` + authorEmail=`git config user.email` + thisYear=`date +%Y` cat < "$FILE".tmp /* $thisfile @@ -10,8 +13,8 @@ find "$@" -name '*.h' -o -name '*.cpp' | grep -v /3rdparty/ | grep -v /qmldebugc This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause + Copyright (C) $thisYear Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: $authorName <$authorEmail> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/attach/attachdialog.ui b/attach/attachdialog.ui deleted file mode 100644 index 63dda71..0000000 --- a/attach/attachdialog.ui +++ /dev/null @@ -1,106 +0,0 @@ - - - AttachDialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - :/gammaray/GammaRay-128x128.png:/gammaray/GammaRay-128x128.png - - - - - - - - - false - - - - - - - - 0 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - KFilterProxySearchLine - QWidget -
kde/kfilterproxysearchline.h
- 1 -
- - GammaRay::PromoLabel - QWidget -
promolabel.h
- 1 -
-
- - - - - - buttonBox - accepted() - AttachDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AttachDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/attach/processlist_unix.cpp b/attach/processlist_unix.cpp deleted file mode 100644 index 0cf6930..0000000 --- a/attach/processlist_unix.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/************************************************************************** -** -** This code is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "processlist.h" - -#include -#include - -static bool isUnixProcessId(const QString &procname) -{ - for (int i = 0; i != procname.size(); ++i) - if (!procname.at(i).isDigit()) - return false; - return true; -} - -static bool processIsQtApp( const QString& pid ) -{ - QProcess lsofProcess; - QStringList args; - args << QLatin1String("-Fn") << QLatin1String("-p") << pid; - lsofProcess.start(QLatin1String("lsof"), args); - if (!lsofProcess.waitForStarted()) - return false; - - lsofProcess.waitForFinished(); - const QByteArray output = lsofProcess.readAllStandardOutput(); - - if ( output.contains( "QtCore") ) - return true; - - return false; -} - -// Determine UNIX processes by running ps -static ProcDataList unixProcessListPS() -{ -#ifdef Q_OS_MAC - // command goes last, otherwise it is cut off - static const char formatC[] = "pid state user command"; -#else - static const char formatC[] = "pid,state,user,cmd"; -#endif - ProcDataList rc; - QProcess psProcess; - QStringList args; - args << QLatin1String("-e") << QLatin1String("-o") << QLatin1String(formatC); - psProcess.start(QLatin1String("ps"), args); - if (!psProcess.waitForStarted()) - return rc; - psProcess.waitForFinished(); - QByteArray output = psProcess.readAllStandardOutput(); - // Split "457 S+ /Users/foo.app" - const QStringList lines = QString::fromLocal8Bit(output).split(QLatin1Char('\n')); - const int lineCount = lines.size(); - const QChar blank = QLatin1Char(' '); - for (int l = 1; l < lineCount; l++) { // Skip header - const QString line = lines.at(l).simplified(); - // we can't just split on blank as the process name might - // contain them - const int endOfPid = line.indexOf(blank); - const int endOfState = line.indexOf(blank, endOfPid+1); - const int endOfUser = line.indexOf(blank, endOfState+1); - const QStringList lineParsed = - QStringList() << line.left(endOfPid) - << line.mid(endOfPid+1, endOfState-endOfPid-1) - << line.mid(endOfState+1, endOfUser-endOfState-1) - << line.right(line.size()-endOfUser-1); - if (lineParsed.count() == 4) { - ProcData procData; - procData.ppid = lineParsed.at(0); - procData.state = lineParsed.at(1); - procData.user = lineParsed.at(2); - procData.name = lineParsed.at(3); - if ( processIsQtApp( procData.ppid ) ) - procData.type = ProcData::QtApp; - else - procData.type = ProcData::NoQtApp; - rc.push_back(procData); - } - } - return rc; -} - -// Determine UNIX processes by reading "/proc". Default to ps if -// it does not exist -ProcDataList processList() -{ - const QDir procDir(QLatin1String("/proc/")); - if (!procDir.exists()) - return unixProcessListPS(); - ProcDataList rc; - const QStringList procIds = procDir.entryList(); - if (procIds.isEmpty()) - return rc; - foreach (const QString &procId, procIds) { - if (!isUnixProcessId(procId)) - continue; - QString filename = QLatin1String("/proc/"); - filename += procId; - filename += QLatin1String("/stat"); - QFile file(filename); - if (!file.open(QIODevice::ReadOnly)) - continue; // process may have exited - - const QStringList data = QString::fromLocal8Bit(file.readAll()).split(' '); - ProcData proc; - proc.ppid = procId; - proc.name = data.at(1); - if (proc.name.startsWith(QLatin1Char('(')) && proc.name.endsWith(QLatin1Char(')'))) { - proc.name.truncate(proc.name.size() - 1); - proc.name.remove(0, 1); - } - proc.state = data.at(2); - // PPID is element 3 - - proc.user = QFileInfo(file).owner(); - file.close(); - - QFile cmdFile(QLatin1String("/proc/") + procId + QLatin1String("/cmdline")); - if(cmdFile.open(QFile::ReadOnly)) { - QByteArray cmd = cmdFile.readAll(); - cmd.replace('\0', ' '); - if ( !cmd.isEmpty() ) - proc.name = QString::fromLocal8Bit(cmd); - } - cmdFile.close(); - - QFile maps(QLatin1String("/proc/") + procId + QLatin1String("/maps")); - if (!maps.open(QIODevice::ReadOnly)) - continue; // process may have exited - - proc.type = ProcData::NoQtApp; - forever { - const QByteArray line = maps.readLine(); - if (line.isEmpty()) { - break; - } - if (line.contains(QByteArray("/libQtCore.so"))) { - proc.type = ProcData::QtApp; - break; - } - } - - rc.push_back(proc); - } - return rc; -} diff --git a/attach/processlist_win.cpp b/attach/processlist_win.cpp deleted file mode 100644 index 45d7c11..0000000 --- a/attach/processlist_win.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************** -** -** This code is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "processlist.h" - -#include - -// Enable Win API of XP SP1 and later -#ifdef Q_OS_WIN -# define _WIN32_WINNT 0x0502 -# include -# if !defined(PROCESS_SUSPEND_RESUME) // Check flag for MinGW -# define PROCESS_SUSPEND_RESUME (0x0800) -# endif // PROCESS_SUSPEND_RESUME -#endif // Q_OS_WIN - -#include -#include -// Resolve QueryFullProcessImageNameW out of kernel32.dll due -// to incomplete MinGW import libs and it not being present -// on Windows XP. -static inline BOOL queryFullProcessImageName(HANDLE h, - DWORD flags, - LPWSTR buffer, - DWORD *size) -{ - // Resolve required symbols from the kernel32.dll - typedef BOOL (WINAPI *QueryFullProcessImageNameWProtoType) - (HANDLE, DWORD, LPWSTR, PDWORD); - static QueryFullProcessImageNameWProtoType queryFullProcessImageNameW = 0; - if (!queryFullProcessImageNameW) { - QLibrary kernel32Lib(QLatin1String("kernel32.dll"), 0); - if (kernel32Lib.isLoaded() || kernel32Lib.load()) - queryFullProcessImageNameW = (QueryFullProcessImageNameWProtoType)kernel32Lib.resolve("QueryFullProcessImageNameW"); - } - if (!queryFullProcessImageNameW) - return FALSE; - // Read out process - return (*queryFullProcessImageNameW)(h, flags, buffer, size); -} - -struct ProcessInfo { - QString imageName; - QString processOwner; -}; - -static inline ProcessInfo processInfo(DWORD processId) -{ - ProcessInfo pi; - HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION , TOKEN_READ, processId); - if (handle == INVALID_HANDLE_VALUE) - return pi; - WCHAR buffer[MAX_PATH]; - DWORD bufSize = MAX_PATH; - if (queryFullProcessImageName(handle, 0, buffer, &bufSize)) - pi.imageName = QString::fromUtf16(reinterpret_cast(buffer)); - - HANDLE processTokenHandle = NULL; - if ( !OpenProcessToken( handle, TOKEN_READ, &processTokenHandle ) || !processTokenHandle ) - return pi; - - DWORD size = 0; - GetTokenInformation(processTokenHandle, TokenUser, NULL, 0, &size); - - if( GetLastError() == ERROR_INSUFFICIENT_BUFFER ) { - QByteArray buf; - buf.resize(size); - PTOKEN_USER userToken = reinterpret_cast( buf.data() ); - if (userToken && GetTokenInformation( processTokenHandle, TokenUser, userToken, size, &size )) { - SID_NAME_USE sidNameUse; - TCHAR user[MAX_PATH] = { 0 }; - DWORD userNameLength = MAX_PATH; - TCHAR domain[MAX_PATH] = { 0 }; - DWORD domainNameLength = MAX_PATH; - - if (LookupAccountSid( NULL, - userToken->User.Sid, - user, - &userNameLength, - domain, - &domainNameLength, - &sidNameUse )) { - pi.processOwner = QString::fromUtf16(reinterpret_cast(user)); - } - } - } - - CloseHandle(processTokenHandle); - CloseHandle(handle); - return pi; -} - -static inline bool isQtApp(DWORD processId) -{ - MODULEENTRY32 me; - me.dwSize = sizeof(MODULEENTRY32); - HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processId); - if (snapshot == INVALID_HANDLE_VALUE) - return false; - - for (bool hasNext = Module32First(snapshot, &me); hasNext; hasNext = Module32Next(snapshot, &me)) { - const QString module = QString::fromUtf16(reinterpret_cast(me.szModule)); -//TODO: Do this check properly, ptobe does not need to have the same type -#ifdef NDEBUG - if (module == QLatin1String("QtCore4.dll")) { -#else - if (module == QLatin1String("QtCored4.dll")) { -#endif - CloseHandle(snapshot); - return true; - } - } - CloseHandle(snapshot); - return false; -} - -ProcDataList processList() -{ - ProcDataList rc; - - PROCESSENTRY32 pe; - pe.dwSize = sizeof(PROCESSENTRY32); - HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (snapshot == INVALID_HANDLE_VALUE) - return rc; - - for (bool hasNext = Process32First(snapshot, &pe); hasNext; hasNext = Process32Next(snapshot, &pe)) { - ProcData procData; - procData.ppid = QString::number(pe.th32ProcessID); - procData.name = QString::fromUtf16(reinterpret_cast(pe.szExeFile)); - const ProcessInfo processInf = processInfo(pe.th32ProcessID); - procData.image = processInf.imageName; - procData.user = processInf.processOwner; - if (isQtApp(pe.th32ProcessID)) - procData.type = ProcData::QtApp; - else - procData.type = ProcData::NoQtApp; - rc.push_back(procData); - } - CloseHandle(snapshot); - return rc; -} diff --git a/cmake/FindGraphviz.cmake b/cmake/FindGraphviz.cmake new file mode 100644 index 0000000..8b3d863 --- /dev/null +++ b/cmake/FindGraphviz.cmake @@ -0,0 +1,49 @@ +# - Try to find Graphviz +# Once done this will define +# +# GRAPHVIZ_FOUND - system has Graphviz +# GRAPHVIZ_INCLUDE_DIR - the Graphviz include directory +# GRAPHVIZ_LIBRARY - Link these to use Graphviz +# GRAPHVIZ_DEFINITIONS - Compiler switches required for using Graphviz + +# Copyright (c) 2009, Adrien Bustany, +# +# Redistribution and use is allowed according to the terms of the GPLv3+ license. + +IF (GRAPHVIZ_INCLUDE_DIR AND GRAPHVIZ_CDT_LIBRARY AND GRAPHVIZ_CGRAPH_LIBRARY AND GRAPHVIZ_GRAPH_LIBRARY AND GRAPHVIZ_PATHPLAN_LIBRARY) + SET(GRAPHVIZ_FIND_QUIETLY TRUE) +ENDIF (GRAPHVIZ_INCLUDE_DIR AND GRAPHVIZ_CDT_LIBRARY AND GRAPHVIZ_CGRAPH_LIBRARY AND GRAPHVIZ_GRAPH_LIBRARY AND GRAPHVIZ_PATHPLAN_LIBRARY) + +FIND_PATH( GRAPHVIZ_INCLUDE_DIR graphviz/graph.h) + +if (WIN32) + IF( CMAKE_BUILD_TYPE STREQUAL "Release") + set(GRAPHVIZ_LIB_PATH_SUFFIX "release/lib") + else() + set(GRAPHVIZ_LIB_PATH_SUFFIX "debug/lib") + endif() +else() + set(GRAPHVIZ_LIB_PATH_SUFFIX) +endif() + +FIND_LIBRARY( GRAPHVIZ_CDT_LIBRARY NAMES cdt PATH_SUFFIXES ${GRAPHVIZ_LIB_PATH_SUFFIX}) +FIND_LIBRARY( GRAPHVIZ_GVC_LIBRARY NAMES gvc PATH_SUFFIXES ${GRAPHVIZ_LIB_PATH_SUFFIX}) +FIND_LIBRARY( GRAPHVIZ_CGRAPH_LIBRARY NAMES cgraph PATH_SUFFIXES ${GRAPHVIZ_LIB_PATH_SUFFIX}) +FIND_LIBRARY( GRAPHVIZ_GRAPH_LIBRARY NAMES graph PATH_SUFFIXES ${GRAPHVIZ_LIB_PATH_SUFFIX}) +FIND_LIBRARY( GRAPHVIZ_PATHPLAN_LIBRARY NAMES pathplan PATH_SUFFIXES ${GRAPHVIZ_LIB_PATH_SUFFIX}) + +IF (GRAPHVIZ_INCLUDE_DIR AND GRAPHVIZ_CDT_LIBRARY AND GRAPHVIZ_GVC_LIBRARY AND GRAPHVIZ_CGRAPH_LIBRARY AND GRAPHVIZ_GRAPH_LIBRARY AND GRAPHVIZ_PATHPLAN_LIBRARY) + SET(GRAPHVIZ_FOUND TRUE) +ELSE (GRAPHVIZ_INCLUDE_DIR AND GRAPHVIZ_CDT_LIBRARY AND GRAPHVIZ_GVC_LIBRARY AND GRAPHVIZ_CGRAPH_LIBRARY AND GRAPHVIZ_GRAPH_LIBRARY AND GRAPHVIZ_PATHPLAN_LIBRARY) + SET(GRAPHVIZ_FOUND FALSE) +ENDIF (GRAPHVIZ_INCLUDE_DIR AND GRAPHVIZ_CDT_LIBRARY AND GRAPHVIZ_GVC_LIBRARY AND GRAPHVIZ_CGRAPH_LIBRARY AND GRAPHVIZ_GRAPH_LIBRARY AND GRAPHVIZ_PATHPLAN_LIBRARY) + +IF (GRAPHVIZ_FOUND) + IF (NOT GRAPHVIZ_FIND_QUIETLY) + MESSAGE(STATUS "Found Graphviz: ${GRAPHVIZ_CDT_LIBRARY} ${GRAPHVIZ_GVC_LIBRARY} ${GRAPHVIZ_CGRAPH_LIBRARY} ${GRAPHVIZ_GRAPH_LIBRARY} ${GRAPHVIZ_PATHPLAN_LIBRARY}") + ENDIF (NOT GRAPHVIZ_FIND_QUIETLY) +ELSE (GRAPHVIZ_FOUND) + IF (GRAPHVIZ_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find Graphivz") + ENDIF (GRAPHVIZ_FIND_REQUIRED) +ENDIF (GRAPHVIZ_FOUND) diff --git a/cmake/GammaRayMacros.cmake b/cmake/GammaRayMacros.cmake new file mode 100644 index 0000000..5daf6ef --- /dev/null +++ b/cmake/GammaRayMacros.cmake @@ -0,0 +1,15 @@ +# +# GAMMARAY_ADD_PLUGIN: create a gammaray plugin, install at the right place, etc +# + +macro(gammaray_add_plugin _target_name _desktop_file) + add_library(${_target_name} MODULE ${ARGN}) + set_target_properties(${_target_name} PROPERTIES + PREFIX "" + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/plugins/gammaray + ) + install(TARGETS ${_target_name} DESTINATION ${PLUGIN_INSTALL_DIR}/gammaray/) + install(FILES ${_desktop_file} DESTINATION ${PLUGIN_INSTALL_DIR}/gammaray/) + #execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/${_desktop_file}" "${PROJECT_BINARY_DIR}/lib/plugins/gammaray") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${_desktop_file}" DESTINATION "${PROJECT_BINARY_DIR}/lib/plugins/gammaray") +endmacro() diff --git a/config-gammaray.h.cmake b/config-gammaray.h.cmake index 026205e..e1a24d2 100644 --- a/config-gammaray.h.cmake +++ b/config-gammaray.h.cmake @@ -3,3 +3,5 @@ // for finding the probe during automatic tests #define GAMMARAY_BUILD_DIR "${CMAKE_BINARY_DIR}" +#cmakedefine BUILD_TIMER_PLUGIN + diff --git a/connectionfilterproxymodel.h b/connectionfilterproxymodel.h index a1a00b3..c66f267 100644 --- a/connectionfilterproxymodel.h +++ b/connectionfilterproxymodel.h @@ -24,7 +24,7 @@ #ifndef GAMMARAY_CONNECTIONFILTERPROXYMODEL_H #define GAMMARAY_CONNECTIONFILTERPROXYMODEL_H -#include +#include namespace GammaRay { diff --git a/connectionmodel.cpp b/connectionmodel.cpp index 54ef77f..2a4b3ae 100644 --- a/connectionmodel.cpp +++ b/connectionmodel.cpp @@ -31,6 +31,27 @@ #include #include +namespace GammaRay { + +struct Connection +{ + Connection() + : sender(0), receiver(0), type(Qt::AutoConnection), valid(false) + { + } + QObject *sender; + QByteArray signal; + QObject *receiver; + QByteArray method; + QByteArray location; + Qt::ConnectionType type; + bool valid; +}; + +} + +Q_DECLARE_TYPEINFO(GammaRay::Connection, Q_MOVABLE_TYPE); + using namespace GammaRay; static bool checkMethodForObject(QObject *obj, const QByteArray &signature, bool isSender) @@ -56,15 +77,8 @@ static bool checkMethodForObject(QObject *obj, const QByteArray &signature, bool return true; } -ConnectionModel::Connection::Connection() -: sender(0), receiver(0), type(Qt::AutoConnection), valid(false) -{ - -} - ConnectionModel::ConnectionModel(QObject *parent) - : QAbstractTableModel(parent), - m_lock(QReadWriteLock::Recursive) + : QAbstractTableModel(parent) { qRegisterMetaType("const char*"); qRegisterMetaType("Qt::ConnectionType"); @@ -97,8 +111,6 @@ void ConnectionModel::connectionAddedMainThread(QObject *sender, const char *sig return; } - QWriteLocker lock(&m_lock); - beginInsertRows(QModelIndex(), m_connections.size(), m_connections.size()); Connection c; c.sender = sender; @@ -148,7 +160,6 @@ void ConnectionModel::connectionRemovedMainThread(QObject *sender, const char *s normalizedMethod = QMetaObject::normalizedSignature(method); } - QWriteLocker lock(&m_lock); for (int i = 0; i < m_connections.size();) { bool remove = false; @@ -174,31 +185,13 @@ void ConnectionModel::connectionRemovedMainThread(QObject *sender, const char *s } } -void ConnectionModel::objectRemoved(QObject *object) -{ - QWriteLocker lock(&m_lock); - - // invalidate data - for (int i = 0; i < m_connections.size(); ++i) { - Connection &con = m_connections[i]; - if (con.receiver == object) { - con.receiver = 0; - } else if (con.sender == object) { - con.sender = 0; - } - } -} - QVariant ConnectionModel::data(const QModelIndex &index, int role) const { - ReadOrWriteLocker lock(&m_lock); - if (!index.isValid() || index.row() < 0 || index.row() >= m_connections.size()) { return QVariant(); } Connection con = m_connections.at(index.row()); - lock.unlock(); ReadOrWriteLocker probeLock(Probe::instance()->objectLock()); if (!Probe::instance()->isValidObject(con.sender)) { @@ -296,7 +289,6 @@ int ConnectionModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) { return 0; } - ReadOrWriteLocker lock(&m_lock); return m_connections.size(); } diff --git a/connectionmodel.h b/connectionmodel.h index dd5d2ae..a0d6d21 100644 --- a/connectionmodel.h +++ b/connectionmodel.h @@ -27,10 +27,11 @@ #include #include #include -#include namespace GammaRay { +class Connection; + class ConnectionModel : public QAbstractTableModel { Q_OBJECT @@ -49,8 +50,6 @@ class ConnectionModel : public QAbstractTableModel void connectionRemoved(QObject *sender, const char *signal, QObject *receiver, const char *method); - void objectRemoved(QObject *object); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -64,19 +63,7 @@ class ConnectionModel : public QAbstractTableModel QObject *receiver, const char *method); private: - struct Connection - { - Connection(); - QObject *sender; - QByteArray signal; - QObject *receiver; - QByteArray method; - QByteArray location; - Qt::ConnectionType type; - bool valid; - }; QVector m_connections; - mutable QReadWriteLock m_lock; }; } diff --git a/hooking/abstractfunctionoverwriter.cpp b/hooking/abstractfunctionoverwriter.cpp new file mode 100644 index 0000000..8a4685b --- /dev/null +++ b/hooking/abstractfunctionoverwriter.cpp @@ -0,0 +1,215 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Andreas Holzammer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "abstractfunctionoverwriter.h" +#include + +#ifdef ARCH_X86 +const long worstSizeForLongJump = 10; +#elif defined(ARCH_64) +const long worstSizeForLongJump = 14; +#else +# error "Unsupported hardware architecture!" +#endif + +using namespace GammaRay; + +bool AbstractFunctionOverwriter::writeShortJump(void *target, void *const func) +{ + quint8 *cur = (quint8 *) target; + + //E9 relative short jump is 5 bytes long + bool ret = unprotectMemory(page_align(target), roundToNextPage(5)); + + if (!ret) { + std::cerr << "Failed to unprotect memory: " << page_align(target); + return false; + } + + *cur = 0xE9; + cur++; + *((quint32 *)cur) = (unsigned long)func - (unsigned long)(cur + 4); + + ret = reprotectMemory(page_align(target), roundToNextPage(5)); + + if (!ret) { + std::cerr << "Failed to reprotect memory: " << page_align(target); + return false; + } + + return true; +} + +bool AbstractFunctionOverwriter::writeLongJump(void *target, void *const func) +{ + quint8 *cur = (quint8 *) target; + + bool ret = unprotectMemory(page_align(target), roundToNextPage(worstSizeForLongJump)); + + if (!ret) { + std::cerr << "Failed to unprotect memory: " << page_align(target); + return false; + } + + *cur = 0xff; + *(++cur) = 0x25; + +#ifdef ARCH_X86 + *((quint32 *) ++cur) = (quint32)(((quint32) cur) + sizeof (quint32)); + cur += sizeof (quint32); + *((quint32 *)cur) = (quint32)func; +#elif defined(ARCH_64) + *((quint32 *) ++cur) = 0; + cur += sizeof (quint32); + *((quint64*)cur) = (quint64)func; +#else +# error "Unsupported hardware architecture!" +#endif + + ret = reprotectMemory(page_align(target), roundToNextPage(worstSizeForLongJump)); + + if (!ret) { + std::cerr << "Failed to reprotect memory: " << page_align(target); + return false; + } + + return true; +} + +void *AbstractFunctionOverwriter::getMemoryNearAddress(void *const addr, size_t size) +{ + Q_ASSERT(blocksize() > size); + +#if defined(ARCH_64) + intptr_t minAddr; + intptr_t maxAddr; + + getAddressRange(minAddr, maxAddr); + + minAddr = std::max(minAddr, reinterpret_cast(addr) - 0x20000000); + maxAddr = std::min(maxAddr, reinterpret_cast(addr) + 0x20000000); +#endif + + for (QList::Iterator it = memoryPool.begin(); it != memoryPool.end(); ++it) { + if (it->free >= size) { +#if defined(ARCH_64) + if (!((intptr_t)it->mem > minAddr && (intptr_t)it->mem < maxAddr)) { + continue; + } +#endif + quint8 *mem = (quint8 *)it->mem + (it->size - it->free); + it->free -= size; + return mem; + } + } + + void *mem = 0; +#ifdef ARCH_X86 + Q_UNUSED(addr); + mem = reserveMemory(0, blocksize()); +#elif defined(ARCH_64) + intptr_t min = minAddr / blocksize(); + intptr_t max = maxAddr / blocksize(); + int rel = 0; + for (int i = 0; i < (max - min + 1); ++i) { + rel = -rel + (i & 1); + void* query = reinterpret_cast(((min + max) / 2 + rel) * blocksize()); + + Q_ASSERT(!((size_t)query & (pagesize() - 1))); + + if (isMemoryFree(query, blocksize())) { + mem = reserveMemory(query, blocksize()); + if (mem != 0 && + reinterpret_cast(mem) > minAddr && + reinterpret_cast(mem) < maxAddr) { + break; + } + } + } +#else +#error "Unsupported hardware architecture!" +#endif + if (!mem) { + std::cerr << "Error could not find memory close to: " << addr; + return 0; + } + if (!commitMemory(mem, blocksize())) { + return 0; + } + MemorySegment memSegment; + memSegment.mem = mem; + memSegment.size = blocksize(); + memSegment.free = blocksize() - size; + memoryPool.append(memSegment); + return mem; +} + +void *AbstractFunctionOverwriter::createTrampoline(void *const func, void *const replacement) +{ + void *mem = getMemoryNearAddress(func, worstSizeForLongJump); + if (!mem) { + return 0; + } + bool ret = writeLongJump(mem, replacement); + if (!ret) { + return 0; + } + return mem; +} + +AbstractFunctionOverwriter::~AbstractFunctionOverwriter() +{ +} + +bool AbstractFunctionOverwriter::overwriteFunction(const QString &orignalFunc, + void * const replacementFunc) +{ + void *func = qtCoreFunctionLookup(orignalFunc); + if (!func) { + std::cerr << "Failed to lookup: " << orignalFunc.toLatin1().data(); + return false; + } + void *mem = createTrampoline(func, replacementFunc); + if (!mem) { + return false; + } + + bool ret = writeShortJump(func, mem); + + return ret; +} + +void *AbstractFunctionOverwriter::page_align(void *addr) const +{ + Q_ASSERT(addr != 0); + return (void *)((size_t)addr & ~(pagesize() - 1)); +} + +size_t AbstractFunctionOverwriter::roundToNextPage(size_t addr) const +{ + Q_ASSERT(addr != 0); + return (size_t)page_align((void*)(addr + (pagesize() - 1))); +} + +size_t GammaRay::AbstractFunctionOverwriter::blocksize() +{ + return roundToNextPage(std::max((worstSizeForLongJump * 4), pagesize())); +} diff --git a/hooking/abstractfunctionoverwriter.h b/hooking/abstractfunctionoverwriter.h new file mode 100644 index 0000000..20d0669 --- /dev/null +++ b/hooking/abstractfunctionoverwriter.h @@ -0,0 +1,150 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Andreas Holzammer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_ABSTRACTFUNCTIONOVERWRITER_H +#define GAMMARAY_ABSTRACTFUNCTIONOVERWRITER_H + +#include +#include + +#if defined(_M_X64) || defined(__amd64) || defined(__x86_64) +#define ARCH_64 +#elif defined(_M_IX86) || defined(__i386__) +#define ARCH_X86 +#endif + +namespace GammaRay { + +class AbstractFunctionOverwriter +{ + public: + virtual ~AbstractFunctionOverwriter(); + + /** + * Overwrites a given Qt Core 4 function with a replacement function. + * @param orignalFunc original Qt Core 4 function + * @param replacementFunc replacement function + */ + bool overwriteFunction(const QString &orignalFunc, + void * const replacementFunc); + + protected: + /** + * Unprotects a memory region so that the memory can get written + * @param mem start address of the memory that should be unprotected + * @param size size of the memory region + */ + virtual bool unprotectMemory(void *mem, size_t size) = 0; + + /** + * Restore the protection of the memory region that has been + * unproteced before with unprotectMemory + * @param mem start address of the memory that should be protected + * @param size size of the memory region + */ + virtual bool reprotectMemory(void *mem, size_t size) = 0; + + /** + * Writes a short jump at a given target to jump to a function. + * NOTE: A short jump takes 5 bytes, so make sure these 5 bytes + * can be written. + * @param target position where the jump should be written to + * @param size size of the memory region + */ + virtual bool writeShortJump(void *target, void * const func); + + /** + * Writes a long jump at a given target to jump to a function. + * NOTE: A short jump takes 10 bytes for x86 and 14 bytes for x64, + * so make sure these 5 bytes can be written. + * @param target position where the jump should be written to + * @param size size of the memory region + */ + virtual bool writeLongJump(void *target, void * const func); + + /** + * Get memory close to a target address. + * @param addr position that should the memory be close to + * @param size size of the memory region + */ + virtual void *getMemoryNearAddress(void * const addr, size_t size); + + /** + * Creates a tranpoline function close to another function. + * @param func function that the tranpoline should be close to + * @param replacement function that the trampoline should point to + */ + virtual void *createTrampoline(void * const func, void * const replacement); + + /** + * Get address range in which the program resists. + * @param min min address + * @param max max address + */ + virtual bool getAddressRange(intptr_t &min, intptr_t &max) = 0; + + /** + * Check if the memory region is not already taken. + * @param mem start address + * @param size size of the memory region + */ + virtual bool isMemoryFree(void * const mem, size_t size) = 0; + + /** + * Allocate memory at the griven position + * @param mem start address + * @param size size of the memory region + */ + virtual void *reserveMemory(void *mem, size_t size) = 0; + + /** + * Commit memory at the griven position + * @param mem start address + * @param size size of the memory region + */ + virtual bool commitMemory(void *mem, size_t size) = 0; + + /** + * Lookup function address of a given Qt Core 4 function. + * @param function function name + */ + virtual void *qtCoreFunctionLookup(const QString &function) = 0; + + virtual long pagesize() const = 0; + + virtual size_t blocksize(); + + private: + void *page_align(void *addr) const; + size_t roundToNextPage(size_t addr) const; + + struct MemorySegment { + void *mem; + size_t size; + size_t free; + }; + + QList memoryPool; +}; + +} + +#endif // ABSTRACTFUNCTIONOVERWRITER_H diff --git a/tests/hooktest/mainwindow.h b/hooking/functionoverwriterfactory.cpp similarity index 65% copy from tests/hooktest/mainwindow.h copy to hooking/functionoverwriterfactory.cpp index b359e2a..2d48cc8 100644 --- a/tests/hooktest/mainwindow.h +++ b/hooking/functionoverwriterfactory.cpp @@ -1,6 +1,4 @@ /* - mainwindow.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,25 +19,24 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include +#include "functionoverwriterfactory.h" +#include "winfunctionoverwriter.h" +#include "unixfunctionoverwriter.h" -namespace Ui { - class MainWindow; -} +using namespace GammaRay; -class MainWindow : public QMainWindow +AbstractFunctionOverwriter *FunctionOverwriterFactory::createFunctionOverwriter() { - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H + static AbstractFunctionOverwriter *overwriter = 0; + +#ifdef Q_OS_WIN + if (!overwriter) { + overwriter = new WinFunctionOverwriter(); + } +#else + if (!overwriter) { + overwriter = new UnixFunctionOverwriter(); + } +#endif + return overwriter; +} diff --git a/tests/hooktest/mainwindow.h b/hooking/functionoverwriterfactory.h similarity index 71% copy from tests/hooktest/mainwindow.h copy to hooking/functionoverwriterfactory.h index b359e2a..7e01819 100644 --- a/tests/hooktest/mainwindow.h +++ b/hooking/functionoverwriterfactory.h @@ -1,6 +1,4 @@ /* - mainwindow.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,25 +19,24 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_FUNCTIONOVERWRITERFACTORY_H +#define GAMMARAY_FUNCTIONOVERWRITERFACTORY_H -#include +#include "abstractfunctionoverwriter.h" -namespace Ui { - class MainWindow; -} +namespace GammaRay { -class MainWindow : public QMainWindow +class FunctionOverwriterFactory { - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); + public: + static AbstractFunctionOverwriter *createFunctionOverwriter(); -private: - Ui::MainWindow *ui; + private: + FunctionOverwriterFactory() + { + } }; -#endif // MAINWINDOW_H +} + +#endif // FUNCTIONOVERWRITERFACTORY_H diff --git a/hooking/unixfunctionoverwriter.cpp b/hooking/unixfunctionoverwriter.cpp new file mode 100644 index 0000000..d2c3bc1 --- /dev/null +++ b/hooking/unixfunctionoverwriter.cpp @@ -0,0 +1,120 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Andreas Holzammer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "unixfunctionoverwriter.h" + +#if !defined(Q_OS_WIN) + +#define __STDC_LIMIT_MACROS + +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; +using namespace GammaRay; + +UnixFunctionOverwriter::UnixFunctionOverwriter() +{ + m_pagesize = sysconf(_SC_PAGESIZE); +} + +bool UnixFunctionOverwriter::unprotectMemory(void *mem, size_t size) +{ + Q_ASSERT(!((size_t)mem & (pagesize() - 1))); + Q_ASSERT(!((size_t)size & (pagesize() - 1))); + const bool writable = (mprotect(mem, size, PROT_READ|PROT_WRITE|PROT_EXEC) == 0); + Q_ASSERT(writable); + return writable; +} + +bool UnixFunctionOverwriter::reprotectMemory(void *mem, size_t size) +{ + Q_ASSERT(!((size_t)mem & (pagesize() - 1))); + Q_ASSERT(!((size_t)size & (pagesize() - 1))); + const bool readOnly = (mprotect(mem, size, PROT_READ|PROT_EXEC) == 0); + Q_ASSERT(readOnly); + return readOnly; +} + +bool UnixFunctionOverwriter::getAddressRange(intptr_t &min, intptr_t &max) +{ + min = INTPTR_MIN; + max = INTPTR_MAX; + + return true; +} + +bool UnixFunctionOverwriter::isMemoryFree(void * const mem, size_t size) +{ + Q_ASSERT(!((size_t)mem & (pagesize() - 1))); + Q_ASSERT(!((size_t)size & (pagesize() - 1))); + Q_UNUSED(mem); + Q_UNUSED(size); + + //under unix there is no easy way to find out if a region is free or not + + return true; +} + +void *UnixFunctionOverwriter::reserveMemory(void *mem, size_t size) +{ + Q_ASSERT(!((size_t)mem & (pagesize() - 1))); + Q_ASSERT(!((size_t)size & (pagesize() - 1))); + + // reserve a memory region with a hint and hope that it is close to the other address + void *retmem = mmap(mem, size, PROT_READ|PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0); + + if (retmem == MAP_FAILED) { + return 0; + } + + return retmem; +} + +bool UnixFunctionOverwriter::commitMemory(void *mem, size_t size) +{ + Q_ASSERT(!((size_t)mem & (pagesize() - 1))); + Q_ASSERT(!((size_t)size & (pagesize() - 1))); + Q_UNUSED(mem); + Q_UNUSED(size); + + //under unix we don't have a commit + return true; +} + +void *UnixFunctionOverwriter::qtCoreFunctionLookup(const QString &function) +{ + return dlsym(RTLD_NEXT, function.toLatin1()); +} + +long GammaRay::UnixFunctionOverwriter::pagesize() const +{ + return m_pagesize; +} + +#endif // Q_OS_WIN diff --git a/hooking/unixfunctionoverwriter.h b/hooking/unixfunctionoverwriter.h new file mode 100644 index 0000000..7cda3a7 --- /dev/null +++ b/hooking/unixfunctionoverwriter.h @@ -0,0 +1,60 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Andreas Holzammer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_UNIXFUNCTIONOVERWRITER_H +#define GAMMARAY_UNIXFUNCTIONOVERWRITER_H + +#include + +#if !defined(Q_OS_WIN) + +#include "abstractfunctionoverwriter.h" + +namespace GammaRay { + +class UnixFunctionOverwriter : public AbstractFunctionOverwriter +{ + protected: + virtual bool unprotectMemory(void *mem, size_t size); + virtual bool reprotectMemory(void *mem, size_t size); + + virtual bool getAddressRange(intptr_t &min, intptr_t &max); + + virtual bool isMemoryFree(void * const mem, size_t size); + virtual void *reserveMemory(void *mem, size_t size); + virtual bool commitMemory(void *mem, size_t size); + + virtual void *qtCoreFunctionLookup(const QString &function); + virtual long pagesize() const; + + private: + UnixFunctionOverwriter(); + + long m_pagesize; + + friend class FunctionOverwriterFactory; +}; + +} + +#endif // Q_OS_WIN + +#endif // UNIXFUNCTIONOVERWRITER_H diff --git a/hooking/winfunctionoverwriter.cpp b/hooking/winfunctionoverwriter.cpp new file mode 100644 index 0000000..6d33830 --- /dev/null +++ b/hooking/winfunctionoverwriter.cpp @@ -0,0 +1,114 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Andreas Holzammer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +//krazy:excludeall=null since the WinAPI likes to use NULL + +#include "winfunctionoverwriter.h" + +#ifdef Q_OS_WIN + +#include + +using namespace std; +using namespace GammaRay; + +WinFunctionOverwriter::WinFunctionOverwriter():oldProtect(0) +{ +} + +bool WinFunctionOverwriter::unprotectMemory(void *mem, size_t size) +{ + BOOL ret = VirtualProtect(mem, size, PAGE_EXECUTE_READWRITE, &oldProtect); + return ret; +} + +bool WinFunctionOverwriter::reprotectMemory(void *mem, size_t size) +{ + BOOL ret = VirtualProtect(mem, size, oldProtect, &oldProtect); + return ret; +} + +bool WinFunctionOverwriter::getAddressRange(intptr_t &min, intptr_t &max) +{ + SYSTEM_INFO si; + GetSystemInfo(&si); + + min = reinterpret_cast(si.lpMinimumApplicationAddress); + max = reinterpret_cast(si.lpMaximumApplicationAddress); + + return true; +} + +bool WinFunctionOverwriter::isMemoryFree(void * const mem, size_t size) +{ + Q_UNUSED(size); + static MEMORY_BASIC_INFORMATION mi = { 0 }; + + VirtualQuery(mem, &mi, sizeof(mi)); + if (mi.State != MEM_FREE) { + return false; + } + + return true; +} + +void *WinFunctionOverwriter::reserveMemory(void *mem, size_t size) +{ + void *retmem = 0; + + retmem = VirtualAlloc(mem, size, MEM_RESERVE, PAGE_EXECUTE_READ); + + return retmem; +} + +bool WinFunctionOverwriter::commitMemory(void *mem, size_t size) +{ + void *retmem = 0; + + retmem = VirtualAlloc(mem, size, MEM_COMMIT, PAGE_EXECUTE_READ); + + return retmem != 0; +} + +void *WinFunctionOverwriter::qtCoreFunctionLookup(const QString &function) +{ + static HMODULE qtCoreDllHandle = GetModuleHandle(L"QtCore4"); + if (qtCoreDllHandle == NULL) { + qtCoreDllHandle = GetModuleHandle(L"QtCored4"); + } + + if (qtCoreDllHandle == NULL) { + cerr << "no handle for QtCore found!" << endl; + return 0; + } + + FARPROC qtfuncaddr = GetProcAddress(qtCoreDllHandle, function.toLatin1()); + + return (void*)qtfuncaddr; +} + +long WinFunctionOverwriter::pagesize() const +{ + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +} + +#endif // Q_OS_WIN diff --git a/hooking/winfunctionoverwriter.h b/hooking/winfunctionoverwriter.h new file mode 100644 index 0000000..2a36cb7 --- /dev/null +++ b/hooking/winfunctionoverwriter.h @@ -0,0 +1,60 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Andreas Holzammer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_WINFUNCTIONOVERWRITER_H +#define GAMMARAY_WINFUNCTIONOVERWRITER_H + +#include + +#ifdef Q_OS_WIN + +#include "abstractfunctionoverwriter.h" +#include + +namespace GammaRay { + +class WinFunctionOverwriter : public AbstractFunctionOverwriter +{ + protected: + virtual bool unprotectMemory(void *mem, size_t size); + virtual bool reprotectMemory(void *mem, size_t size); + + virtual bool getAddressRange(intptr_t &min, intptr_t &max); + + virtual bool isMemoryFree(void * const mem, size_t size); + virtual void *reserveMemory(void *mem, size_t size); + virtual bool commitMemory(void *mem, size_t size); + + virtual void *qtCoreFunctionLookup(const QString &function); + virtual long pagesize() const; + + private: + WinFunctionOverwriter(); + DWORD oldProtect; + + friend class FunctionOverwriterFactory; +}; + +} + +#endif // Q_OS_WIN + +#endif // WINFUNCTIONOVERWRITER_H diff --git a/injector/CMakeLists.txt b/injector/CMakeLists.txt index 712178f..3ce47b0 100644 --- a/injector/CMakeLists.txt +++ b/injector/CMakeLists.txt @@ -5,10 +5,13 @@ qt4_automoc(${gammaray_injector_style_srcs}) add_library(gammaray_injector_style MODULE ${gammaray_injector_style_srcs}) target_link_libraries(gammaray_injector_style -${QT_QTCORE_LIBRARY} -${QT_QTGUI_LIBRARY} +${QT_QTCORE_LIBRARIES} +${QT_QTGUI_LIBRARIES} +) +set_target_properties(gammaray_injector_style + PROPERTIES PREFIX "" + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/plugins/styles ) -set_target_properties(gammaray_injector_style PROPERTIES PREFIX "") install( TARGETS gammaray_injector_style DESTINATION ${LIB_INSTALL_DIR}/qt4/plugins/styles diff --git a/injector/abstractinjector.cpp b/injector/abstractinjector.cpp index dae96a8..d18b739 100644 --- a/injector/abstractinjector.cpp +++ b/injector/abstractinjector.cpp @@ -51,3 +51,8 @@ bool AbstractInjector::attach(int pid, const QString &probeDll, const QString &p qWarning() << "Attaching to a running process is not supported by this injector."; return false; } + +bool AbstractInjector::selfTest() +{ + return true; +} diff --git a/injector/abstractinjector.h b/injector/abstractinjector.h index 8721fce..c948465 100644 --- a/injector/abstractinjector.h +++ b/injector/abstractinjector.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef ABSTRACTINJECTOR_H -#define ABSTRACTINJECTOR_H +#ifndef GAMMARAY_ABSTRACTINJECTOR_H +#define GAMMARAY_ABSTRACTINJECTOR_H #include #include @@ -75,9 +75,17 @@ class AbstractInjector virtual QProcess::ProcessError processError() = 0; /** - * @return Descriptional error message when launch/attach failed. + * @return Descriptional error message when launch/attach/self-test failed. */ virtual QString errorString() = 0; + + /** + * Perform tests to ensure the injector is operational, such as testing if + * all necessary runtime dependencies are available. + * @return @c true on success, @c false otherwise. + * @note Make sure to set errorString() when returning @c false. + */ + virtual bool selfTest(); }; } diff --git a/injector/gdbinjector.cpp b/injector/gdbinjector.cpp index 9709c3e..3322e0a 100644 --- a/injector/gdbinjector.cpp +++ b/injector/gdbinjector.cpp @@ -211,4 +211,9 @@ void GdbInjector::addBreakpoint(const QByteArray &method) #endif } +bool GdbInjector::selfTest() +{ + return startGdb(QStringList() << QLatin1String("--version")); +} + #include "gdbinjector.moc" diff --git a/injector/gdbinjector.h b/injector/gdbinjector.h index f146a86..5b804c9 100644 --- a/injector/gdbinjector.h +++ b/injector/gdbinjector.h @@ -40,6 +40,7 @@ class GdbInjector : public QObject, public AbstractInjector virtual bool launch(const QStringList &programAndArgs, const QString &probeDll, const QString &probeFunc); virtual bool attach(int pid, const QString &probeDll, const QString &probeFunc); + virtual bool selfTest(); virtual int exitCode(); virtual QProcess::ExitStatus exitStatus(); virtual QProcess::ProcessError processError(); diff --git a/injector/injectorstyleplugin.cpp b/injector/injectorstyleplugin.cpp index a8b279f..cc24533 100644 --- a/injector/injectorstyleplugin.cpp +++ b/injector/injectorstyleplugin.cpp @@ -24,14 +24,13 @@ #include "injectorstyleplugin.h" #include +#include #include #include <3rdparty/qt/qguiplatformplugin_p.h> -#ifdef _WIN32 -#include -#else -#include +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) +typedef void *QFunctionPointer; #endif using namespace GammaRay; @@ -50,47 +49,31 @@ QStringList InjectorStylePlugin::keys() const void InjectorStylePlugin::inject() { - const QByteArray probeDll = qgetenv("GAMMARAY_STYLEINJECTOR_PROBEDLL"); - if (probeDll.isEmpty()) { + const QByteArray probeDllPath = qgetenv("GAMMARAY_STYLEINJECTOR_PROBEDLL"); + if (probeDllPath.isEmpty()) { qWarning("No probe DLL specified."); return; } -#ifdef _WIN32 -//TODO: GetLastError and so on for error string - HMODULE probeDllHandle = LoadLibrary(reinterpret_cast(QString(probeDll).utf16())); - if (!probeDllHandle) { - qWarning() << QLatin1String("Failed to load probe dll!"); + QLibrary probeDll(QString::fromLocal8Bit(probeDllPath)); + probeDll.setLoadHints(QLibrary::ResolveAllSymbolsHint); + if (!probeDll.load()) { + qWarning() << "Loading probe DLL failed:" << probeDll.errorString(); return; } -#else - void *probeDllHandle = dlopen(probeDll, RTLD_NOW); - if (!probeDllHandle) { - qWarning() << dlerror(); - return; - } -#endif const QByteArray probeFunc = qgetenv("GAMMARAY_STYLEINJECTOR_PROBEFUNC"); if (probeFunc.isEmpty()) { + qWarning("No probe function specified."); return; } -#ifdef _WIN32 -//TODO: GetLastError and so on for error string - FARPROC probeFuncHandle = GetProcAddress(probeDllHandle, QString(probeFunc).toLatin1()); - if (probeFuncHandle) { - reinterpret_cast(probeFuncHandle)(); - } else { - qWarning() << QLatin1String("Error finding probe function!"); - } -#else - void *probeFuncHandle = dlsym(probeDllHandle, probeFunc); + + QFunctionPointer probeFuncHandle = probeDll.resolve(probeFunc); if (probeFuncHandle) { reinterpret_cast(probeFuncHandle)(); } else { - qWarning() << dlerror(); + qWarning() << "Resolving probe function failed:" << probeDll.errorString(); } -#endif } Q_EXPORT_PLUGIN2(gammaray_injector_style, GammaRay::InjectorStylePlugin) diff --git a/injector/interactiveprocess.cpp b/injector/interactiveprocess.cpp index 59e2170..b2a4d24 100644 --- a/injector/interactiveprocess.cpp +++ b/injector/interactiveprocess.cpp @@ -29,8 +29,12 @@ #include #define dup _dup #define dup2 _dup2 +#ifndef __MINGW32__ #define fileno _fileno #endif +#else +#include +#endif int InteractiveProcess::stdinClone = -1; diff --git a/injector/interactiveprocess.h b/injector/interactiveprocess.h index abcf54b..4e0139b 100644 --- a/injector/interactiveprocess.h +++ b/injector/interactiveprocess.h @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef INTERACTIVEPROCESS_H -#define INTERACTIVEPROCESS_H +#ifndef GAMMARAY_INTERACTIVEPROCESS_H +#define GAMMARAY_INTERACTIVEPROCESS_H #include diff --git a/injector/preloadinjector.cpp b/injector/preloadinjector.cpp index 9d74246..402d802 100644 --- a/injector/preloadinjector.cpp +++ b/injector/preloadinjector.cpp @@ -70,7 +70,11 @@ bool PreloadInjector::launch(const QStringList &programAndArgs, args = newArgs; } else if (env.value("GAMMARAY_MEMCHECK").toInt()) { QStringList newArgs; - newArgs << "valgrind" << "--tool=memcheck" << "--track-origins=yes" << "--num-callers=25"; + newArgs << "valgrind" + << "--tool=memcheck" + << "--track-origins=yes" + << "--num-callers=25" + << "--leak-check=full"; newArgs += args; args = newArgs; } else if (env.value("GAMMARAY_HELGRIND").toInt()) { diff --git a/injector/styleinjector.cpp b/injector/styleinjector.cpp index 5aea97a..3d23a12 100644 --- a/injector/styleinjector.cpp +++ b/injector/styleinjector.cpp @@ -26,6 +26,7 @@ #include "styleinjector.h" #include "interactiveprocess.h" +#include #include #include @@ -88,6 +89,27 @@ bool StyleInjector::launch(const QStringList &programAndArgs, return mExitCode == EXIT_SUCCESS && mExitStatus == QProcess::NormalExit; } +bool StyleInjector::selfTest() +{ + // TODO: be a bit more clever in finding the plugin location (also when actually using it above) +#ifndef Q_OS_WIN + const QString stylePath = + QLatin1String(GAMMARAY_LIB_INSTALL_DIR "/qt4/plugins/styles/gammaray_injector_style.so"); +#else + const QString stylePath = + QLatin1String(GAMMARAY_LIB_INSTALL_DIR "/qt4/plugins/styles/gammaray_injector_style.dll"); +#endif + + QFileInfo fi(stylePath); + if (!fi.exists() || !fi.isFile() || !fi.isReadable()) { + mErrorString = + QObject::tr("Injector style plugin does not exists or is not readable at %1.").arg(stylePath); + return false; + } + + return true; +} + int StyleInjector::exitCode() { return mExitCode; diff --git a/injector/styleinjector.h b/injector/styleinjector.h index f0b3e72..280ffe4 100644 --- a/injector/styleinjector.h +++ b/injector/styleinjector.h @@ -38,6 +38,7 @@ public: } virtual bool launch(const QStringList &programAndArgs, const QString &probeDll, const QString &probeFunc); + virtual bool selfTest(); virtual int exitCode(); virtual QProcess::ExitStatus exitStatus(); virtual QProcess::ProcessError processError(); diff --git a/injector/windllinjector.cpp b/injector/windllinjector.cpp index 4989ded..4ca66b8 100644 --- a/injector/windllinjector.cpp +++ b/injector/windllinjector.cpp @@ -42,7 +42,7 @@ WinDllInjector::WinDllInjector() : } bool WinDllInjector::launch(const QStringList &programAndArgs, - const QString &probeDll, const QString &probeFunc) + const QString &probeDll, const QString &/*probeFunc*/) { DWORD dwCreationFlags = CREATE_NO_WINDOW; dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; @@ -58,10 +58,15 @@ bool WinDllInjector::launch(const QStringList &programAndArgs, PROCESS_INFORMATION pid; memset(&pid, 0, sizeof(PROCESS_INFORMATION)); - BOOL success = CreateProcess(0, (wchar_t *)programAndArgs.join(" ").utf16(), + const QString applicationName = programAndArgs.join(" "); + BOOL success = CreateProcess(0, (wchar_t *)applicationName.utf16(), 0, 0, TRUE, dwCreationFlags, 0, 0, &startupInfo, &pid); + if (!success) { + return false; + } + m_destProcess = pid.hProcess; m_destThread = pid.hThread; m_dllPath = probeDll; diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt new file mode 100644 index 0000000..d1f3c15 --- /dev/null +++ b/launcher/CMakeLists.txt @@ -0,0 +1,51 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +set(gammaray_runner_srcs + ${CMAKE_SOURCE_DIR}/injector/abstractinjector.cpp + ${CMAKE_SOURCE_DIR}/injector/injectorfactory.cpp + ${CMAKE_SOURCE_DIR}/injector/preloadinjector.cpp + ${CMAKE_SOURCE_DIR}/injector/styleinjector.cpp + ${CMAKE_SOURCE_DIR}/injector/windllinjector.cpp + ${CMAKE_SOURCE_DIR}/injector/interactiveprocess.cpp + probefinder.cpp + main.cpp + promolabel.cpp + splashscreen.cpp + launcherwindow.cpp + launchpage.cpp + selftestpage.cpp + + attachdialog.cpp + processmodel.cpp + processfiltermodel.cpp + + ${CMAKE_SOURCE_DIR}/3rdparty/kde/kidentityproxymodel.cpp + ${CMAKE_SOURCE_DIR}/3rdparty/kde/krecursivefilterproxymodel.cpp + ${CMAKE_SOURCE_DIR}/3rdparty/kde/kfilterproxysearchline.cpp +) +if(NOT WIN32) + set(gammaray_runner_srcs + ${gammaray_runner_srcs} + ${CMAKE_SOURCE_DIR}/injector/gdbinjector.cpp + processlist_unix.cpp + ) +else() + set(gammaray_runner_srcs + ${gammaray_runner_srcs} + processlist_win.cpp + ) +endif() + +qt4_wrap_ui(gammaray_runner_srcs + attachdialog.ui + launcherwindow.ui + launchpage.ui + selftestpage.ui +) +# TODO we don't need all the class icons here, so split the qrc file accordingly +qt4_add_resources(gammaray_runner_srcs ${CMAKE_SOURCE_DIR}/resources/gammaray.qrc) +qt4_automoc(${gammaray_runner_srcs}) + +add_executable(gammaray ${gammaray_runner_srcs}) +target_link_libraries(gammaray ${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES}) +install(TARGETS gammaray ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/attach/attachdialog.cpp b/launcher/attachdialog.cpp similarity index 83% rename from attach/attachdialog.cpp rename to launcher/attachdialog.cpp index 8fbf821..546bc94 100644 --- a/attach/attachdialog.cpp +++ b/launcher/attachdialog.cpp @@ -32,14 +32,14 @@ #include #include #include +#include using namespace GammaRay; AttachDialog::AttachDialog(QWidget *parent, Qt::WindowFlags f) -: QDialog(parent, f) +: QWidget(parent, f) { ui.setupUi(this); - ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Attach")); m_model = new ProcessModel(this); @@ -58,10 +58,9 @@ AttachDialog::AttachDialog(QWidget *parent, Qt::WindowFlags f) ui.view->setSelectionBehavior(QAbstractItemView::SelectRows); ui.view->setSelectionMode(QAbstractItemView::SingleSelection); connect(ui.view->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), - this, SLOT(selectionChanged())); + this, SIGNAL(updateButtonState())); - connect(ui.view, SIGNAL(activated(QModelIndex)), - ui.buttonBox->button(QDialogButtonBox::Ok), SLOT(click())); + connect(ui.view, SIGNAL(activated(QModelIndex)), SIGNAL(activate())); ui.filter->setProxy(m_proxyModel); @@ -72,14 +71,14 @@ AttachDialog::AttachDialog(QWidget *parent, Qt::WindowFlags f) connect(m_timer, SIGNAL(timeout()), this, SLOT(updateProcesses())); m_timer->start(1000); - // set process list syncronously the first time - m_model->setProcesses(processList()); - selectionChanged(); + ui.stackedWidget->setCurrentWidget(ui.loadingLabel); + emit updateButtonState(); + updateProcesses(); } -void AttachDialog::selectionChanged() +bool AttachDialog::isValid() const { - ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ui.view->currentIndex().isValid()); + return ui.view->currentIndex().isValid(); } QString AttachDialog::pid() const @@ -92,13 +91,14 @@ void AttachDialog::updateProcesses() QFutureWatcher* watcher = new QFutureWatcher(this); connect(watcher, SIGNAL(finished()), this, SLOT(updateProcessesFinished())); - watcher->setFuture(QtConcurrent::run(processList)); + watcher->setFuture(QtConcurrent::run(processList, m_model->processes())); } void AttachDialog::updateProcessesFinished() { QFutureWatcher* watcher = dynamic_cast*>(sender()); Q_ASSERT(watcher); + ui.stackedWidget->setCurrentWidget(ui.listViewPage); const QString oldPid = pid(); m_model->mergeProcesses(watcher->result()); if (oldPid != pid()) { diff --git a/attach/attachdialog.h b/launcher/attachdialog.h similarity index 82% rename from attach/attachdialog.h rename to launcher/attachdialog.h index 6961bfa..b92eee9 100644 --- a/attach/attachdialog.h +++ b/launcher/attachdialog.h @@ -21,11 +21,12 @@ along with this program. If not, see . */ -#ifndef ATTACHDIALOG_H -#define ATTACHDIALOG_H +#ifndef GAMMARAY_ATTACHDIALOG_H +#define GAMMARAY_ATTACHDIALOG_H -#include +#include +#include "processlist.h" #include "ui_attachdialog.h" namespace GammaRay { @@ -33,7 +34,7 @@ namespace GammaRay { class ProcessModel; class ProcessFilterModel; -class AttachDialog : public QDialog +class AttachDialog : public QWidget { Q_OBJECT @@ -41,9 +42,14 @@ class AttachDialog : public QDialog explicit AttachDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); QString pid() const; + /// Returns @c true if a valid process is selected. + bool isValid() const; + + signals: + void updateButtonState(); + void activate(); private slots: - void selectionChanged(); void updateProcesses(); void updateProcessesFinished(); diff --git a/launcher/attachdialog.ui b/launcher/attachdialog.ui new file mode 100644 index 0000000..7d634da --- /dev/null +++ b/launcher/attachdialog.ui @@ -0,0 +1,66 @@ + + + GammaRay::AttachDialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + :/gammaray/GammaRay-128x128.png:/gammaray/GammaRay-128x128.png + + + + + + 1 + + + + <html><head/><body><p align="center"><img src=":/gammaray/GammaRay-48x48.png"/></p><p align="center">Retrieving the list of processes which use Qt ...</p></body></html> + + + + + + 0 + + + + + + + + false + + + + + + listViewPage + loadingLabel + + + + + + + KFilterProxySearchLine + QWidget +
kfilterproxysearchline.h
+ 1 +
+
+ + + + +
diff --git a/launcher/launcherwindow.cpp b/launcher/launcherwindow.cpp new file mode 100644 index 0000000..c81cfd2 --- /dev/null +++ b/launcher/launcherwindow.cpp @@ -0,0 +1,92 @@ +/* + launcherwindow.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "launcherwindow.h" +#include "ui_launcherwindow.h" +#include "config-gammaray-version.h" + +#include +#include + +using namespace GammaRay; + +LauncherWindow::LauncherWindow(QWidget *parent) + : QDialog(parent), ui(new Ui::LauncherWindow) +{ + ui->setupUi(this); + ui->aboutLabel->setText(ui->aboutLabel->text().arg(GAMMARAY_VERSION_STRING)); + connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabChanged())); + connect(ui->attachPage, SIGNAL(updateButtonState()), SLOT(tabChanged())); + connect(ui->launchPage, SIGNAL(updateButtonState()), SLOT(tabChanged())); + connect(ui->attachPage, SIGNAL(activate()), + ui->buttonBox->button(QDialogButtonBox::Ok), SLOT(click())); + + QSettings settings; + ui->tabWidget->setCurrentIndex(settings.value(QLatin1String("Launcher/TabIndex")).toInt()); +} + +LauncherWindow::~LauncherWindow() +{ + delete ui; +} + +QString LauncherWindow::pid() const +{ + if (ui->tabWidget->currentWidget() == ui->attachPage) { + return ui->attachPage->pid(); + } + return QString(); +} + +QStringList LauncherWindow::launchArguments() const +{ + if (ui->tabWidget->currentWidget() == ui->launchPage) { + return ui->launchPage->launchArguments(); + } + return QStringList(); +} + +void LauncherWindow::tabChanged() +{ + if (ui->tabWidget->currentWidget() == ui->attachPage) { + ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Attach")); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ui->attachPage->isValid()); + } else if (ui->tabWidget->currentWidget() == ui->launchPage) { + ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Launch")); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ui->launchPage->isValid()); + } else { + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); + } +} + +void LauncherWindow::accept() +{ + QSettings settings; + settings.setValue(QLatin1String("Launcher/TabIndex"), ui->tabWidget->currentIndex()); + + ui->launchPage->writeSettings(); + + QDialog::accept(); +} + +#include "launcherwindow.moc" diff --git a/mainwindow.h b/launcher/launcherwindow.h similarity index 57% copy from mainwindow.h copy to launcher/launcherwindow.h index 5b72d88..59c8058 100644 --- a/mainwindow.h +++ b/launcher/launcherwindow.h @@ -1,10 +1,10 @@ /* - mainwindow.h + launcherwindow.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,35 +21,39 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_LAUNCHERWINDOW_H +#define GAMMARAY_LAUNCHERWINDOW_H -#include - -#include "ui_mainwindow.h" - -class QComboBox; +#include namespace GammaRay { -class MainWindow : public QMainWindow +namespace Ui { + class LauncherWindow; +} + +class LauncherWindow : public QDialog { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit LauncherWindow(QWidget *parent = 0); + ~LauncherWindow(); - private slots: - void about(); - void aboutKDAB(); + /// returns the selected PID, if the attach page is active + QString pid() const; - void toolSelected(); + /// returns the command and arguments, if the launch page is active + QStringList launchArguments() const; - private: - void selectInitialTool(); + void accept(); + + private slots: + void tabChanged(); - Ui::MainWindow ui; + private: + Ui::LauncherWindow *ui; }; } -#endif // MAINWINDOW_H +#endif // GAMMARAY_LAUNCHERWINDOW_H diff --git a/launcher/launcherwindow.ui b/launcher/launcherwindow.ui new file mode 100644 index 0000000..fcb8a8f --- /dev/null +++ b/launcher/launcherwindow.ui @@ -0,0 +1,192 @@ + + + GammaRay::LauncherWindow + + + + 0 + 0 + 698 + 352 + + + + Dialog + + + + :/gammaray/GammaRay-128x128.png:/gammaray/GammaRay-128x128.png + + + + + + 0 + + + + Attach + + + + + Launch + + + + + Self Test + + + + + About + + + + + + + + + 0 + 0 + + + + + + + :/gammaray/GammaRay-128x128.png + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-weight:600;">GammaRay %1</span></p><p>The Qt application inspection and manipulation tool. Learn more at <a href="http://www.kdab.com/gammaray"><span style=" text-decoration: underline; color:#0057ae;">http://www.kdab.com/gammaray</span></a>.</p><p>Copyright (C) 2010-2012 Klarälvdalens Datakonsult AB, a KDAB Group company, <a href="mailto:info@kdab.com"><span style=" text-decoration: underline; color:#0057ae;">info@kdab.com</span></a></p><p><span style=" text-decoration: underline;">Authors:</span><br/>Allen Winter &lt;allen.winter@kdab.com&gt;<br/>Andreas Holzammer &lt;andreas.holzammer@kdab.com&gt;<br/>David Faure &lt;david.faure@kdab.com&gt;<br/>Kevin Funk &lt;kevin.funk@kdab.com&gt;<br/>Milian Wolff &lt;milian.wolff@kdab.com&gt;<br/>Patrick Spendrin &lt;patrick.spendrin@kdab.com&gt;<br/>Stephen Kelly &lt;stephen.kelly@kdab.com&gt;<br/>Till Adam &lt;till@kdab.com&gt;<br/>Thomas McGuire &lt;thomas.mcguire@kdab.com&gt;<br/>Tobias Koenig &lt;tobias.koenig@kdab.com&gt;<br/>Volker Krause &lt;volker.krause@kdab.com&gt;</p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + + + + + + + + + + 0 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close|QDialogButtonBox::Ok + + + + + + + + + + + GammaRay::PromoLabel + QWidget +
promolabel.h
+ 1 +
+ + GammaRay::AttachDialog + QWidget +
attachdialog.h
+ 1 +
+ + GammaRay::LaunchPage + QWidget +
launchpage.h
+ 1 +
+ + GammaRay::SelfTestPage + QWidget +
selftestpage.h
+ 1 +
+
+ + + + + + buttonBox + accepted() + GammaRay::LauncherWindow + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + GammaRay::LauncherWindow + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/launcher/launchpage.cpp b/launcher/launchpage.cpp new file mode 100644 index 0000000..f419e88 --- /dev/null +++ b/launcher/launchpage.cpp @@ -0,0 +1,126 @@ +/* + launchpage.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "launchpage.h" +#include "ui_launchpage.h" + +#include +#include +#include +#include +#include + +using namespace GammaRay; + +LaunchPage::LaunchPage(QWidget *parent) + : QWidget(parent), + ui(new Ui::LaunchPage), + m_argsModel(new QStringListModel(this)) +{ + ui->setupUi(this); + connect(ui->progSelectButton, SIGNAL(clicked()), SLOT(showFileDialog())); + connect(ui->addArgButton, SIGNAL(clicked()), SLOT(addArgument())); + connect(ui->removeArgButton, SIGNAL(clicked()), SLOT(removeArgument())); + connect(ui->progEdit, SIGNAL(textChanged(QString)), SIGNAL(updateButtonState())); + + ui->argsBox->setModel(m_argsModel); + + QCompleter *pathCompleter = new QCompleter(this); + QFileSystemModel *fsModel = new QFileSystemModel(this); + fsModel->setRootPath(QDir::rootPath()); + pathCompleter->setModel(fsModel); + ui->progEdit->setCompleter(pathCompleter); + + QSettings settings; + ui->progEdit->setText(settings.value(QLatin1String("Launcher/Program")).toString()); + m_argsModel->setStringList(settings.value(QLatin1String("Launcher/Arguments")).toStringList()); + updateArgumentButtons(); +} + +LaunchPage::~LaunchPage() +{ + delete ui; +} + +void LaunchPage::writeSettings() +{ + QSettings settings; + settings.setValue(QLatin1String("Launcher/Program"), ui->progEdit->text()); + settings.setValue(QLatin1String("Launcher/Arguments"), m_argsModel->stringList()); +} + +QStringList LaunchPage::launchArguments() const +{ + QStringList l; + l.push_back(ui->progEdit->text()); + l.append(m_argsModel->stringList()); + return l; +} + +void LaunchPage::showFileDialog() +{ + // TODO: add *.exe filter on Windows + const QString exeFilePath = + QFileDialog::getOpenFileName( + this, + tr("Executable to Launch"), + ui->progEdit->text()); + + if (exeFilePath.isEmpty()) { + return; + } + + ui->progEdit->setText(exeFilePath); +} + +void LaunchPage::addArgument() +{ + m_argsModel->insertRows(m_argsModel->rowCount(), 1); + const QModelIndex newIndex = m_argsModel->index(m_argsModel->rowCount() - 1, 0); + ui->argsBox->edit(newIndex); + updateArgumentButtons(); +} + +void LaunchPage::removeArgument() +{ + // TODO check if there's a selection at all and update button state accordingly + m_argsModel->removeRows(ui->argsBox->currentIndex().row(), 1); + updateArgumentButtons(); +} + +bool LaunchPage::isValid() +{ + if (ui->progEdit->text().isEmpty()) { + return false; + } + + const QFileInfo fi(ui->progEdit->text()); + return fi.exists() && fi.isFile() && fi.isExecutable(); +} + +void LaunchPage::updateArgumentButtons() +{ + ui->removeArgButton->setEnabled(m_argsModel->rowCount() > 0); +} + +#include "launchpage.moc" diff --git a/mainwindow.h b/launcher/launchpage.h similarity index 56% copy from mainwindow.h copy to launcher/launchpage.h index 5b72d88..ab4a1e1 100644 --- a/mainwindow.h +++ b/launcher/launchpage.h @@ -1,10 +1,10 @@ /* - mainwindow.h + launchpage.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,35 +21,45 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_LAUNCHPAGE_H +#define GAMMARAY_LAUNCHPAGE_H -#include +#include -#include "ui_mainwindow.h" - -class QComboBox; +class QStringListModel; namespace GammaRay { -class MainWindow : public QMainWindow +namespace Ui { + class LaunchPage; +} + +class LaunchPage : public QWidget { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit LaunchPage(QWidget *parent = 0); + ~LaunchPage(); - private slots: - void about(); - void aboutKDAB(); + QStringList launchArguments() const; + bool isValid(); - void toolSelected(); + void writeSettings(); - private: - void selectInitialTool(); + signals: + void updateButtonState(); + + private slots: + void showFileDialog(); + void addArgument(); + void removeArgument(); + void updateArgumentButtons(); - Ui::MainWindow ui; + private: + Ui::LaunchPage *ui; + QStringListModel *m_argsModel; }; } -#endif // MAINWINDOW_H +#endif // GAMMARAY_LAUNCHPAGE_H diff --git a/launcher/launchpage.ui b/launcher/launchpage.ui new file mode 100644 index 0000000..dc50ea3 --- /dev/null +++ b/launcher/launchpage.ui @@ -0,0 +1,89 @@ + + + GammaRay::LaunchPage + + + + 0 + 0 + 401 + 280 + + + + Form + + + + + + + + &Executable: + + + progEdit + + + + + + + + + + ... + + + + + + + + + &Program arguments: + + + argsBox + + + + + + + + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 170 + + + + + + + + + + + diff --git a/main.cpp b/launcher/main.cpp similarity index 92% rename from main.cpp rename to launcher/main.cpp index 26e3d40..cd90fd5 100644 --- a/main.cpp +++ b/launcher/main.cpp @@ -25,11 +25,12 @@ #include "config-gammaray-version.h" #include "probefinder.h" #include "injector/injectorfactory.h" -#include "attach/attachdialog.h" +#include "launcherwindow.h" #include #include #include +#include using namespace GammaRay; @@ -63,6 +64,10 @@ static void usage(const char *argv0) int main(int argc, char **argv) { + QApplication::setOrganizationName("KDAB"); + QApplication::setOrganizationDomain("kdab.com"); + QApplication::setApplicationName("GammaRay"); + QApplication app(argc, argv); QStringList args = app.arguments(); args.takeFirst(); // that's us @@ -85,7 +90,7 @@ int main(int argc, char **argv) } if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) { out << PROGRAM_NAME << " version " << GAMMARAY_VERSION_STRING << endl; - out << "Copyright (C) 2010-2011 Klaralvdalens Datakonsult AB, " + out << "Copyright (C) 2010-2012 Klaralvdalens Datakonsult AB, " << "a KDAB Group company, info@kdab.com" << endl; return 0; } @@ -101,11 +106,12 @@ int main(int argc, char **argv) } if (args.isEmpty() && pid <= 0) { - AttachDialog dialog; + LauncherWindow dialog; if (dialog.exec() == QDialog::Accepted) { + args = dialog.launchArguments(); bool ok; pid = dialog.pid().toInt(&ok); - if (!ok) { + if (!ok && args.isEmpty()) { return 0; } } else { @@ -114,6 +120,8 @@ int main(int argc, char **argv) } const QString probeDll = ProbeFinder::findProbe(QLatin1String("gammaray_probe")); + qputenv("GAMMARAY_PROBE_PATH", QFileInfo(probeDll).absolutePath().toLocal8Bit()); + AbstractInjector::Ptr injector; if (injectorType.isEmpty()) { if (pid > 0) { diff --git a/probefinder.cpp b/launcher/probefinder.cpp similarity index 100% rename from probefinder.cpp rename to launcher/probefinder.cpp diff --git a/probefinder.h b/launcher/probefinder.h similarity index 100% copy from probefinder.h copy to launcher/probefinder.h diff --git a/attach/processfiltermodel.cpp b/launcher/processfiltermodel.cpp similarity index 99% rename from attach/processfiltermodel.cpp rename to launcher/processfiltermodel.cpp index 5554885..7a1d3a1 100644 --- a/attach/processfiltermodel.cpp +++ b/launcher/processfiltermodel.cpp @@ -36,6 +36,7 @@ static QString qGetLogin() { return QString::fromLocal8Bit(winUserName); } #else +#include static QString qGetLogin(){ return QString::fromLocal8Bit(getlogin()); } diff --git a/attach/processfiltermodel.h b/launcher/processfiltermodel.h similarity index 100% rename from attach/processfiltermodel.h rename to launcher/processfiltermodel.h diff --git a/attach/processlist.h b/launcher/processlist.h similarity index 92% rename from attach/processlist.h rename to launcher/processlist.h index f9acc5b..9baa858 100644 --- a/attach/processlist.h +++ b/launcher/processlist.h @@ -30,8 +30,8 @@ ** **************************************************************************/ -#ifndef PROCESSLIST_H -#define PROCESSLIST_H +#ifndef GAMMARAY_PROCESSLIST_H +#define GAMMARAY_PROCESSLIST_H #include #include @@ -43,6 +43,7 @@ struct ProcData QString image; QString state; QString user; + enum AppType { Unknown, QtApp, @@ -58,6 +59,6 @@ struct ProcData typedef QList ProcDataList; -extern ProcDataList processList(); +extern ProcDataList processList(const ProcDataList &previous); #endif // PROCESSLIST_H diff --git a/launcher/processlist_unix.cpp b/launcher/processlist_unix.cpp new file mode 100644 index 0000000..cb2dabd --- /dev/null +++ b/launcher/processlist_unix.cpp @@ -0,0 +1,209 @@ +/************************************************************************** +** +** This code is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "processlist.h" + +#include +#include + +#include +#include + +static bool isUnixProcessId(const QString &procname) +{ + for (int i = 0; i != procname.size(); ++i) { + if (!procname.at(i).isDigit()) { + return false; + } + } + return true; +} + +static bool processIsQtApp(const QString &pid) +{ + QProcess lsofProcess; + QStringList args; + args << QLatin1String("-Fn") << QLatin1String("-n") << QLatin1String("-p") << pid; + lsofProcess.start(QLatin1String("lsof"), args); + if (!lsofProcess.waitForStarted()) { + return false; + } + + lsofProcess.waitForFinished(); + const QByteArray output = lsofProcess.readAllStandardOutput(); + + if (output.contains("QtCore")) { + return true; + } + + return false; +} + +struct PidAndNameMatch : public std::unary_function { + + explicit PidAndNameMatch(const QString &ppid, const QString &name) + : m_ppid(ppid), m_name(name) + { + } + + bool operator()(const ProcData &p) const + { + return p.ppid == m_ppid && m_name == p.name; + } + + const QString m_ppid; + const QString m_name; +}; + +// Determine UNIX processes by running ps +static ProcDataList unixProcessListPS(const ProcDataList &previous) +{ +#ifdef Q_OS_MAC + // command goes last, otherwise it is cut off + static const char formatC[] = "pid state user command"; +#else + static const char formatC[] = "pid,state,user,cmd"; +#endif + ProcDataList rc; + QProcess psProcess; + QStringList args; + args << QLatin1String("-e") << QLatin1String("-o") << QLatin1String(formatC); + psProcess.start(QLatin1String("ps"), args); + if (!psProcess.waitForStarted()) { + return rc; + } + psProcess.waitForFinished(); + QByteArray output = psProcess.readAllStandardOutput(); + // Split "457 S+ /Users/foo.app" + const QStringList lines = QString::fromLocal8Bit(output).split(QLatin1Char('\n')); + const int lineCount = lines.size(); + const QChar blank = QLatin1Char(' '); + for (int l = 1; l < lineCount; l++) { // Skip header + const QString line = lines.at(l).simplified(); + // we can't just split on blank as the process name might + // contain them + const int endOfPid = line.indexOf(blank); + const int endOfState = line.indexOf(blank, endOfPid+1); + const int endOfUser = line.indexOf(blank, endOfState+1); + if (endOfPid >= 0 && endOfState >= 0 && endOfUser >= 0) { + ProcData procData; + procData.ppid = line.left(endOfPid); + procData.state = line.mid(endOfPid+1, endOfState-endOfPid-1); + procData.user = line.mid(endOfState+1, endOfUser-endOfState-1); + procData.name = line.right(line.size()-endOfUser-1); + ProcDataList::ConstIterator it = + std::find_if(previous.constBegin(), previous.constEnd(), + PidAndNameMatch(procData.ppid, procData.name)); + if (it != previous.constEnd()) { + procData.type = it->type; + } else { + procData.type = processIsQtApp(procData.ppid) ? + ProcData::QtApp : + ProcData::NoQtApp; + } + rc.push_back(procData); + } + } + + return rc; +} + +// Determine UNIX processes by reading "/proc". Default to ps if +// it does not exist +ProcDataList processList(const ProcDataList &previous) +{ + const QDir procDir(QLatin1String("/proc/")); + if (!procDir.exists()) { + return unixProcessListPS(previous); + } + ProcDataList rc; + const QStringList procIds = procDir.entryList(); + if (procIds.isEmpty()) { + return rc; + } + foreach (const QString &procId, procIds) { + if (!isUnixProcessId(procId)) { + continue; + } + QString filename = QLatin1String("/proc/"); + filename += procId; + filename += QLatin1String("/stat"); + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) { + continue; // process may have exited + } + + const QStringList data = QString::fromLocal8Bit(file.readAll()).split(' '); + ProcData proc; + proc.ppid = procId; + proc.name = data.at(1); + if (proc.name.startsWith(QLatin1Char('(')) && proc.name.endsWith(QLatin1Char(')'))) { + proc.name.truncate(proc.name.size() - 1); + proc.name.remove(0, 1); + } + proc.state = data.at(2); + // PPID is element 3 + + proc.user = QFileInfo(file).owner(); + file.close(); + + QFile cmdFile(QLatin1String("/proc/") + procId + QLatin1String("/cmdline")); + if(cmdFile.open(QFile::ReadOnly)) { + QByteArray cmd = cmdFile.readAll(); + cmd.replace('\0', ' '); + if (!cmd.isEmpty()) { + proc.name = QString::fromLocal8Bit(cmd); + } + } + cmdFile.close(); + + QFile maps(QLatin1String("/proc/") + procId + QLatin1String("/maps")); + if (!maps.open(QIODevice::ReadOnly)) { + continue; // process may have exited + } + + proc.type = ProcData::NoQtApp; + forever { + const QByteArray line = maps.readLine(); + if (line.isEmpty()) { + break; + } + if (line.contains(QByteArray("/libQtCore.so"))) { + proc.type = ProcData::QtApp; + break; + } + } + + rc.push_back(proc); + } + return rc; +} diff --git a/launcher/processlist_win.cpp b/launcher/processlist_win.cpp new file mode 100644 index 0000000..4a1c0c6 --- /dev/null +++ b/launcher/processlist_win.cpp @@ -0,0 +1,183 @@ +/************************************************************************** +** +** This code is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "processlist.h" + +#include + +// Enable Win API of XP SP1 and later +#ifdef Q_OS_WIN +# define _WIN32_WINNT 0x0502 +# include +# if !defined(PROCESS_SUSPEND_RESUME) // Check flag for MinGW +# define PROCESS_SUSPEND_RESUME (0x0800) +# endif // PROCESS_SUSPEND_RESUME +#endif // Q_OS_WIN + +#include +#include +// Resolve QueryFullProcessImageNameW out of kernel32.dll due +// to incomplete MinGW import libs and it not being present +// on Windows XP. +static inline BOOL queryFullProcessImageName(HANDLE h, + DWORD flags, + LPWSTR buffer, + DWORD *size) +{ + // Resolve required symbols from the kernel32.dll + typedef BOOL (WINAPI *QueryFullProcessImageNameWProtoType)(HANDLE, DWORD, LPWSTR, PDWORD); + static QueryFullProcessImageNameWProtoType queryFullProcessImageNameW = 0; + if (!queryFullProcessImageNameW) { + QLibrary kernel32Lib(QLatin1String("kernel32.dll"), 0); + if (kernel32Lib.isLoaded() || kernel32Lib.load()) { + queryFullProcessImageNameW = + (QueryFullProcessImageNameWProtoType)kernel32Lib.resolve("QueryFullProcessImageNameW"); + } + } + if (!queryFullProcessImageNameW) { + return FALSE; + } + // Read out process + return (*queryFullProcessImageNameW)(h, flags, buffer, size); +} + +struct ProcessInfo { + QString imageName; + QString processOwner; +}; + +static inline ProcessInfo processInfo(DWORD processId) +{ + ProcessInfo pi; + HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION, TOKEN_READ, processId); + if (handle == INVALID_HANDLE_VALUE) { + return pi; + } + WCHAR buffer[MAX_PATH]; + DWORD bufSize = MAX_PATH; + if (queryFullProcessImageName(handle, 0, buffer, &bufSize)) { + pi.imageName = QString::fromUtf16(reinterpret_cast(buffer)); + } + + HANDLE processTokenHandle = NULL; + if (!OpenProcessToken(handle, TOKEN_READ, &processTokenHandle) || !processTokenHandle) { + return pi; + } + + DWORD size = 0; + GetTokenInformation(processTokenHandle, TokenUser, NULL, 0, &size); + + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + QByteArray buf; + buf.resize(size); + PTOKEN_USER userToken = reinterpret_cast(buf.data()); + if (userToken && GetTokenInformation(processTokenHandle, TokenUser, userToken, size, &size)) { + SID_NAME_USE sidNameUse; + TCHAR user[MAX_PATH] = { 0 }; + DWORD userNameLength = MAX_PATH; + TCHAR domain[MAX_PATH] = { 0 }; + DWORD domainNameLength = MAX_PATH; + + if (LookupAccountSid(NULL, + userToken->User.Sid, + user, + &userNameLength, + domain, + &domainNameLength, + &sidNameUse)) { + pi.processOwner = QString::fromUtf16(reinterpret_cast(user)); + } + } + } + + CloseHandle(processTokenHandle); + CloseHandle(handle); + return pi; +} + +static inline bool isQtApp(DWORD processId) +{ + MODULEENTRY32 me; + me.dwSize = sizeof(MODULEENTRY32); + HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processId); + if (snapshot == INVALID_HANDLE_VALUE) { + return false; + } + + for (bool hasNext = Module32First(snapshot, &me); + hasNext; + hasNext = Module32Next(snapshot, &me)) { + const QString module = QString::fromUtf16(reinterpret_cast(me.szModule)); +//TODO: Do this check properly, probe does not need to have the same type +#ifdef NDEBUG + if (module == QLatin1String("QtCore4.dll")) { +#else + if (module == QLatin1String("QtCored4.dll")) { +#endif + CloseHandle(snapshot); + return true; + } + CloseHandle(snapshot); + return false; + } +} + +ProcDataList processList(const ProcDataList &previous) +{ + ProcDataList rc; + + PROCESSENTRY32 pe; + pe.dwSize = sizeof(PROCESSENTRY32); + HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (snapshot == INVALID_HANDLE_VALUE) { + return rc; + } + + for (bool hasNext = Process32First(snapshot, &pe); + hasNext; + hasNext = Process32Next(snapshot, &pe)) { + ProcData procData; + procData.ppid = QString::number(pe.th32ProcessID); + procData.name = QString::fromUtf16(reinterpret_cast(pe.szExeFile)); + const ProcessInfo processInf = processInfo(pe.th32ProcessID); + procData.image = processInf.imageName; + procData.user = processInf.processOwner; + if (isQtApp(pe.th32ProcessID)) { + procData.type = ProcData::QtApp; + } else { + procData.type = ProcData::NoQtApp; + } + rc.push_back(procData); + } + CloseHandle(snapshot); + return rc; +} diff --git a/attach/processmodel.cpp b/launcher/processmodel.cpp similarity index 98% rename from attach/processmodel.cpp rename to launcher/processmodel.cpp index b2ca1a1..59c0e2c 100644 --- a/attach/processmodel.cpp +++ b/launcher/processmodel.cpp @@ -189,3 +189,7 @@ int ProcessModel::rowCount(const QModelIndex &parent) const return parent.isValid() ? 0 : m_data.count(); } +ProcDataList ProcessModel::processes() const +{ + return m_data; +} diff --git a/attach/processmodel.h b/launcher/processmodel.h similarity index 98% rename from attach/processmodel.h rename to launcher/processmodel.h index a1d6645..43e86e3 100644 --- a/attach/processmodel.h +++ b/launcher/processmodel.h @@ -42,6 +42,8 @@ class ProcessModel : public QAbstractTableModel ProcData dataForRow(int row) const; QModelIndex indexForPid(const QString &pid) const; + ProcDataList processes() const; + void clear(); enum Columns { diff --git a/promolabel.cpp b/launcher/promolabel.cpp similarity index 100% rename from promolabel.cpp rename to launcher/promolabel.cpp diff --git a/promolabel.h b/launcher/promolabel.h similarity index 95% copy from promolabel.h copy to launcher/promolabel.h index dafb851..6739c40 100644 --- a/promolabel.h +++ b/launcher/promolabel.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef PROMOLABEL_H -#define PROMOLABEL_H +#ifndef GAMMARAY_PROMOLABEL_H +#define GAMMARAY_PROMOLABEL_H #include diff --git a/launcher/selftestpage.cpp b/launcher/selftestpage.cpp new file mode 100644 index 0000000..49a97b9 --- /dev/null +++ b/launcher/selftestpage.cpp @@ -0,0 +1,118 @@ +/* + selftestpage.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "selftestpage.h" +#include "ui_selftestpage.h" +#include "probefinder.h" + +#include +#include +#include + +using namespace GammaRay; + +SelfTestPage::SelfTestPage(QWidget *parent) + : QWidget(parent), ui(new Ui::SelfTestPage), m_resultModel(new QStandardItemModel(this)) +{ + ui->setupUi(this); + ui->resultView->setModel(m_resultModel); + run(); +} + +SelfTestPage::~SelfTestPage() +{ + delete ui; +} + +void SelfTestPage::run() +{ + m_resultModel->clear(); + testProbe(); + testAvailableInjectors(); + testInjectors(); +} + +void SelfTestPage::testProbe() +{ + const QString probePath = ProbeFinder::findProbe(QLatin1String("gammaray_probe")); + if (probePath.isEmpty()) { + error(tr("No probe found - GammaRay not functional.")); + return; + } + + QFileInfo fi(probePath); + if (!fi.exists() || !fi.isFile() || !fi.isReadable()) { + error(tr("Probe at %1 is invalid - GammaRay not functional.")); + return; + } + + information(tr("Found valid probe at %1.").arg(probePath)); +} + +void SelfTestPage::testAvailableInjectors() +{ + const QStringList injectors = InjectorFactory::availableInjectors(); + if (injectors.isEmpty()) { + error(tr("No injectors available - GammaRay not functional.")); + return; + } + + information(tr("The following injectors are available: %1"). + arg(injectors.join(QLatin1String(", ")))); +} + +void SelfTestPage::testInjectors() +{ + foreach (const QString &injectorType, InjectorFactory::availableInjectors()) { + AbstractInjector::Ptr injector = InjectorFactory::createInjector(injectorType); + if (!injector) { + error(tr("Unable to create instance of injector %1.").arg(injectorType)); + continue; + } + if (injector->selfTest()) { + information(tr("Injector %1 successfully passed its self-test."). + arg(injectorType)); + } else { + error(tr("Injector %1 failed to pass its self-test: %2."). + arg(injectorType, injector->errorString())); + } + } +} + +void SelfTestPage::error(const QString &msg) +{ + QStandardItem *item = new QStandardItem; + item->setText(msg); + item->setIcon(style()->standardIcon(QStyle::SP_MessageBoxCritical)); + m_resultModel->appendRow(item); +} + +void SelfTestPage::information(const QString &msg) +{ + QStandardItem *item = new QStandardItem; + item->setText(msg); + item->setIcon(style()->standardIcon(QStyle::SP_MessageBoxInformation)); + m_resultModel->appendRow(item); +} + +#include "selftestpage.moc" diff --git a/mainwindow.h b/launcher/selftestpage.h similarity index 56% copy from mainwindow.h copy to launcher/selftestpage.h index 5b72d88..ee2a832 100644 --- a/mainwindow.h +++ b/launcher/selftestpage.h @@ -1,10 +1,10 @@ /* - mainwindow.h + selftestpage.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,35 +21,42 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_SELFTESTPAGE_H +#define GAMMARAY_SELFTESTPAGE_H -#include +#include -#include "ui_mainwindow.h" - -class QComboBox; +class QStandardItemModel; namespace GammaRay { -class MainWindow : public QMainWindow +namespace Ui { + class SelfTestPage; +} + +class SelfTestPage : public QWidget { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit SelfTestPage(QWidget *parent = 0); + ~SelfTestPage(); - private slots: - void about(); - void aboutKDAB(); - - void toolSelected(); + public slots: + void run(); private: - void selectInitialTool(); + void testProbe(); + void testAvailableInjectors(); + void testInjectors(); + + void error(const QString &msg); + void information(const QString &msg); - Ui::MainWindow ui; + private: + Ui::SelfTestPage *ui; + QStandardItemModel *m_resultModel; }; } -#endif // MAINWINDOW_H +#endif // GAMMARAY_SELFTESTPAGE_H diff --git a/launcher/selftestpage.ui b/launcher/selftestpage.ui new file mode 100644 index 0000000..5d621eb --- /dev/null +++ b/launcher/selftestpage.ui @@ -0,0 +1,24 @@ + + + GammaRay::SelfTestPage + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/splashscreen.cpp b/launcher/splashscreen.cpp similarity index 100% copy from splashscreen.cpp copy to launcher/splashscreen.cpp diff --git a/splashscreen.h b/launcher/splashscreen.h similarity index 93% copy from splashscreen.h copy to launcher/splashscreen.h index 1181348..9168abd 100644 --- a/splashscreen.h +++ b/launcher/splashscreen.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef SPLASHSCREEN_H -#define SPLASHSCREEN_H +#ifndef GAMMARAY_SPLASHSCREEN_H +#define GAMMARAY_SPLASHSCREEN_H namespace GammaRay { diff --git a/mainwindow.cpp b/mainwindow.cpp index a536664..f8cbdab 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -34,11 +34,11 @@ #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include @@ -80,7 +80,19 @@ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) // hide unused tool bar for now ui.mainToolBar->setHidden(true); - setWindowTitle(tr("%1 (%2)").arg(progName).arg(qApp->applicationName())); + QString appName = qApp->applicationName(); + if (appName.isEmpty() && !qApp->arguments().isEmpty()) { + appName = qApp->arguments().first().remove(qApp->applicationDirPath()); + if (appName.startsWith('.')) { + appName = appName.right(appName.length() - 1); + } + if (appName.startsWith('/')) { + appName = appName.right(appName.length() - 1); + } + } else { + appName = tr("PID %1").arg(qApp->applicationPid()); + } + setWindowTitle(tr("%1 (%2)").arg(progName).arg(appName)); selectInitialTool(); @@ -94,10 +106,9 @@ void MainWindow::about() mb.setWindowTitle(tr("About %1").arg(progName)); mb.setText(tr("%1 %2

%3").arg(progName).arg(progVersion).arg(progDesc)); mb.setInformativeText( - trUtf8("

Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, " + trUtf8("

Copyright (C) 2010-2012 Klarälvdalens Datakonsult AB, " "a KDAB Group company, info@kdab.com

" "

Authors:
" - "Volker Krause <volker.krause@kdab.com> (Head Engineer)
" "Allen Winter <allen.winter@kdab.com>
" "Andreas Holzammer <andreas.holzammer@kdab.com>
" "David Faure <david.faure@kdab.com>
" @@ -106,7 +117,9 @@ void MainWindow::about() "Patrick Spendrin <patrick.spendrin@kdab.com>
" "Stephen Kelly <stephen.kelly@kdab.com>
" "Till Adam <till@kdab.com>
" - "Tobias Koenig <tobias.koenig@kdab.com>

")); + "Thomas McGuire <thomas.mcguire@kdab.com>
" + "Tobias Koenig <tobias.koenig@kdab.com>
" + "Volker Krause <volker.krause@kdab.com>

")); mb.setIconPixmap(QPixmap(":gammaray/GammaRay-128x128.png")); mb.addButton(QMessageBox::Close); mb.exec(); @@ -149,6 +162,7 @@ void MainWindow::selectInitialTool() void MainWindow::toolSelected() { + ui.actionsMenu->clear(); const int row = ui.toolSelector->currentIndex().row(); if (row == -1) { return; @@ -162,11 +176,18 @@ void MainWindow::toolSelected() // qDebug() << Q_FUNC_INFO << "creating new probe: " // << toolIface->name() << toolIface->supportedTypes(); toolWidget = toolIface->createWidget(Probe::instance(), this); - toolWidget->layout()->setContentsMargins(11, 0, 0, 0); + if (toolWidget->layout()) { + toolWidget->layout()->setContentsMargins(11, 0, 0, 0); + } ui.toolStack->addWidget(toolWidget); ui.toolSelector->model()->setData(mi, QVariant::fromValue(toolWidget)); } ui.toolStack->setCurrentIndex(ui.toolStack->indexOf(toolWidget)); + + foreach (QAction *action, toolWidget->actions()) { + ui.actionsMenu->addAction(action); + } + ui.actionsMenu->setEnabled(!ui.actionsMenu->isEmpty()); } #include "mainwindow.moc" diff --git a/mainwindow.h b/mainwindow.h index 5b72d88..24d90c4 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_MAINWINDOW_H +#define GAMMARAY_MAINWINDOW_H #include diff --git a/mainwindow.ui b/mainwindow.ui index 1a25a8f..b56eee3 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -98,7 +98,7 @@ background-position:bottom right; 0 0 829 - 21 + 20 @@ -117,7 +117,13 @@ background-position:bottom right; + + + &Actions + + + @@ -142,7 +148,7 @@ background-position:bottom right; - &Retract Probe + &Detach Retract probe from application. diff --git a/metaobject.cpp b/metaobject.cpp new file mode 100644 index 0000000..ee5d799 --- /dev/null +++ b/metaobject.cpp @@ -0,0 +1,94 @@ +/* + metaobject.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "metaobject.h" + +using namespace GammaRay; + +MetaObject::MetaObject() +{ +} + +MetaObject::~MetaObject() +{ + qDeleteAll(m_properties); +} + +int MetaObject::propertyCount() const +{ + int count = 0; + foreach (MetaObject *mo, m_baseClasses) { + count += mo->propertyCount(); + } + return count + m_properties.size(); +} + +MetaProperty *MetaObject::propertyAt(int index) const +{ + foreach (MetaObject *mo, m_baseClasses) { + if (index >= mo->propertyCount()) { + index -= mo->propertyCount(); + } else { + return mo->propertyAt(index); + } + } + Q_ASSERT(index >= 0 && index < m_properties.size()); + return m_properties.at(index); +} + +void MetaObject::addBaseClass(MetaObject *baseClass) +{ + Q_ASSERT(baseClass); + m_baseClasses.push_back(baseClass); +} + +void MetaObject::addProperty(MetaProperty *property) +{ + Q_ASSERT(property); + // TODO: sort + property->setMetaObject(this); + m_properties.push_back(property); +} + +QString MetaObject::className() const +{ + return m_className; +} + +void MetaObject::setClassName(const QString &className) +{ + m_className = className; +} + +void *MetaObject::castForPropertyAt(void *object, int index) const +{ + for (int i = 0; i < m_baseClasses.size(); ++i) { + const MetaObject *base = m_baseClasses.at(i); + if (index >= base->propertyCount()) { + index -= base->propertyCount(); + } else { + return base->castForPropertyAt(castToBaseClass(object, i), index); + } + } + return object; // our own property +} diff --git a/metaobject.h b/metaobject.h new file mode 100644 index 0000000..dd50160 --- /dev/null +++ b/metaobject.h @@ -0,0 +1,106 @@ +/* + metaobject.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_METAOBJECT_H +#define GAMMARAY_METAOBJECT_H + +#include "metaproperty.h" + +#include + +namespace GammaRay { + +/** Compile-time introspection adaptor for non-QObject classes. */ +class MetaObject +{ + public: + MetaObject(); + virtual ~MetaObject(); + + /** + * Returns the amount of properties available in this class (including base classes). + */ + int propertyCount() const; + + /** + * Returns the property adaptor for index @p index. + */ + MetaProperty *propertyAt(int index) const; + + /** Add a base class meta object. */ + void addBaseClass(MetaObject *baseClass); + + /** Add a property for this class. This transfers ownership. */ + void addProperty(MetaProperty *property); + + /// Returns the name of the class represented by this object. + QString className() const; + + /** Casts a void pointer for an instance of this type to one appropriate + * for use with the property at index @p index. + * Make sure to use this when dealing with multi-inheritance. + */ + void *castForPropertyAt(void *object, int index) const; + + protected: + /** Casts down to base class @p baseClassIndex. + * This is important when traversing multi-inheritance trees. + */ + virtual void *castToBaseClass(void *object, int baseClassIndex) const = 0; + + protected: + QVector m_baseClasses; + + private: + friend class MetaObjectRepository; + void setClassName(const QString &className); + + private: + QVector m_properties; + QString m_className; +}; + +/** Template implementation of MetaObject. */ +template +class MetaObjectImpl : public MetaObject +{ + public: + void *castToBaseClass(void *object, int baseClassIndex) const + { + Q_ASSERT(baseClassIndex >= 0 && baseClassIndex < m_baseClasses.size()); + switch (baseClassIndex) { + case 0: + return static_cast(static_cast(object)); + case 1: + return static_cast(static_cast(object)); + case 2: + return static_cast(static_cast(object)); + } + Q_ASSERT(!"WTF!?"); + return 0; + } +}; + +} + +#endif // GAMMARAY_METAOBJECT_H diff --git a/metaobjectrepository.cpp b/metaobjectrepository.cpp new file mode 100644 index 0000000..4c3d9b3 --- /dev/null +++ b/metaobjectrepository.cpp @@ -0,0 +1,261 @@ +/* + metaobjectrepository.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "metaobjectrepository.h" +#include "metaobject.h" +#include "metatypedeclarations.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MO_ADD_BASECLASS(Base) \ + Q_ASSERT( hasMetaObject( QLatin1String( #Base ) ) ); \ + mo->addBaseClass( metaObject( QLatin1String( #Base ) ) ); + +#define MO_ADD_METAOBJECT0(Class) \ + mo = new MetaObjectImpl; \ + mo->setClassName( QLatin1String( #Class ) ); \ + addMetaObject(mo); + +#define MO_ADD_METAOBJECT1(Class, Base1) \ + mo = new MetaObjectImpl; \ + mo->setClassName( QLatin1String( #Class ) ); \ + MO_ADD_BASECLASS( Base1 ) \ + addMetaObject(mo); + +#define MO_ADD_METAOBJECT2(Class, Base1, Base2) \ + mo = new MetaObjectImpl; \ + mo->setClassName( QLatin1String( #Class ) ); \ + MO_ADD_BASECLASS( Base1 ) \ + MO_ADD_BASECLASS( Base2 ) \ + addMetaObject(mo); + +#define MO_ADD_PROPERTY(Class, Type, Getter, Setter) \ + mo->addProperty( new MetaPropertyImpl( \ + QLatin1String( #Getter ), \ + &Class::Getter, \ + static_cast(&Class::Setter) ) \ + ); + +#define MO_ADD_PROPERTY_CR(Class, Type, Getter, Setter) \ + mo->addProperty( new MetaPropertyImpl( \ + QLatin1String( #Getter ), \ + &Class::Getter, \ + static_cast(&Class::Setter) ) \ + ); + +#define MO_ADD_PROPERTY_RO(Class, Type, Getter) \ + mo->addProperty( new MetaPropertyImpl( \ + QLatin1String( #Getter ), \ + &Class::Getter ) ); + +using namespace GammaRay; + +namespace GammaRay { + +class StaticMetaObjectRepository : public MetaObjectRepository +{ + public: + StaticMetaObjectRepository() : MetaObjectRepository() {} +}; + +} + +Q_GLOBAL_STATIC(StaticMetaObjectRepository, s_instance) + +MetaObjectRepository::MetaObjectRepository() +{ + initBuiltInTypes(); +} + +MetaObjectRepository::~MetaObjectRepository() +{ + qDeleteAll(m_metaObjects); +} + +void MetaObjectRepository::initBuiltInTypes() +{ + initQObjectTypes(); + initGraphicsViewTypes(); +} + +void MetaObjectRepository::initQObjectTypes() +{ + MetaObject *mo = 0; + MO_ADD_METAOBJECT0(QObject); + MO_ADD_PROPERTY_RO(QObject, bool, signalsBlocked); // TODO setter has non-void return type + + MO_ADD_METAOBJECT0(QPaintDevice); + MO_ADD_PROPERTY_RO(QPaintDevice, int, colorCount); + MO_ADD_PROPERTY_RO(QPaintDevice, int, heightMM); + MO_ADD_PROPERTY_RO(QPaintDevice, int, logicalDpiX); + MO_ADD_PROPERTY_RO(QPaintDevice, int, logicalDpiY); + MO_ADD_PROPERTY_RO(QPaintDevice, bool, paintingActive); + MO_ADD_PROPERTY_RO(QPaintDevice, int, physicalDpiX); + MO_ADD_PROPERTY_RO(QPaintDevice, int, physicalDpiY); + MO_ADD_PROPERTY_RO(QPaintDevice, int, widthMM); + + MO_ADD_METAOBJECT2(QWidget, QObject, QPaintDevice); + MO_ADD_PROPERTY_RO(QWidget, QWidget*, focusProxy); + + MO_ADD_METAOBJECT1(QStyle, QObject); + MO_ADD_PROPERTY_RO(QStyle, const QStyle*, proxy); + MO_ADD_PROPERTY_RO(QStyle, QPalette, standardPalette); +} + +void MetaObjectRepository::initGraphicsViewTypes() +{ + MetaObject *mo = 0; //createMetaObject( "QGraphicsItem" ); + MO_ADD_METAOBJECT0(QGraphicsItem); + MO_ADD_PROPERTY (QGraphicsItem, bool, acceptDrops, setAcceptDrops); + MO_ADD_PROPERTY (QGraphicsItem, bool, acceptHoverEvents, setAcceptHoverEvents); + MO_ADD_PROPERTY (QGraphicsItem, bool, acceptTouchEvents, setAcceptTouchEvents); + MO_ADD_PROPERTY (QGraphicsItem, Qt::MouseButtons, acceptedMouseButtons, setAcceptedMouseButtons); + MO_ADD_PROPERTY_RO(QGraphicsItem, QRectF, boundingRect); + MO_ADD_PROPERTY (QGraphicsItem, qreal, boundingRegionGranularity, setBoundingRegionGranularity); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItem::CacheMode, cacheMode); + MO_ADD_PROPERTY_RO(QGraphicsItem, QRectF, childrenBoundingRect); + MO_ADD_PROPERTY_RO(QGraphicsItem, QPainterPath, clipPath); + MO_ADD_PROPERTY_CR(QGraphicsItem, QCursor, cursor, setCursor); + MO_ADD_PROPERTY_RO(QGraphicsItem, qreal, effectiveOpacity); + MO_ADD_PROPERTY (QGraphicsItem, bool, filtersChildEvents, setFiltersChildEvents); + MO_ADD_PROPERTY (QGraphicsItem, QGraphicsItem::GraphicsItemFlags, flags, setFlags); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItem*, focusItem); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItem*, focusProxy); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsEffect*, graphicsEffect); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItemGroup*, group); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, hasCursor); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, hasFocus); + MO_ADD_PROPERTY (QGraphicsItem, Qt::InputMethodHints, inputMethodHints, setInputMethodHints); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isActive); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isClipped); + MO_ADD_PROPERTY (QGraphicsItem, bool, isEnabled, setEnabled); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isObscured); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isPanel); + MO_ADD_PROPERTY (QGraphicsItem, bool, isSelected, setSelected); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isUnderMouse); + MO_ADD_PROPERTY (QGraphicsItem, bool, isVisible, setVisible); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isWidget); + MO_ADD_PROPERTY_RO(QGraphicsItem, bool, isWindow); + MO_ADD_PROPERTY (QGraphicsItem, qreal, opacity, setOpacity); + MO_ADD_PROPERTY_RO(QGraphicsItem, QPainterPath, opaqueArea); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItem*, panel); + MO_ADD_PROPERTY (QGraphicsItem, QGraphicsItem::PanelModality, panelModality, setPanelModality); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItem*, parentItem); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsObject*, parentObject); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsWidget*, parentWidget); + MO_ADD_PROPERTY_CR(QGraphicsItem, QPointF, pos, setPos); + MO_ADD_PROPERTY (QGraphicsItem, qreal, rotation, setRotation); + MO_ADD_PROPERTY (QGraphicsItem, qreal, scale, setScale); + MO_ADD_PROPERTY_RO(QGraphicsItem, QRectF, sceneBoundingRect); + MO_ADD_PROPERTY_RO(QGraphicsItem, QPointF, scenePos); + MO_ADD_PROPERTY_RO(QGraphicsItem, QTransform, sceneTransform); + MO_ADD_PROPERTY_RO(QGraphicsItem, QPainterPath, shape); + MO_ADD_PROPERTY_CR(QGraphicsItem, QString, toolTip, setToolTip); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsItem*, topLevelItem); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsWidget*, topLevelWidget); + MO_ADD_PROPERTY_RO(QGraphicsItem, QTransform, transform/*, setTransform*/); // TODO: support setTransform + MO_ADD_PROPERTY_CR(QGraphicsItem, QPointF, transformOriginPoint, setTransformOriginPoint); + MO_ADD_PROPERTY_RO(QGraphicsItem, int, type); + MO_ADD_PROPERTY_RO(QGraphicsItem, QGraphicsWidget*, window); + MO_ADD_PROPERTY (QGraphicsItem, qreal, x, setX); + MO_ADD_PROPERTY (QGraphicsItem, qreal, y, setY); + MO_ADD_PROPERTY (QGraphicsItem, qreal, zValue, setZValue); + + MO_ADD_METAOBJECT1(QAbstractGraphicsShapeItem, QGraphicsItem); + MO_ADD_PROPERTY_CR(QAbstractGraphicsShapeItem, QBrush, brush, setBrush); + MO_ADD_PROPERTY_CR(QAbstractGraphicsShapeItem, QPen, pen, setPen); + + MO_ADD_METAOBJECT1(QGraphicsEllipseItem, QAbstractGraphicsShapeItem); + MO_ADD_PROPERTY_CR(QGraphicsEllipseItem, QRectF, rect, setRect); + MO_ADD_PROPERTY (QGraphicsEllipseItem, int, spanAngle, setSpanAngle); + MO_ADD_PROPERTY (QGraphicsEllipseItem, int, startAngle, setStartAngle); + + MO_ADD_METAOBJECT1(QGraphicsPathItem, QAbstractGraphicsShapeItem); + MO_ADD_PROPERTY_CR(QGraphicsPathItem, QPainterPath, path, setPath); + + MO_ADD_METAOBJECT1(QGraphicsPolygonItem, QAbstractGraphicsShapeItem); + MO_ADD_PROPERTY (QGraphicsPolygonItem, Qt::FillRule, fillRule, setFillRule); + MO_ADD_PROPERTY_CR(QGraphicsPolygonItem, QPolygonF, polygon, setPolygon); + + MO_ADD_METAOBJECT1(QGraphicsSimpleTextItem, QAbstractGraphicsShapeItem); + MO_ADD_PROPERTY_CR(QGraphicsSimpleTextItem, QFont, font, setFont); + MO_ADD_PROPERTY_CR(QGraphicsSimpleTextItem, QString, text, setText); + + MO_ADD_METAOBJECT1(QGraphicsRectItem, QAbstractGraphicsShapeItem); + MO_ADD_PROPERTY_CR(QGraphicsRectItem, QRectF, rect, setRect); + + MO_ADD_METAOBJECT1(QGraphicsLineItem, QGraphicsItem); + MO_ADD_PROPERTY_CR(QGraphicsLineItem, QLineF, line, setLine); + MO_ADD_PROPERTY_CR(QGraphicsLineItem, QPen, pen, setPen); + + MO_ADD_METAOBJECT1(QGraphicsPixmapItem, QGraphicsItem); + MO_ADD_PROPERTY_CR(QGraphicsPixmapItem, QPointF, offset, setOffset); + MO_ADD_PROPERTY_CR(QGraphicsPixmapItem, QPixmap, pixmap, setPixmap); + MO_ADD_PROPERTY (QGraphicsPixmapItem, QGraphicsPixmapItem::ShapeMode, shapeMode, setShapeMode); + MO_ADD_PROPERTY (QGraphicsPixmapItem, Qt::TransformationMode, transformationMode, setTransformationMode); + + // no extra properties, but we need the inheritance connection for anything above to work + MO_ADD_METAOBJECT2(QGraphicsObject, QGraphicsItem, QObject); + + MO_ADD_METAOBJECT0(QGraphicsLayoutItem); + MO_ADD_PROPERTY_RO(QGraphicsLayoutItem, QRectF, contentsRect); + MO_ADD_PROPERTY_RO(QGraphicsLayoutItem, bool, isLayout); + MO_ADD_PROPERTY_RO(QGraphicsLayoutItem, bool, ownedByLayout); + + MO_ADD_METAOBJECT2(QGraphicsWidget, QGraphicsObject, QGraphicsLayoutItem); + MO_ADD_PROPERTY_RO(QGraphicsWidget, QRectF, windowFrameGeometry); + MO_ADD_PROPERTY_RO(QGraphicsWidget, QRectF, windowFrameRect); + + MO_ADD_METAOBJECT1(QGraphicsProxyWidget, QGraphicsWidget); + MO_ADD_PROPERTY_RO(QGraphicsProxyWidget, QWidget*, widget); +} + +MetaObjectRepository *MetaObjectRepository::instance() +{ + return s_instance(); +} + +void MetaObjectRepository::addMetaObject(MetaObject *mo) +{ + Q_ASSERT(!mo->className().isEmpty()); + m_metaObjects.insert(mo->className(), mo); +} + +MetaObject *MetaObjectRepository::metaObject(const QString &typeName) const +{ + return m_metaObjects.value(typeName); +} + +bool MetaObjectRepository::hasMetaObject(const QString &typeName) const +{ + return m_metaObjects.contains(typeName); +} diff --git a/metaobjectrepository.h b/metaobjectrepository.h new file mode 100644 index 0000000..c30d685 --- /dev/null +++ b/metaobjectrepository.h @@ -0,0 +1,76 @@ +/* + metaobjectrepository.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_METAOBJECTREPOSITORY_H +#define GAMMARAY_METAOBJECTREPOSITORY_H + +#include + +class QString; + +namespace GammaRay { + +class MetaObject; + +/** + * Repository of compile-time introspection information for stuff + * not covered by the Qt meta object system. + */ +class MetaObjectRepository +{ + public: + ~MetaObjectRepository(); + + /** Singleton accessor. */ + static MetaObjectRepository *instance(); + + /** + * Adds object type information to the repository. + */ + void addMetaObject(MetaObject *mo); + + /** + * Returns the introspection information for the type with the given name. + */ + MetaObject *metaObject(const QString &typeName) const; + + /** + * Returns whether a meta object is known for the given type name. + */ + bool hasMetaObject(const QString &typeName) const; + + protected: + MetaObjectRepository(); + + private: + void initBuiltInTypes(); + void initQObjectTypes(); + void initGraphicsViewTypes(); + + private: + QHash m_metaObjects; +}; + +} + +#endif // GAMMARAY_METAOBJECTREPOSITORY_H diff --git a/probefinder.h b/metaproperty.cpp similarity index 63% copy from probefinder.h copy to metaproperty.cpp index 6ebcc21..7cf68a3 100644 --- a/probefinder.h +++ b/metaproperty.cpp @@ -1,10 +1,10 @@ /* - probefinder.h + metaproperty.cpp This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,21 +21,29 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_PROBEFINDER_H -#define GAMMARAY_PROBEFINDER_H +#include "metaproperty.h" +#include "metaobject.h" -class QString; +#include +#include -namespace GammaRay { +using namespace GammaRay; -namespace ProbeFinder +MetaProperty::MetaProperty() : m_class(0) { - /** - * Attempts to find the full path of the probe DLL. - */ - QString findProbe(const QString &baseName); } +MetaProperty::~MetaProperty() +{ +} + +MetaObject *MetaProperty::metaObject() const +{ + Q_ASSERT(m_class); + return m_class; } -#endif // GAMMARAY_PROBEFINDER_H +void MetaProperty::setMetaObject(MetaObject *om) +{ + m_class = om; +} diff --git a/metaproperty.h b/metaproperty.h new file mode 100644 index 0000000..b62dae6 --- /dev/null +++ b/metaproperty.h @@ -0,0 +1,128 @@ +/* + metaproperty.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_METAPROPERTY_H +#define GAMMARAY_METAPROPERTY_H + +#include +#include + +namespace GammaRay { + +class MetaObject; + +/** Introspectable adaptor to non-QObject properties. */ +class MetaProperty +{ + public: + MetaProperty(); + virtual ~MetaProperty(); + + /// User-readable name of that property + virtual QString name() const = 0; + + /// Current value of the property for object @p object. + virtual QVariant value(void *object) const = 0; + + /// Returns @c true if this property is read-only. + virtual bool isReadOnly() const = 0; + + /// Allows changing the property value, assuming it's not read-only, for the instance @p object. + virtual void setValue(void *object, const QVariant &value) = 0; + + /// Returns the name of the data type of this property. + virtual QString typeName() const = 0; + + /// Returns the class this property belongs to. + MetaObject *metaObject() const; + + private: + friend class MetaObject; + void setMetaObject(MetaObject *om); + + MetaObject *m_class; +}; + +/** Template-ed implementation of MetaProperty. */ +template +class MetaPropertyImpl : public MetaProperty +{ + public: + inline MetaPropertyImpl( + const QString &name, + ValueType (Class::*getter)() const, void (Class::*setter)(SetterArgType) = 0) + : m_name(name), m_getter(getter), m_setter(setter) + { + } + + inline QString name() const + { + return m_name; + } + + inline bool isReadOnly() const + { + return m_setter == 0 ; + } + + inline QVariant value(void *object) const + { + Q_ASSERT(object); + return value(static_cast(object)); + } + + inline void setValue(void *object, const QVariant &value) + { + setValue(static_cast(object), value); + } + + private: + inline QVariant value(Class *object) const + { + Q_ASSERT(object); + const ValueType v = (object->*(m_getter))(); + return QVariant::fromValue(v); + } + + inline void setValue(Class *object, const QVariant &value) + { + if (isReadOnly()) { + return; + } + (object->*(m_setter))(value.value()); + } + + inline QString typeName() const + { + return QMetaType::typeName(qMetaTypeId()) ; + } + + private: + QString m_name; + ValueType (Class::*m_getter)() const; + void (Class::*m_setter)(SetterArgType); +}; + +} + +#endif diff --git a/metapropertymodel.cpp b/metapropertymodel.cpp new file mode 100644 index 0000000..36b0329 --- /dev/null +++ b/metapropertymodel.cpp @@ -0,0 +1,157 @@ +/* + metapropertymodel.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "metapropertymodel.h" +#include "metaobjectrepository.h" +#include "metaobject.h" +#include "util.h" + +using namespace GammaRay; + +MetaPropertyModel::MetaPropertyModel(QObject *parent): + QAbstractTableModel(parent), + m_metaObject(0), + m_object(0) +{ +} + +void MetaPropertyModel::setObject(void *object, const QString &typeName) +{ + beginResetModel(); + m_object = object; + m_metaObject = MetaObjectRepository::instance()->metaObject(typeName); + endResetModel(); +} + +void MetaPropertyModel::setObject(QObject *object) +{ + beginResetModel(); + m_object = 0; + m_metaObject = 0; + + if (object) { + const QMetaObject *mo = object->metaObject(); + while (mo && !m_metaObject) { + m_metaObject = MetaObjectRepository::instance()->metaObject(mo->className()); + mo = mo->superClass(); + } + if (m_metaObject) { + m_object = object; + } + } + endResetModel(); +} + +int MetaPropertyModel::columnCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return 4; +} + +int MetaPropertyModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid() || !m_metaObject) { + return 0; + } + return m_metaObject->propertyCount(); +} + +QVariant MetaPropertyModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { + switch (section) { + case 0: + return tr("Property"); + case 1: + return tr("Value"); + case 2: + return tr("Type"); + case 3: + return tr("Class"); + } + } + return QAbstractItemModel::headerData(section, orientation, role); +} + +QVariant MetaPropertyModel::data(const QModelIndex &index, int role) const +{ + if (!m_metaObject || !index.isValid()) { + return QVariant(); + } + + MetaProperty *property = m_metaObject->propertyAt(index.row()); + if (role == Qt::DisplayRole) { + switch (index.column()) { + case 0: + return property->name(); + case 2: + return property->typeName(); + case 3: + return property->metaObject()->className(); + } + } + + if (index.column() == 1) { + if (!m_object) { + return QVariant(); + } + + // TODO: cache this, to make this more robust against m_object becoming invalid + const QVariant value = property->value(m_metaObject->castForPropertyAt(m_object, index.row())); + switch (role) { + case Qt::DisplayRole: + return Util::variantToString(value); + case Qt::DecorationRole: + return Util::decorationForVariant(value); + case Qt::EditRole: + return value; + } + } + return QVariant(); +} + +bool MetaPropertyModel::setData(const QModelIndex &index, const QVariant &value, int role) +{ + if (index.isValid() && index.column() == 1 && m_metaObject && m_object && role == Qt::EditRole) { + MetaProperty *property = m_metaObject->propertyAt(index.row()); + property->setValue(m_metaObject->castForPropertyAt(m_object, index.row()), value); + return true; + } + return QAbstractItemModel::setData(index, value, role); +} + +Qt::ItemFlags MetaPropertyModel::flags(const QModelIndex &index) const +{ + const Qt::ItemFlags f = QAbstractItemModel::flags(index); + if (!index.isValid() || index.column() != 1 || !m_metaObject || !m_object) { + return f; + } + + MetaProperty *property = m_metaObject->propertyAt(index.row()); + if (property->isReadOnly()) { + return f; + } + return f | Qt::ItemIsEditable; +} + +#include "metapropertymodel.moc" diff --git a/tools/sceneinspector/scenemodel.h b/metapropertymodel.h similarity index 55% copy from tools/sceneinspector/scenemodel.h copy to metapropertymodel.h index 9d74123..6e003a3 100644 --- a/tools/sceneinspector/scenemodel.h +++ b/metapropertymodel.h @@ -1,10 +1,10 @@ /* - scenemodel.h + metapropertymodel.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,37 +21,41 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SCENEMODEL_H -#define GAMMARAY_SCENEMODEL_H +#ifndef GAMMARAY_METAPROPERTYMODEL_H +#define GAMMARAY_METAPROPERTYMODEL_H -#include - -class QGraphicsScene; -class QGraphicsItem; +#include namespace GammaRay { -class SceneModel : public QAbstractItemModel +class MetaObject; + +/** Model showing non-QObject object properties. + * @todo needs better name, but ObjectPropertyModel is already in use... + * @todo maybe it's a good to merge those to anyway? + */ +class MetaPropertyModel : public QAbstractTableModel { Q_OBJECT public: - enum Role { - SceneItemRole = Qt::UserRole + 1 - }; - explicit SceneModel(QObject *parent = 0); - void setScene(QGraphicsScene *scene); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + explicit MetaPropertyModel(QObject *parent = 0); + + /** Sets the object that should be represented by this model. */ + void setObject(void *object, const QString &typeName); + void setObject(QObject *object); + int columnCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &child) const; - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + Qt::ItemFlags flags(const QModelIndex &index) const; private: - QList topLevelItems() const; - QGraphicsScene *m_scene; + MetaObject *m_metaObject; + void *m_object; }; } -#endif // GAMMARAY_SCENEMODEL_H +#endif // GAMMARAY_METAPROPERTYMODEL_H diff --git a/metatypedeclarations.h b/metatypedeclarations.h new file mode 100644 index 0000000..4914f03 --- /dev/null +++ b/metatypedeclarations.h @@ -0,0 +1,49 @@ +/* + metatypedeclarations.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_METATYPEDECALARATIONS_H +#define GAMMARAY_METATYPEDECALARATIONS_H + +#include +#include +#include +#include + +Q_DECLARE_METATYPE(Qt::FillRule) +Q_DECLARE_METATYPE(Qt::InputMethodHints) +Q_DECLARE_METATYPE(Qt::MouseButtons) +Q_DECLARE_METATYPE(Qt::TransformationMode) +Q_DECLARE_METATYPE(QGraphicsEffect*) +Q_DECLARE_METATYPE(QGraphicsItemGroup*) +Q_DECLARE_METATYPE(QGraphicsObject*) +Q_DECLARE_METATYPE(QGraphicsWidget*) +Q_DECLARE_METATYPE(QGraphicsItem::CacheMode) +Q_DECLARE_METATYPE(QGraphicsItem::GraphicsItemFlags) +Q_DECLARE_METATYPE(QGraphicsItem::PanelModality) +Q_DECLARE_METATYPE(QGraphicsPixmapItem::ShapeMode) +Q_DECLARE_METATYPE(QPainterPath) +Q_DECLARE_METATYPE(QPolygonF) +Q_DECLARE_METATYPE(const QStyle*) + +#endif + diff --git a/objectmodel.h b/objectmodel.h index 791e7a6..d4fe1dd 100644 --- a/objectmodel.h +++ b/objectmodel.h @@ -36,7 +36,8 @@ namespace ObjectModel { /** Role enum, to be used with the object list and tree models. */ enum Role { - ObjectRole = Qt::UserRole +1 + ObjectRole = Qt::UserRole +1, + UserRole }; } diff --git a/objectmodelbase.h b/objectmodelbase.h index a6aee7f..2bf43e2 100644 --- a/objectmodelbase.h +++ b/objectmodelbase.h @@ -60,6 +60,8 @@ class ObjectModelBase : public Base arg(obj->parent() ? obj->parent()->metaObject()->className() : ""). arg(Util::addressToString(obj->parent())). arg(obj->children().size()); + } else if (role == Qt::DecorationRole && index.column() == 0) { + return Util::iconForObject(obj); } return QVariant(); diff --git a/objectstaticpropertymodel.cpp b/objectstaticpropertymodel.cpp index 064848f..c0ad0f1 100644 --- a/objectstaticpropertymodel.cpp +++ b/objectstaticpropertymodel.cpp @@ -50,7 +50,14 @@ QVariant ObjectStaticPropertyModel::data(const QModelIndex &index, int role) con if (index.column() == 0) { return prop.name(); } else if (index.column() == 1) { - return Util::variantToString(prop.read(m_obj.data())); + // QMetaProperty::read sets QVariant::typeName to int for enums, + // so we need to handle that separately here + const QVariant value = prop.read(m_obj.data()); + const QString enumStr = Util::enumToString(value, prop.typeName(), m_obj.data()); + if (!enumStr.isEmpty()) { + return enumStr; + } + return Util::variantToString(value); } else if (index.column() == 2) { return prop.typeName(); } else if (index.column() == 3) { @@ -60,6 +67,10 @@ QVariant ObjectStaticPropertyModel::data(const QModelIndex &index, int role) con } return mo->className(); } + } else if (role == Qt::DecorationRole) { + if (index.column() == 1) { + return Util::decorationForVariant(prop.read(m_obj.data())); + } } else if (role == Qt::EditRole) { if (index.column() == 1) { return prop.read(m_obj.data()); diff --git a/objecttreemodel.cpp b/objecttreemodel.cpp index 641fc18..b67aa16 100644 --- a/objecttreemodel.cpp +++ b/objecttreemodel.cpp @@ -38,35 +38,20 @@ extern void dumpObject(QObject *); using namespace std; using namespace GammaRay; -ObjectTreeModel::ObjectTreeModel(QObject *parent) - : ObjectModelBase< QAbstractItemModel >(parent), - m_lock(QReadWriteLock::Recursive) +ObjectTreeModel::ObjectTreeModel(Probe *probe) + : ObjectModelBase< QAbstractItemModel >(probe) { + connect(probe, SIGNAL(objectCreated(QObject*)), + this, SLOT(objectAdded(QObject*))); + connect(probe, SIGNAL(objectDestroyed(QObject*)), + this, SLOT(objectRemoved(QObject*))); + connect(probe, SIGNAL(objectReparanted(QObject*)), + this, SLOT(objectReparanted(QObject*))); } void ObjectTreeModel::objectAdded(QObject *obj) { - // this is ugly, but apparently it can happen - // that an object gets created without parent - // then later the delayed signal comes in - // so catch this gracefully by first adding the - // parent if required - if (obj->parent()) { - ReadOrWriteLocker lock(&m_lock); - const QModelIndex index = indexForObject(obj->parent()); - lock.unlock(); - if (!index.isValid()) { - objectAdded(obj->parent()); - } - } - - // when called from background, delay into foreground, otherwise call directly - QMetaObject::invokeMethod(this, "objectAddedMainThread", Qt::AutoConnection, - Q_ARG(QObject *, obj)); -} - -void ObjectTreeModel::objectAddedMainThread(QObject *obj) -{ + // slot, hence should always land in main thread due to auto connection Q_ASSERT(thread() == QThread::currentThread()); ReadOrWriteLocker objectLock(Probe::instance()->objectLock()); @@ -77,13 +62,24 @@ void ObjectTreeModel::objectAddedMainThread(QObject *obj) IF_DEBUG(cout << "tree obj added: " << hex << obj << " p: " << obj->parent() << endl;) Q_ASSERT(!obj->parent() || Probe::instance()->isValidObject(obj->parent())); - QWriteLocker lock(&m_lock); - if (indexForObject(obj).isValid()) { IF_DEBUG(cout << "tree double obj added: " << hex << obj << endl;) return; } + // this is ugly, but apparently it can happen + // that an object gets created without parent + // then later the delayed signal comes in + // so catch this gracefully by first adding the + // parent if required + if (obj->parent()) { + const QModelIndex index = indexForObject(obj->parent()); + if (!index.isValid()) { + IF_DEBUG(cout << "tree: handle parent first" << endl;) + objectAdded(obj->parent()); + } + } + const QModelIndex index = indexForObject(obj->parent()); // either we get a proper parent and hence valid index or there is no parent @@ -101,6 +97,9 @@ void ObjectTreeModel::objectAddedMainThread(QObject *obj) void ObjectTreeModel::objectRemoved(QObject *obj) { + // slot, hence should always land in main thread due to auto connection + Q_ASSERT(thread() == QThread::currentThread()); + IF_DEBUG(cout << "tree removed: " << hex << obj << " " @@ -108,15 +107,6 @@ void ObjectTreeModel::objectRemoved(QObject *obj) << m_parentChildMap.value(obj->parent()).size() << " " << m_parentChildMap.contains(obj) << endl;) - // when called from background, delay into foreground, otherwise call directly - QMetaObject::invokeMethod(this, "objectRemovedMainThread", Qt::AutoConnection, - Q_ARG(QObject *, obj)); -} - -void ObjectTreeModel::objectRemovedMainThread(QObject *obj) -{ - QWriteLocker lock(&m_lock); - if (!m_childParentMap.contains(obj)) { Q_ASSERT(!m_parentChildMap.contains(obj)); return; @@ -145,6 +135,19 @@ void ObjectTreeModel::objectRemovedMainThread(QObject *obj) endRemoveRows(); } +void ObjectTreeModel::objectReparanted(QObject *obj) +{ + // slot, hence should always land in main thread due to auto connection + Q_ASSERT(thread() == QThread::currentThread()); + + ReadOrWriteLocker objectLock(Probe::instance()->objectLock()); + if (Probe::instance()->isValidObject(obj)) { + objectAdded(obj); + } + + objectRemoved(obj); +} + QVariant ObjectTreeModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { @@ -172,21 +175,18 @@ int ObjectTreeModel::rowCount(const QModelIndex &parent) const if (parent.column() == 1) { return 0; } - ReadOrWriteLocker lock(&m_lock); QObject *parentObj = reinterpret_cast(parent.internalPointer()); return m_parentChildMap.value(parentObj).size(); } QModelIndex ObjectTreeModel::parent(const QModelIndex &child) const { - ReadOrWriteLocker lock(&m_lock); QObject *childObj = reinterpret_cast(child.internalPointer()); return indexForObject(m_childParentMap.value(childObj)); } QModelIndex ObjectTreeModel::index(int row, int column, const QModelIndex &parent) const { - ReadOrWriteLocker lock(&m_lock); QObject *parentObj = reinterpret_cast(parent.internalPointer()); const QVector children = m_parentChildMap.value(parentObj); if (row < 0 || column < 0 || row >= children.size() || column >= columnCount()) { diff --git a/objecttreemodel.h b/objecttreemodel.h index 6edb442..bb2b2b3 100644 --- a/objecttreemodel.h +++ b/objecttreemodel.h @@ -27,35 +27,33 @@ #include "objectmodelbase.h" #include -#include namespace GammaRay { +class Probe; + class ObjectTreeModel : public ObjectModelBase { Q_OBJECT public: - explicit ObjectTreeModel(QObject *parent = 0); + explicit ObjectTreeModel(Probe *probe); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &child) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - void objectAdded(QObject *objPtr); - void objectRemoved(QObject *obj); - private slots: - void objectAddedMainThread(QObject *objPtr); - void objectRemovedMainThread(QObject *obj); + void objectAdded(QObject *obj); + void objectRemoved(QObject *obj); + void objectReparanted(QObject *obj); private: QModelIndex indexForObject(QObject *object) const; private: - QMap m_childParentMap; - QMap > m_parentChildMap; - mutable QReadWriteLock m_lock; + QHash m_childParentMap; + QHash > m_parentChildMap; }; } diff --git a/objecttypefilterproxymodel.h b/objecttypefilterproxymodel.h index d40fdae..285a3a6 100644 --- a/objecttypefilterproxymodel.h +++ b/objecttypefilterproxymodel.h @@ -24,16 +24,16 @@ #ifndef GAMMARAY_OBJECTTYPEFILTERPROXYMODEL_H #define GAMMARAY_OBJECTTYPEFILTERPROXYMODEL_H -#include -#include "objectlistmodel.h" +#include + +#include "objectmodelbase.h" namespace GammaRay { -template -class ObjectTypeFilterProxyModel : public QSortFilterProxyModel +class ObjectFilterProxyModelBase : public QSortFilterProxyModel { public: - explicit ObjectTypeFilterProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) + explicit ObjectFilterProxyModelBase(QObject *parent = 0) : QSortFilterProxyModel(parent) { setDynamicSortFilter(true); } @@ -47,11 +47,28 @@ class ObjectTypeFilterProxyModel : public QSortFilterProxyModel } QObject *obj = source_index.data(ObjectModel::ObjectRole).value(); - if (!qobject_cast(obj)) { + Q_ASSERT(obj); + if (!filterAcceptsObject(obj)) { return false; } + return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); } + + virtual bool filterAcceptsObject(QObject *object) const = 0; +}; + +template +class ObjectTypeFilterProxyModel : public ObjectFilterProxyModelBase +{ + public: + explicit ObjectTypeFilterProxyModel(QObject *parent = 0) + : ObjectFilterProxyModelBase(parent) {} + + protected: + virtual bool filterAcceptsObject(QObject *object) const { + return qobject_cast(object); + } }; } diff --git a/pluginmanager.cpp b/pluginmanager.cpp new file mode 100644 index 0000000..949305d --- /dev/null +++ b/pluginmanager.cpp @@ -0,0 +1,114 @@ +/* + pluginmanager.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "pluginmanager.h" + +#include "config-gammaray.h" + +#include +#include +#include +#include +#include + +#include +#include "proxytoolfactory.h" + +#define IF_DEBUG(x) + +using namespace GammaRay; +using namespace std; + +static const QLatin1String GAMMARAY_PLUGIN_SUFFIX("gammaray"); +PluginManager *PluginManager::s_instance = 0; + +PluginManager *PluginManager::instance() +{ + if (!s_instance) { + s_instance = new PluginManager(); + s_instance->scan(); + } + return s_instance; +} + +PluginManager::PluginManager() +{ + QCoreApplication::addLibraryPath(QLatin1String(GAMMARAY_PLUGIN_INSTALL_DIR)); +} + +QStringList PluginManager::pluginPaths() const +{ + QStringList pluginPaths; + + // add plugins from gammaray's build directory + pluginPaths << QLatin1String(GAMMARAY_BUILD_DIR) + + QDir::separator() + "lib" + + QDir::separator() + "plugins" + + QDir::separator() + GAMMARAY_PLUGIN_SUFFIX; + + QStringList libraryPaths = QCoreApplication::libraryPaths(); + foreach (const QString &libraryPath, libraryPaths) { + pluginPaths << libraryPath + QDir::separator() + GAMMARAY_PLUGIN_SUFFIX; + } + + return pluginPaths; +} + +void PluginManager::scan() +{ + // TODO: temporary work-around to avoid loading the same plugin two times + // should be fixed when providing valid plugin spec files + QStringList loadedPluginNames; + + foreach (const QString &pluginPath, pluginPaths()) { + const QDir dir(pluginPath); + IF_DEBUG(cout << "checking plugin path: " << qPrintable(dir.absolutePath()) << endl); + foreach (const QString &plugin, dir.entryList(QDir::Files)) { + const QString pluginFile = dir.absoluteFilePath(plugin); + const QFileInfo pluginInfo(pluginFile); + const QString pluginName = pluginInfo.baseName(); + + if (loadedPluginNames.contains(pluginName)) { + cout << "not loading plugin, already loaded: " << qPrintable(pluginFile) << endl; + continue; + } + + if (pluginInfo.suffix() == QLatin1String("desktop")) { + ProxyToolFactory *proxy = new ProxyToolFactory(pluginFile); + if (!proxy->isValid()) { + std::cerr << "invalid plugin " << qPrintable(pluginFile) << std::endl; + delete proxy; + } else { + IF_DEBUG(cout << "plugin looks valid " << qPrintable(pluginFile) << endl;) + m_plugins.push_back(proxy); + loadedPluginNames << pluginName; + } + } + } + } +} + +QVector PluginManager::plugins() +{ + return m_plugins; +} diff --git a/sidepane.h b/pluginmanager.h similarity index 64% copy from sidepane.h copy to pluginmanager.h index 09b0183..3530327 100644 --- a/sidepane.h +++ b/pluginmanager.h @@ -1,5 +1,5 @@ /* - sidepane.h + pluginmanager.h This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +21,37 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H +#ifndef GAMMARAY_PLUGINMANAGER_H +#define GAMMARAY_PLUGINMANAGER_H -#include +#include +#include +#include + +#include namespace GammaRay { -class SidePane : public QListView +class ToolFactory; + +class PluginManager { - Q_OBJECT + public: + static PluginManager *instance(); + + QVector plugins(); -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); + protected: + PluginManager(); - virtual QSize sizeHint() const; + private: + QStringList pluginPaths() const; + void scan(); -protected: - virtual void resizeEvent(QResizeEvent *e); + static PluginManager *s_instance; + QVector m_plugins; }; } -#endif // GAMMARAY_SIDEPANE_H +#endif // GAMMARAY_PLUGINMANAGER_H diff --git a/probe.cpp b/probe.cpp index 46b9fac..25e0841 100644 --- a/probe.cpp +++ b/probe.cpp @@ -31,12 +31,14 @@ #include "toolmodel.h" #include "readorwritelocker.h" #include "tools/modelinspector/modeltest.h" +#include "hooking/functionoverwriterfactory.h" #include #include -#include -#include +#include +#include #include +#include #include #include @@ -63,7 +65,9 @@ using namespace GammaRay; using namespace std; Probe *Probe::s_instance = 0; -QReadWriteLock Probe::s_lock(QReadWriteLock::Recursive); +bool functionsOverwritten = false; + +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) namespace GammaRay { @@ -90,6 +94,7 @@ static bool probeDisconnectCallback(void ** args) } } +#endif // QT_VERSION // useful for debugging, dumps the object and all it's parents // also useable from GDB! @@ -124,15 +129,30 @@ struct Listener Q_GLOBAL_STATIC(Listener, s_listener) Q_GLOBAL_STATIC(QVector, s_addedBeforeProbeInsertion) +// ensures proper information is returned by isValidObject by +// locking it in objectAdded/Removed +class ObjectLock : public QReadWriteLock +{ + public: + ObjectLock() + : QReadWriteLock(QReadWriteLock::Recursive) + {} +}; +Q_GLOBAL_STATIC(ObjectLock, s_lock) + ProbeCreator::ProbeCreator(Type type) -: m_type(type) + : m_type(type) { + //push object into the main thread, as windows creates a + //different thread where this runs in + moveToThread(QApplication::instance()->thread()); // delay to foreground thread QMetaObject::invokeMethod(this, "createProbe", Qt::QueuedConnection); } void ProbeCreator::createProbe() { + QWriteLocker lock(s_lock()); // make sure we are in the ui thread Q_ASSERT(QThread::currentThread() == qApp->thread()); @@ -141,6 +161,15 @@ void ProbeCreator::createProbe() return; } + // Exit early instead of asserting in QWidgetPrivate::init() + const QApplication * const qGuiApplication = qApp; // qobject_cast(qApp); + if (!qGuiApplication || qGuiApplication->type() == QApplication::Tty) { + cerr << "Unable to attach to a non-GUI application.\n" + << "Your application needs to use QApplication, " + << "otherwise GammaRay can not work." << endl; + return; + } + IF_DEBUG(cout << "setting up new probe instance" << endl;) s_listener()->filterThread = QThread::currentThread(); Q_ASSERT(!Probe::s_instance); @@ -181,8 +210,10 @@ Probe::Probe(QObject *parent): new ModelTest(m_toolModel, m_toolModel); } +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) QInternal::registerCallback(QInternal::ConnectCallback, &GammaRay::probeConnectCallback); QInternal::registerCallback(QInternal::DisconnectCallback, &GammaRay::probeDisconnectCallback); +#endif m_queueTimer->setSingleShot(true); m_queueTimer->setInterval(0); @@ -194,8 +225,10 @@ Probe::~Probe() { IF_DEBUG(cerr << "detaching GammaRay probe" << endl;) +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) QInternal::unregisterCallback(QInternal::ConnectCallback, &GammaRay::probeConnectCallback); QInternal::unregisterCallback(QInternal::DisconnectCallback, &GammaRay::probeDisconnectCallback); +#endif s_instance = 0; } @@ -248,13 +281,7 @@ void Probe::delayedInit() window->show(); } -/** - * Returns true if @p obj belongs to the GammaRay Probe or Window. - * - * These objects should not be tracked or shown to the user, - * hence must be explictly filtered. - */ -static bool filterObject(QObject *obj) +bool Probe::filterObject(QObject *obj) { Probe *p = Probe::instance(); Q_ASSERT(p); @@ -294,17 +321,18 @@ QObject *Probe::probe() const bool Probe::isValidObject(QObject *obj) const { - ///TODO: can we somehow assert(s_lock.isLocked()) ?! + ///TODO: can we somehow assert(s_lock().isLocked()) ?! return m_validObjects.contains(obj); } QReadWriteLock *Probe::objectLock() const { - return &s_lock; + return s_lock(); } void Probe::objectAdded(QObject *obj, bool fromCtor) { + QWriteLocker lock(s_lock()); if (s_listener()->filterThread == obj->thread()) { // Ignore IF_DEBUG(cout @@ -313,8 +341,6 @@ void Probe::objectAdded(QObject *obj, bool fromCtor) << (fromCtor ? " (from ctor)" : "") << endl;) return; } else if (isInitialized()) { - QWriteLocker lock(&s_lock); - if (filterObject(obj)) { IF_DEBUG(cout << "objectAdded Filter: " @@ -381,7 +407,7 @@ void Probe::objectAdded(QObject *obj, bool fromCtor) void Probe::queuedObjectsFullyConstructed() { - QWriteLocker lock(&s_lock); + QWriteLocker lock(s_lock()); IF_DEBUG(cout << Q_FUNC_INFO << " " << m_queuedObjects.size() << endl;) @@ -404,7 +430,7 @@ void Probe::queuedObjectsFullyConstructed() void Probe::objectFullyConstructed(QObject *obj) { // must be write locked - Q_ASSERT(!s_lock.tryLockForRead()); + Q_ASSERT(!s_lock()->tryLockForRead()); if (!m_validObjects.contains(obj)) { // deleted already @@ -428,7 +454,6 @@ void Probe::objectFullyConstructed(QObject *obj) Q_ASSERT(!obj->parent() || m_validObjects.contains(obj->parent())); m_objectListModel->objectAdded(obj); - m_objectTreeModel->objectAdded(obj); m_toolModel->objectAdded(obj); emit objectCreated(obj); @@ -436,8 +461,8 @@ void Probe::objectFullyConstructed(QObject *obj) void Probe::objectRemoved(QObject *obj) { + QWriteLocker lock(s_lock()); if (isInitialized()) { - QWriteLocker lock(&s_lock); IF_DEBUG(cout << "object removed:" << hex << obj << " " << obj->parent() << endl;) bool success = instance()->m_validObjects.remove(obj); @@ -449,8 +474,6 @@ void Probe::objectRemoved(QObject *obj) instance()->m_queuedObjects.removeOne(obj); instance()->m_objectListModel->objectRemoved(obj); - instance()->m_objectTreeModel->objectRemoved(obj); - instance()->m_connectionModel->objectRemoved(obj); instance()->connectionRemoved(obj, 0, 0, 0); instance()->connectionRemoved(0, 0, obj, 0); @@ -482,7 +505,7 @@ void Probe::connectionAdded(QObject *sender, const char *signal, QObject *receiv return; } - ReadOrWriteLocker lock(&s_lock); + ReadOrWriteLocker lock(s_lock()); if (filterObject(sender) || filterObject(receiver)) { return; } @@ -499,7 +522,7 @@ void Probe::connectionRemoved(QObject *sender, const char *signal, return; } - ReadOrWriteLocker lock(&s_lock); + ReadOrWriteLocker lock(s_lock()); if ((sender && filterObject(sender)) || (receiver && filterObject(receiver))) { return; } @@ -517,7 +540,7 @@ bool Probe::eventFilter(QObject *receiver, QEvent *event) QChildEvent *childEvent = static_cast(event); QObject *obj = childEvent->child(); - QWriteLocker lock(&s_lock); + QWriteLocker lock(s_lock()); const bool tracked = m_validObjects.contains(obj); const bool filtered = filterObject(obj); @@ -529,13 +552,14 @@ bool Probe::eventFilter(QObject *receiver, QEvent *event) if (!filtered && childEvent->added()) { if (!tracked) { // was not tracked before, add to all models - objectAdded(obj); + // child added events are sent before qt_addObject is called, + // so we assumes this comes from the ctor + objectAdded(obj, true); } else if (!m_queuedObjects.contains(obj)) { // object is known already, just update the position in the tree // BUT: only when we did not queue this item before IF_DEBUG(cout << "update pos: " << hex << obj << endl;) - m_objectTreeModel->objectRemoved(obj); - m_objectTreeModel->objectAdded(obj); + emit objectReparanted(obj); } } else if (tracked) { objectRemoved(obj); @@ -563,7 +587,7 @@ bool Probe::eventFilter(QObject *receiver, QEvent *event) // we have no preloading hooks, so recover all objects we see if (s_listener()->trackDestroyed && event->type() != QEvent::ChildAdded && event->type() != QEvent::ChildRemoved && !filterObject(receiver)) { - QWriteLocker lock(&s_lock); + QWriteLocker lock(s_lock()); const bool tracked = m_validObjects.contains(receiver); if (!tracked) { objectAdded(receiver); @@ -616,29 +640,35 @@ extern "C" Q_DECL_EXPORT void qt_startup_hook() s_listener()->trackDestroyed = false; new ProbeCreator(ProbeCreator::CreateOnly); -#if !defined Q_OS_WIN and !defined Q_OS_MAC - static void(*next_qt_startup_hook)() = (void (*)()) dlsym(RTLD_NEXT, "qt_startup_hook"); - next_qt_startup_hook(); +#if !defined Q_OS_WIN && !defined Q_OS_MAC + if (!functionsOverwritten) { + static void(*next_qt_startup_hook)() = (void (*)()) dlsym(RTLD_NEXT, "qt_startup_hook"); + next_qt_startup_hook(); + } #endif } extern "C" Q_DECL_EXPORT void qt_addObject(QObject *obj) { Probe::objectAdded(obj, true); -#if !defined Q_OS_WIN and !defined Q_OS_MAC - static void (*next_qt_addObject)(QObject *obj) = - (void (*)(QObject *obj)) dlsym(RTLD_NEXT, "qt_addObject"); - next_qt_addObject(obj); +#if !defined Q_OS_WIN && !defined Q_OS_MAC + if (!functionsOverwritten) { + static void (*next_qt_addObject)(QObject *obj) = + (void (*)(QObject *obj)) dlsym(RTLD_NEXT, "qt_addObject"); + next_qt_addObject(obj); + } #endif } extern "C" Q_DECL_EXPORT void qt_removeObject(QObject *obj) { Probe::objectRemoved(obj); -#if !defined Q_OS_WIN and !defined Q_OS_MAC - static void (*next_qt_removeObject)(QObject *obj) = - (void (*)(QObject *obj)) dlsym(RTLD_NEXT, "qt_removeObject"); - next_qt_removeObject(obj); +#if !defined Q_OS_WIN && !defined Q_OS_MAC + if (!functionsOverwritten) { + static void (*next_qt_removeObject)(QObject *obj) = + (void (*)(QObject *obj)) dlsym(RTLD_NEXT, "qt_removeObject"); + next_qt_removeObject(obj); + } #endif } @@ -667,130 +697,35 @@ Q_DECL_EXPORT const char *myFlagLocation(const char *method) } #endif -#if defined(Q_OS_WIN) or defined(Q_OS_MAC) -// IMPORTANT NOTE: -// We are writing a jmp instruction at the target address. -// If the function is not big, we have to trust that the alignment gives -// us enough space to this jmp. Jumps are 10 bytes long under 32 bit and -// 13 bytes long under x64. -// We will overwrite the existing function, which cannot be reverted. -// It would be possible to save the content and write it back when we unattach. - -static inline void *page_align(void *addr) -{ - assert(addr != NULL); - return (void *)((size_t)addr & ~(0xFFFF)); -} - -void writeJmp(void *func, void *replacement) +void overwriteQtFunctions() { -#ifdef Q_OS_WIN - DWORD oldProtect = 0; - - //Jump takes 10 bytes under x86 and 14 bytes under x64 - int worstSize; -#ifdef _M_IX86 - worstSize = 10; -#else ifdef _M_X64 - worstSize = 14; -#endif - - VirtualProtect(func, worstSize, PAGE_EXECUTE_READWRITE, &oldProtect); -#else ifdef Q_OS_MAC - quint8 *aligned = (quint8*)page_align(func); - const bool writable = (mprotect(aligned, 0xFFFF, PROT_READ|PROT_WRITE|PROT_EXEC) == 0); - assert(writable); -#endif - - quint8 *cur = (quint8 *) func; + functionsOverwritten = true; + AbstractFunctionOverwriter *overwriter = FunctionOverwriterFactory::createFunctionOverwriter(); - // If there is a short jump, its a jumptable and we don't have enough - // space after, so follow the short jump and write the jmp there - if (*cur == 0xE9) { - size_t old_offset = *(unsigned long *)(cur + 1); -#ifdef _M_IX86 - void *ret = (void *)(((quint32)(((quint32) cur) + sizeof (quint32))) + old_offset + 1); -#else ifdef _M_X64 - void *ret = (void *)(((quint32)(((quint64) cur) + sizeof (quint32))) + old_offset + 1); -#endif - writeJmp(ret, replacement); - return; - } - - *cur = 0xff; - *(++cur) = 0x25; - -#ifdef _M_IX86 - *((quint32 *) ++cur) = (quint32)(((quint32) cur) + sizeof (quint32)); - cur += sizeof (DWORD); - *((quint32 *)cur) = (quint32)replacement; -#else ifdef _M_X64 - *((quint32 *) ++cur) = 0; - cur += sizeof (quint32); - *((quint64*)cur) = (quint64)replacement; + overwriter->overwriteFunction(QLatin1String("qt_startup_hook"), (void*)qt_startup_hook); + overwriter->overwriteFunction(QLatin1String("qt_addObject"), (void*)qt_addObject); + overwriter->overwriteFunction(QLatin1String("qt_removeObject"), (void*)qt_removeObject); +#if defined(Q_OS_WIN) +#ifdef ARCH_64 + overwriter->overwriteFunction( + QLatin1String("?qFlagLocation@@YAPEBDPEBD@Z"), (void*)myFlagLocation); +#else + overwriter->overwriteFunction( + QLatin1String("?qFlagLocation@@YAPBDPBD@Z"), (void*)myFlagLocation); #endif - -#ifdef Q_OS_WIN - VirtualProtect(func, worstSize, oldProtect, &oldProtect); -#else ifdef Q_OS_MAC - const bool readOnly = (mprotect(aligned, 0xFFFF, PROT_READ|PROT_EXEC) == 0); - assert(readOnly); #endif } -#endif - #ifdef Q_OS_WIN extern "C" Q_DECL_EXPORT void gammaray_probe_inject(); -BOOL WINAPI DllMain(HINSTANCE/*hInstance*/, DWORD dwReason, LPVOID/*lpvReserved*/) +extern "C" BOOL WINAPI DllMain(HINSTANCE/*hInstance*/, DWORD dwReason, LPVOID/*lpvReserved*/) { - // First retrieve the right module, if Qt is linked in release or debug - HMODULE qtCoreDllHandle = GetModuleHandle(L"QtCore4"); - if (qtCoreDllHandle == NULL) { - qtCoreDllHandle = GetModuleHandle(L"QtCored4"); - } - - if (qtCoreDllHandle == NULL) { - cerr << "no handle for QtCore found!" << endl; - return FALSE; - } - - // Look up the address of qt_startup_hook - FARPROC qtstartuphookaddr = GetProcAddress(qtCoreDllHandle, "qt_startup_hook"); - FARPROC qtaddobjectaddr = GetProcAddress(qtCoreDllHandle, "qt_addObject"); - FARPROC qtremobjectaddr = GetProcAddress(qtCoreDllHandle, "qt_removeObject"); -#ifdef _M_X64 - FARPROC qFlagLocationaddr = GetProcAddress(qtCoreDllHandle, "?qFlagLocation@@YAPEBDPEBD@Z"); -#else - FARPROC qFlagLocationaddr = GetProcAddress(qtCoreDllHandle, "?qFlagLocation@@YAPBDPBD@Z"); -#endif - - if (qtstartuphookaddr == NULL) { - cerr << "no address for qt_startup_hook found!" << endl; - return FALSE; - } - if (qtaddobjectaddr == NULL) { - cerr << "no address for qt_addObject found!" << endl; - return FALSE; - } - if (qtremobjectaddr == NULL) { - cerr << "no address for qt_removeObject found!" << endl; - return FALSE; - } - if (qFlagLocationaddr == NULL) { - cerr << "no address for qFlagLocation found!" << endl; - return FALSE; - } - switch(dwReason) { case DLL_PROCESS_ATTACH: { - // write ourself into the hook chain - writeJmp(qtstartuphookaddr, (void *)qt_startup_hook); - writeJmp(qtaddobjectaddr, (void *)qt_addObject); - writeJmp(qtremobjectaddr, (void *)qt_removeObject); - writeJmp(qFlagLocationaddr, (void *)myFlagLocation); + overwriteQtFunctions(); + gammaray_probe_inject(); break; } @@ -823,12 +758,7 @@ class HitMeBabyOneMoreTime public: HitMeBabyOneMoreTime() { - void *qt_startup_hook_addr = dlsym(RTLD_NEXT, "qt_startup_hook"); - void *qt_add_object_addr = dlsym(RTLD_NEXT, "qt_addObject"); - void *qt_remove_object_addr = dlsym(RTLD_NEXT, "qt_removeObject"); - writeJmp(qt_startup_hook_addr, (void *)qt_startup_hook); - writeJmp(qt_add_object_addr, (void *)qt_addObject); - writeJmp(qt_remove_object_addr, (void *)qt_removeObject); + overwriteQtFunctions(); } }; diff --git a/probe.h b/probe.h index f38edb5..44694ea 100644 --- a/probe.h +++ b/probe.h @@ -105,6 +105,14 @@ class Q_DECL_EXPORT Probe : public QObject, public ProbeInterface */ bool isValidObject(QObject *obj) const; + /** + * Returns true if @p obj belongs to the GammaRay Probe or Window. + * + * These objects should not be tracked or shown to the user, + * hence must be explictly filtered. + */ + static bool filterObject(QObject *obj); + signals: /** * Emitted when the user selected @p widget at position @p pos in the probed application. @@ -113,6 +121,7 @@ class Q_DECL_EXPORT Probe : public QObject, public ProbeInterface void objectCreated(QObject *obj); void objectDestroyed(QObject *obj); + void objectReparanted(QObject *obj); protected: bool eventFilter(QObject *receiver, QEvent *event); @@ -134,9 +143,6 @@ class Q_DECL_EXPORT Probe : public QObject, public ProbeInterface ConnectionModel *m_connectionModel; ToolModel *m_toolModel; GammaRay::MainWindow *m_window; - // ensures proper information is returned by isValidObject by - // locking it in objectAdded/Removed - static QReadWriteLock s_lock; QSet m_validObjects; QQueue m_queuedObjects; QTimer *m_queueTimer; diff --git a/probefinder.h b/propertyeditor/propertycoloreditor.cpp similarity index 60% copy from probefinder.h copy to propertyeditor/propertycoloreditor.cpp index 6ebcc21..9c06d39 100644 --- a/probefinder.h +++ b/propertyeditor/propertycoloreditor.cpp @@ -1,10 +1,10 @@ /* - probefinder.h + propertycoloreditor.cpp This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,21 +21,22 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_PROBEFINDER_H -#define GAMMARAY_PROBEFINDER_H +#include "propertycoloreditor.h" +#include -class QString; +using namespace GammaRay; -namespace GammaRay { - -namespace ProbeFinder +PropertyColorEditor::PropertyColorEditor(QWidget *parent) + : PropertyExtendedEditor(parent) { - /** - * Attempts to find the full path of the probe DLL. - */ - QString findProbe(const QString &baseName); } +void PropertyColorEditor::edit() +{ + const QColor color = QColorDialog::getColor(value().value(), this); + if (color.isValid()) { + setValue(QVariant::fromValue(color)); + } } -#endif // GAMMARAY_PROBEFINDER_H +#include "propertycoloreditor.moc" diff --git a/mainwindow.h b/propertyeditor/propertycoloreditor.h similarity index 63% copy from mainwindow.h copy to propertyeditor/propertycoloreditor.h index 5b72d88..2769cd7 100644 --- a/mainwindow.h +++ b/propertyeditor/propertycoloreditor.h @@ -1,10 +1,10 @@ /* - mainwindow.h + propertycoloreditor.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,35 +21,24 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_PROPERTYCOLOREDITOR_H +#define GAMMARAY_PROPERTYCOLOREDITOR_H -#include - -#include "ui_mainwindow.h" - -class QComboBox; +#include "propertyextendededitor.h" namespace GammaRay { -class MainWindow : public QMainWindow +/** Property editor for QColor. */ +class PropertyColorEditor : public PropertyExtendedEditor { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); - - private slots: - void about(); - void aboutKDAB(); - - void toolSelected(); - - private: - void selectInitialTool(); + explicit PropertyColorEditor(QWidget *parent = 0); - Ui::MainWindow ui; + protected: + virtual void edit(); }; } -#endif // MAINWINDOW_H +#endif // GAMMARAY_PROPERTYCOLOREDITOR_H diff --git a/propertyeditor/propertydoublepaireditor.cpp b/propertyeditor/propertydoublepaireditor.cpp new file mode 100644 index 0000000..6a44b55 --- /dev/null +++ b/propertyeditor/propertydoublepaireditor.cpp @@ -0,0 +1,67 @@ +/* + propertydoublepaireditor.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "propertydoublepaireditor.h" + +#include "ui_propertydoublepaireditor.h" + +using namespace GammaRay; + +PropertyDoublePairEditor::PropertyDoublePairEditor(QWidget *parent) + : QWidget(parent), ui(new Ui::PropertyDoublePairEditor) +{ + ui->setupUi(this); +} + +PropertyPointFEditor::PropertyPointFEditor(QWidget *parent) + : PropertyDoublePairEditor(parent) +{ +} + +QPointF PropertyPointFEditor::pointF() const +{ + return QPointF(ui->xBox->value(), ui->yBox->value()); +} + +void PropertyPointFEditor::setPointF(const QPointF &point) +{ + ui->xBox->setValue(point.x()); + ui->yBox->setValue(point.y()); +} + +PropertySizeFEditor::PropertySizeFEditor(QWidget *parent) : PropertyDoublePairEditor(parent) +{ +} + +QSizeF PropertySizeFEditor::sizeF() const +{ + return QSizeF(ui->xBox->value(), ui->yBox->value()); +} + +void PropertySizeFEditor::setSizeF(const QSizeF &size) +{ + ui->xBox->setValue(size.width()); + ui->yBox->setValue(size.height()); +} + +#include "propertydoublepaireditor.moc" diff --git a/propertyeditor/propertydoublepaireditor.h b/propertyeditor/propertydoublepaireditor.h new file mode 100644 index 0000000..e853d05 --- /dev/null +++ b/propertyeditor/propertydoublepaireditor.h @@ -0,0 +1,68 @@ +/* + propertydoublepaireditor.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_PROPERTYDOUBLEPAIREDITOR_H +#define GAMMARAY_PROPERTYDOUBLEPAIREDITOR_H + +#include + +namespace GammaRay { + +namespace Ui { + class PropertyDoublePairEditor; +} + +/** Property editor for pairs of doubles, such as PointF and SizeF. */ +class PropertyDoublePairEditor : public QWidget +{ + Q_OBJECT + public: + explicit PropertyDoublePairEditor(QWidget *parent = 0); + + protected: + QScopedPointer ui; +}; + +class PropertyPointFEditor : public PropertyDoublePairEditor +{ + Q_OBJECT + Q_PROPERTY(QPointF pointF READ pointF WRITE setPointF USER true) + public: + explicit PropertyPointFEditor(QWidget *parent = 0); + QPointF pointF() const; + void setPointF(const QPointF &point); +}; + +class PropertySizeFEditor : public PropertyDoublePairEditor +{ + Q_OBJECT + Q_PROPERTY(QSizeF sizeF READ sizeF WRITE setSizeF USER true) + public: + explicit PropertySizeFEditor(QWidget *parent = 0); + QSizeF sizeF() const; + void setSizeF(const QSizeF &size); +}; + +} + +#endif // GAMMARAY_PROPERTYDOUBLEPAIREDITOR_H diff --git a/propertyeditor/propertydoublepaireditor.ui b/propertyeditor/propertydoublepaireditor.ui new file mode 100644 index 0000000..91a1440 --- /dev/null +++ b/propertyeditor/propertydoublepaireditor.ui @@ -0,0 +1,48 @@ + + + GammaRay::PropertyDoublePairEditor + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 0 + + + + + false + + + + + + + x + + + Qt::AlignCenter + + + + + + + false + + + + + + + + diff --git a/propertyeditor/propertyeditorfactory.cpp b/propertyeditor/propertyeditorfactory.cpp new file mode 100644 index 0000000..d1cfc7d --- /dev/null +++ b/propertyeditor/propertyeditorfactory.cpp @@ -0,0 +1,54 @@ +/* + propertyeditorfactory.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "propertyeditorfactory.h" +#include "propertycoloreditor.h" +#include "propertyfonteditor.h" +#include "propertyintpaireditor.h" +#include "propertydoublepaireditor.h" + +#include + +using namespace GammaRay; + +PropertyEditorFactory::PropertyEditorFactory() +{ + registerEditor(QVariant::Color, new QStandardItemEditorCreator()); + registerEditor(QVariant::Font, new QStandardItemEditorCreator()); + registerEditor(QVariant::Point, new QStandardItemEditorCreator()); + registerEditor(QVariant::PointF, new QStandardItemEditorCreator()); + registerEditor(QVariant::Size, new QStandardItemEditorCreator()); + registerEditor(QVariant::SizeF, new QStandardItemEditorCreator()); +} + +QWidget *PropertyEditorFactory::createEditor(QVariant::Type type, QWidget *parent) const +{ + QWidget *w = QItemEditorFactory::createEditor(type, parent); + if (!w) { + return 0; + } + + // the read-only view is still in the background usually, so transpareny is not a good choice here + w->setAutoFillBackground(true); + return w; +} diff --git a/mainwindow.h b/propertyeditor/propertyeditorfactory.h similarity index 60% copy from mainwindow.h copy to propertyeditor/propertyeditorfactory.h index 5b72d88..e60df61 100644 --- a/mainwindow.h +++ b/propertyeditor/propertyeditorfactory.h @@ -1,10 +1,10 @@ /* - mainwindow.h + propertyeditorfactory.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,35 +21,21 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_PROPERTYEDITORFACTORY_H +#define GAMMARAY_PROPERTYEDITORFACTORY_H -#include - -#include "ui_mainwindow.h" - -class QComboBox; +#include namespace GammaRay { -class MainWindow : public QMainWindow +/** Item editor factory with support for extra types while keeping support for the built-in ones. */ +class PropertyEditorFactory : public QItemEditorFactory { - Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); - - private slots: - void about(); - void aboutKDAB(); - - void toolSelected(); - - private: - void selectInitialTool(); - - Ui::MainWindow ui; + PropertyEditorFactory(); + virtual QWidget *createEditor(QVariant::Type type, QWidget *parent) const; }; } -#endif // MAINWINDOW_H +#endif // GAMMARAY_PROPERTYEDITORFACTORY_H diff --git a/injector/abstractinjector.cpp b/propertyeditor/propertyextendededitor.cpp similarity index 50% copy from injector/abstractinjector.cpp copy to propertyeditor/propertyextendededitor.cpp index dae96a8..0820e2b 100644 --- a/injector/abstractinjector.cpp +++ b/propertyeditor/propertyextendededitor.cpp @@ -1,10 +1,10 @@ /* - abstractinjector.cpp + propertyextendededitor.cpp This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,33 +21,35 @@ along with this program. If not, see . */ -#include "abstractinjector.h" - -#include -#include +#include "propertyextendededitor.h" +#include "ui_propertyextendededitor.h" +#include +#include using namespace GammaRay; -AbstractInjector::~AbstractInjector() +PropertyExtendedEditor::PropertyExtendedEditor(QWidget *parent) + : QWidget(parent), ui(new Ui::PropertyExtendedEditor) { + ui->setupUi(this); + // TODO: make button content smaller by using a tiny icon + connect(ui->editButton, SIGNAL(clicked()),SLOT(edit())); } -bool AbstractInjector::launch(const QStringList &programAndArgs, - const QString &probeDll, - const QString &probeFunc) +PropertyExtendedEditor::~PropertyExtendedEditor() { - Q_UNUSED(programAndArgs); - Q_UNUSED(probeDll); - Q_UNUSED(probeFunc); - qWarning() << "Injection on launch not supported by this injector."; - return false; + delete ui; } -bool AbstractInjector::attach(int pid, const QString &probeDll, const QString &probeFunc) +QVariant PropertyExtendedEditor::value() const { - Q_UNUSED(pid); - Q_UNUSED(probeDll); - Q_UNUSED(probeFunc); - qWarning() << "Attaching to a running process is not supported by this injector."; - return false; + return m_value; } + +void PropertyExtendedEditor::setValue(const QVariant &value) +{ + m_value = value; + ui->valueLabel->setText(Util::variantToString(value)); +} + +#include "propertyextendededitor.moc" diff --git a/tools/webinspector/webinspector.h b/propertyeditor/propertyextendededitor.h similarity index 52% copy from tools/webinspector/webinspector.h copy to propertyeditor/propertyextendededitor.h index 3bf4c8f..8e7b956 100644 --- a/tools/webinspector/webinspector.h +++ b/propertyeditor/propertyextendededitor.h @@ -1,10 +1,10 @@ /* - webinspector.h + propertyextendededitor.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,40 +21,38 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_WEBINSPECTOR_H -#define GAMMARAY_WEBINSPECTOR_H +#ifndef GAMMARAY_PROPERTYEXTENDEDEDITOR_H +#define GAMMARAY_PROPERTYEXTENDEDEDITOR_H -#include #include -#include +#include namespace GammaRay { -namespace Ui { class WebInspector; } +namespace Ui { + class PropertyExtendedEditor; +} -class WebInspector : public QWidget +/** Base class for property editors that open a separate dialog. */ +class PropertyExtendedEditor : public QWidget { Q_OBJECT + Q_PROPERTY(QVariant value READ value WRITE setValue USER true) public: - explicit WebInspector(GammaRay::ProbeInterface *probe, QWidget *parent = 0); + explicit PropertyExtendedEditor(QWidget *parent = 0); + virtual ~PropertyExtendedEditor(); - private slots: - void webPageSelected(int index); + QVariant value() const; + void setValue(const QVariant &value); - private: - QScopedPointer ui; -}; + protected slots: + virtual void edit() = 0; -class WebInspectorFactory - : public QObject, public StandardToolFactory -{ - Q_OBJECT - Q_INTERFACES(GammaRay::ToolFactory) - public: - explicit WebInspectorFactory(QObject *parent) : QObject(parent) {} - inline QString name() const { return tr("Web Pages"); } + private: + Ui::PropertyExtendedEditor *ui; + QVariant m_value; }; } -#endif // GAMMARAY_WEBINSPECTOR_H +#endif // GAMMARAY_PROPERTYEXTENDEDEDITOR_H diff --git a/propertyeditor/propertyextendededitor.ui b/propertyeditor/propertyextendededitor.ui new file mode 100644 index 0000000..e363ba4 --- /dev/null +++ b/propertyeditor/propertyextendededitor.ui @@ -0,0 +1,37 @@ + + + GammaRay::PropertyExtendedEditor + + + + 0 + 0 + 392 + 23 + + + + Form + + + + 0 + + + 0 + + + + + + + + ... + + + + + + + + diff --git a/probefinder.h b/propertyeditor/propertyfonteditor.cpp similarity index 61% copy from probefinder.h copy to propertyeditor/propertyfonteditor.cpp index 6ebcc21..52e3215 100644 --- a/probefinder.h +++ b/propertyeditor/propertyfonteditor.cpp @@ -1,10 +1,10 @@ /* - probefinder.h + propertyfonteditor.cpp This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,21 +21,24 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_PROBEFINDER_H -#define GAMMARAY_PROBEFINDER_H +#include "propertyfonteditor.h" -class QString; +#include -namespace GammaRay { +using namespace GammaRay; -namespace ProbeFinder +PropertyFontEditor::PropertyFontEditor(QWidget *parent) + : PropertyExtendedEditor(parent) { - /** - * Attempts to find the full path of the probe DLL. - */ - QString findProbe(const QString &baseName); } +void PropertyFontEditor::edit() +{ + bool ok = false; + const QFont font = QFontDialog::getFont(&ok, value().value(), this); + if (ok) { + setValue(font); + } } -#endif // GAMMARAY_PROBEFINDER_H +#include "propertyfonteditor.moc" diff --git a/probefinder.h b/propertyeditor/propertyfonteditor.h similarity index 64% copy from probefinder.h copy to propertyeditor/propertyfonteditor.h index 6ebcc21..044f3b9 100644 --- a/probefinder.h +++ b/propertyeditor/propertyfonteditor.h @@ -1,10 +1,10 @@ /* - probefinder.h + propertyfonteditor.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,21 +21,23 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_PROBEFINDER_H -#define GAMMARAY_PROBEFINDER_H +#ifndef GAMMARAY_PROPERTYFONTEDITOR_H +#define GAMMARAY_PROPERTYFONTEDITOR_H -class QString; +#include "propertyextendededitor.h" namespace GammaRay { -namespace ProbeFinder +class PropertyFontEditor : public PropertyExtendedEditor { - /** - * Attempts to find the full path of the probe DLL. - */ - QString findProbe(const QString &baseName); -} + Q_OBJECT + public: + explicit PropertyFontEditor(QWidget *parent = 0); + + protected: + virtual void edit(); +}; } -#endif // GAMMARAY_PROBEFINDER_H +#endif // GAMMARAY_PROPERTYFONTEDITOR_H diff --git a/propertyeditor/propertyintpaireditor.cpp b/propertyeditor/propertyintpaireditor.cpp new file mode 100644 index 0000000..3fa35f1 --- /dev/null +++ b/propertyeditor/propertyintpaireditor.cpp @@ -0,0 +1,75 @@ +/* + propertyintpaireditor.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "propertyintpaireditor.h" + +#include "ui_propertyintpaireditor.h" +#include + +#include + +using namespace GammaRay; + +PropertyIntPairEditor::PropertyIntPairEditor(QWidget *parent) + : QWidget(parent), ui(new Ui::PropertyIntPairEditor) +{ + ui->setupUi(this); + ui->xBox->setMinimum(std::numeric_limits::min()); + ui->xBox->setMaximum(std::numeric_limits::max()); + ui->yBox->setMinimum(std::numeric_limits::min()); + ui->yBox->setMaximum(std::numeric_limits::max()); +} + +PropertyPointEditor::PropertyPointEditor(QWidget *parent) + : PropertyIntPairEditor(parent) +{ +} + +QPoint PropertyPointEditor::point() const +{ + return QPoint(ui->xBox->value(), ui->yBox->value()); +} + +void PropertyPointEditor::setPoint(const QPoint &point) +{ + ui->xBox->setValue(point.x()); + ui->yBox->setValue(point.y()); +} + +PropertySizeEditor::PropertySizeEditor(QWidget *parent) + : PropertyIntPairEditor(parent) +{ +} + +QSize PropertySizeEditor::sizeValue() const +{ + return QSize(ui->xBox->value(), ui->yBox->value()); +} + +void PropertySizeEditor::setSizeValue(const QSize &size) +{ + ui->xBox->setValue(size.width()); + ui->yBox->setValue(size.height()); +} + +#include "propertyintpaireditor.moc" diff --git a/propertyeditor/propertyintpaireditor.h b/propertyeditor/propertyintpaireditor.h new file mode 100644 index 0000000..3ad6169 --- /dev/null +++ b/propertyeditor/propertyintpaireditor.h @@ -0,0 +1,76 @@ +/* + propertyintpaireditor.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_PROPERTYINTPAIREDITOR_H +#define GAMMARAY_PROPERTYINTPAIREDITOR_H + +#include + +class QPoint; + +namespace GammaRay { + +namespace Ui { + class PropertyIntPairEditor; +} + +/** Property editor for QPoint, QSize and anything else consisting of two integer values. */ +class PropertyIntPairEditor : public QWidget +{ + Q_OBJECT + public: + explicit PropertyIntPairEditor(QWidget *parent = 0); + + protected: + QScopedPointer ui; +}; + +/** Property editor for points. Since QStyledItemDelegate ignore valuePropertyName and insists on + * USER properties we need one class per type here... + */ +class PropertyPointEditor : public PropertyIntPairEditor +{ + Q_OBJECT + Q_PROPERTY(QPoint point READ point WRITE setPoint USER true) + public: + explicit PropertyPointEditor(QWidget *parent = 0); + + QPoint point() const; + void setPoint(const QPoint &point); +}; + +/** Same again for size. */ +class PropertySizeEditor : public PropertyIntPairEditor +{ + Q_OBJECT + Q_PROPERTY(QSize sizeValue READ sizeValue WRITE setSizeValue USER true) + public: + explicit PropertySizeEditor(QWidget *parent = 0); + + QSize sizeValue() const; + void setSizeValue(const QSize &size); +}; + +} + +#endif // GAMMARAY_PROPERTYINTPAIREDITOR_H diff --git a/propertyeditor/propertyintpaireditor.ui b/propertyeditor/propertyintpaireditor.ui new file mode 100644 index 0000000..d8198cf --- /dev/null +++ b/propertyeditor/propertyintpaireditor.ui @@ -0,0 +1,54 @@ + + + GammaRay::PropertyIntPairEditor + + + + 0 + 0 + 145 + 22 + + + + Form + + + + 0 + + + + + false + + + -99999 + + + 99999 + + + + + + + x + + + Qt::AlignCenter + + + + + + + false + + + + + + + + diff --git a/propertywidget.cpp b/propertywidget.cpp index c399af4..1464904 100644 --- a/propertywidget.cpp +++ b/propertywidget.cpp @@ -27,11 +27,14 @@ #include "objectclassinfomodel.h" #include "objectmethodmodel.h" #include "objectenummodel.h" +#include "metapropertymodel.h" #include "connectionmodel.h" #include "connectionfilterproxymodel.h" #include "probe.h" #include "methodinvocationdialog.h" #include "multisignalmapper.h" +#include "proxydetacher.h" +#include "propertyeditor/propertyeditorfactory.h" #include "kde/krecursivefilterproxymodel.h" @@ -39,6 +42,7 @@ #include #include #include +#include using namespace GammaRay; @@ -52,7 +56,9 @@ PropertyWidget::PropertyWidget(QWidget *parent) m_outboundConnectionModel(new ConnectionFilterProxyModel(this)), m_enumModel(new ObjectEnumModel(this)), m_signalMapper(0), - m_methodLogModel(new QStandardItemModel(this)) + m_methodLogModel(new QStandardItemModel(this)), + m_metaPropertyModel(new MetaPropertyModel(this)), + m_editorFactory(new PropertyEditorFactory) { ui.setupUi(this); @@ -63,6 +69,7 @@ PropertyWidget::PropertyWidget(QWidget *parent) ui.staticPropertyView->sortByColumn(0, Qt::AscendingOrder); ui.staticPropertyView->header()->setResizeMode(0, QHeaderView::ResizeToContents); ui.staticPropertySearchLine->setProxy(proxy); + setEditorFactory(ui.staticPropertyView); proxy = new QSortFilterProxyModel(this); proxy->setDynamicSortFilter(true); @@ -70,6 +77,7 @@ PropertyWidget::PropertyWidget(QWidget *parent) ui.dynamicPropertyView->setModel(proxy); ui.dynamicPropertyView->sortByColumn(0, Qt::AscendingOrder); ui.dynamicPropertyView->header()->setResizeMode(0, QHeaderView::ResizeToContents); + setEditorFactory(ui.dynamicPropertyView); ui.dynamicPropertySearchLine->setProxy(proxy); proxy = new QSortFilterProxyModel(this); @@ -93,12 +101,14 @@ PropertyWidget::PropertyWidget(QWidget *parent) ui.classInfoView->header()->setResizeMode(QHeaderView::ResizeToContents); ui.classInfoSearchLine->setProxy(proxy); - m_inboundConnectionModel->setSourceModel(Probe::instance()->connectionModel()); + new ProxyDetacher(ui.inboundConnectionView, m_inboundConnectionModel, + Probe::instance()->connectionModel()); ui.inboundConnectionView->setModel(m_inboundConnectionModel); ui.inboundConnectionView->sortByColumn(0, Qt::AscendingOrder); ui.inboundConnectionSearchLine->setProxy(m_inboundConnectionModel); - m_outboundConnectionModel->setSourceModel(Probe::instance()->connectionModel()); + new ProxyDetacher(ui.outboundConnectionView, m_outboundConnectionModel, + Probe::instance()->connectionModel()); ui.outboundConnectionView->setModel(m_outboundConnectionModel); ui.outboundConnectionView->sortByColumn(0, Qt::AscendingOrder); ui.outboundConnectionSearchLine->setProxy(m_outboundConnectionModel); @@ -110,6 +120,9 @@ PropertyWidget::PropertyWidget(QWidget *parent) ui.enumView->sortByColumn(0, Qt::AscendingOrder); ui.enumView->header()->setResizeMode(QHeaderView::ResizeToContents); ui.enumSearchLine->setProxy(proxy); + + ui.metaPropertyView->setModel(m_metaPropertyModel); + setEditorFactory(ui.metaPropertyView); } void GammaRay::PropertyWidget::setObject(QObject *object) @@ -128,9 +141,20 @@ void GammaRay::PropertyWidget::setObject(QObject *object) connect(m_signalMapper, SIGNAL(signalEmitted(QObject*,int)), SLOT(signalEmitted(QObject*,int))); m_methodLogModel->clear(); + + m_metaPropertyModel->setObject(object); + + setQObjectTabsVisible(true); +} + +void PropertyWidget::setObject(void *object, const QString &className) +{ + setObject(0); + m_metaPropertyModel->setObject(object, className); + setQObjectTabsVisible(false); } -void PropertyWidget::methodActivated(const QModelIndex &index) +void GammaRay::PropertyWidget::methodActivated(const QModelIndex &index) { const QMetaMethod method = index.data(ObjectMethodModel::MetaMethodRole).value(); if (method.methodType() == QMetaMethod::Slot) { @@ -172,4 +196,25 @@ void PropertyWidget::methodConextMenu(const QPoint &pos) } } +void PropertyWidget::setQObjectTabsVisible(bool visible) +{ + // TODO: this should actually hide instead of disable... + for (int i = 0; i < ui.tabWidget->count(); ++i) { + if (ui.tabWidget->widget(i) != ui.metaPropertyTab) { + ui.tabWidget->setTabEnabled(i, visible); + } + } + if (!visible) { + ui.tabWidget->setCurrentWidget(ui.metaPropertyTab); + } +} + +void PropertyWidget::setEditorFactory(QAbstractItemView *view) +{ + QStyledItemDelegate *delegate = qobject_cast(view->itemDelegate()); + if (delegate) { + delegate->setItemEditorFactory(m_editorFactory.data()); + } +} + #include "propertywidget.moc" diff --git a/propertywidget.h b/propertywidget.h index f61d1c4..fbb56c5 100644 --- a/propertywidget.h +++ b/propertywidget.h @@ -38,6 +38,8 @@ class ObjectStaticPropertyModel; class ObjectClassInfoModel; class ObjectMethodModel; class ObjectEnumModel; +class MetaPropertyModel; +class PropertyEditorFactory; class PropertyWidget : public QWidget { @@ -46,6 +48,11 @@ class PropertyWidget : public QWidget explicit PropertyWidget(QWidget *parent = 0); void setObject(QObject *object); + void setObject(void *object, const QString &className); + + private: + void setQObjectTabsVisible(bool visible); + void setEditorFactory(QAbstractItemView *view); private slots: void methodActivated(const QModelIndex &index); @@ -64,6 +71,8 @@ class PropertyWidget : public QWidget ObjectEnumModel *m_enumModel; MultiSignalMapper *m_signalMapper; QStandardItemModel *m_methodLogModel; + MetaPropertyModel *m_metaPropertyModel; + QScopedPointer m_editorFactory; }; } diff --git a/propertywidget.ui b/propertywidget.ui index abba90d..5c54a0d 100644 --- a/propertywidget.ui +++ b/propertywidget.ui @@ -6,7 +6,7 @@ 0 0 - 703 + 816 605 @@ -25,7 +25,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -133,7 +133,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -173,7 +173,7 @@ - + @@ -190,6 +190,26 @@ + + + Non-QObject Properties + + + + + + false + + + true + + + true + + + + + diff --git a/splashscreen.cpp b/proxydetacher.cpp similarity index 50% rename from splashscreen.cpp rename to proxydetacher.cpp index ce94a23..9e88cce 100644 --- a/splashscreen.cpp +++ b/proxydetacher.cpp @@ -1,5 +1,5 @@ /* - attachdialog.h + proxydetacher.cpp This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,31 +21,39 @@ along with this program. If not, see . */ -#include "splashscreen.h" +#include "proxydetacher.h" -#include -#include +#include +#include +#include +#include -QSplashScreen *splash = 0; +using namespace GammaRay; -namespace GammaRay { - -void showSplashScreen() +ProxyDetacher::ProxyDetacher(QWidget *widget, + QAbstractProxyModel *proxyModel, + QAbstractItemModel *sourceModel) + : QObject(widget), + m_widget(widget), + m_proxy(proxyModel), + m_source(sourceModel) { - if (!splash) { - QPixmap pixmap(QLatin1String(":gammaray/splashscreen.png")); - splash = new QSplashScreen(pixmap); - splash->setMask(pixmap.mask()); - } - - splash->show(); + widget->installEventFilter(this); } -void hideSplashScreen() +bool ProxyDetacher::eventFilter(QObject *obj, QEvent *e) { - if (splash) { - splash->hide(); + Q_ASSERT(obj == m_widget); + + if (dynamic_cast(e)) { + Q_ASSERT(m_proxy->sourceModel() == m_source); + m_proxy->setSourceModel(0); + } else if (dynamic_cast(e)) { + Q_ASSERT(!m_proxy->sourceModel()); + m_proxy->setSourceModel(m_source); } -} + return QObject::eventFilter(obj, e); } + +#include "proxydetacher.moc" diff --git a/promolabel.h b/proxydetacher.h similarity index 57% rename from promolabel.h rename to proxydetacher.h index dafb851..1e436ab 100644 --- a/promolabel.h +++ b/proxydetacher.h @@ -1,5 +1,5 @@ /* - mainwindow.cpp + proxydetacher.h This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,30 +21,38 @@ along with this program. If not, see . */ -#ifndef PROMOLABEL_H -#define PROMOLABEL_H +#ifndef GAMMARAY_PROXYDETACHER_H +#define GAMMARAY_PROXYDETACHER_H -#include +#include + +class QWidget; +class QAbstractItemModel; +class QAbstractProxyModel; namespace GammaRay { -class PromoLabel : public QLabel +/** + * Optimization Helper + * + * Detaches source model of proxy when widget gets hidden. + * Re-attaches source model when widget gets shown again. + */ +class ProxyDetacher : public QObject { Q_OBJECT - public: - explicit PromoLabel(QWidget *parent = 0, Qt::WindowFlags f = 0); - - static QImage tintedImage(const QString &image, const QColor &color); - - protected: - virtual bool event(QEvent *e); - virtual void mouseReleaseEvent(QMouseEvent *ev); + explicit ProxyDetacher(QWidget *widget, + QAbstractProxyModel *proxyModel, + QAbstractItemModel *sourceModel); + virtual bool eventFilter(QObject *obj, QEvent *e); private: - void updatePixmap(); + QWidget *m_widget; + QAbstractProxyModel *m_proxy; + QAbstractItemModel *m_source; }; } -#endif // PROMOLABEL_H +#endif // PROXYDETACHER_H diff --git a/proxytoolfactory.cpp b/proxytoolfactory.cpp new file mode 100644 index 0000000..88f7a57 --- /dev/null +++ b/proxytoolfactory.cpp @@ -0,0 +1,113 @@ +/* + proxytoolfactory.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "proxytoolfactory.h" + +#include +#include +#include +#include +#include + +#include + +using namespace GammaRay; + +ProxyToolFactory::ProxyToolFactory(const QString &path, QObject *parent) + : QObject(parent), m_factory(0) +{ + const QFileInfo pluginInfo(path); + m_id = pluginInfo.baseName(); + + QSettings desktopFile(path, QSettings::IniFormat); + desktopFile.beginGroup(QLatin1String("Desktop Entry")); + m_name = desktopFile.value(QLatin1String("Name")).toString(); + m_supportedTypes = + desktopFile.value( + QLatin1String("X-GammaRay-Types")).toString().split(QLatin1Char(';'), + QString::SkipEmptyParts); + m_pluginPath = + pluginInfo.dir().absoluteFilePath(desktopFile.value(QLatin1String("Exec")).toString()); + + const QString dllBaseName = desktopFile.value(QLatin1String("Exec")).toString(); + if (dllBaseName.isEmpty()) { + return; + } + + foreach (const QString &entry, + pluginInfo.dir().entryList(QStringList(dllBaseName + QLatin1Char('*')), QDir::Files)) { + const QString path = pluginInfo.dir().absoluteFilePath(entry); + if (QLibrary::isLibrary(path)) { + m_pluginPath = path; + break; + } + } +} + +bool ProxyToolFactory::isValid() const +{ + return + !m_id.isEmpty() && + !m_name.isEmpty() && + !m_pluginPath.isEmpty() && + !m_supportedTypes.isEmpty(); +} + +QString ProxyToolFactory::id() const +{ + return m_id; +} + +QString ProxyToolFactory::name() const +{ + return m_name; +} + +QStringList ProxyToolFactory::supportedTypes() const +{ + return m_supportedTypes; +} + +void ProxyToolFactory::init(ProbeInterface *probe) +{ + QPluginLoader loader(m_pluginPath, this); + m_factory = qobject_cast(loader.instance()); + if (!m_factory) { + std::cerr << "error loading plugin " << qPrintable(m_pluginPath) + << ": " << qPrintable(loader.errorString()) << std::endl; + return; + } + Q_ASSERT(m_factory); + m_factory->init(probe); +} + +QWidget *ProxyToolFactory::createWidget(ProbeInterface *probe, QWidget *parentWidget) +{ + if (!m_factory) { + return new QLabel(tr("Plugin '%1' could not be loaded.").arg(m_pluginPath), parentWidget); + } + Q_ASSERT(m_factory); + return m_factory->createWidget(probe, parentWidget); +} + +#include "proxytoolfactory.moc" diff --git a/proxytoolfactory.h b/proxytoolfactory.h new file mode 100644 index 0000000..1e57e84 --- /dev/null +++ b/proxytoolfactory.h @@ -0,0 +1,65 @@ +/* + proxytoolfactory.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_PROXYTOOLFACTORY_H +#define GAMMARAY_PROXYTOOLFACTORY_H + +#include "toolfactory.h" + +namespace GammaRay { + +/** + * A wrapper around a plugin ToolFactory that only loads the actual plugin + * once initialized. + * Until then, meta-data is provided based on a plugin spec file. + */ +class ProxyToolFactory : public QObject, public ToolFactory +{ + Q_OBJECT + public: + /** + * @param path Path to the plugin spec file + */ + explicit ProxyToolFactory(const QString &path, QObject *parent = 0); + + /** Returns @c true if the plugin seems valid from all the information we have so far. */ + bool isValid() const; + + virtual QString id() const; + virtual QString name() const; + virtual QStringList supportedTypes() const; + + virtual void init(ProbeInterface *probe); + virtual QWidget *createWidget(ProbeInterface *probe, QWidget *parentWidget); + + private: + QString m_id; + QString m_pluginPath; + QString m_name; + QStringList m_supportedTypes; + ToolFactory *m_factory; +}; + +} + +#endif // GAMMARAY_PROXYTOOLFACTORY_H diff --git a/qmldebugcontrol/CMakeLists.txt b/qmldebugcontrol/CMakeLists.txt deleted file mode 100644 index f57029a..0000000 --- a/qmldebugcontrol/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -project(qmldebugcontrol) - -include(${QT_USE_FILE}) - -remove_definitions(-DQT_NO_CAST_TO_ASCII) -remove_definitions(-DQT_NO_CAST_FROM_ASCII) - -add_subdirectory(qmljsdebugclient) -add_subdirectory(canvas) -add_subdirectory(qmljsdebugger) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/qmljsdebugclient -) - -set(qmldebugcontrol_SRCS - qmlprofilertool.cpp - qmlprofilereventview.cpp - tracewindow.cpp - timelineview.cpp - tracewindow.cpp - qmlprofilertraceclient.cpp - main.cpp -) - -qt4_add_resources(_testresource_rcc_src qml/qml.qrc OPTIONS -root "/") - -qt4_automoc(${qmldebugcontrol_SRCS}) - -add_executable(qmldebugcontrol ${qmldebugcontrol_SRCS} ${_testresource_rcc_src}) - -target_link_libraries(qmldebugcontrol - ${QT_QTGUI_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARIES} - ${QT_QTCORE_LIBRARIES} - ${QT_QTSCRIPT_LIBRARIES} - ${QT_QTNETWORK_LIBRARIES} - qmldebugclient - canvas -) - diff --git a/qmldebugcontrol/QmlProfiler.pluginspec.in b/qmldebugcontrol/QmlProfiler.pluginspec.in deleted file mode 100644 index 8f58a64..0000000 --- a/qmldebugcontrol/QmlProfiler.pluginspec.in +++ /dev/null @@ -1,22 +0,0 @@ - - Nokia Corporation - (C) 2011 Nokia Corporation - - Commercial Usage - - Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia. - - GNU Lesser General Public License Usage - - Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License version 2.1 requirements will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. - - Qml Profiler Plugin - http://qt.nokia.com - - - - - - - - diff --git a/qmldebugcontrol/abstractqmlprofilerrunner.h b/qmldebugcontrol/abstractqmlprofilerrunner.h deleted file mode 100644 index b1ce6f1..0000000 --- a/qmldebugcontrol/abstractqmlprofilerrunner.h +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef ABSTRACTQMLPROFILERRUNNER_H -#define ABSTRACTQMLPROFILERRUNNER_H - -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class AbstractQmlProfilerRunner : public QObject -{ - Q_OBJECT - -public: - explicit AbstractQmlProfilerRunner(QObject *parent = 0) : QObject(parent) { } - - virtual void start() = 0; - virtual void stop() = 0; - - virtual int debugPort() const = 0; - -signals: - void started(); - void stopped(); - - void appendMessage(const QString &message, Utils::OutputFormat format); -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // ABSTRACTQMLPROFILERRUNNER_H diff --git a/qmldebugcontrol/canvas/CMakeLists.txt b/qmldebugcontrol/canvas/CMakeLists.txt deleted file mode 100644 index faf39e4..0000000 --- a/qmldebugcontrol/canvas/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -project(canvas) - -set(canvas_SRCS - qdeclarativecanvas.cpp - qdeclarativecanvastimer.cpp - qdeclarativecontext2d.cpp - qdeclarativetiledcanvas.cpp -) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - -) - -add_library(canvas ${canvas_SRCS}) - -qt4_automoc(${canvas_SRCS}) - -target_link_libraries(canvas - ${QT_QTGUI_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARIES} - ${QT_QTCORE_LIBRARIES} -) diff --git a/qmldebugcontrol/canvas/canvas.pri b/qmldebugcontrol/canvas/canvas.pri deleted file mode 100644 index 2b37e8e..0000000 --- a/qmldebugcontrol/canvas/canvas.pri +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += $$PWD/qdeclarativecontext2d_p.h \ - $$PWD/qdeclarativecanvas_p.h \ - $$PWD/qdeclarativetiledcanvas_p.h \ - $$PWD/qdeclarativecanvastimer_p.h - -SOURCES += $$PWD/qdeclarativecontext2d.cpp \ - $$PWD/qdeclarativecanvas.cpp \ - $$PWD/qdeclarativetiledcanvas.cpp \ - $$PWD/qdeclarativecanvastimer.cpp diff --git a/qmldebugcontrol/canvas/qdeclarativecanvas.cpp b/qmldebugcontrol/canvas/qdeclarativecanvas.cpp deleted file mode 100644 index 98a1bcd..0000000 --- a/qmldebugcontrol/canvas/qdeclarativecanvas.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qdeclarativecanvas.h" -#include "qdeclarativecanvastimer.h" -#include "qdeclarativecontext2d.h" - -#include - -QT_BEGIN_NAMESPACE - -Canvas::Canvas(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_context(new Context2D(this)), - m_canvasWidth(0), - m_canvasHeight(0), - m_fillMode(Canvas::Stretch), - m_color(Qt::white) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); - setCacheMode(QGraphicsItem::DeviceCoordinateCache); -} - - -void Canvas::componentComplete() -{ - if (m_canvasWidth == 0 && m_canvasHeight == 0) - m_context->setSize(width(), height()); - else - m_context->setSize(m_canvasWidth, m_canvasHeight); - - connect(m_context, SIGNAL(changed()), this, SLOT(requestPaint())); - emit init(); - QDeclarativeItem::componentComplete(); -} - -void Canvas::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) -{ - m_context->setInPaint(true); - emit paint(); - - bool oldAA = painter->testRenderHint(QPainter::Antialiasing); - bool oldSmooth = painter->testRenderHint(QPainter::SmoothPixmapTransform); - if (smooth()) - painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, smooth()); - - if (m_context->pixmap().isNull()) { - painter->fillRect(0, 0, width(), height(), m_color); - } else if (width() != m_context->pixmap().width() || height() != m_context->pixmap().height()) { - if (m_fillMode>= Tile) { - if (m_fillMode== Tile) { - painter->drawTiledPixmap(QRectF(0,0,width(),height()), m_context->pixmap()); - } else { - qreal widthScale = width() / qreal(m_context->pixmap().width()); - qreal heightScale = height() / qreal(m_context->pixmap().height()); - - QTransform scale; - if (m_fillMode== TileVertically) { - scale.scale(widthScale, 1.0); - QTransform old = painter->transform(); - painter->setWorldTransform(scale * old); - painter->drawTiledPixmap(QRectF(0,0,m_context->pixmap().width(),height()), m_context->pixmap()); - painter->setWorldTransform(old); - } else { - scale.scale(1.0, heightScale); - QTransform old = painter->transform(); - painter->setWorldTransform(scale * old); - painter->drawTiledPixmap(QRectF(0,0,width(),m_context->pixmap().height()), m_context->pixmap()); - painter->setWorldTransform(old); - } - } - } else { - qreal widthScale = width() / qreal(m_context->pixmap().width()); - qreal heightScale = height() / qreal(m_context->pixmap().height()); - - QTransform scale; - - if (m_fillMode== PreserveAspectFit) { - if (widthScale <= heightScale) { - heightScale = widthScale; - scale.translate(0, (height() - heightScale * m_context->pixmap().height()) / 2); - } else if (heightScale < widthScale) { - widthScale = heightScale; - scale.translate((width() - widthScale * m_context->pixmap().width()) / 2, 0); - } - } else if (m_fillMode== PreserveAspectCrop) { - if (widthScale < heightScale) { - widthScale = heightScale; - scale.translate((width() - widthScale * m_context->pixmap().width()) / 2, 0); - } else if (heightScale < widthScale) { - heightScale = widthScale; - scale.translate(0, (height() - heightScale * m_context->pixmap().height()) / 2); - } - } - if (clip()) { - painter->save(); - painter->setClipRect(boundingRect(), Qt::IntersectClip); - } - scale.scale(widthScale, heightScale); - QTransform old = painter->transform(); - painter->setWorldTransform(scale * old); - painter->drawPixmap(0, 0, m_context->pixmap()); - painter->setWorldTransform(old); - if (clip()) { - painter->restore(); - } - } - } else { - painter->drawPixmap(0, 0, m_context->pixmap()); - } - - if (smooth()) { - painter->setRenderHint(QPainter::Antialiasing, oldAA); - painter->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); - } - m_context->setInPaint(false); -} - -Context2D *Canvas::getContext(const QString &contextId) -{ - if (contextId == QLatin1String("2d")) - return m_context; - qDebug("Canvas:requesting unsupported context"); - return 0; -} - -void Canvas::requestPaint() -{ - update(); -} - -void Canvas::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - if (m_canvasWidth == 0 && m_canvasHeight == 0 - && newGeometry.width() > 0 && newGeometry.height() > 0) { - m_context->setSize(width(), height()); - } - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -void Canvas::setCanvasWidth(int newWidth) -{ - if (m_canvasWidth != newWidth) { - m_canvasWidth = newWidth; - m_context->setSize(m_canvasWidth, m_canvasHeight); - emit canvasWidthChanged(); - } -} - -void Canvas::setCanvasHeight(int newHeight) -{ - if (m_canvasHeight != newHeight) { - m_canvasHeight = newHeight; - m_context->setSize(m_canvasWidth, m_canvasHeight); - emit canvasHeightChanged(); - } -} - -void Canvas::setFillMode(FillMode mode) -{ - if (m_fillMode == mode) - return; - - m_fillMode = mode; - update(); - emit fillModeChanged(); -} - -QColor Canvas::color() -{ - return m_color; -} - -void Canvas::setColor(const QColor &color) -{ - if (m_color !=color) { - m_color = color; - colorChanged(); - } -} - -Canvas::FillMode Canvas::fillMode() const -{ - return m_fillMode; -} - -bool Canvas::save(const QString &filename) const -{ - return m_context->pixmap().save(filename); -} - -CanvasImage *Canvas::toImage() const -{ - return new CanvasImage(m_context->pixmap()); -} - -void Canvas::setTimeout(const QScriptValue &handler, long timeout) -{ - if (handler.isFunction()) - CanvasTimer::createTimer(this, handler, timeout, true); -} - -void Canvas::setInterval(const QScriptValue &handler, long interval) -{ - if (handler.isFunction()) - CanvasTimer::createTimer(this, handler, interval, false); -} - -void Canvas::clearTimeout(const QScriptValue &handler) -{ - CanvasTimer::removeTimer(handler); -} - -void Canvas::clearInterval(const QScriptValue &handler) -{ - CanvasTimer::removeTimer(handler); -} - -#include "qdeclarativecanvas.moc" - -QT_END_NAMESPACE diff --git a/qmldebugcontrol/canvas/qdeclarativecanvas.h b/qmldebugcontrol/canvas/qdeclarativecanvas.h deleted file mode 100644 index 2a7cced..0000000 --- a/qmldebugcontrol/canvas/qdeclarativecanvas.h +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVECANVAS_P_H -#define QDECLARATIVECANVAS_P_H - -#include - -#include "qdeclarativecontext2d.h" -#include "qdeclarativecanvastimer.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class Canvas : public QDeclarativeItem -{ - Q_OBJECT - - Q_ENUMS(FillMode) - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged); - Q_PROPERTY(int canvasWidth READ canvasWidth WRITE setCanvasWidth NOTIFY canvasWidthChanged); - Q_PROPERTY(int canvasHeight READ canvasHeight WRITE setCanvasHeight NOTIFY canvasHeightChanged); - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) - -public: - Canvas(QDeclarativeItem *parent = 0); - enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally }; - - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - void setCanvasWidth(int newWidth); - int canvasWidth() {return m_canvasWidth;} - - void setCanvasHeight(int canvasHeight); - int canvasHeight() {return m_canvasHeight;} - - void componentComplete(); - - -public Q_SLOTS: - Context2D *getContext(const QString & = QString("2d")); - void requestPaint(); - - FillMode fillMode() const; - void setFillMode(FillMode); - - QColor color(); - void setColor(const QColor &); - - // Save current canvas to disk - bool save(const QString& filename) const; - - // Timers - void setInterval(const QScriptValue &handler, long timeout); - void setTimeout(const QScriptValue &handler, long timeout); - void clearInterval(const QScriptValue &handler); - void clearTimeout(const QScriptValue &handler); - -Q_SIGNALS: - void fillModeChanged(); - void canvasWidthChanged(); - void canvasHeightChanged(); - void colorChanged(); - void init(); - void paint(); - -private: - // Return canvas contents as a drawable image - CanvasImage *toImage() const; - Context2D *m_context; - int m_canvasWidth; - int m_canvasHeight; - FillMode m_fillMode; - QColor m_color; - - friend class Context2D; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif //QDECLARATIVECANVAS_P_H diff --git a/qmldebugcontrol/canvas/qdeclarativecanvastimer.cpp b/qmldebugcontrol/canvas/qdeclarativecanvastimer.cpp deleted file mode 100644 index 49a5846..0000000 --- a/qmldebugcontrol/canvas/qdeclarativecanvastimer.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include -#include -#include - -#include "qdeclarativecanvastimer.h" - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QList , activeTimers); - -CanvasTimer::CanvasTimer(QObject *parent, const QScriptValue &data) - : QTimer(parent), m_value(data) -{ -} - -void CanvasTimer::handleTimeout() -{ - Q_ASSERT(m_value.isFunction()); - m_value.call(); - if (isSingleShot()) { - removeTimer(this); - } -} - -void CanvasTimer::createTimer(QObject *parent, const QScriptValue &val, long timeout, bool singleshot) -{ - - CanvasTimer *timer = new CanvasTimer(parent, val); - timer->setInterval(timeout); - timer->setSingleShot(singleshot); - connect(timer, SIGNAL(timeout()), timer, SLOT(handleTimeout())); - activeTimers()->append(timer); - timer->start(); -} - -void CanvasTimer::removeTimer(CanvasTimer *timer) -{ - activeTimers()->removeAll(timer); - timer->deleteLater(); -} - -void CanvasTimer::removeTimer(const QScriptValue &val) -{ - if (!val.isFunction()) - return; - - for (int i = 0 ; i < activeTimers()->count() ; ++i) { - CanvasTimer *timer = activeTimers()->at(i); - if (timer->equals(val)) { - removeTimer(timer); - return; - } - } -} - -QT_END_NAMESPACE - -#include "qdeclarativecanvastimer.moc" diff --git a/qmldebugcontrol/canvas/qdeclarativecanvastimer.h b/qmldebugcontrol/canvas/qdeclarativecanvastimer.h deleted file mode 100644 index 17ad439..0000000 --- a/qmldebugcontrol/canvas/qdeclarativecanvastimer.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVECANVASTIMER_P_H -#define QDECLARATIVECANVASTIMER_P_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class CanvasTimer : public QTimer -{ - Q_OBJECT - -public: - CanvasTimer(QObject *parent, const QScriptValue &data); - -public Q_SLOTS: - void handleTimeout(); - bool equals(const QScriptValue &value){return m_value.equals(value);} - -public: - static void createTimer(QObject *parent, const QScriptValue &val, long timeout, bool singleshot); - static void removeTimer(CanvasTimer *timer); - static void removeTimer(const QScriptValue &); - -private: - QScriptValue m_value; - -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVECANVASTIMER_P_H diff --git a/qmldebugcontrol/canvas/qdeclarativecontext2d.cpp b/qmldebugcontrol/canvas/qdeclarativecontext2d.cpp deleted file mode 100644 index 2bcce23..0000000 --- a/qmldebugcontrol/canvas/qdeclarativecontext2d.cpp +++ /dev/null @@ -1,1132 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qdeclarativecontext2d.h" - -#include "qdeclarativecanvas.h" - -#include -#include - -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -static const double Q_PI = 3.14159265358979323846; // pi - -class CustomDropShadowEffect : public QGraphicsDropShadowEffect -{ -public: - void draw(QPainter *painter) { QGraphicsDropShadowEffect::draw(painter);} - void drawSource(QPainter *painter) { QGraphicsDropShadowEffect::drawSource(painter);} -}; - -// Note, this is exported but in a private header as qtopengl depends on it. -// But it really should be considered private API -void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0); -void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0); - -#define DEGREES(t) ((t) * 180.0 / Q_PI) - -#define qClamp(val, min, max) qMin(qMax(val, min), max) -static QList parseNumbersList(QString::const_iterator &itr) -{ - QList points; - QString temp; - while ((*itr).isSpace()) - ++itr; - while ((*itr).isNumber() || - (*itr) == '-' || (*itr) == '+' || (*itr) == '.') { - temp.clear(); - - if ((*itr) == '-') - temp += *itr++; - else if ((*itr) == '+') - temp += *itr++; - while ((*itr).isDigit()) - temp += *itr++; - if ((*itr) == '.') - temp += *itr++; - while ((*itr).isDigit()) - temp += *itr++; - while ((*itr).isSpace()) - ++itr; - if ((*itr) == ',') - ++itr; - points.append(temp.toDouble()); - //eat spaces - while ((*itr).isSpace()) - ++itr; - } - - return points; -} - -QColor colorFromString(const QString &name) -{ - QString::const_iterator itr = name.constBegin(); - QList compo; - if (name.startsWith("rgba(")) { - ++itr; ++itr; ++itr; ++itr; ++itr; - compo = parseNumbersList(itr); - if (compo.size() != 4) { - return QColor(); - } - //alpha seems to be always between 0-1 - compo[3] *= 255; - return QColor((int)compo[0], (int)compo[1], - (int)compo[2], (int)compo[3]); - } else if (name.startsWith("rgb(")) { - ++itr; ++itr; ++itr; ++itr; - compo = parseNumbersList(itr); - if (compo.size() != 3) { - return QColor(); - } - return QColor((int)qClamp(compo[0], qreal(0), qreal(255)), - (int)qClamp(compo[1], qreal(0), qreal(255)), - (int)qClamp(compo[2], qreal(0), qreal(255))); - } else if (name.startsWith("hsla(")){ - ++itr; ++itr; ++itr; ++itr; ++itr; - compo = parseNumbersList(itr); - if (compo.size() != 4) { - return QColor(); - } - return QColor::fromHslF(compo[0], compo[1], - compo[2], compo[3]); - } else if (name.startsWith("hsl(")){ - ++itr; ++itr; ++itr; ++itr; ++itr; - compo = parseNumbersList(itr); - if (compo.size() != 3) { - return QColor(); - } - return QColor::fromHslF(compo[0], compo[1], - compo[2]); - } else { - //QRgb color; - //CSSParser::parseColor(name, color); - return QColor(name); - } -} - - -static QPainter::CompositionMode compositeOperatorFromString(const QString &compositeOperator) -{ - if (compositeOperator == QLatin1String("source-over")) { - return QPainter::CompositionMode_SourceOver; - } else if (compositeOperator == QLatin1String("source-out")) { - return QPainter::CompositionMode_SourceOut; - } else if (compositeOperator == QLatin1String("source-in")) { - return QPainter::CompositionMode_SourceIn; - } else if (compositeOperator == QLatin1String("source-atop")) { - return QPainter::CompositionMode_SourceAtop; - } else if (compositeOperator == QLatin1String("destination-atop")) { - return QPainter::CompositionMode_DestinationAtop; - } else if (compositeOperator == QLatin1String("destination-in")) { - return QPainter::CompositionMode_DestinationIn; - } else if (compositeOperator == QLatin1String("destination-out")) { - return QPainter::CompositionMode_DestinationOut; - } else if (compositeOperator == QLatin1String("destination-over")) { - return QPainter::CompositionMode_DestinationOver; - } else if (compositeOperator == QLatin1String("darker")) { - return QPainter::CompositionMode_SourceOver; - } else if (compositeOperator == QLatin1String("lighter")) { - return QPainter::CompositionMode_SourceOver; - } else if (compositeOperator == QLatin1String("copy")) { - return QPainter::CompositionMode_Source; - } else if (compositeOperator == QLatin1String("xor")) { - return QPainter::CompositionMode_Xor; - } - - return QPainter::CompositionMode_SourceOver; -} - -static QString compositeOperatorToString(QPainter::CompositionMode op) -{ - switch (op) { - case QPainter::CompositionMode_SourceOver: - return "source-over"; - case QPainter::CompositionMode_DestinationOver: - return "destination-over"; - case QPainter::CompositionMode_Clear: - return "clear"; - case QPainter::CompositionMode_Source: - return "source"; - case QPainter::CompositionMode_Destination: - return "destination"; - case QPainter::CompositionMode_SourceIn: - return "source-in"; - case QPainter::CompositionMode_DestinationIn: - return "destination-in"; - case QPainter::CompositionMode_SourceOut: - return "source-out"; - case QPainter::CompositionMode_DestinationOut: - return "destination-out"; - case QPainter::CompositionMode_SourceAtop: - return "source-atop"; - case QPainter::CompositionMode_DestinationAtop: - return "destination-atop"; - case QPainter::CompositionMode_Xor: - return "xor"; - case QPainter::CompositionMode_Plus: - return "plus"; - case QPainter::CompositionMode_Multiply: - return "multiply"; - case QPainter::CompositionMode_Screen: - return "screen"; - case QPainter::CompositionMode_Overlay: - return "overlay"; - case QPainter::CompositionMode_Darken: - return "darken"; - case QPainter::CompositionMode_Lighten: - return "lighten"; - case QPainter::CompositionMode_ColorDodge: - return "color-dodge"; - case QPainter::CompositionMode_ColorBurn: - return "color-burn"; - case QPainter::CompositionMode_HardLight: - return "hard-light"; - case QPainter::CompositionMode_SoftLight: - return "soft-light"; - case QPainter::CompositionMode_Difference: - return "difference"; - case QPainter::CompositionMode_Exclusion: - return "exclusion"; - default: - break; - } - return QString(); -} - -void Context2D::save() -{ - m_stateStack.push(m_state); -} - - -void Context2D::restore() -{ - if (!m_stateStack.isEmpty()) { - m_state = m_stateStack.pop(); - m_state.flags = AllIsFullOfDirt; - } -} - - -void Context2D::scale(qreal x, qreal y) -{ - m_state.matrix.scale(x, y); - m_state.flags |= DirtyTransformationMatrix; -} - - -void Context2D::rotate(qreal angle) -{ - m_state.matrix.rotate(DEGREES(angle)); - m_state.flags |= DirtyTransformationMatrix; -} - - -void Context2D::translate(qreal x, qreal y) -{ - m_state.matrix.translate(x, y); - m_state.flags |= DirtyTransformationMatrix; -} - - -void Context2D::transform(qreal m11, qreal m12, qreal m21, qreal m22, - qreal dx, qreal dy) -{ - QMatrix mat(m11, m12, - m21, m22, - dx, dy); - m_state.matrix *= mat; - m_state.flags |= DirtyTransformationMatrix; -} - - -void Context2D::setTransform(qreal m11, qreal m12, qreal m21, qreal m22, - qreal dx, qreal dy) -{ - QMatrix mat(m11, m12, - m21, m22, - dx, dy); - m_state.matrix = mat; - m_state.flags |= DirtyTransformationMatrix; -} - - -QString Context2D::globalCompositeOperation() const -{ - return compositeOperatorToString(m_state.globalCompositeOperation); -} - -void Context2D::setGlobalCompositeOperation(const QString &op) -{ - QPainter::CompositionMode mode = - compositeOperatorFromString(op); - m_state.globalCompositeOperation = mode; - m_state.flags |= DirtyGlobalCompositeOperation; -} - -QVariant Context2D::strokeStyle() const -{ - return m_state.strokeStyle; -} - -void Context2D::setStrokeStyle(const QVariant &style) -{ - CanvasGradient * gradient= qobject_cast(style.value()); - if (gradient) { - m_state.strokeStyle = gradient->value(); - } else { - QColor color = colorFromString(style.toString()); - m_state.strokeStyle = color; - } - m_state.flags |= DirtyStrokeStyle; -} - -QVariant Context2D::fillStyle() const -{ - return m_state.fillStyle; -} - -void Context2D::setFillStyle(const QVariant &style) -{ - CanvasGradient * gradient= qobject_cast(style.value()); - if (gradient) { - m_state.fillStyle = gradient->value(); - } else { - QColor color = colorFromString(style.toString()); - m_state.fillStyle = color; - } - m_state.flags |= DirtyFillStyle; -} - -qreal Context2D::globalAlpha() const -{ - return m_state.globalAlpha; -} - -void Context2D::setGlobalAlpha(qreal alpha) -{ - m_state.globalAlpha = alpha; - m_state.flags |= DirtyGlobalAlpha; -} - -CanvasImage *Context2D::createImage(const QString &url) -{ - return new CanvasImage(url); -} - -CanvasGradient *Context2D::createLinearGradient(qreal x0, qreal y0, - qreal x1, qreal y1) -{ - QLinearGradient g(x0, y0, x1, y1); - return new CanvasGradient(g); -} - - -CanvasGradient *Context2D::createRadialGradient(qreal x0, qreal y0, - qreal r0, qreal x1, - qreal y1, qreal r1) -{ - QRadialGradient g(QPointF(x1, y1), r0+r1, QPointF(x0, y0)); - return new CanvasGradient(g); -} - -qreal Context2D::lineWidth() const -{ - return m_state.lineWidth; -} - -void Context2D::setLineWidth(qreal w) -{ - m_state.lineWidth = w; - m_state.flags |= DirtyLineWidth; -} - -QString Context2D::lineCap() const -{ - switch (m_state.lineCap) { - case Qt::FlatCap: - return "butt"; - case Qt::SquareCap: - return "square"; - case Qt::RoundCap: - return "round"; - default: ; - } - return QString(); -} - -void Context2D::setLineCap(const QString &capString) -{ - Qt::PenCapStyle style; - if (capString == QLatin1String("round")) - style = Qt::RoundCap; - else if (capString == QLatin1String("square")) - style = Qt::SquareCap; - else //if (capString == "butt") - style = Qt::FlatCap; - m_state.lineCap = style; - m_state.flags |= DirtyLineCap; -} - -QString Context2D::lineJoin() const -{ - switch (m_state.lineJoin) { - case Qt::RoundJoin: - return QLatin1String("round"); - case Qt::BevelJoin: - return QLatin1String("bevel"); - case Qt::MiterJoin: - return QLatin1String("miter"); - default: ; - } - return QString(); -} - -void Context2D::setLineJoin(const QString &joinString) -{ - Qt::PenJoinStyle style; - if (joinString == QLatin1String("round")) - style = Qt::RoundJoin; - else if (joinString == QLatin1String("bevel")) - style = Qt::BevelJoin; - else //if (joinString == "miter") - style = Qt::MiterJoin; - m_state.lineJoin = style; - m_state.flags |= DirtyLineJoin; -} - -qreal Context2D::miterLimit() const -{ - return m_state.miterLimit; -} - -void Context2D::setMiterLimit(qreal m) -{ - m_state.miterLimit = m; - m_state.flags |= DirtyMiterLimit; -} - -void Context2D::setShadowOffsetX(qreal x) -{ - if (m_state.shadowOffsetX == x) - return; - m_state.shadowOffsetX = x; - updateShadowBuffer(); - if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0) - endPainting(); - m_state.flags |= DirtyShadowOffsetX; -} - -const QList &Context2D::mouseAreas() const -{ - return m_mouseAreas; -} - -void Context2D::updateShadowBuffer() { - if (m_shadowbuffer.isNull() || m_shadowbuffer.width() != m_width+m_state.shadowOffsetX || - m_shadowbuffer.height() != m_height+m_state.shadowOffsetY) { - m_shadowbuffer = QImage(m_width+m_state.shadowOffsetX, m_height+m_state.shadowOffsetY, QImage::Format_ARGB32); - m_shadowbuffer.fill(Qt::transparent); - } -} - -void Context2D::setShadowOffsetY(qreal y) -{ - if (m_state.shadowOffsetY == y) - return; - m_state.shadowOffsetY = y; - updateShadowBuffer(); - if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0) - endPainting(); - - m_state.flags |= DirtyShadowOffsetY; -} - -void Context2D::setShadowBlur(qreal b) -{ - if (m_state.shadowBlur == b) - return; - m_state.shadowBlur = b; - updateShadowBuffer(); - if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0) - endPainting(); - m_state.flags |= DirtyShadowBlur; -} - -void Context2D::setShadowColor(const QString &str) -{ - m_state.shadowColor = colorFromString(str); - if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0) - endPainting(); - m_state.flags |= DirtyShadowColor; -} - -QString Context2D::textBaseline() -{ - switch (m_state.textBaseline) { - case Context2D::Alphabetic: - return QLatin1String("alphabetic"); - case Context2D::Hanging: - return QLatin1String("hanging"); - case Context2D::Bottom: - return QLatin1String("bottom"); - case Context2D::Top: - return QLatin1String("top"); - case Context2D::Middle: - return QLatin1String("middle"); - default: - Q_ASSERT("invalid value"); - return QLatin1String("start"); - } -} - -void Context2D::setTextBaseline(const QString &baseline) -{ - if (baseline==QLatin1String("alphabetic")) - m_state.textBaseline = Context2D::Alphabetic; - else if (baseline == QLatin1String("hanging")) - m_state.textBaseline = Context2D::Hanging; - else if (baseline == QLatin1String("top")) - m_state.textBaseline = Context2D::Top; - else if (baseline == QLatin1String("bottom")) - m_state.textBaseline = Context2D::Bottom; - else if (baseline == QLatin1String("middle")) - m_state.textBaseline = Context2D::Middle; - else { - m_state.textBaseline = Context2D::Alphabetic; - qWarning() << ("Context2D: invalid baseline:" + baseline); - } - m_state.flags |= DirtyTextBaseline; -} - -QString Context2D::textAlign() -{ - switch (m_state.textAlign) { - case Context2D::Left: - return QLatin1String("left"); - case Context2D::Right: - return QLatin1String("right"); - case Context2D::Center: - return QLatin1String("center"); - case Context2D::Start: - return QLatin1String("start"); - case Context2D::End: - return QLatin1String("end"); - default: - Q_ASSERT("invalid value"); - qWarning() << ("Context2D::invalid textAlign"); - return QLatin1String("start"); - } -} - -void Context2D::setTextAlign(const QString &baseline) -{ - if (baseline==QLatin1String("start")) - m_state.textAlign = Context2D::Start; - else if (baseline == QLatin1String("end")) - m_state.textAlign = Context2D::End; - else if (baseline == QLatin1String("left")) - m_state.textAlign = Context2D::Left; - else if (baseline == QLatin1String("right")) - m_state.textAlign = Context2D::Right; - else if (baseline == QLatin1String("center")) - m_state.textAlign = Context2D::Center; - else { - m_state.textAlign= Context2D::Start; - qWarning("Context2D: invalid text align"); - } - // ### alphabetic, ideographic, hanging - m_state.flags |= DirtyTextBaseline; -} - -void Context2D::setFont(const QString &fontString) -{ - QFont font; - // ### this is simplified and incomplete - QStringList tokens = fontString.split(QLatin1Char(' ')); - foreach (const QString &token, tokens) { - if (token == QLatin1String("italic")) - font.setItalic(true); - else if (token == QLatin1String("bold")) - font.setBold(true); - else if (token.endsWith(QLatin1String("px"))) { - QString number = token; - number.remove("px"); - font.setPointSizeF(number.trimmed().toFloat()); - } else - font.setFamily(token); - } - m_state.font = font; - m_state.flags |= DirtyFont; -} - -QString Context2D::font() -{ - return m_state.font.toString(); -} - -qreal Context2D::shadowOffsetX() const -{ - return m_state.shadowOffsetX; -} - -qreal Context2D::shadowOffsetY() const -{ - return m_state.shadowOffsetY; -} - - -qreal Context2D::shadowBlur() const -{ - return m_state.shadowBlur; -} - - -QString Context2D::shadowColor() const -{ - return m_state.shadowColor.name(); -} - - -void Context2D::clearRect(qreal x, qreal y, qreal w, qreal h) -{ - beginPainting(); - m_painter.save(); - m_painter.setMatrix(worldMatrix(), false); - m_painter.setCompositionMode(QPainter::CompositionMode_Source); - QColor fillColor = parent()->property("color").value(); - - m_painter.fillRect(QRectF(x, y, w, h), fillColor); - m_painter.restore(); - scheduleChange(); -} - -void Context2D::fillRect(qreal x, qreal y, qreal w, qreal h) -{ - beginPainting(); - m_painter.save(); - m_painter.setMatrix(worldMatrix(), false); - m_painter.fillRect(QRectF(x, y, w, h), m_painter.brush()); - m_painter.restore(); - scheduleChange(); -} - -int Context2D::baseLineOffset(Context2D::TextBaseLine value, const QFontMetrics &metrics) -{ - int offset = 0; - switch (value) { - case Context2D::Top: - break; - case Context2D::Alphabetic: - case Context2D::Middle: - case Context2D::Hanging: - offset = metrics.ascent(); - break; - case Context2D::Bottom: - offset = metrics.height(); - break; - } - return offset; -} - -int Context2D::textAlignOffset(Context2D::TextAlign value, const QFontMetrics &metrics, const QString &text) -{ - int offset = 0; - if (value == Context2D::Start) - value = qApp->layoutDirection() == Qt::LeftToRight ? Context2D::Left : Context2D::Right; - else if (value == Context2D::End) - value = qApp->layoutDirection() == Qt::LeftToRight ? Context2D::Right: Context2D::Left; - switch (value) { - case Context2D::Center: - offset = metrics.width(text)/2; - break; - case Context2D::Right: - offset = metrics.width(text); - case Context2D::Left: - default: - break; - } - return offset; -} - -void Context2D::fillText(const QString &text, qreal x, qreal y) -{ - beginPainting(); - m_painter.save(); - m_painter.setPen(QPen(m_state.fillStyle, m_state.lineWidth)); - m_painter.setMatrix(worldMatrix(), false); - QFont font; - font.setBold(true); - m_painter.setFont(m_state.font); - int yoffset = baseLineOffset(m_state.textBaseline, m_painter.fontMetrics()); - int xoffset = textAlignOffset(m_state.textAlign, m_painter.fontMetrics(), text); - QTextOption opt; // Adjust baseLine etc - m_painter.drawText(QRectF(x-xoffset, y-yoffset, QWIDGETSIZE_MAX, m_painter.fontMetrics().height()), text, opt); - m_painter.restore(); - endPainting(); - scheduleChange(); -} - -void Context2D::strokeText(const QString &text, qreal x, qreal y) -{ - beginPainting(); - m_painter.save(); - m_painter.setPen(QPen(m_state.fillStyle,0)); - m_painter.setMatrix(worldMatrix(), false); - - QPainterPath textPath; - QFont font = m_state.font; - font.setStyleStrategy(QFont::ForceOutline); - m_painter.setFont(font); - const QFontMetrics &metrics = m_painter.fontMetrics(); - int yoffset = baseLineOffset(m_state.textBaseline, metrics); - int xoffset = textAlignOffset(m_state.textAlign, metrics, text); - textPath.addText(x-xoffset, y-yoffset+metrics.ascent(), font, text); - m_painter.strokePath(textPath, QPen(m_state.fillStyle, m_state.lineWidth)); - m_painter.restore(); - endPainting(); - scheduleChange(); -} - -void Context2D::strokeRect(qreal x, qreal y, qreal w, qreal h) -{ - QPainterPath path; - path.addRect(x, y, w, h); - beginPainting(); - m_painter.save(); - m_painter.setMatrix(worldMatrix(), false); - m_painter.strokePath(path, m_painter.pen()); - m_painter.restore(); - scheduleChange(); -} - -void Context2D::mouseArea(qreal x, qreal y, qreal w, qreal h, const QScriptValue &callback, - const QScriptValue &data) -{ - MouseArea a = { callback, data, QRectF(x, y, w, h), m_state.matrix }; - m_mouseAreas << a; -} - -void Context2D::beginPath() -{ - m_path = QPainterPath(); -} - - -void Context2D::closePath() -{ - m_path.closeSubpath(); -} - - -void Context2D::moveTo(qreal x, qreal y) -{ - QPointF pt = worldMatrix().map(QPointF(x, y)); - m_path.moveTo(pt); -} - - -void Context2D::lineTo(qreal x, qreal y) -{ - QPointF pt = worldMatrix().map(QPointF(x, y)); - m_path.lineTo(pt); -} - - -void Context2D::quadraticCurveTo(qreal cpx, qreal cpy, qreal x, qreal y) -{ - QPointF cp = worldMatrix().map(QPointF(cpx, cpy)); - QPointF xy = worldMatrix().map(QPointF(x, y)); - m_path.quadTo(cp, xy); -} - - -void Context2D::bezierCurveTo(qreal cp1x, qreal cp1y, - qreal cp2x, qreal cp2y, qreal x, qreal y) -{ - QPointF cp1 = worldMatrix().map(QPointF(cp1x, cp1y)); - QPointF cp2 = worldMatrix().map(QPointF(cp2x, cp2y)); - QPointF end = worldMatrix().map(QPointF(x, y)); - m_path.cubicTo(cp1, cp2, end); -} - - -void Context2D::arcTo(qreal x1, qreal y1, qreal x2, qreal y2, qreal radius) -{ - //FIXME: this is surely busted - QPointF st = worldMatrix().map(QPointF(x1, y1)); - QPointF end = worldMatrix().map(QPointF(x2, y2)); - m_path.arcTo(st.x(), st.y(), - end.x()-st.x(), end.y()-st.y(), - radius, 90); -} - - -void Context2D::rect(qreal x, qreal y, qreal w, qreal h) -{ - QPainterPath path; path.addRect(x, y, w, h); - path = worldMatrix().map(path); - m_path.addPath(path); -} - -void Context2D::arc(qreal xc, qreal yc, qreal radius, - qreal sar, qreal ear, - bool anticlockwise) -{ - //### HACK - // In Qt we don't switch the coordinate system for degrees - // and still use the 0,0 as bottom left for degrees so we need - // to switch - sar = -sar; - ear = -ear; - anticlockwise = !anticlockwise; - //end hack - - float sa = DEGREES(sar); - float ea = DEGREES(ear); - - double span = 0; - - double xs = xc - radius; - double ys = yc - radius; - double width = radius*2; - double height = radius*2; - - if (!anticlockwise && (ea < sa)) { - span += 360; - } else if (anticlockwise && (sa < ea)) { - span -= 360; - } - - //### this is also due to switched coordinate system - // we would end up with a 0 span instead of 360 - if (!(qFuzzyCompare(span + (ea - sa) + 1, 1) && - qFuzzyCompare(qAbs(span), 360))) { - span += ea - sa; - } - - QPainterPath path; - path.moveTo(QPointF(xc + radius * cos(sar), - yc - radius * sin(sar))); - - path.arcTo(xs, ys, width, height, sa, span); - path = worldMatrix().map(path); - m_path.addPath(path); -} - - -void Context2D::fill() -{ - beginPainting(); - m_painter.fillPath(m_path, m_painter.brush()); - scheduleChange(); -} - - -void Context2D::stroke() -{ - beginPainting(); - m_painter.save(); - m_painter.setMatrix(worldMatrix(), false); - QPainterPath tmp = worldMatrix().inverted().map(m_path); - m_painter.strokePath(tmp, m_painter.pen()); - m_painter.restore(); - scheduleChange(); -} - - -void Context2D::clip() -{ - m_state.clipPath = m_path; - m_state.flags |= DirtyClippingRegion; -} - - -bool Context2D::isPointInPath(qreal x, qreal y) const -{ - return m_path.contains(QPointF(x, y)); -} - - -ImageData Context2D::getImageData(qreal sx, qreal sy, qreal sw, qreal sh) -{ - Q_UNUSED(sx); - Q_UNUSED(sy); - Q_UNUSED(sw); - Q_UNUSED(sh); - return ImageData(); -} - - -void Context2D::putImageData(ImageData image, qreal dx, qreal dy) -{ - Q_UNUSED(image); - Q_UNUSED(dx); - Q_UNUSED(dy); -} - -Context2D::Context2D(QObject *parent) - : QObject(parent), m_changeTimerId(-1), m_width(0), m_height(0), m_inPaint(false) -{ - reset(); -} - -void Context2D::setupPainter() -{ - m_painter.setRenderHint(QPainter::Antialiasing, true); - if ((m_state.flags & DirtyClippingRegion) && !m_state.clipPath.isEmpty()) - m_painter.setClipPath(m_state.clipPath); - if (m_state.flags & DirtyFillStyle) - m_painter.setBrush(m_state.fillStyle); - if (m_state.flags & DirtyGlobalAlpha) - m_painter.setOpacity(m_state.globalAlpha); - if (m_state.flags & DirtyGlobalCompositeOperation) - m_painter.setCompositionMode(m_state.globalCompositeOperation); - if (m_state.flags & MDirtyPen) { - QPen pen = m_painter.pen(); - if (m_state.flags & DirtyStrokeStyle) - pen.setBrush(m_state.strokeStyle); - if (m_state.flags & DirtyLineWidth) - pen.setWidthF(m_state.lineWidth); - if (m_state.flags & DirtyLineCap) - pen.setCapStyle(m_state.lineCap); - if (m_state.flags & DirtyLineJoin) - pen.setJoinStyle(m_state.lineJoin); - if (m_state.flags & DirtyMiterLimit) - pen.setMiterLimit(m_state.miterLimit); - m_painter.setPen(pen); - } -} - -void Context2D::beginPainting() -{ - if (m_width <= 0 || m_height <=0) - return; - - if (m_pixmap.width() != m_width || m_pixmap.height() != m_height) { - m_pixmap = QPixmap(m_width, m_height); - m_pixmap.fill(parent()->property("color").value()); - } - - if (m_state.shadowBlur > 0 && m_painter.device() != &m_shadowbuffer) { - if (m_painter.isActive()) - m_painter.end(); - updateShadowBuffer(); - m_painter.begin(&m_shadowbuffer); - m_painter.setViewport(m_state.shadowOffsetX, - m_state.shadowOffsetY, - m_shadowbuffer.width(), - m_shadowbuffer.height()); - m_shadowbuffer.fill(Qt::transparent); - } - - if (!m_painter.isActive()) { - m_painter.begin(&m_pixmap); - m_painter.setRenderHint(QPainter::Antialiasing); - if (!m_state.clipPath.isEmpty()) - m_painter.setClipPath(m_state.clipPath); - m_painter.setBrush(m_state.fillStyle); - m_painter.setOpacity(m_state.globalAlpha); - QPen pen; - pen.setBrush(m_state.strokeStyle); - if (pen.style() == Qt::NoPen) - pen.setStyle(Qt::SolidLine); - pen.setCapStyle(m_state.lineCap); - pen.setJoinStyle(m_state.lineJoin); - pen.setWidthF(m_state.lineWidth); - pen.setMiterLimit(m_state.miterLimit); - m_painter.setPen(pen); - } else { - setupPainter(); - m_state.flags = 0; - } -} - -void Context2D::endPainting() -{ - if (m_state.shadowBlur > 0) { - QImage alphaChannel = m_shadowbuffer.alphaChannel(); - - qt_blurImage(alphaChannel, m_state.shadowBlur, false, 1); - - QRect imageRect = m_shadowbuffer.rect(); - - if (m_shadowColorIndexBuffer.isEmpty() || m_shadowColorBuffer != m_state.shadowColor) { - m_shadowColorIndexBuffer.clear(); - m_shadowColorBuffer = m_state.shadowColor; - - for (int i = 0; i < 256; ++i) { - m_shadowColorIndexBuffer << qRgba(qRound(255 * m_state.shadowColor.redF()), - qRound(255 * m_state.shadowColor.greenF()), - qRound(255 * m_state.shadowColor.blueF()), - i); - } - } - alphaChannel.setColorTable(m_shadowColorIndexBuffer); - - if (m_painter.isActive()) - m_painter.end(); - - m_painter.begin(&m_pixmap); - - // draw the blurred drop shadow... - m_painter.save(); - QTransform tf = m_painter.transform(); - m_painter.translate(0, imageRect.height()); - m_painter.rotate(-90); - m_painter.drawImage(0, 0, alphaChannel); - m_painter.setTransform(tf); - m_painter.restore(); - - // draw source - m_painter.drawImage(-m_state.shadowOffsetX, -m_state.shadowOffsetY, m_shadowbuffer.copy()); - m_painter.end(); - } -} - -void Context2D::clear() -{ - m_painter.fillRect(QRect(QPoint(0,0), size()), Qt::white); -} - -void Context2D::reset() -{ - m_stateStack.clear(); - m_state.matrix = QMatrix(); - m_state.clipPath = QPainterPath(); - m_state.strokeStyle = Qt::black; - m_state.fillStyle = Qt::black; - m_state.globalAlpha = 1.0; - m_state.lineWidth = 1; - m_state.lineCap = Qt::FlatCap; - m_state.lineJoin = Qt::MiterJoin; - m_state.miterLimit = 10; - m_state.shadowOffsetX = 0; - m_state.shadowOffsetY = 0; - m_state.shadowBlur = 0; - m_state.shadowColor = qRgba(0, 0, 0, 0); - m_state.globalCompositeOperation = QPainter::CompositionMode_SourceOver; - m_state.font = QFont(); - m_state.textAlign = Start; - m_state.textBaseline = Alphabetic; - m_state.flags = AllIsFullOfDirt; - m_mouseAreas.clear(); - clear(); -} - -void Context2D::drawImage(const QVariant &var, qreal sx, qreal sy, - qreal sw = 0, qreal sh = 0) -{ - CanvasImage *image = qobject_cast(var.value()); - if (!image) { - Canvas *canvas = qobject_cast(var.value()); - if (canvas) - image = canvas->toImage(); - } - if (image) { - beginPainting(); - if (sw == sh && sh == 0) - m_painter.drawPixmap(QPointF(sx, sy), image->value()); - else - m_painter.drawPixmap(QRect(sx, sy, sw, sh), image->value()); - - scheduleChange(); - } -} - -void Context2D::setSize(int width, int height) -{ - endPainting(); - m_width = width; - m_height = height; - - scheduleChange(); -} - -void Context2D::setSize(const QSize &size) -{ - setSize(size.width(), size.height()); -} - -QSize Context2D::size() const -{ - return m_pixmap.size(); -} - -QPoint Context2D::painterTranslate() const -{ - return m_painterTranslate; -} - -void Context2D::setPainterTranslate(const QPoint &translate) -{ - m_painterTranslate = translate; - m_state.flags |= DirtyTransformationMatrix; -} - -void Context2D::scheduleChange() -{ - if (m_changeTimerId == -1 && !m_inPaint) - m_changeTimerId = startTimer(0); -} - -void Context2D::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_changeTimerId) { - killTimer(m_changeTimerId); - m_changeTimerId = -1; - endPainting(); - emit changed(); - } else { - QObject::timerEvent(e); - } -} - -QMatrix Context2D::worldMatrix() const -{ - QMatrix mat; - mat.translate(m_painterTranslate.x(), m_painterTranslate.y()); - mat *= m_state.matrix; - return mat; -} - -#include "qdeclarativecontext2d.moc" - -QT_END_NAMESPACE diff --git a/qmldebugcontrol/canvas/qdeclarativecontext2d.h b/qmldebugcontrol/canvas/qdeclarativecontext2d.h deleted file mode 100644 index 5d6048d..0000000 --- a/qmldebugcontrol/canvas/qdeclarativecontext2d.h +++ /dev/null @@ -1,327 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVECONTEXT2D_P_H -#define QDECLARATIVECONTEXT2D_P_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -QColor colorFromString(const QString &name); - -class CanvasGradient : public QObject -{ - Q_OBJECT -public: - CanvasGradient(const QGradient &gradient) : m_gradient(gradient) {} - -public slots: - QGradient value() { return m_gradient; } - void addColorStop(float pos, const QString &color) { m_gradient.setColorAt(pos, colorFromString(color));} - -public: - QGradient m_gradient; -}; - -class CanvasImage: public QObject -{ - Q_OBJECT - Q_PROPERTY(QString src READ src WRITE setSrc NOTIFY sourceChanged) - Q_PROPERTY(int width READ width) - Q_PROPERTY(int height READ height) - -public: - CanvasImage() {} - CanvasImage(const QString &url) : m_image(url), m_src(url) {} - CanvasImage(const QPixmap &pixmap) {m_image = pixmap;} - -public slots: - int width() { return m_image.width(); } - int height() { return m_image.height(); } - QPixmap &value() { return m_image; } - QString src() { return m_src; } - void setSrc(const QString &src) { m_src = src; m_image.load(src); emit sourceChanged();} -signals: - void sourceChanged(); - -private: - QPixmap m_image; - QString m_src; -}; - - -class ImageData { -}; - -class Context2D : public QObject -{ - Q_OBJECT - // compositing - Q_PROPERTY(qreal globalAlpha READ globalAlpha WRITE setGlobalAlpha) - Q_PROPERTY(QString globalCompositeOperation READ globalCompositeOperation WRITE setGlobalCompositeOperation) - Q_PROPERTY(QVariant strokeStyle READ strokeStyle WRITE setStrokeStyle) - Q_PROPERTY(QVariant fillStyle READ fillStyle WRITE setFillStyle) - // line caps/joins - Q_PROPERTY(qreal lineWidth READ lineWidth WRITE setLineWidth) - Q_PROPERTY(QString lineCap READ lineCap WRITE setLineCap) - Q_PROPERTY(QString lineJoin READ lineJoin WRITE setLineJoin) - Q_PROPERTY(qreal miterLimit READ miterLimit WRITE setMiterLimit) - // shadows - Q_PROPERTY(qreal shadowOffsetX READ shadowOffsetX WRITE setShadowOffsetX) - Q_PROPERTY(qreal shadowOffsetY READ shadowOffsetY WRITE setShadowOffsetY) - Q_PROPERTY(qreal shadowBlur READ shadowBlur WRITE setShadowBlur) - Q_PROPERTY(QString shadowColor READ shadowColor WRITE setShadowColor) - // fonts - Q_PROPERTY(QString font READ font WRITE setFont) - Q_PROPERTY(QString textBaseline READ textBaseline WRITE setTextBaseline) - Q_PROPERTY(QString textAlign READ textAlign WRITE setTextAlign) - - enum TextBaseLine { Alphabetic=0, Top, Middle, Bottom, Hanging}; - enum TextAlign { Start=0, End, Left, Right, Center}; - -public: - Context2D(QObject *parent = 0); - void setSize(int width, int height); - void setSize(const QSize &size); - QSize size() const; - - QPoint painterTranslate() const; - void setPainterTranslate(const QPoint &); - - void scheduleChange(); - void timerEvent(QTimerEvent *e); - - void clear(); - void reset(); - - QPixmap pixmap() { return m_pixmap; } - - // compositing - qreal globalAlpha() const; // (default 1.0) - QString globalCompositeOperation() const; // (default over) - QVariant strokeStyle() const; // (default black) - QVariant fillStyle() const; // (default black) - - void setGlobalAlpha(qreal alpha); - void setGlobalCompositeOperation(const QString &op); - void setStrokeStyle(const QVariant &style); - void setFillStyle(const QVariant &style); - - // line caps/joins - qreal lineWidth() const; // (default 1) - QString lineCap() const; // "butt", "round", "square" (default "butt") - QString lineJoin() const; // "round", "bevel", "miter" (default "miter") - qreal miterLimit() const; // (default 10) - - void setLineWidth(qreal w); - void setLineCap(const QString &s); - void setLineJoin(const QString &s); - void setMiterLimit(qreal m); - - void setFont(const QString &font); - QString font(); - void setTextBaseline(const QString &font); - QString textBaseline(); - void setTextAlign(const QString &font); - QString textAlign(); - - // shadows - qreal shadowOffsetX() const; // (default 0) - qreal shadowOffsetY() const; // (default 0) - qreal shadowBlur() const; // (default 0) - QString shadowColor() const; // (default black) - - void setShadowOffsetX(qreal x); - void setShadowOffsetY(qreal y); - void setShadowBlur(qreal b); - void setShadowColor(const QString &str); - - struct MouseArea { - QScriptValue callback; - QScriptValue data; - QRectF rect; - QMatrix matrix; - }; - const QList &mouseAreas() const; - -public slots: - void save(); // push state on state stack - void restore(); // pop state stack and restore state - - void fillText(const QString &text, qreal x, qreal y); - void strokeText(const QString &text, qreal x, qreal y); - - void setInPaint(bool val){m_inPaint = val;} - void scale(qreal x, qreal y); - void rotate(qreal angle); - void translate(qreal x, qreal y); - void transform(qreal m11, qreal m12, qreal m21, qreal m22, - qreal dx, qreal dy); - void setTransform(qreal m11, qreal m12, qreal m21, qreal m22, - qreal dx, qreal dy); - - CanvasGradient *createLinearGradient(qreal x0, qreal y0, - qreal x1, qreal y1); - CanvasGradient *createRadialGradient(qreal x0, qreal y0, - qreal r0, qreal x1, - qreal y1, qreal r1); - - // rects - void clearRect(qreal x, qreal y, qreal w, qreal h); - void fillRect(qreal x, qreal y, qreal w, qreal h); - void strokeRect(qreal x, qreal y, qreal w, qreal h); - - // mouse - void mouseArea(qreal x, qreal y, qreal w, qreal h, const QScriptValue &, const QScriptValue & = QScriptValue()); - - // path API - void beginPath(); - void closePath(); - void moveTo(qreal x, qreal y); - void lineTo(qreal x, qreal y); - void quadraticCurveTo(qreal cpx, qreal cpy, qreal x, qreal y); - void bezierCurveTo(qreal cp1x, qreal cp1y, - qreal cp2x, qreal cp2y, qreal x, qreal y); - void arcTo(qreal x1, qreal y1, qreal x2, qreal y2, qreal radius); - void rect(qreal x, qreal y, qreal w, qreal h); - void arc(qreal x, qreal y, qreal radius, - qreal startAngle, qreal endAngle, - bool anticlockwise); - void fill(); - void stroke(); - void clip(); - bool isPointInPath(qreal x, qreal y) const; - - CanvasImage *createImage(const QString &url); - - // drawing images (no overloads due to QTBUG-11604) - void drawImage(const QVariant &var, qreal dx, qreal dy, qreal dw, qreal dh); - - // pixel manipulation - ImageData getImageData(qreal sx, qreal sy, qreal sw, qreal sh); - void putImageData(ImageData image, qreal dx, qreal dy); - void endPainting(); - -signals: - void changed(); - -private: - void setupPainter(); - void beginPainting(); - void updateShadowBuffer(); - - int m_changeTimerId; - QPainterPath m_path; - - enum DirtyFlag { - DirtyTransformationMatrix = 0x00001, - DirtyClippingRegion = 0x00002, - DirtyStrokeStyle = 0x00004, - DirtyFillStyle = 0x00008, - DirtyGlobalAlpha = 0x00010, - DirtyLineWidth = 0x00020, - DirtyLineCap = 0x00040, - DirtyLineJoin = 0x00080, - DirtyMiterLimit = 0x00100, - MDirtyPen = DirtyStrokeStyle - | DirtyLineWidth - | DirtyLineCap - | DirtyLineJoin - | DirtyMiterLimit, - DirtyShadowOffsetX = 0x00200, - DirtyShadowOffsetY = 0x00400, - DirtyShadowBlur = 0x00800, - DirtyShadowColor = 0x01000, - DirtyGlobalCompositeOperation = 0x2000, - DirtyFont = 0x04000, - DirtyTextAlign = 0x08000, - DirtyTextBaseline = 0x10000, - AllIsFullOfDirt = 0xfffff - }; - - struct State { - State() : flags(0) {} - QMatrix matrix; - QPainterPath clipPath; - QBrush strokeStyle; - QBrush fillStyle; - qreal globalAlpha; - qreal lineWidth; - Qt::PenCapStyle lineCap; - Qt::PenJoinStyle lineJoin; - qreal miterLimit; - qreal shadowOffsetX; - qreal shadowOffsetY; - qreal shadowBlur; - QColor shadowColor; - QPainter::CompositionMode globalCompositeOperation; - QFont font; - Context2D::TextAlign textAlign; - Context2D::TextBaseLine textBaseline; - int flags; - }; - - int baseLineOffset(Context2D::TextBaseLine value, const QFontMetrics &metrics); - int textAlignOffset(Context2D::TextAlign value, const QFontMetrics &metrics, const QString &string); - - QMatrix worldMatrix() const; - - QPoint m_painterTranslate; - State m_state; - QStack m_stateStack; - QPixmap m_pixmap; - QList m_mouseAreas; - QImage m_shadowbuffer; - QVector m_shadowColorIndexBuffer; - QColor m_shadowColorBuffer; - QPainter m_painter; - int m_width, m_height; - bool m_inPaint; -}; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(CanvasImage*) -Q_DECLARE_METATYPE(CanvasGradient*) - -#endif // QDECLARATIVECONTEXT2D_P_H diff --git a/qmldebugcontrol/canvas/qdeclarativetiledcanvas.cpp b/qmldebugcontrol/canvas/qdeclarativetiledcanvas.cpp deleted file mode 100644 index af3c6d4..0000000 --- a/qmldebugcontrol/canvas/qdeclarativetiledcanvas.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativetiledcanvas.h" - -#include "qdeclarativecontext2d.h" - -#include -#include - -TiledCanvas::TiledCanvas() -: m_context2d(new Context2D(this)), m_canvasSize(-1, -1), m_tileSize(100, 100) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); - setAcceptedMouseButtons(Qt::LeftButton); - setCacheMode(QGraphicsItem::DeviceCoordinateCache); -} - -QSizeF TiledCanvas::canvasSize() const -{ - return m_canvasSize; -} - -void TiledCanvas::setCanvasSize(const QSizeF &v) -{ - if (m_canvasSize != v) { - m_canvasSize = v; - emit canvasSizeChanged(); - update(); - } -} - -QSize TiledCanvas::tileSize() const -{ - return m_tileSize; -} - -void TiledCanvas::setTileSize(const QSize &v) -{ - if (v != m_tileSize) { - m_tileSize = v; - emit tileSizeChanged(); - update(); - } -} - -QRectF TiledCanvas::canvasWindow() const -{ - return m_canvasWindow; -} - -void TiledCanvas::setCanvasWindow(const QRectF &v) -{ - if (m_canvasWindow != v) { - m_canvasWindow = v; - emit canvasWindowChanged(); - update(); - } -} - -void TiledCanvas::requestPaint() -{ - update(); -} - -void TiledCanvas::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) -{ - if (m_context2d->size() != m_tileSize) - m_context2d->setSize(m_tileSize); - - const int tw = m_tileSize.width(); - const int th = m_tileSize.height(); - - int h1 = m_canvasWindow.left() / tw; - int htiles = ((m_canvasWindow.right() - h1 * tw) + tw - 1) / tw; - - int v1 = m_canvasWindow.top() / th; - int vtiles = ((m_canvasWindow.bottom() - v1 * th) + th - 1) / th; - - for (int yy = 0; yy < vtiles; ++yy) { - for (int xx = 0; xx < htiles; ++xx) { - int ht = xx + h1; - int vt = yy + v1; - - m_context2d->reset(); - m_context2d->setPainterTranslate(QPoint(-ht * tw, -vt * th)); - - emit drawRegion(m_context2d, QRect(ht * tw, vt * th, tw, th)); - - p->drawPixmap(-m_canvasWindow.x() + ht * tw, -m_canvasWindow.y() + vt * th, m_context2d->pixmap()); - } - } -} - -void TiledCanvas::componentComplete() -{ - const QMetaObject *metaObject = this->metaObject(); - int propertyCount = metaObject->propertyCount(); - int requestPaintMethod = metaObject->indexOfMethod("requestPaint()"); - for (int ii = TiledCanvas::staticMetaObject.propertyCount(); ii < propertyCount; ++ii) { - QMetaProperty p = metaObject->property(ii); - if (p.hasNotifySignal()) - QMetaObject::connect(this, p.notifySignalIndex(), this, requestPaintMethod, 0, 0); - } - QDeclarativeItem::componentComplete(); -} - - -void TiledCanvas::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - Q_UNUSED(event); - qWarning("MPE"); -} - -QPixmap TiledCanvas::getTile(int xx, int yy) -{ - QPixmap pix(m_tileSize); - - pix.fill(Qt::green); - - QString text = QString::number(xx) + QLatin1Char(' ') + QString::number(yy); - - QPainter p(&pix); - p.drawText(pix.rect(), Qt::AlignHCenter | Qt::AlignVCenter, text); - - return pix; -} - - -#include "qdeclarativetiledcanvas.moc" diff --git a/qmldebugcontrol/canvas/qdeclarativetiledcanvas.h b/qmldebugcontrol/canvas/qdeclarativetiledcanvas.h deleted file mode 100644 index 818318b..0000000 --- a/qmldebugcontrol/canvas/qdeclarativetiledcanvas.h +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVETILEDCANVAS_P_H -#define QDECLARATIVETILEDCANVAS_P_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class Context2D; -class TiledCanvas : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QSizeF canvasSize READ canvasSize WRITE setCanvasSize NOTIFY canvasSizeChanged) - Q_PROPERTY(QSize tileSize READ tileSize WRITE setTileSize NOTIFY tileSizeChanged) - Q_PROPERTY(QRectF canvasWindow READ canvasWindow WRITE setCanvasWindow NOTIFY canvasWindowChanged) - -public: - TiledCanvas(); - - QSizeF canvasSize() const; - void setCanvasSize(const QSizeF &); - - QSize tileSize() const; - void setTileSize(const QSize &); - - QRectF canvasWindow() const; - void setCanvasWindow(const QRectF &); - -Q_SIGNALS: - void canvasSizeChanged(); - void tileSizeChanged(); - void canvasWindowChanged(); - - void drawRegion(Context2D *ctxt, const QRect ®ion); - -public Q_SLOTS: - void requestPaint(); - -protected: - virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - virtual void componentComplete(); - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - -private: - QPixmap getTile(int, int); - - Context2D *m_context2d; - - QSizeF m_canvasSize; - QSize m_tileSize; - QRectF m_canvasWindow; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVETILEDCANVAS_P_H diff --git a/qmldebugcontrol/codaqmlprofilerrunner.cpp b/qmldebugcontrol/codaqmlprofilerrunner.cpp deleted file mode 100644 index a2414b8..0000000 --- a/qmldebugcontrol/codaqmlprofilerrunner.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "codaqmlprofilerrunner.h" -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace ProjectExplorer; -using namespace Qt4ProjectManager; -using namespace QmlProfiler::Internal; - -CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configuration, - QObject *parent) : - AbstractQmlProfilerRunner(parent), - m_configuration(configuration), - m_runControl(new CodaRunControl(configuration, "QmlProfiler")) -{ - connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped())); - connect(m_runControl, - SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)), - this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat))); -} - -CodaQmlProfilerRunner::~CodaQmlProfilerRunner() -{ - delete m_runControl; -} - -void CodaQmlProfilerRunner::start() -{ - QTC_ASSERT(m_runControl, return); - m_runControl->start(); -} - -void CodaQmlProfilerRunner::stop() -{ - QTC_ASSERT(m_runControl, return); - m_runControl->stop(); -} - -void CodaQmlProfilerRunner::appendMessage(ProjectExplorer::RunControl *, const QString &message, - Utils::OutputFormat format) -{ - emit appendMessage(message, format); -} - -int QmlProfiler::Internal::CodaQmlProfilerRunner::debugPort() const -{ - return m_configuration->qmlDebugServerPort(); -} - diff --git a/qmldebugcontrol/codaqmlprofilerrunner.h b/qmldebugcontrol/codaqmlprofilerrunner.h deleted file mode 100644 index e9e9317..0000000 --- a/qmldebugcontrol/codaqmlprofilerrunner.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef CODAQMLPROFILERRUNNER_H -#define CODAQMLPROFILERRUNNER_H - -#include "abstractqmlprofilerrunner.h" - -#include -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class CodaQmlProfilerRunner : public AbstractQmlProfilerRunner -{ - Q_OBJECT - Q_DISABLE_COPY(CodaQmlProfilerRunner) - - using AbstractQmlProfilerRunner::appendMessage; // don't hide signal -public: - explicit CodaQmlProfilerRunner(Qt4ProjectManager::S60DeviceRunConfiguration *configuration, - QObject *parent = 0); - ~CodaQmlProfilerRunner(); - - // AbstractQmlProfilerRunner - virtual void start(); - virtual void stop(); - virtual int debugPort() const; - -private slots: - void appendMessage(ProjectExplorer::RunControl *, const QString &message, - Utils::OutputFormat format); -private: - Qt4ProjectManager::S60DeviceRunConfiguration *m_configuration; - ProjectExplorer::RunControl *m_runControl; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // CODAQMLPROFILERRUNNER_H diff --git a/qmldebugcontrol/localqmlprofilerrunner.cpp b/qmldebugcontrol/localqmlprofilerrunner.cpp deleted file mode 100644 index 98762b8..0000000 --- a/qmldebugcontrol/localqmlprofilerrunner.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "localqmlprofilerrunner.h" -#include "qmlprofilerplugin.h" - -using namespace QmlProfiler; -using namespace QmlProfiler::Internal; - -LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration, QObject *parent) : - AbstractQmlProfilerRunner(parent), - m_configuration(configuration) -{ - connect(&m_launcher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), - this, SIGNAL(appendMessage(QString,Utils::OutputFormat))); -} - -void LocalQmlProfilerRunner::start() -{ - QString arguments = QString("-qmljsdebugger=port:%1,block").arg( - QString::number(m_configuration.port)); - - if (!m_configuration.executableArguments.isEmpty()) - arguments += QChar(' ') + m_configuration.executableArguments; - - if (QmlProfilerPlugin::debugOutput) - qWarning("QmlProfiler: Launching %s:%d", qPrintable(m_configuration.executable), - m_configuration.port); - - m_launcher.setWorkingDirectory(m_configuration.workingDirectory); - m_launcher.setEnvironment(m_configuration.environment); - connect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int))); - m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_configuration.executable, - arguments); - - emit started(); -} - -void LocalQmlProfilerRunner::spontaneousStop(int exitCode) -{ - if (QmlProfilerPlugin::debugOutput) - qWarning("QmlProfiler: Application exited (exit code %d).", exitCode); - - disconnect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int))); - - emit stopped(); -} - -void LocalQmlProfilerRunner::stop() -{ - if (QmlProfilerPlugin::debugOutput) - qWarning("QmlProfiler: Stopping application ..."); - - if (m_launcher.isRunning()) { - m_launcher.stop(); - } -} - -int LocalQmlProfilerRunner::debugPort() const -{ - return m_configuration.port; -} diff --git a/qmldebugcontrol/localqmlprofilerrunner.h b/qmldebugcontrol/localqmlprofilerrunner.h deleted file mode 100644 index 2a8b703..0000000 --- a/qmldebugcontrol/localqmlprofilerrunner.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef LOCALQMLPROFILERRUNNER_H -#define LOCALQMLPROFILERRUNNER_H - -#include "abstractqmlprofilerrunner.h" - -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class LocalQmlProfilerRunner : public AbstractQmlProfilerRunner -{ - Q_OBJECT - Q_DISABLE_COPY(LocalQmlProfilerRunner) - -public: - struct Configuration { - QString executable; - QString executableArguments; - quint16 port; - QString workingDirectory; - Utils::Environment environment; - }; - - explicit LocalQmlProfilerRunner(const Configuration &configuration, QObject *parent = 0); - - // AbstractQmlProfilerRunner - virtual void start(); - virtual void stop(); - virtual int debugPort() const; - -private slots: - void spontaneousStop(int exitCode); - -private: - Configuration m_configuration; - ProjectExplorer::ApplicationLauncher m_launcher; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // LOCALQMLPROFILERRUNNER_H diff --git a/qmldebugcontrol/main.cpp b/qmldebugcontrol/main.cpp deleted file mode 100644 index 26349cb..0000000 --- a/qmldebugcontrol/main.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -#include - -// #if defined(QMLJSDEBUGGER) -#include -// #endif - -#include "qmlprofilertool.h" - -using namespace QmlProfiler::Internal; - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QmlProfilerTool tool(0); - tool.createWidgets(); - - tool.connectClient(3768); - - tool.show(); - - return app.exec(); -} diff --git a/qmldebugcontrol/qml/Detail.qml b/qmldebugcontrol/qml/Detail.qml deleted file mode 100644 index c0ec386..0000000 --- a/qmldebugcontrol/qml/Detail.qml +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -import QtQuick 1.0 -import Monitor 1.0 -import "MainView.js" as Plotter - -Item { - id: detail - property string label - property string content - signal linkActivated(string url) - - height: childrenRect.height - width: childrenRect.width - Item { - id: guideline - x: 70 - width: 5 - } - Text { - id: lbl - text: label - font.pixelSize: 12 - font.bold: true - } - Text { - text:":" - font.pixelSize: 12 - font.bold: true - anchors.right: baseline.left - anchors.baseline: lbl.baseline - } - Text { - text: content - font.pixelSize: 12 - anchors.baseline: lbl.baseline - anchors.left: guideline.right - onLinkActivated: detail.linkActivated(link) - } -} diff --git a/qmldebugcontrol/qml/Label.qml b/qmldebugcontrol/qml/Label.qml deleted file mode 100644 index abe2839..0000000 --- a/qmldebugcontrol/qml/Label.qml +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -import QtQuick 1.0 - -Item { - property alias text: txt.text - - height: 50 - width: 150 //### required, or ignored by positioner - - Text { - id: txt; - x: 5 - font.pixelSize: 12 - color: "#232323" - anchors.verticalCenter: parent.verticalCenter - } - - Rectangle { - height: 1 - width: parent.width - color: "#cccccc" - anchors.bottom: parent.bottom - } -} diff --git a/qmldebugcontrol/qml/MainView.js b/qmldebugcontrol/qml/MainView.js deleted file mode 100644 index bd4752d..0000000 --- a/qmldebugcontrol/qml/MainView.js +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -.pragma library - -var values = [ ]; //events -var ranges = [ ]; -var frameFps = [ ]; -var xmargin = 0; -var ymargin = 0; -var drawFpsGraph = false; -var nestingDepth = []; - -var names = [ "Painting", "Compiling", "Creating", "Binding", "Handling Signal"] -//### need better way to manipulate color from QML. In the meantime, these need to be kept in sync. -var colors = [ "#99CCB3", "#99CCCC", "#99B3CC", "#9999CC", "#CC99B3", "#CC99CC", "#CCCC99", "#CCB399" ]; -var origColors = [ "#99CCB3", "#99CCCC", "#99B3CC", "#9999CC", "#CC99B3", "#CC99CC", "#CCCC99", "#CCB399" ]; -var xRayColors = [ "#6699CCB3", "#6699CCCC", "#6699B3CC", "#669999CC", "#66CC99B3", "#66CC99CC", "#66CCCC99", "#66CCB399" ]; - -function reset() -{ - values = []; - ranges = []; - frameFps = []; - xmargin = 0; - ymargin = 0; - nestingDepth = []; -} - -function calcFps() -{ - if (drawFpsGraph) { - if (values.length) - frameFps = new Array(values.length - 1); - for (var i = 0; i < values.length - 1; ++i) { - var frameTime = (values[i + 1] - values[i]) / 1000000; - frameFps[i] = 1000 / frameTime; - } - } -} - -//draw background of the graph -function drawGraph(canvas, ctxt, region) -{ - var grad = ctxt.createLinearGradient(0, 0, 0, canvas.canvasSize.height); - grad.addColorStop(0, '#fff'); - grad.addColorStop(1, '#ccc'); - ctxt.fillStyle = grad; - - ctxt.fillRect(0, 0, canvas.canvasSize.width + xmargin, canvas.canvasSize.height - ymargin); -} - -//draw the actual data to be graphed -function drawData(canvas, ctxt, region) -{ - if (values.length == 0 && ranges.length == 0) - return; - - var width = canvas.canvasSize.width - xmargin; - var height = canvas.height - ymargin; - - var sumValue = ranges[ranges.length - 1].start + ranges[ranges.length - 1].duration - ranges[0].start; - var spacing = width / sumValue; - - ctxt.fillStyle = "rgba(0,0,0,1)"; - var highest = [0,0,0,0,0]; - - //### only draw those in range - for (var ii = 0; ii < ranges.length; ++ii) { - - var xx = (ranges[ii].start - ranges[0].start) * spacing + xmargin; - if (xx > region.x + region.width) - continue; - - var size = ranges[ii].duration * spacing; - if (xx + size < region.x) - continue; - - if (size < 0.5) - size = 0.5; - - xx = Math.round(xx); - if (xx + size > highest[ranges[ii].type]) { - ctxt.fillRect(xx, ranges[ii].type*10, size, 10); - highest[ranges[ii].type] = xx+size; - } - } - - if (drawFpsGraph) { - //draw fps overlay - var heightScale = height / 60; - ctxt.beginPath(); - ctxt.moveTo(0,0); - for (var i = 1; i < values.length; ++i) { - var xx = (values[i] - ranges[0].start) * spacing + xmargin; - ctxt.lineTo(xx, height - frameFps[i-1]*heightScale) - } - ctxt.lineTo(width, 0); - ctxt.closePath(); - var grad = ctxt.createLinearGradient(0, 0, 0, canvas.canvasSize.height); - grad.addColorStop(0, "rgba(255,128,128,.5)"); - grad.addColorStop(1, "rgba(255,0,0,.5)"); - ctxt.fillStyle = grad; - ctxt.fill(); - } -} - -function plot(canvas, ctxt, region) -{ - drawGraph(canvas, ctxt, region); - drawData(canvas, ctxt, region); -} - -function xScale(canvas) -{ - if (values.length === 0 && ranges.length === 0) - return; - - var width = canvas.canvasSize.width - xmargin; - - var sumValue = ranges[ranges.length - 1].start + ranges[ranges.length - 1].duration - ranges[0].start; - var spacing = sumValue / width; - return spacing; -} diff --git a/qmldebugcontrol/qml/MainView.qml b/qmldebugcontrol/qml/MainView.qml deleted file mode 100644 index b66c733..0000000 --- a/qmldebugcontrol/qml/MainView.qml +++ /dev/null @@ -1,503 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -import QtQuick 1.0 -import Monitor 1.0 -import "MainView.js" as Plotter - -Rectangle { - id: root - - property bool dataAvailable: false; - - // move the cursor in the editor - signal updateCursorPosition - property string fileName: "" - property int lineNumber: -1 - function gotoSourceLocation(file,line) { - root.fileName = file; - root.lineNumber = line; - root.updateCursorPosition(); - } - - function clearData() { - Plotter.reset(); - view.clearData(); - root.dataAvailable = false; - rangeMover.x = 2 - rangeMover.opacity = 0 - } - - function clearAll() { - clearData(); - selectedEventIndex = -1; - canvas.requestPaint(); - view.visible = false; - root.elapsedTime = 0; - root.updateTimer(); - } - - property int selectedEventIndex : -1; - property bool mouseTracking: false; - - onSelectedEventIndexChanged: { - if ((!mouseTracking) && Plotter.ranges.length > 0 - && selectedEventIndex > -1 && selectedEventIndex < Plotter.ranges.length) { - // re-center flickable if necessary - var event = Plotter.ranges[selectedEventIndex]; - var xs = Plotter.xScale(canvas); - var startTime = Plotter.ranges[0].start; - if (rangeMover.value + startTime> event.start) { - rangeMover.x = Math.max(0, - Math.floor((event.start - startTime) / xs - canvas.canvasWindow.x - rangeMover.zoomWidth/2) ); - } else if (rangeMover.value + startTime + rangeMover.zoomWidth * xs < event.start + event.duration) { - rangeMover.x = Math.floor((event.start + event.duration - startTime) / xs - canvas.canvasWindow.x - rangeMover.zoomWidth/2); - } - } - } - - function nextEvent() { - if (Plotter.ranges.length > 0) { - ++selectedEventIndex; - if (selectedEventIndex >= Plotter.ranges.length) - selectedEventIndex = 0; - } - } - - function prevEvent() { - if (Plotter.ranges.length > 0) { - --selectedEventIndex; - if (selectedEventIndex < 0) - selectedEventIndex = Plotter.ranges.length - 1; - } - } - - function zoomIn() { - // 10% - var newZoom = rangeMover.zoomWidth / 1.1; - - // 0.1 ms minimum zoom - if (newZoom * Plotter.xScale(canvas) > 100000) { - hideRangeDetails(); - rangeMover.zoomWidth = newZoom - rangeMover.updateZoomControls(); - } - } - - function zoomOut() { - hideRangeDetails(); - // 10% - var newZoom = rangeMover.zoomWidth * 1.1; - if (newZoom > canvas.width) - newZoom = canvas.width; - if (newZoom + rangeMover.x > canvas.width) - rangeMover.x = canvas.width - newZoom; - rangeMover.zoomWidth = newZoom; - rangeMover.updateZoomControls(); - } - - //handle debug data coming from C++ - Connections { - target: connection - onEvent: { - if (root.dataAvailable) { - root.clearData(); - } - - if (!root.dataAvailable && event === 0) //### only handle paint event - Plotter.values.push(time); - } - - onRange: { - if (root.dataAvailable) { - root.clearData(); - } - - // todo: consider nestingLevel - if (!root.dataAvailable) { - if (!Plotter.nestingDepth[type]) - Plotter.nestingDepth[type] = nestingInType; - else - Plotter.nestingDepth[type] = Math.max(Plotter.nestingDepth[type], nestingInType); - Plotter.ranges.push( { type: type, start: startTime, duration: length, label: data, fileName: fileName, line: line, nestingLevel: nestingInType, nestingDepth: Plotter.nestingDepth[type] } ); - if (nestingInType == 1) - Plotter.nestingDepth[type] = 1; - } - } - - onComplete: { - root.dataAvailable = true; - Plotter.calcFps(); - view.visible = true; - view.setRanges(Plotter.ranges); - view.updateTimeline(); - canvas.requestPaint(); - rangeMover.x = 1 //### hack to get view to display things immediately - rangeMover.x = 0 - rangeMover.opacity = 1 - } - - onClear: { - root.clearAll(); - } - - } - - // Elapsed - property real elapsedTime; - signal updateTimer; - Timer { - property date startDate - property bool reset: true - running: connection.recording - repeat: true - onRunningChanged: if (running) reset = true - interval: 100 - triggeredOnStart: true - onTriggered: { - if (reset) { - startDate = new Date() - reset = false - } - var time = (new Date() - startDate)/1000 - //elapsed.text = time.toFixed(1) + "s" - root.elapsedTime = time.toFixed(1); - root.updateTimer(); - } - } - - // time markers - TimeDisplay { - height: flick.height + labels.y - anchors.left: flick.left - anchors.right: flick.right - startTime: rangeMover.x * Plotter.xScale(canvas); - endTime: (rangeMover.x + rangeMover.zoomWidth) * Plotter.xScale(canvas); - } - - function hideRangeDetails() { - rangeDetails.visible = false - rangeDetails.duration = "" - rangeDetails.label = "" - rangeDetails.type = "" - rangeDetails.file = "" - rangeDetails.line = -1 - } - - //our main interaction view - Flickable { - id: flick - anchors.top: parent.top - anchors.topMargin: labels.y - anchors.right: parent.right - anchors.left: labels.right - anchors.bottom: canvas.top - contentWidth: view.totalWidth - contentHeight: height - flickableDirection: Flickable.HorizontalFlick - - clip:true - - MouseArea { - width: flick.width - height: flick.contentHeight - x: flick.contentX - onClicked: { - root.hideRangeDetails(); - } - hoverEnabled: true - onExited: { - root.hideRangeDetails(); - } - } - - TimelineView { - id: view - - width: flick.width; - height: flick.contentHeight; - - startX: flick.contentX - onStartXChanged: { - var newX = startTime / Plotter.xScale(canvas) - canvas.canvasWindow.x; - if (Math.abs(rangeMover.x - newX) > .01) - rangeMover.x = newX - if (Math.abs(startX - flick.contentX) > .01) - flick.contentX = startX - } - startTime: rangeMover.value - endTime: startTime + (rangeMover.zoomWidth*Plotter.xScale(canvas)) - onEndTimeChanged: updateTimeline() - - delegate: Rectangle { - id: obj - - property color baseColor: Plotter.colors[type] - property color myColor: baseColor - - function conditionalHide() { - if (!mouseArea.containsMouse) - mouseArea.exited() - } - - property int baseY: type * view.height / labels.rowCount; - property int baseHeight: view.height / labels.rowCount - y: baseY + (nestingLevel-1)*(baseHeight / nestingDepth); - height: baseHeight / nestingDepth; - gradient: Gradient { - GradientStop { position: 0.0; color: myColor } - GradientStop { position: 0.5; color: Qt.darker(myColor, 1.1) } - GradientStop { position: 1.0; color: myColor } - } - smooth: true - - property bool componentIsCompleted: false - Component.onCompleted: { - componentIsCompleted = true; - updateDetails(); - } - - property bool isSelected: root.selectedEventIndex == index; - onIsSelectedChanged: updateDetails(); - function updateDetails() { - if (!root.mouseTracking && componentIsCompleted) { - if (isSelected) { - enableSelected(0, 0); - } - else - disableSelected(); - } - } - - function enableSelected(x,y) { - myColor = Qt.darker(baseColor, 1.2) - rangeDetails.duration = duration - rangeDetails.label = label - rangeDetails.file = fileName - rangeDetails.line = line - rangeDetails.type = Plotter.names[type] - - var pos = mapToItem(rangeDetails.parent, x, y+height) - var preferredX = Math.max(10, pos.x - rangeDetails.width/2) - if (preferredX + rangeDetails.width > rangeDetails.parent.width) - preferredX = rangeDetails.parent.width - rangeDetails.width - rangeDetails.x = preferredX - - var preferredY = pos.y - rangeDetails.height/2; - if (preferredY + rangeDetails.height > root.height - 10) - preferredY = root.height - 10 - rangeDetails.height; - if (preferredY < 10) - preferredY=10; - rangeDetails.y = preferredY; - rangeDetails.visible = true - } - - function disableSelected() { - myColor = baseColor - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: { - root.mouseTracking = true; - root.selectedEventIndex = index; - enableSelected(mouseX, y); - root.mouseTracking = false; - } - onExited: { - disableSelected(); - } - - onClicked: root.gotoSourceLocation(rangeDetails.file, rangeDetails.line); - } - } - } - } - - //popup showing the details for the hovered range - RangeDetails { - id: rangeDetails - - // follow the flickable - property int flickableX: flick.contentX; - property int lastFlickableX; - onXChanged: lastFlickableX = flickableX; - onFlickableXChanged: { - x = x - flickableX + lastFlickableX; - if (visible && (x + width <= 0 || x > root.width)) { - root.hideRangeDetails(); - visible = false; - } - } - } - - Rectangle { - id: labels - width: 150 - color: "#dcdcdc" - y: 24 - height: flick.height - - property int rowCount: 5 - - Column { - id: col - //### change to use Repeater + Plotter.names? - Label { text: "Painting"; height: labels.height/labels.rowCount} - Label { text: "Compiling"; height: labels.height/labels.rowCount } - Label { text: "Creating"; height: labels.height/labels.rowCount } - Label { text: "Binding"; height: labels.height/labels.rowCount } - Label { text: "Signal Handler"; height: labels.height/labels.rowCount } - } - - //right border divider - Rectangle { - width: 1 - height: parent.height - anchors.right: parent.right - color: "#cccccc" - } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - onEntered: root.hideRangeDetails(); - } - } - - //bottom border divider - Rectangle { - height: 1 - width: parent.width - anchors.bottom: canvas.top - color: "#cccccc" - } - - //"overview" graph at the bottom - TiledCanvas { - id: canvas - - anchors.bottom: parent.bottom - width: parent.width; height: 50 - - property int canvasWidth: width - - canvasSize { - width: canvasWidth - height: canvas.height - } - - tileSize.width: width - tileSize.height: height - - canvasWindow.width: width - canvasWindow.height: height - - onDrawRegion: { - if (root.dataAvailable) - Plotter.plot(canvas, ctxt, region); - else - Plotter.drawGraph(canvas, ctxt, region) //just draw the background - } - } - - //moves the range mover to the position of a click - MouseArea { - anchors.fill: canvas - //### ideally we could press to position then immediately drag - onPressed: rangeMover.x = mouse.x - rangeMover.zoomWidth/2 - } - - RangeMover { - id: rangeMover - opacity: 0 - anchors.top: canvas.top - } - - // the next elements are here because I want them rendered on top of the other - Rectangle { - id: timeDisplayLabel - color: "lightsteelblue" - border.color: Qt.darker(color) - border.width: 1 - radius: 2 - height: Math.max(labels.y-2, timeDisplayText.height); - y: timeDisplayEnd.visible ? flick.height - 1 : 1 - width: timeDisplayText.width + 10 + ( timeDisplayEnd.visible ? timeDisplayCloseControl.width + 10 : 0 ) - visible: false - - function hideAll() { - timeDisplayBegin.visible = false; - timeDisplayEnd.visible = false; - timeDisplayLabel.visible = false; - } - Text { - id: timeDisplayText - x: 5 - y: parent.height/2 - height/2 + 1 - font.pointSize: 8 - } - - Text { - id: timeDisplayCloseControl - text:"X" - anchors.right: parent.right - anchors.rightMargin: 3 - y: parent.height/2 - height/2 + 1 - visible: timeDisplayEnd.visible - MouseArea { - anchors.fill: parent - onClicked: { - timeDisplayLabel.hideAll(); - } - } - } - } - - Rectangle { - id: timeDisplayBegin - width: 1 - color: Qt.rgba(0,0,64,0.7); - height: flick.height + labels.y - visible: false - } - - Rectangle { - id: timeDisplayEnd - width: 1 - color: Qt.rgba(0,0,64,0.7); - height: flick.height + labels.y - visible: false - } -} diff --git a/qmldebugcontrol/qml/RangeDetails.qml b/qmldebugcontrol/qml/RangeDetails.qml deleted file mode 100644 index 7b4207f..0000000 --- a/qmldebugcontrol/qml/RangeDetails.qml +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -import QtQuick 1.0 -import Monitor 1.0 -import "MainView.js" as Plotter - -BorderImage { - id: rangeDetails - - property string duration //###int? - property string label - property string type - property string file - property int line - - source: "popup.png" - border { - left: 10; top: 10 - right: 20; bottom: 20 - } - - width: col.width + 45 - height: childrenRect.height + 30 - z: 1 - visible: false - - //title - Text { - id: typeTitle - text: rangeDetails.type - font.bold: true - y: 10 - anchors.horizontalCenter: parent.horizontalCenter - anchors.horizontalCenterOffset: -5 - } - - //details - Column { - id: col - anchors.top: typeTitle.bottom - x: 2 - Detail { - label: "Duration" - content: rangeDetails.duration < 1000 ? - rangeDetails.duration + "μs" : - Math.floor(rangeDetails.duration/10)/100 + "ms" - } - Detail { - opacity: content.length !== 0 ? 1 : 0 - label: "Details" - content: { - var inputString = rangeDetails.label; - if (inputString.length > 7 && inputString.substring(0,7) == "file://") { - var pos = inputString.lastIndexOf("/"); - return inputString.substr(pos+1); - } - // transform code blocks into oneliners - inputString = inputString.replace("\n", " "); - - var maxLen = 40; - if (inputString.length > maxLen) - inputString = inputString.substring(0,maxLen)+"..."; - - return inputString; - } - } - Detail { - opacity: content.length !== 0 ? 1 : 0 - label: "Location" - content: { - var file = rangeDetails.file - var pos = file.lastIndexOf("/") - if (pos != -1) - file = file.substr(pos+1) - return (file.length !== 0) ? (file + ":" + rangeDetails.line) : ""; - } - onLinkActivated: Qt.openUrlExternally(url) - } - } -} diff --git a/qmldebugcontrol/qml/RangeMover.qml b/qmldebugcontrol/qml/RangeMover.qml deleted file mode 100644 index 1444378..0000000 --- a/qmldebugcontrol/qml/RangeMover.qml +++ /dev/null @@ -1,151 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -import "MainView.js" as Plotter -import QtQuick 1.0 -import Monitor 1.0 - -Item { - id: rangeMover - - - property color lighterColor:"#cc80b2f6" - property color darkerColor:"#cc6da1e8" - property real value: (canvas.canvasWindow.x + x) * Plotter.xScale(canvas) - property real zoomWidth: 20 - onZoomWidthChanged: timeDisplayLabel.hideAll(); - - function updateZoomControls() { - rightRange.x = rangeMover.width; - } - onXChanged: updateZoomControls(); - - width: Math.max(rangeMover.zoomWidth, 20); height: 50 - - MouseArea { - anchors.fill: parent - drag.target: rangeMover - drag.axis: "XAxis" - drag.minimumX: 0 - drag.maximumX: canvas.width - rangeMover.zoomWidth //### - } - - Rectangle { - id: frame - color:"transparent" - border.width: 1 - border.color: darkerColor - anchors.fill: parent - anchors.rightMargin: 1 - anchors.bottomMargin: 1 - } - - Rectangle { - id: rect - - color: lighterColor - width: parent.zoomWidth - height: parent.height - } - - - - Rectangle { - id: leftRange - - property int currentX: rangeMover.x - property int currentWidth : rangeMover.zoomWidth - - x: -width - height: parent.height - width: 15 - color: darkerColor - - Text { - anchors.centerIn: parent - text:"<" - } - - MouseArea { - anchors.fill: parent - drag.target: leftRange - drag.axis: "XAxis" - drag.minimumX: -parent.currentX - drag.maximumX: parent.currentWidth - width - 1 - onPressed: { - parent.currentX = rangeMover.x; - parent.currentWidth = rangeMover.zoomWidth; - } - } - onXChanged: { - if (x + width != 0) { - rangeMover.zoomWidth = currentWidth - x - width; - rangeMover.x = currentX + x + width; - x = -width; - } - } - } - - Rectangle { - id: rightRange - property int currentX: rangeMover.x - property int widthSpace: rangeMover.width - rangeMover.zoomWidth - - height: parent.height - width: 15 - x: rangeMover.width - color: darkerColor; - - Text { - anchors.centerIn: parent - text:">" - } - MouseArea { - anchors.fill: parent - drag.target: rightRange - drag.axis: "XAxis" - drag.minimumX: 1 + parent.widthSpace - drag.maximumX: canvas.width - parent.currentX; - onPressed: { - parent.currentX = rangeMover.x; - parent.widthSpace = rangeMover.width - rangeMover.zoomWidth; - } - onReleased: rightRange.x = rangeMover.width; - } - onXChanged: { - if (x != rangeMover.width) { - rangeMover.zoomWidth = x - widthSpace; - } - } - } - -} diff --git a/qmldebugcontrol/qml/TimeDisplay.qml b/qmldebugcontrol/qml/TimeDisplay.qml deleted file mode 100644 index 24dd47d..0000000 --- a/qmldebugcontrol/qml/TimeDisplay.qml +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -import QtQuick 1.0 -import Monitor 1.0 -import "MainView.js" as Plotter - -TiledCanvas { - id: timeDisplay - - canvasSize { - width: timeDisplay.width - height: timeDisplay.height - } - tileSize.width: width - tileSize.height: height - canvasWindow.width: width - canvasWindow.height: height - - - Component.onCompleted: { - requestPaint(); - } - - property variant startTime; - property variant endTime; - - onStartTimeChanged: requestPaint(); - onEndTimeChanged: requestPaint(); - onWidthChanged: requestPaint(); - onHeightChanged: requestPaint(); - - property variant timePerPixel; - - onDrawRegion: { - drawBackgroundBars( ctxt, region ); - - var totalTime = endTime - startTime; - var spacing = width / totalTime; - - var initialBlockLength = 120; - var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / width * initialBlockLength ) / Math.LN2 ) ); - var pixelsPerBlock = timePerBlock * spacing; - var pixelsPerSection = pixelsPerBlock / 5; - var blockCount = width / pixelsPerBlock; - - var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock; - var realStartPos = (startTime-realStartTime) * spacing; - - timePerPixel = timePerBlock/pixelsPerBlock; - - - ctxt.fillStyle = "#000000"; - ctxt.font = "8px sans-serif"; - for (var ii = 0; ii < blockCount+1; ii++) { - var x = Math.floor(ii*pixelsPerBlock - realStartPos); - ctxt.strokeStyle = "#909090"; - ctxt.beginPath(); - ctxt.moveTo(x, 0); - ctxt.lineTo(x, height); - ctxt.stroke(); - - ctxt.strokeStyle = "#C0C0C0"; - for (var jj=1; jj < 5; jj++) { - var xx = Math.floor(ii*pixelsPerBlock + jj*pixelsPerSection - realStartPos); - ctxt.beginPath(); - ctxt.moveTo(xx, labels.y); - ctxt.lineTo(xx, height); - ctxt.stroke(); - } - - ctxt.fillText(prettyPrintTime(ii*timePerBlock + realStartTime), x + 5, 5 + labels.y/2); - } - } - - function drawBackgroundBars( ctxt, region ) { - var barHeight = labels.height / labels.rowCount; - var originY = labels.y - for (var i=0; if;GUsL0qBRjX96&(C`bfAJ>s`b+`Cp}{?E7(1{ z_55!_C#tCn4tfLzdI)8i3-zDqi!OS;)lwk${E6STNP2K3ezlR($Z;CEB_@{6*^_j# zmwMgx1#+L7LmpjZx1!}-a;4DyeYLW~yh{Wu-!M8K+tJu^8rKHLaC0Kq%fQ#w(!)Ow zlL5yaM<+3ePgGCOl+?xo7M}bL+$Lkdu z$ji#dks){jPjnEi(VKVAB1>%Vmd>aDZAST2hIu=3R0?K0+=M~GySt$dLpdl=B z2_tJzX%e=iPlgm;7hv_BV&Ar{*<~eLvnb09D5VgOC)gjS{C2RMLP}m2_-FSqfZ%+D v88)AZu~$qTN7UMxIXGA-a}j--`zgQxFg`uNZ_gb%00000NkvXXu0mjf@s2&r diff --git a/qmldebugcontrol/qml/magnifier-minus.png b/qmldebugcontrol/qml/magnifier-minus.png deleted file mode 100644 index 3bfcea0ff7603225f0a7f9e9b1ff01bb71cbdbb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 423 zcwXxa@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmP?o3wzqu@r-96VMcOPZ!4!i_>o> zF6?U#5OC$^p4a8|kHKzn7fa{5)d#LDy!eN4WrIz0c;LnUl}>^zZ5Jl&@j03ouetkf zT6o?!HTBBMoyF;D%=KYmvDf+KW3NwKwo<0wo#Bvy%K75#jS)7yA8q>0j~DK^xJ}nl zpyU1T4i2TJ_rF;j6?`uneDz~okQ?nR(Kab{=9#IfGuMP^&#YQLBQ%fUlTU-s-arxG z*K*<2OLu-Ru(6tdsE!V!(_P^e>>~Pgyv-c{VOERUlT;q2MYzg98 z`?YrK)1pkS*SpM?|L0pO;-z`-J%fnr$Hx;aYwpZmq){iE)b#IbQ22Ydq9-gneAF4Bz?LbpxJY5_^EKa|j zw709-L8R4QJUUTfZT^D%#N_<>c6+z_3taL~o_Nmu#N{QMgt`?4SRDPjV$)6ScfXl- zTJFb#a|Q1b-<>%yKlH-3w^@fR-6N-2&Gln=QhBa!KYx#*zVjoCXSzJjX}|WV`v$9e zHmRsgRN>5=wd%Fiw0o)yUuxf<{2UV+`Z6vwRP(fv?p|*Orss3)7a6)uns?t(;K3a3 zY4<8~dm{V4&3(7m_wtGFyoVoXb~%;C+V_NA-`ch4f&mXh6;sdS6Bd0jdg6;Tgcclr z_`rG1R;CiW`FqRnZN64DV_E0xudkdLa<@mvzb~^cjXiGStNm<2|F7CDXVV@_-`@7s z|G((*$AZ~!pFcix{Ez1eTLzCqQNLeL2*3X{zJC{Edw+({=GkkzfI-LL>FVdQ&MBb@ E0RIQBqW}N^ diff --git a/qmldebugcontrol/qml/next.png b/qmldebugcontrol/qml/next.png deleted file mode 100644 index 7700d6fce6ba1d328b435fb7117cd63fb760cca0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 908 zcwPaF19SX|P)j7>9=N}4&EW2lu2X^tbNq!01+-83))oqGlnqJfV)+?jKJzkAOAoWm6WGM$nC z0xFHNjp8pNGZ>%0E}+59r&c)94@m0HUpE@0vDnssU|<(g}O|jHXXLxF+<)+ zs0-LkKxqWmCX$0Se~Xt@+4O;tC;-Kf|KJS6=7jIrx8O1#l8F{ywCN1p}wcnxr# z1)5R`F#?r4fb!)W{y9J~|N58`Pbu+&5)G8d^;}}|O@~j84#Mjq0sDHu76e#V0TvE@ zxi3&gaH)(%`~I8~m6Uj=Nf*(!c&* iFhOE^-i-dam(w5dP+NWyTI59l0000p6mx29i$9$4?d<0N#cVnjR@G4IdBY=bez_VY#kQhT+)8<^jeNcT&sIndtP_ zeLcM`XI^ORkP87zrd{il3Ji#tk+c#^32SFz1L$B2!V8y z80FG!7#y=9SaanEBY9lB)yC{Z?yK;eeCFxrBv!F_kvOV|x>iu!FOG14d%Q2d-&|J` z4xOqzT$Q(3Yfc9KS1Twi@XSoz4#i`!{=S}TQ8`)H-Kvcu{f=EyR(w1pyERvEkP|Ch z9`-$WthP>?d&HT#UE+D-D9GM0>(UP92cP0mA{{xklF|}y^^wC5Nl@UJVg(FHU0)0y zTP8Zpb1v6L%s?;*7>^9x4TypU(w6O0$U`{SMogd2i&|_Boaxm~a%YNpedTif352n9 zOm-?zIIz0@?o6?CZnpuYj&iEr$|l)vI*E^3_!>Cr^FX=XW?mKoL8)#Y(tzy*K!t%t z>y+4zP*9-^5Kw8Sy(1JfAo8QCt!nRtDOR9$%l`q_mE|5fZJGHLpX9l=bWC?(cO4wl zwxx)Z;N;qfDNY^&h{9=I+m`J(sVLc3u8o-U^YbK53g!OXS3t*}j?R2VYM5)l$%)BS zcgK}}i3^zfOWF-;+1I*zTc#v$&E+~I*5uf&<)6>D0SFwf2|a)rNW1y;E1k2kco%uA z9LR}{kBm7tt`Cj3|9ELw0y2B*Yan?JF1MU(sUI5}O~qsJEeD*PiCH59!^`hBoo$t1 z{KKG$J9R*T)G2rP%*pTR{B73n_jQz2l%FImB!ArsLxBFCKI@&vx4ygF+CC^TP=wt0 zcG{`aH!lwCGJw!{yF0H=m+TD>6orZ&_1LyeYPeZn+N?RIb+C8PX*gB?#V;2w4oFNl z+>Eqw0Qt9p-JJpCQ=6&wUT$k2oxC;GQ5GqyicQ5riDc5_^ZCr{P?+!e&!ffpMQe0; zG&S&Nf3l~mXY{qxueSX0>+d5HOW_oZ5*25~QIF|ns#APHkWrDakX4c8lcyFxcH;4) zwRK02Ro5J<4Fm!tR@_MT7l(AMYff@0k(ggtSh#xWO8>Hr83U{h&V z$W;mw5IBNU0!yB%pqf+Z9d$??yo#TOm;i7xWe-EBQ5qnwWSH>?Af^;KL zQl}Lrc`24B9pdoPGE>88-e`H7)^I+=ukX>JQJDN6UZiy3CzPw z0B^j^Tz#0iUc=%;!R~Q^MeruTEB7)#3ub)?asqc=OIxw2;Qf{2490+Yj)~rfk9$p6c zd%)`ee+lRdz$5lO;rfdx25?IYj@ zz+VGi19&yfMfzUr$E=r@Vh0*>7jr`hCgT|MKmlhb(m3E(ks!APX5r<4_grH(?gKz7 zH-LItIZcr0P3NoxvI3rl>~u>2>lapWGrWfJ1 zoFe`1g1{FU0uBjZRWOBJiJ>PAr5YPsAkhnnZb)=OqLb#1U1-8jXu=*ep&3nR27C}r zXf2Q};Dz`>LNzO)gTyE#1|iW02{Yim7{h+_$1uil1YErPGJnE_3{LMDKP;F z3nYdhF}#uaD;`9Jk@n1Znv{UfNjylVRgdAa5>t>EgTyGxZjEEHINlz2fSPe$E|TH6 z>of;^bq}ItCCVUSgTz!cvrS;JM6e%MQ9aJlB4JX=9SM^4C|*{g91=4b%rjZD0*dSh zTuS`VD<|Mm;;F_a>J-`$xsuRE(f$0CZ6g8xl&8p^aH#|mygPu@IG$B(SG+`GEwUBa luIPJ#3lZhtjQ;tT)1Om}V+##pbj1Jw002ovPDHLkV1o8FiTwZo diff --git a/qmldebugcontrol/qml/qml.qrc b/qmldebugcontrol/qml/qml.qrc deleted file mode 100644 index acb92c1..0000000 --- a/qmldebugcontrol/qml/qml.qrc +++ /dev/null @@ -1,19 +0,0 @@ - - - Detail.qml - Label.qml - MainView.js - MainView.qml - popup.png - RangeDetails.qml - RangeMover.qml - TimeDisplay.qml - clean_pane_small.png - prev.png - next.png - magnifier-minus.png - magnifier-plus.png - recordOff.png - recordOn.png - - diff --git a/qmldebugcontrol/qml/recordOff.png b/qmldebugcontrol/qml/recordOff.png deleted file mode 100644 index 66f4e3b36b18d09d60f29585486251b9d1b9a9ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 589 zcwPZb0Px#24YJ`L;&vqDF7)Z=?-!L000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipe) z4=oXJ6<1CG000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0004~NkllSoYV7Gg-$ zx4Q$&!pxkr^Kn-2hqv b|7QOHIaC0(dRxyn00000NkvXXu0mjf>uU4g diff --git a/qmldebugcontrol/qml/recordOn.png b/qmldebugcontrol/qml/recordOn.png deleted file mode 100644 index 5d4b77f0f26688edad425ea1cd16e91c9dd7347e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 632 zcwPZ`0*C#HP)Px#24YJ`L;&vqDF7)Z=?-!L000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipe) z4=gYxXLeBl000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0005gNklGjQl+&-W#~Zp4k?K8Ni04<8uw{kB3&0*bjTIw z>OhGUi6RDZ=kuBSvqN#l*q5YZnqAHAdoyp|uJAzkzOU6>r_+&YuJ#Zx`p_r;GC{)` z(rQuLf4MqaCz2{SK0n8dKl8ZzibpS=Q){{uQN%n5_<4B=M@KYHPgf)>0?+f*xwxQt zb;a)SF?P)XQAC%wR4B5P@53S4euu{UlEm83Gy25S!vm~eA^f<-nog1F^xqnVJUKj| z_~>oU!1Fxa8Vs;7Y#}hcMV5uvH45M$I2hu7AK&+NHAE{2uz~FQ8ryYCu!0CcX^1G8 z*$f*fCXo<3wa -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeDebugService; - -class QDeclarativeDebugServerPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeDebugServer : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugServer) - Q_DISABLE_COPY(QDeclarativeDebugServer) -public: - static QDeclarativeDebugServer *instance(); - - void setConnection(QDeclarativeDebugServerConnection *connection); - - bool hasDebuggingClient() const; - - QList services() const; - QStringList serviceNames() const; - - bool addService(QDeclarativeDebugService *service); - bool removeService(QDeclarativeDebugService *service); - - void sendMessage(QDeclarativeDebugService *service, const QByteArray &message); - void receiveMessage(const QByteArray &message); - -private: - friend class QDeclarativeDebugService; - friend class QDeclarativeDebugServicePrivate; - QDeclarativeDebugServer(); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGSERVICE_H diff --git a/qmldebugcontrol/qmldbg_tcp/private/qdeclarativeglobal_p.h b/qmldebugcontrol/qmldbg_tcp/private/qdeclarativeglobal_p.h deleted file mode 100644 index 87be79f..0000000 --- a/qmldebugcontrol/qmldbg_tcp/private/qdeclarativeglobal_p.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEGLOBAL_H -#define QDECLARATIVEGLOBAL_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -#define DEFINE_BOOL_CONFIG_OPTION(name, var) \ - static bool name() \ - { \ - static enum { Yes, No, Unknown } status = Unknown; \ - if (status == Unknown) { \ - QByteArray v = qgetenv(#var); \ - bool value = !v.isEmpty() && v != "0" && v != "false"; \ - if (value) status = Yes; \ - else status = No; \ - } \ - return status == Yes; \ - } - -#ifdef Q_OS_SYMBIAN -#define Q_DECLARATIVE_PRIVATE_EXPORT Q_AUTOTEST_EXPORT -#else -#define Q_DECLARATIVE_PRIVATE_EXPORT Q_DECLARATIVE_EXPORT -#endif - -struct QDeclarativeGraphics_DerivedObject : public QObject -{ - void setParent_noEvent(QObject *parent) { - bool sce = d_ptr->sendChildEvents; - d_ptr->sendChildEvents = false; - setParent(parent); - d_ptr->sendChildEvents = sce; - } -}; - -/*! - Returns true if the case of \a fileName is equivalent to the file case of - \a fileName on disk, and false otherwise. - - This is used to ensure that the behavior of QML on a case-insensitive file - system is the same as on a case-sensitive file system. This function - performs a "best effort" attempt to determine the real case of the file. - It may have false positives (say the case is correct when it isn't), but it - should never have a false negative (say the case is incorrect when it is - correct). -*/ -bool QDeclarative_isFileCaseCorrect(const QString &fileName); - -/*! - Makes the \a object a child of \a parent. Note that when using this method, - neither \a parent nor the object's previous parent (if it had one) will - receive ChildRemoved or ChildAdded events. -*/ -inline void QDeclarative_setParent_noEvent(QObject *object, QObject *parent) -{ - static_cast(object)->setParent_noEvent(parent); -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEGLOBAL_H diff --git a/qmldebugcontrol/qmldbg_tcp/private/qpacketprotocol_p.h b/qmldebugcontrol/qmldbg_tcp/private/qpacketprotocol_p.h deleted file mode 100644 index 8540828..0000000 --- a/qmldebugcontrol/qmldbg_tcp/private/qpacketprotocol_p.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPACKETPROTOCOL_H -#define QPACKETPROTOCOL_H - -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QIODevice; -class QBuffer; -class QPacket; -class QPacketAutoSend; -class QPacketProtocolPrivate; - -class Q_DECLARATIVE_EXPORT QPacketProtocol : public QObject -{ -Q_OBJECT -public: - explicit QPacketProtocol(QIODevice * dev, QObject * parent = 0); - virtual ~QPacketProtocol(); - - qint32 maximumPacketSize() const; - qint32 setMaximumPacketSize(qint32); - - QPacketAutoSend send(); - void send(const QPacket &); - - qint64 packetsAvailable() const; - QPacket read(); - - void clear(); - - QIODevice * device(); - -Q_SIGNALS: - void readyRead(); - void invalidPacket(); - void packetWritten(); - -private: - QPacketProtocolPrivate * d; -}; - - -class Q_DECLARATIVE_EXPORT QPacket : public QDataStream -{ -public: - QPacket(); - QPacket(const QPacket &); - virtual ~QPacket(); - - void clear(); - bool isEmpty() const; - QByteArray data() const; - -protected: - friend class QPacketProtocol; - QPacket(const QByteArray & ba); - QByteArray b; - QBuffer * buf; -}; - -class Q_DECLARATIVE_PRIVATE_EXPORT QPacketAutoSend : public QPacket -{ -public: - virtual ~QPacketAutoSend(); - -private: - friend class QPacketProtocol; - QPacketAutoSend(QPacketProtocol *); - QPacketProtocol * p; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/qmldebugcontrol/qmldbg_tcp/qmldbg_tcp.pro b/qmldebugcontrol/qmldbg_tcp/qmldbg_tcp.pro deleted file mode 100644 index e8ab962..0000000 --- a/qmldebugcontrol/qmldbg_tcp/qmldbg_tcp.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = qmldbg_tcp -QT += declarative network - -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling -QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" - -SOURCES += \ - qtcpserverconnection.cpp - -HEADERS += \ - qtcpserverconnection.h - -target.path += $$[QT_INSTALL_PLUGINS]/qmltooling -INSTALLS += target - -symbian:TARGET.UID3=0x20031E90 diff --git a/qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.cpp b/qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.cpp deleted file mode 100644 index 71efe9b..0000000 --- a/qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtcpserverconnection.h" - -#include -#include - -#include "private/qdeclarativedebugserver_p.h" -#include - -QT_BEGIN_NAMESPACE - -class QTcpServerConnectionPrivate { -public: - QTcpServerConnectionPrivate(); - - int port; - QTcpSocket *socket; - QPacketProtocol *protocol; - QTcpServer *tcpServer; - - QDeclarativeDebugServer *debugServer; -}; - -QTcpServerConnectionPrivate::QTcpServerConnectionPrivate() : - port(0), - socket(0), - protocol(0), - tcpServer(0), - debugServer(0) -{ -} - -QTcpServerConnection::QTcpServerConnection() : - d_ptr(new QTcpServerConnectionPrivate) -{ - -} - -QTcpServerConnection::~QTcpServerConnection() -{ - delete d_ptr; -} - -void QTcpServerConnection::setServer(QDeclarativeDebugServer *server) -{ - Q_D(QTcpServerConnection); - d->debugServer = server; -} - -bool QTcpServerConnection::isConnected() const -{ - Q_D(const QTcpServerConnection); - return d->socket && d->socket->state() == QTcpSocket::ConnectedState; -} - -void QTcpServerConnection::send(const QByteArray &message) -{ - Q_D(QTcpServerConnection); - - if (!isConnected() - || !d->protocol || !d->socket) - return; - - QPacket pack; - pack.writeRawData(message.data(), message.length()); - - d->protocol->send(pack); - d->socket->flush(); -} - -void QTcpServerConnection::disconnect() -{ - Q_D(QTcpServerConnection); - - // protocol might still be processing packages at this point - d->protocol->deleteLater(); - d->protocol = 0; - d->socket->deleteLater(); - d->socket = 0; -} - -void QTcpServerConnection::setPort(int port, bool block) -{ - Q_D(QTcpServerConnection); - d->port = port; - - listen(); - if (block) - d->tcpServer->waitForNewConnection(-1); -} - -void QTcpServerConnection::listen() -{ - Q_D(QTcpServerConnection); - - d->tcpServer = new QTcpServer(this); - QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); - if (d->tcpServer->listen(QHostAddress::Any, d->port)) - qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); - else - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); -} - - -void QTcpServerConnection::readyRead() -{ - Q_D(QTcpServerConnection); - if (!d->protocol) - return; - - QPacket packet = d->protocol->read(); - - QByteArray content = packet.data(); - d->debugServer->receiveMessage(content); -} - -void QTcpServerConnection::newConnection() -{ - Q_D(QTcpServerConnection); - - if (d->socket) { - qWarning("QDeclarativeDebugServer: Another client is already connected"); - QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); - delete faultyConnection; - return; - } - - d->socket = d->tcpServer->nextPendingConnection(); - d->socket->setParent(this); - d->protocol = new QPacketProtocol(d->socket, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); -} - - -Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection) - -QT_END_NAMESPACE - -#include "qtcpserverconnection.moc" - diff --git a/qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.h b/qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.h deleted file mode 100644 index ed0ff2c..0000000 --- a/qmldebugcontrol/qmldbg_tcp/qtcpserverconnection.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTCPSERVERCONNECTION_H -#define QTCPSERVERCONNECTION_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeDebugServer; -class QTcpServerConnectionPrivate; -class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConnection -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QTcpServerConnection) - Q_DISABLE_COPY(QTcpServerConnection) - Q_INTERFACES(QDeclarativeDebugServerConnection) - - -public: - QTcpServerConnection(); - ~QTcpServerConnection(); - - void setServer(QDeclarativeDebugServer *server); - void setPort(int port, bool bock); - - bool isConnected() const; - void send(const QByteArray &message); - void disconnect(); - - void listen(); - void waitForConnection(); - -private Q_SLOTS: - void readyRead(); - void newConnection(); - -private: - QTcpServerConnectionPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QTCPSERVERCONNECTION_H diff --git a/qmldebugcontrol/qmljsdebugclient/CMakeLists.txt b/qmldebugcontrol/qmljsdebugclient/CMakeLists.txt deleted file mode 100644 index cc1a4fd..0000000 --- a/qmldebugcontrol/qmljsdebugclient/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -project(qmldebugclient) - -set(qmldebugclient_SRCS - qdeclarativedebug.cpp - qdeclarativedebugclient.cpp - qpacketprotocol.cpp -) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - -) - -# qt4_generate_moc(${_testname}.cpp ${moc_output_file}) -# qt4_wrap_cpp(${qmldebugclient_SRCS}) -qt4_automoc(${qmldebugclient_SRCS}) -# qt4_generate_moc(qpacketprotocol.cpp ) - -add_library(qmldebugclient ${qmldebugclient_SRCS}) - -target_link_libraries(qmldebugclient - ${QT_QTGUI_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARIES} - ${QT_QTCORE_LIBRARIES} - ${QT_QTNETWORK_LIBRARIES} -) diff --git a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.cpp b/qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.cpp deleted file mode 100644 index 4d912d8..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.cpp +++ /dev/null @@ -1,1099 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qdeclarativedebug.h" - -#include "qdeclarativedebugclient.h" - -namespace QmlJsDebugClient { - -class QDeclarativeEngineDebugClient : public QDeclarativeDebugClient -{ -public: - QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, QDeclarativeEngineDebugPrivate *p); - ~QDeclarativeEngineDebugClient(); - -protected: - virtual void statusChanged(Status status); - virtual void messageReceived(const QByteArray &); - -private: - QDeclarativeEngineDebugPrivate *priv; - friend class QDeclarativeEngineDebugPrivate; -}; - -class QDeclarativeEngineDebugPrivate -{ -// Q_DECLARE_PUBLIC(QDeclarativeEngineDebug) -public: - QDeclarativeEngineDebugPrivate(QDeclarativeEngineDebug *, QDeclarativeDebugConnection *); - ~QDeclarativeEngineDebugPrivate(); - - void statusChanged(QDeclarativeEngineDebug::Status status); - void message(const QByteArray &); - - QDeclarativeEngineDebugClient *client; - QDeclarativeEngineDebug *q_ptr; - int nextId; - int getId(); - - void decode(QDataStream &, QDeclarativeDebugContextReference &); - void decode(QDataStream &, QDeclarativeDebugObjectReference &, bool simple); - - static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugEnginesQuery *); - static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *); - static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *); - static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *); - static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugWatch *); - - QHash enginesQuery; - QHash rootContextQuery; - QHash objectQuery; - QHash expressionQuery; - - QHash watched; -}; - -QDeclarativeEngineDebugClient::QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, - QDeclarativeEngineDebugPrivate *p) -: QDeclarativeDebugClient(QLatin1String("QDeclarativeEngine"), client), priv(p) -{ -} - -QDeclarativeEngineDebugClient::~QDeclarativeEngineDebugClient() -{ -} - -void QDeclarativeEngineDebugClient::statusChanged(Status status) -{ - if (priv) - priv->statusChanged(static_cast(status)); -} - -void QDeclarativeEngineDebugClient::messageReceived(const QByteArray &data) -{ - if (priv) - priv->message(data); -} - -QDeclarativeEngineDebugPrivate::QDeclarativeEngineDebugPrivate(QDeclarativeEngineDebug *q, QDeclarativeDebugConnection *c) -: client(new QDeclarativeEngineDebugClient(c, this)), q_ptr(q), nextId(0) -{ -} - -QDeclarativeEngineDebugPrivate::~QDeclarativeEngineDebugPrivate() -{ - if (client) - client->priv = 0; - delete client; - - QHash::iterator enginesIter = enginesQuery.begin(); - for (; enginesIter != enginesQuery.end(); ++enginesIter) { - enginesIter.value()->m_client = 0; - if (enginesIter.value()->state() == QDeclarativeDebugQuery::Waiting) - enginesIter.value()->setState(QDeclarativeDebugQuery::Error); - } - - QHash::iterator rootContextIter = rootContextQuery.begin(); - for (; rootContextIter != rootContextQuery.end(); ++rootContextIter) { - rootContextIter.value()->m_client = 0; - if (rootContextIter.value()->state() == QDeclarativeDebugQuery::Waiting) - rootContextIter.value()->setState(QDeclarativeDebugQuery::Error); - } - - QHash::iterator objectIter = objectQuery.begin(); - for (; objectIter != objectQuery.end(); ++objectIter) { - objectIter.value()->m_client = 0; - if (objectIter.value()->state() == QDeclarativeDebugQuery::Waiting) - objectIter.value()->setState(QDeclarativeDebugQuery::Error); - } - - QHash::iterator exprIter = expressionQuery.begin(); - for (; exprIter != expressionQuery.end(); ++exprIter) { - exprIter.value()->m_client = 0; - if (exprIter.value()->state() == QDeclarativeDebugQuery::Waiting) - exprIter.value()->setState(QDeclarativeDebugQuery::Error); - } - - QHash::iterator watchIter = watched.begin(); - for (; watchIter != watched.end(); ++watchIter) { - watchIter.value()->m_client = 0; - watchIter.value()->setState(QDeclarativeDebugWatch::Dead); - } -} - -int QDeclarativeEngineDebugPrivate::getId() -{ - return nextId++; -} - -void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugEnginesQuery *q) -{ - if (c && q) { - QDeclarativeEngineDebugPrivate *p = c->d_func(); - p->enginesQuery.remove(q->m_queryId); - } -} - -void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, - QDeclarativeDebugRootContextQuery *q) -{ - if (c && q) { - QDeclarativeEngineDebugPrivate *p = c->d_func(); - p->rootContextQuery.remove(q->m_queryId); - } -} - -void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugWatch *w) -{ - if (c && w) { - QDeclarativeEngineDebugPrivate *p = c->d_func(); - p->watched.remove(w->m_queryId); - } -} - -// from qdeclarativeenginedebug_p.h -struct QDeclarativeObjectData { - QUrl url; - int lineNumber; - int columnNumber; - QString idString; - QString objectName; - QString objectType; - int objectId; - int contextId; -}; - -QDataStream &operator>>(QDataStream &ds, QDeclarativeObjectData &data) -{ - ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString - >> data.objectName >> data.objectType >> data.objectId >> data.contextId; - return ds; -} - -struct QDeclarativeObjectProperty { - enum Type { Unknown, Basic, Object, List, SignalProperty }; - Type type; - QString name; - QVariant value; - QString valueTypeName; - QString binding; - bool hasNotifySignal; -}; - -QDataStream &operator>>(QDataStream &ds, QDeclarativeObjectProperty &data) -{ - int type; - ds >> type >> data.name >> data.value >> data.valueTypeName - >> data.binding >> data.hasNotifySignal; - data.type = (QDeclarativeObjectProperty::Type)type; - return ds; -} - -void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugObjectQuery *q) -{ - if (c && q) { - QDeclarativeEngineDebugPrivate *p = c->d_func(); - p->objectQuery.remove(q->m_queryId); - } -} - -void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugExpressionQuery *q) -{ - if (c && q) { - QDeclarativeEngineDebugPrivate *p = c->d_func(); - p->expressionQuery.remove(q->m_queryId); - } -} - -void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugObjectReference &o, - bool simple) -{ - QDeclarativeObjectData data; - ds >> data; - o.m_debugId = data.objectId; - o.m_class = data.objectType; - o.m_idString = data.idString; - o.m_name = data.objectName; - o.m_source.m_url = data.url; - o.m_source.m_lineNumber = data.lineNumber; - o.m_source.m_columnNumber = data.columnNumber; - o.m_contextDebugId = data.contextId; - - if (simple) - return; - - int childCount; - bool recur; - ds >> childCount >> recur; - - for (int ii = 0; ii < childCount; ++ii) { - o.m_children.append(QDeclarativeDebugObjectReference()); - decode(ds, o.m_children.last(), !recur); - } - - int propCount; - ds >> propCount; - - for (int ii = 0; ii < propCount; ++ii) { - QDeclarativeObjectProperty data; - ds >> data; - QDeclarativeDebugPropertyReference prop; - prop.m_objectDebugId = o.m_debugId; - prop.m_name = data.name; - prop.m_binding = data.binding; - prop.m_hasNotifySignal = data.hasNotifySignal; - prop.m_valueTypeName = data.valueTypeName; - switch (data.type) { - case QDeclarativeObjectProperty::Basic: - case QDeclarativeObjectProperty::List: - case QDeclarativeObjectProperty::SignalProperty: - { - prop.m_value = data.value; - break; - } - case QDeclarativeObjectProperty::Object: - { - QDeclarativeDebugObjectReference obj; - obj.m_debugId = prop.m_value.toInt(); - prop.m_value = qVariantFromValue(obj); - break; - } - case QDeclarativeObjectProperty::Unknown: - break; - } - o.m_properties << prop; - } -} - -void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugContextReference &c) -{ - ds >> c.m_name >> c.m_debugId; - - int contextCount; - ds >> contextCount; - - for (int ii = 0; ii < contextCount; ++ii) { - c.m_contexts.append(QDeclarativeDebugContextReference()); - decode(ds, c.m_contexts.last()); - } - - int objectCount; - ds >> objectCount; - - for (int ii = 0; ii < objectCount; ++ii) { - QDeclarativeDebugObjectReference obj; - decode(ds, obj, true); - - obj.m_contextDebugId = c.m_debugId; - c.m_objects << obj; - } -} - -void QDeclarativeEngineDebugPrivate::statusChanged(QDeclarativeEngineDebug::Status status) -{ - emit q_ptr->statusChanged(status); -} - -void QDeclarativeEngineDebugPrivate::message(const QByteArray &data) -{ - QDataStream ds(data); - - QByteArray type; - ds >> type; - - //qDebug() << "QDeclarativeEngineDebugPrivate::message()" << type; - - if (type == "LIST_ENGINES_R") { - int queryId; - ds >> queryId; - - QDeclarativeDebugEnginesQuery *query = enginesQuery.value(queryId); - if (!query) - return; - enginesQuery.remove(queryId); - - int count; - ds >> count; - - for (int ii = 0; ii < count; ++ii) { - QDeclarativeDebugEngineReference ref; - ds >> ref.m_name; - ds >> ref.m_debugId; - query->m_engines << ref; - } - - query->m_client = 0; - query->setState(QDeclarativeDebugQuery::Completed); - } else if (type == "LIST_OBJECTS_R") { - int queryId; - ds >> queryId; - - QDeclarativeDebugRootContextQuery *query = rootContextQuery.value(queryId); - if (!query) - return; - rootContextQuery.remove(queryId); - - if (!ds.atEnd()) - decode(ds, query->m_context); - - query->m_client = 0; - query->setState(QDeclarativeDebugQuery::Completed); - } else if (type == "FETCH_OBJECT_R") { - int queryId; - ds >> queryId; - - QDeclarativeDebugObjectQuery *query = objectQuery.value(queryId); - if (!query) - return; - objectQuery.remove(queryId); - - if (!ds.atEnd()) - decode(ds, query->m_object, false); - - query->m_client = 0; - query->setState(QDeclarativeDebugQuery::Completed); - } else if (type == "EVAL_EXPRESSION_R") { - int queryId; - QVariant result; - ds >> queryId >> result; - - QDeclarativeDebugExpressionQuery *query = expressionQuery.value(queryId); - if (!query) - return; - expressionQuery.remove(queryId); - - query->m_result = result; - query->m_client = 0; - query->setState(QDeclarativeDebugQuery::Completed); - } else if (type == "WATCH_PROPERTY_R") { - int queryId; - bool ok; - ds >> queryId >> ok; - - QDeclarativeDebugWatch *watch = watched.value(queryId); - if (!watch) - return; - - watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive); - } else if (type == "WATCH_OBJECT_R") { - int queryId; - bool ok; - ds >> queryId >> ok; - - QDeclarativeDebugWatch *watch = watched.value(queryId); - if (!watch) - return; - - watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive); - } else if (type == "WATCH_EXPR_OBJECT_R") { - int queryId; - bool ok; - ds >> queryId >> ok; - - QDeclarativeDebugWatch *watch = watched.value(queryId); - if (!watch) - return; - - watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive); - } else if (type == "UPDATE_WATCH") { - int queryId; - int debugId; - QByteArray name; - QVariant value; - ds >> queryId >> debugId >> name >> value; - - QDeclarativeDebugWatch *watch = watched.value(queryId, 0); - if (!watch) - return; - emit watch->valueChanged(name, value); - } else if (type == "OBJECT_CREATED") { - emit q_ptr->newObjects(); - } -} - -QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent) -: QObject(parent), d_ptr(new QDeclarativeEngineDebugPrivate(this, client)) -{ -} - -QDeclarativeEngineDebug::~QDeclarativeEngineDebug() { } - -QDeclarativeEngineDebug::Status QDeclarativeEngineDebug::status() const -{ - Q_D(const QDeclarativeEngineDebug); - - return static_cast(d->client->status()); -} - -QDeclarativeDebugPropertyWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugPropertyReference &property, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugPropertyWatch *watch = new QDeclarativeDebugPropertyWatch(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled) { - int queryId = d->getId(); - watch->m_queryId = queryId; - watch->m_client = this; - watch->m_objectDebugId = property.objectDebugId(); - watch->m_name = property.name(); - d->watched.insert(queryId, watch); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8(); - d->client->sendMessage(message); - } else { - watch->m_state = QDeclarativeDebugWatch::Dead; - } - - return watch; -} - -QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugContextReference &, const QString &, QObject *) -{ - qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented"); - return 0; -} - -QDeclarativeDebugObjectExpressionWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, const QString &expr, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - QDeclarativeDebugObjectExpressionWatch *watch = new QDeclarativeDebugObjectExpressionWatch(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled) { - int queryId = d->getId(); - watch->m_queryId = queryId; - watch->m_client = this; - watch->m_objectDebugId = object.debugId(); - watch->m_expr = expr; - d->watched.insert(queryId, watch); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr; - d->client->sendMessage(message); - } else { - watch->m_state = QDeclarativeDebugWatch::Dead; - } - return watch; -} - -QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugWatch *watch = new QDeclarativeDebugWatch(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled) { - int queryId = d->getId(); - watch->m_queryId = queryId; - watch->m_client = this; - watch->m_objectDebugId = object.debugId(); - d->watched.insert(queryId, watch); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId(); - d->client->sendMessage(message); - } else { - watch->m_state = QDeclarativeDebugWatch::Dead; - } - - return watch; -} - -QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugFileReference &, QObject *) -{ - qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented"); - return 0; -} - -void QDeclarativeEngineDebug::removeWatch(QDeclarativeDebugWatch *watch) -{ - Q_D(QDeclarativeEngineDebug); - - if (!watch || !watch->m_client) - return; - - watch->m_client = 0; - watch->setState(QDeclarativeDebugWatch::Inactive); - - d->watched.remove(watch->queryId()); - - if (d->client && d->client->status() == QDeclarativeDebugClient::Enabled) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("NO_WATCH") << watch->queryId(); - d->client->sendMessage(message); - } -} - -QDeclarativeDebugEnginesQuery *QDeclarativeEngineDebug::queryAvailableEngines(QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugEnginesQuery *query = new QDeclarativeDebugEnginesQuery(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->enginesQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("LIST_ENGINES") << queryId; - d->client->sendMessage(message); - } else { - query->m_state = QDeclarativeDebugQuery::Error; - } - - return query; -} - -QDeclarativeDebugRootContextQuery *QDeclarativeEngineDebug::queryRootContexts(const QDeclarativeDebugEngineReference &engine, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugRootContextQuery *query = new QDeclarativeDebugRootContextQuery(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled && engine.debugId() != -1) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->rootContextQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId(); - d->client->sendMessage(message); - } else { - query->m_state = QDeclarativeDebugQuery::Error; - } - - return query; -} - -QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclarativeDebugObjectReference &object, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled && object.debugId() != -1) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->objectQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() - << false << true; - d->client->sendMessage(message); - } else { - query->m_state = QDeclarativeDebugQuery::Error; - } - - return query; -} - -QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(const QDeclarativeDebugObjectReference &object, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled && object.debugId() != -1) { - query->m_client = this; - int queryId = d->getId(); - query->m_queryId = queryId; - d->objectQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() - << true << true; - d->client->sendMessage(message); - } else { - query->m_state = QDeclarativeDebugQuery::Error; - } - - return query; -} - -QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent) -{ - Q_D(QDeclarativeEngineDebug); - - QDeclarativeDebugExpressionQuery *query = new QDeclarativeDebugExpressionQuery(parent); - if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { - query->m_client = this; - query->m_expr = expr; - int queryId = d->getId(); - query->m_queryId = queryId; - d->expressionQuery.insert(queryId, query); - - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr; - d->client->sendMessage(message); - } else { - query->m_state = QDeclarativeDebugQuery::Error; - } - - return query; -} - -bool QDeclarativeEngineDebug::setBindingForObject(int objectDebugId, const QString &propertyName, - const QVariant &bindingExpression, - bool isLiteralValue, - QString source, int line) -{ - Q_D(QDeclarativeEngineDebug); - - if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue << source << line; - d->client->sendMessage(message); - return true; - } else { - return false; - } -} - -bool QDeclarativeEngineDebug::resetBindingForObject(int objectDebugId, const QString &propertyName) -{ - Q_D(QDeclarativeEngineDebug); - - if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName; - d->client->sendMessage(message); - return true; - } else { - return false; - } -} - -bool QDeclarativeEngineDebug::setMethodBody(int objectDebugId, const QString &methodName, - const QString &methodBody) -{ - Q_D(QDeclarativeEngineDebug); - - if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("SET_METHOD_BODY") << objectDebugId << methodName << methodBody; - d->client->sendMessage(message); - return true; - } else { - return false; - } -} - -QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent) -: QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1) -{ -} - -QDeclarativeDebugWatch::~QDeclarativeDebugWatch() -{ - if (m_client && m_queryId != -1) - QDeclarativeEngineDebugPrivate::remove(m_client, this); -} - -int QDeclarativeDebugWatch::queryId() const -{ - return m_queryId; -} - -int QDeclarativeDebugWatch::objectDebugId() const -{ - return m_objectDebugId; -} - -QDeclarativeDebugWatch::State QDeclarativeDebugWatch::state() const -{ - return m_state; -} - -void QDeclarativeDebugWatch::setState(State s) -{ - if (m_state == s) - return; - m_state = s; - emit stateChanged(m_state); -} - -QDeclarativeDebugPropertyWatch::QDeclarativeDebugPropertyWatch(QObject *parent) - : QDeclarativeDebugWatch(parent) -{ -} - -QString QDeclarativeDebugPropertyWatch::name() const -{ - return m_name; -} - - -QDeclarativeDebugObjectExpressionWatch::QDeclarativeDebugObjectExpressionWatch(QObject *parent) - : QDeclarativeDebugWatch(parent) -{ -} - -QString QDeclarativeDebugObjectExpressionWatch::expression() const -{ - return m_expr; -} - - -QDeclarativeDebugQuery::QDeclarativeDebugQuery(QObject *parent) -: QObject(parent), m_state(Waiting) -{ -} - -QDeclarativeDebugQuery::State QDeclarativeDebugQuery::state() const -{ - return m_state; -} - -bool QDeclarativeDebugQuery::isWaiting() const -{ - return m_state == Waiting; -} - -void QDeclarativeDebugQuery::setState(State s) -{ - if (m_state == s) - return; - m_state = s; - emit stateChanged(m_state); -} - -QDeclarativeDebugEnginesQuery::QDeclarativeDebugEnginesQuery(QObject *parent) -: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QDeclarativeDebugEnginesQuery::~QDeclarativeDebugEnginesQuery() -{ - if (m_client && m_queryId != -1) - QDeclarativeEngineDebugPrivate::remove(m_client, this); -} - -QList QDeclarativeDebugEnginesQuery::engines() const -{ - return m_engines; -} - -QDeclarativeDebugRootContextQuery::QDeclarativeDebugRootContextQuery(QObject *parent) -: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QDeclarativeDebugRootContextQuery::~QDeclarativeDebugRootContextQuery() -{ - if (m_client && m_queryId != -1) - QDeclarativeEngineDebugPrivate::remove(m_client, this); -} - -QDeclarativeDebugContextReference QDeclarativeDebugRootContextQuery::rootContext() const -{ - return m_context; -} - -QDeclarativeDebugObjectQuery::QDeclarativeDebugObjectQuery(QObject *parent) -: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QDeclarativeDebugObjectQuery::~QDeclarativeDebugObjectQuery() -{ - if (m_client && m_queryId != -1) - QDeclarativeEngineDebugPrivate::remove(m_client, this); -} - -QDeclarativeDebugObjectReference QDeclarativeDebugObjectQuery::object() const -{ - return m_object; -} - -QDeclarativeDebugExpressionQuery::QDeclarativeDebugExpressionQuery(QObject *parent) -: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1) -{ -} - -QDeclarativeDebugExpressionQuery::~QDeclarativeDebugExpressionQuery() -{ - if (m_client && m_queryId != -1) - QDeclarativeEngineDebugPrivate::remove(m_client, this); -} - -QVariant QDeclarativeDebugExpressionQuery::expression() const -{ - return m_expr; -} - -QVariant QDeclarativeDebugExpressionQuery::result() const -{ - return m_result; -} - -QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference() -: m_debugId(-1) -{ -} - -QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(int debugId) -: m_debugId(debugId) -{ -} - -QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &o) -: m_debugId(o.m_debugId), m_name(o.m_name) -{ -} - -QDeclarativeDebugEngineReference & -QDeclarativeDebugEngineReference::operator=(const QDeclarativeDebugEngineReference &o) -{ - m_debugId = o.m_debugId; m_name = o.m_name; - return *this; -} - -int QDeclarativeDebugEngineReference::debugId() const -{ - return m_debugId; -} - -QString QDeclarativeDebugEngineReference::name() const -{ - return m_name; -} - -QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference() -: m_debugId(-1), m_contextDebugId(-1) -{ -} - -QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(int debugId) -: m_debugId(debugId), m_contextDebugId(-1) -{ -} - -QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &o) -: m_debugId(o.m_debugId), m_class(o.m_class), m_idString(o.m_idString), - m_name(o.m_name), m_source(o.m_source), m_contextDebugId(o.m_contextDebugId), - m_properties(o.m_properties), m_children(o.m_children) -{ -} - -QDeclarativeDebugObjectReference & -QDeclarativeDebugObjectReference::operator=(const QDeclarativeDebugObjectReference &o) -{ - m_debugId = o.m_debugId; m_class = o.m_class; m_idString = o.m_idString; - m_name = o.m_name; m_source = o.m_source; m_contextDebugId = o.m_contextDebugId; - m_properties = o.m_properties; m_children = o.m_children; - return *this; -} - -int QDeclarativeDebugObjectReference::debugId() const -{ - return m_debugId; -} - -QString QDeclarativeDebugObjectReference::className() const -{ - return m_class; -} - -QString QDeclarativeDebugObjectReference::idString() const -{ - return m_idString; -} - -QString QDeclarativeDebugObjectReference::name() const -{ - return m_name; -} - -QDeclarativeDebugFileReference QDeclarativeDebugObjectReference::source() const -{ - return m_source; -} - -int QDeclarativeDebugObjectReference::contextDebugId() const -{ - return m_contextDebugId; -} - -QList QDeclarativeDebugObjectReference::properties() const -{ - return m_properties; -} - -QList QDeclarativeDebugObjectReference::children() const -{ - return m_children; -} - -QDeclarativeDebugContextReference::QDeclarativeDebugContextReference() -: m_debugId(-1) -{ -} - -QDeclarativeDebugContextReference::QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &o) -: m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts) -{ -} - -QDeclarativeDebugContextReference &QDeclarativeDebugContextReference::operator=(const QDeclarativeDebugContextReference &o) -{ - m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects; - m_contexts = o.m_contexts; - return *this; -} - -int QDeclarativeDebugContextReference::debugId() const -{ - return m_debugId; -} - -QString QDeclarativeDebugContextReference::name() const -{ - return m_name; -} - -QList QDeclarativeDebugContextReference::objects() const -{ - return m_objects; -} - -QList QDeclarativeDebugContextReference::contexts() const -{ - return m_contexts; -} - -QDeclarativeDebugFileReference::QDeclarativeDebugFileReference() -: m_lineNumber(-1), m_columnNumber(-1) -{ -} - -QDeclarativeDebugFileReference::QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &o) -: m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber) -{ -} - -QDeclarativeDebugFileReference &QDeclarativeDebugFileReference::operator=(const QDeclarativeDebugFileReference &o) -{ - m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber; - return *this; -} - -QUrl QDeclarativeDebugFileReference::url() const -{ - return m_url; -} - -void QDeclarativeDebugFileReference::setUrl(const QUrl &u) -{ - m_url = u; -} - -int QDeclarativeDebugFileReference::lineNumber() const -{ - return m_lineNumber; -} - -void QDeclarativeDebugFileReference::setLineNumber(int l) -{ - m_lineNumber = l; -} - -int QDeclarativeDebugFileReference::columnNumber() const -{ - return m_columnNumber; -} - -void QDeclarativeDebugFileReference::setColumnNumber(int c) -{ - m_columnNumber = c; -} - -QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference() -: m_objectDebugId(-1), m_hasNotifySignal(false) -{ -} - -QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &o) -: m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value), - m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding), - m_hasNotifySignal(o.m_hasNotifySignal) -{ -} - -QDeclarativeDebugPropertyReference &QDeclarativeDebugPropertyReference::operator=(const QDeclarativeDebugPropertyReference &o) -{ - m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value; - m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding; - m_hasNotifySignal = o.m_hasNotifySignal; - return *this; -} - -int QDeclarativeDebugPropertyReference::objectDebugId() const -{ - return m_objectDebugId; -} - -QString QDeclarativeDebugPropertyReference::name() const -{ - return m_name; -} - -QString QDeclarativeDebugPropertyReference::valueTypeName() const -{ - return m_valueTypeName; -} - -QVariant QDeclarativeDebugPropertyReference::value() const -{ - return m_value; -} - -QString QDeclarativeDebugPropertyReference::binding() const -{ - return m_binding; -} - -bool QDeclarativeDebugPropertyReference::hasNotifySignal() const -{ - return m_hasNotifySignal; -} - -} diff --git a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.h b/qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.h deleted file mode 100644 index dcb5396..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebug.h +++ /dev/null @@ -1,375 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDEBUG_H -#define QDECLARATIVEDEBUG_H - -#include -#include -#include - -QT_BEGIN_HEADER - -namespace QmlJsDebugClient { - -class QDeclarativeDebugConnection; -class QDeclarativeDebugWatch; -class QDeclarativeDebugPropertyWatch; -class QDeclarativeDebugObjectExpressionWatch; -class QDeclarativeDebugEnginesQuery; -class QDeclarativeDebugRootContextQuery; -class QDeclarativeDebugObjectQuery; -class QDeclarativeDebugExpressionQuery; -class QDeclarativeDebugPropertyReference; -class QDeclarativeDebugContextReference; -class QDeclarativeDebugObjectReference; -class QDeclarativeDebugFileReference; -class QDeclarativeDebugEngineReference; -class QDeclarativeEngineDebugPrivate; - -class QDeclarativeEngineDebug : public QObject -{ -Q_OBJECT -public: - enum Status { NotConnected, Unavailable, Enabled }; - - explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0); - ~QDeclarativeEngineDebug(); - - Status status() const; - - QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &, - QObject *parent = 0); - QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &, - QObject *parent = 0); - QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &, - QObject *parent = 0); - QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &, - QObject *parent = 0); - QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &, - QObject *parent = 0); - - void removeWatch(QDeclarativeDebugWatch *watch); - - QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0); - QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &, - QObject *parent = 0); - QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &, - QObject *parent = 0); - QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &, - QObject *parent = 0); - QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId, - const QString &expr, - QObject *parent = 0); - bool setBindingForObject(int objectDebugId, const QString &propertyName, - const QVariant &bindingExpression, bool isLiteralValue, - QString source = QString(), int line = -1); - bool resetBindingForObject(int objectDebugId, const QString &propertyName); - bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody); - -Q_SIGNALS: - void newObjects(); - void statusChanged(Status status); - -private: - Q_DECLARE_PRIVATE(QDeclarativeEngineDebug) - QScopedPointer d_ptr; -}; - -class QDeclarativeDebugWatch : public QObject -{ -Q_OBJECT -public: - enum State { Waiting, Active, Inactive, Dead }; - - QDeclarativeDebugWatch(QObject *); - ~QDeclarativeDebugWatch(); - - int queryId() const; - int objectDebugId() const; - State state() const; - -Q_SIGNALS: - void stateChanged(QDeclarativeDebugWatch::State); - //void objectChanged(int, const QDeclarativeDebugObjectReference &); - //void valueChanged(int, const QVariant &); - - // Server sends value as string if it is a user-type variant - void valueChanged(const QByteArray &name, const QVariant &value); - -private: - friend class QDeclarativeEngineDebug; - friend class QDeclarativeEngineDebugPrivate; - void setState(State); - State m_state; - int m_queryId; - QDeclarativeEngineDebug *m_client; - int m_objectDebugId; -}; - -class QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch -{ - Q_OBJECT -public: - QDeclarativeDebugPropertyWatch(QObject *parent); - - QString name() const; - -private: - friend class QDeclarativeEngineDebug; - QString m_name; -}; - -class QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch -{ - Q_OBJECT -public: - QDeclarativeDebugObjectExpressionWatch(QObject *parent); - - QString expression() const; - -private: - friend class QDeclarativeEngineDebug; - QString m_expr; - int m_debugId; -}; - -class QDeclarativeDebugQuery : public QObject -{ -Q_OBJECT -public: - enum State { Waiting, Error, Completed }; - - State state() const; - bool isWaiting() const; - -// bool waitUntilCompleted(); - -Q_SIGNALS: - void stateChanged(QDeclarativeDebugQuery::State); - -protected: - QDeclarativeDebugQuery(QObject *); - -private: - friend class QDeclarativeEngineDebug; - friend class QDeclarativeEngineDebugPrivate; - void setState(State); - State m_state; -}; - -class QDeclarativeDebugFileReference -{ -public: - QDeclarativeDebugFileReference(); - QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &); - QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &); - - QUrl url() const; - void setUrl(const QUrl &); - int lineNumber() const; - void setLineNumber(int); - int columnNumber() const; - void setColumnNumber(int); - -private: - friend class QDeclarativeEngineDebugPrivate; - QUrl m_url; - int m_lineNumber; - int m_columnNumber; -}; - -class QDeclarativeDebugEngineReference -{ -public: - QDeclarativeDebugEngineReference(); - QDeclarativeDebugEngineReference(int); - QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &); - QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &); - - int debugId() const; - QString name() const; - -private: - friend class QDeclarativeEngineDebugPrivate; - int m_debugId; - QString m_name; -}; - -class QDeclarativeDebugObjectReference -{ -public: - QDeclarativeDebugObjectReference(); - QDeclarativeDebugObjectReference(int); - QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &); - QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &); - - int debugId() const; - QString className() const; - QString idString() const; - QString name() const; - - QDeclarativeDebugFileReference source() const; - int contextDebugId() const; - - QList properties() const; - QList children() const; - -private: - friend class QDeclarativeEngineDebugPrivate; - int m_debugId; - QString m_class; - QString m_idString; - QString m_name; - QDeclarativeDebugFileReference m_source; - int m_contextDebugId; - QList m_properties; - QList m_children; -}; - -class QDeclarativeDebugContextReference -{ -public: - QDeclarativeDebugContextReference(); - QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &); - QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &); - - int debugId() const; - QString name() const; - - QList objects() const; - QList contexts() const; - -private: - friend class QDeclarativeEngineDebugPrivate; - int m_debugId; - QString m_name; - QList m_objects; - QList m_contexts; -}; - -class QDeclarativeDebugPropertyReference -{ -public: - QDeclarativeDebugPropertyReference(); - QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &); - QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &); - - int objectDebugId() const; - QString name() const; - QVariant value() const; - QString valueTypeName() const; - QString binding() const; - bool hasNotifySignal() const; - -private: - friend class QDeclarativeEngineDebugPrivate; - int m_objectDebugId; - QString m_name; - QVariant m_value; - QString m_valueTypeName; - QString m_binding; - bool m_hasNotifySignal; -}; - - -class QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery -{ -Q_OBJECT -public: - virtual ~QDeclarativeDebugEnginesQuery(); - QList engines() const; -private: - friend class QDeclarativeEngineDebug; - friend class QDeclarativeEngineDebugPrivate; - QDeclarativeDebugEnginesQuery(QObject *); - QDeclarativeEngineDebug *m_client; - int m_queryId; - QList m_engines; -}; - -class QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery -{ -Q_OBJECT -public: - virtual ~QDeclarativeDebugRootContextQuery(); - QDeclarativeDebugContextReference rootContext() const; -private: - friend class QDeclarativeEngineDebug; - friend class QDeclarativeEngineDebugPrivate; - QDeclarativeDebugRootContextQuery(QObject *); - QDeclarativeEngineDebug *m_client; - int m_queryId; - QDeclarativeDebugContextReference m_context; -}; - -class QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery -{ -Q_OBJECT -public: - virtual ~QDeclarativeDebugObjectQuery(); - QDeclarativeDebugObjectReference object() const; -private: - friend class QDeclarativeEngineDebug; - friend class QDeclarativeEngineDebugPrivate; - QDeclarativeDebugObjectQuery(QObject *); - QDeclarativeEngineDebug *m_client; - int m_queryId; - QDeclarativeDebugObjectReference m_object; - -}; - -class QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery -{ -Q_OBJECT -public: - virtual ~QDeclarativeDebugExpressionQuery(); - QVariant expression() const; - QVariant result() const; -private: - friend class QDeclarativeEngineDebug; - friend class QDeclarativeEngineDebugPrivate; - QDeclarativeDebugExpressionQuery(QObject *); - QDeclarativeEngineDebug *m_client; - int m_queryId; - QVariant m_expr; - QVariant m_result; -}; - -} - -Q_DECLARE_METATYPE(QmlJsDebugClient::QDeclarativeDebugEngineReference) -Q_DECLARE_METATYPE(QmlJsDebugClient::QDeclarativeDebugObjectReference) -Q_DECLARE_METATYPE(QmlJsDebugClient::QDeclarativeDebugContextReference) -Q_DECLARE_METATYPE(QmlJsDebugClient::QDeclarativeDebugPropertyReference) - - -#endif // QDECLARATIVEDEBUG_H diff --git a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.cpp b/qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.cpp deleted file mode 100644 index df8fb73..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qdeclarativedebugclient.h" - -#include "qpacketprotocol.h" - -#include -#include - -namespace QmlJsDebugClient { - -const int protocolVersion = 1; -const QString serverId = QLatin1String("QDeclarativeDebugServer"); -const QString clientId = QLatin1String("QDeclarativeDebugClient"); -static const uchar KQmlOstProtocolId = 0x94; - -class QDeclarativeDebugClientPrivate -{ -// Q_DECLARE_PUBLIC(QDeclarativeDebugClient) -public: - QDeclarativeDebugClientPrivate(); - - QString name; - QDeclarativeDebugConnection *connection; -}; - -QDeclarativeDebugConnectionPrivate::QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c) -: QObject(c), q(c), protocol(0), device(0), gotHello(false) -{ - protocol = new QPacketProtocol(q, this); - QObject::connect(c, SIGNAL(connected()), this, SLOT(connected())); - QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); -} - -void QDeclarativeDebugConnectionPrivate::advertisePlugins() -{ - if (!q->isConnected() || !gotHello) - return; - - QPacket pack; - pack << serverId << 1 << plugins.keys(); - protocol->send(pack); - q->flush(); -} - -void QDeclarativeDebugConnectionPrivate::connected() -{ - QPacket pack; - pack << serverId << 0 << protocolVersion << plugins.keys(); - protocol->send(pack); - q->flush(); -} - -void QDeclarativeDebugConnectionPrivate::readyRead() -{ - if (!gotHello) { - QPacket pack = protocol->read(); - QString name; - - pack >> name; - - bool validHello = false; - if (name == clientId) { - int op = -1; - pack >> op; - if (op == 0) { - int version = -1; - pack >> version; - if (version == protocolVersion) { - pack >> serverPlugins; - validHello = true; - } - } - } - - if (!validHello) { - qWarning("QDeclarativeDebugConnection: Invalid hello message"); - QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - return; - } - gotHello = true; - - QHash::Iterator iter = plugins.begin(); - for (; iter != plugins.end(); ++iter) { - QDeclarativeDebugClient::Status newStatus = QDeclarativeDebugClient::Unavailable; - if (serverPlugins.contains(iter.key())) - newStatus = QDeclarativeDebugClient::Enabled; - iter.value()->statusChanged(newStatus); - } - } - - while (protocol->packetsAvailable()) { - QPacket pack = protocol->read(); - QString name; - pack >> name; - - if (name == clientId) { - int op = -1; - pack >> op; - - if (op == 1) { - // Service Discovery - QStringList oldServerPlugins = serverPlugins; - pack >> serverPlugins; - - QHash::Iterator iter = plugins.begin(); - for (; iter != plugins.end(); ++iter) { - const QString pluginName = iter.key(); - QDeclarativeDebugClient::Status newStatus = QDeclarativeDebugClient::Unavailable; - if (serverPlugins.contains(pluginName)) - newStatus = QDeclarativeDebugClient::Enabled; - - if (oldServerPlugins.contains(pluginName) - != serverPlugins.contains(pluginName)) { - iter.value()->statusChanged(newStatus); - } - } - } else { - qWarning() << "QDeclarativeDebugConnection: Unknown control message id" << op; - } - } else { - QByteArray message; - pack >> message; - - QHash::Iterator iter = - plugins.find(name); - if (iter == plugins.end()) { - qWarning() << "QDeclarativeDebugConnection: Message received for missing plugin" << name; - } else { - (*iter)->messageReceived(message); - } - } - } -} - -void QDeclarativeDebugConnectionPrivate::deviceAboutToClose() -{ - // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close()) - // without calling the underlying device close fn as that would cause an infinite loop - q->QIODevice::close(); -} - -QDeclarativeDebugConnection::QDeclarativeDebugConnection(QObject *parent) -: QIODevice(parent), d(new QDeclarativeDebugConnectionPrivate(this)) -{ -} - -QDeclarativeDebugConnection::~QDeclarativeDebugConnection() -{ - QHash::iterator iter = d->plugins.begin(); - for (; iter != d->plugins.end(); ++iter) { - iter.value()->d_func()->connection = 0; - iter.value()->statusChanged(QDeclarativeDebugClient::NotConnected); - } -} - -bool QDeclarativeDebugConnection::isConnected() const -{ - return state() == QAbstractSocket::ConnectedState; -} - -qint64 QDeclarativeDebugConnection::readData(char *data, qint64 maxSize) -{ - return d->device->read(data, maxSize); -} - -qint64 QDeclarativeDebugConnection::writeData(const char *data, qint64 maxSize) -{ - return d->device->write(data, maxSize); -} - -qint64 QDeclarativeDebugConnection::bytesAvailable() const -{ - return d->device->bytesAvailable(); -} - -bool QDeclarativeDebugConnection::isSequential() const -{ - return true; -} - -void QDeclarativeDebugConnection::close() -{ - if (isOpen()) { - QIODevice::close(); - d->device->close(); - emit stateChanged(QAbstractSocket::UnconnectedState); - } -} - -// For ease of refactoring we use QAbstractSocket's states even if we're actually using a OstChannel underneath -// since serial ports have a subset of the socket states afaics -QAbstractSocket::SocketState QDeclarativeDebugConnection::state() const -{ - QAbstractSocket *socket = qobject_cast(d->device); - if (socket) - return socket->state(); - - return QAbstractSocket::UnconnectedState; -} - -void QDeclarativeDebugConnection::flush() -{ - QAbstractSocket *socket = qobject_cast(d->device); - if (socket) { - socket->flush(); - return; - } - -} - -void QDeclarativeDebugConnection::connectToHost(const QString &hostName, quint16 port) -{ - QTcpSocket *socket = new QTcpSocket(d); - d->device = socket; - d->connectDeviceSignals(); - connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState))); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(connected()), this, SIGNAL(connected())); - socket->connectToHost(hostName, port); -// qDebug() << "RESULT" << socket->error() << socket->errorString(); - QIODevice::open(ReadWrite | Unbuffered); -} - -void QDeclarativeDebugConnection::connectToOst(const QString &port) -{ - Q_UNUSED(port); - emit error(QAbstractSocket::HostNotFoundError); - -} - -void QDeclarativeDebugConnectionPrivate::connectDeviceSignals() -{ - connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64))); - connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead())); - connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose())); -} - -// - -QDeclarativeDebugClientPrivate::QDeclarativeDebugClientPrivate() -: connection(0) -{ -} - -QDeclarativeDebugClient::QDeclarativeDebugClient(const QString &name, - QDeclarativeDebugConnection *parent) -: QObject(parent), d_ptr(new QDeclarativeDebugClientPrivate()) -{ - Q_D(QDeclarativeDebugClient); - d->name = name; - d->connection = parent; - - if (!d->connection) - return; - - if (d->connection->d->plugins.contains(name)) { - qWarning() << "QDeclarativeDebugClient: Conflicting plugin name" << name; - d->connection = 0; - } else { - d->connection->d->plugins.insert(name, this); - d->connection->d->advertisePlugins(); - } -} - -QDeclarativeDebugClient::~QDeclarativeDebugClient() -{ - Q_D(QDeclarativeDebugClient); - if (d->connection && d->connection->d) { - d->connection->d->plugins.remove(d->name); - d->connection->d->advertisePlugins(); - } -} - -QString QDeclarativeDebugClient::name() const -{ - Q_D(const QDeclarativeDebugClient); - return d->name; -} - -QDeclarativeDebugClient::Status QDeclarativeDebugClient::status() const -{ - Q_D(const QDeclarativeDebugClient); - if (!d->connection - || !d->connection->isConnected() - || !d->connection->d->gotHello) - return NotConnected; - - if (d->connection->d->serverPlugins.contains(d->name)) - return Enabled; - - return Unavailable; -} - -void QDeclarativeDebugClient::sendMessage(const QByteArray &message) -{ - Q_D(QDeclarativeDebugClient); - if (status() != Enabled) - return; - - QPacket pack; - pack << d->name << message; - d->connection->d->protocol->send(pack); - d->connection->flush(); -} - -void QDeclarativeDebugClient::statusChanged(Status) -{ -} - -void QDeclarativeDebugClient::messageReceived(const QByteArray &) -{ -} - -} // namespace QmlJsDebugClient - -#include diff --git a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.h b/qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.h deleted file mode 100644 index f9b5a0b..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qdeclarativedebugclient.h +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDEBUGCLIENT_H -#define QDECLARATIVEDEBUGCLIENT_H - -#include -#include "qpacketprotocol.h" -#include - -QT_BEGIN_HEADER - -namespace QmlJsDebugClient { - -class QDeclarativeDebugConnectionPrivate; -class QDeclarativeDebugConnection : public QIODevice -{ - Q_OBJECT - Q_DISABLE_COPY(QDeclarativeDebugConnection) -public: - QDeclarativeDebugConnection(QObject * = 0); - ~QDeclarativeDebugConnection(); - - void connectToHost(const QString &hostName, quint16 port); - void connectToOst(const QString &port); - - qint64 bytesAvailable() const; - bool isConnected() const; - QAbstractSocket::SocketState state() const; - void flush(); - bool isSequential() const; - void close(); - -signals: - void connected(); - void stateChanged(QAbstractSocket::SocketState socketState); - void error(QAbstractSocket::SocketError socketError); - -private: - qint64 readData(char *data, qint64 maxSize); - qint64 writeData(const char *data, qint64 maxSize); - -private: - QDeclarativeDebugConnectionPrivate *d; - friend class QDeclarativeDebugClient; - friend class QDeclarativeDebugClientPrivate; -}; - -class QDeclarativeDebugClientPrivate; -class QDeclarativeDebugClient : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugClient) - Q_DISABLE_COPY(QDeclarativeDebugClient) - -public: - enum Status { NotConnected, Unavailable, Enabled }; - - QDeclarativeDebugClient(const QString &, QDeclarativeDebugConnection *parent); - ~QDeclarativeDebugClient(); - - QString name() const; - - Status status() const; - - void sendMessage(const QByteArray &); - -protected: - virtual void statusChanged(Status); - virtual void messageReceived(const QByteArray &); - -private: - friend class QDeclarativeDebugConnection; - friend class QDeclarativeDebugConnectionPrivate; - QScopedPointer d_ptr; -}; - - -class QDeclarativeDebugConnectionPrivate : public QObject -{ - Q_OBJECT -public: - QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c); - QDeclarativeDebugConnection *q; - QPacketProtocol *protocol; - QIODevice *device; // Currently either a QTcpSocket or a SymbianUtils::OstChannel - - bool gotHello; - QStringList serverPlugins; - QHash plugins; - - void advertisePlugins(); - void connectDeviceSignals(); - -public Q_SLOTS: - void connected(); - void readyRead(); - void deviceAboutToClose(); -}; - - -} - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGCLIENT_H diff --git a/qmldebugcontrol/qmljsdebugclient/qmljsdebugclient-lib.pri b/qmldebugcontrol/qmljsdebugclient/qmljsdebugclient-lib.pri deleted file mode 100644 index 3fbd99c..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qmljsdebugclient-lib.pri +++ /dev/null @@ -1,15 +0,0 @@ - -## Input -HEADERS += \ -../../libs/qmljsdebugclient/qdeclarativedebug_p.h \ -../../libs/qmljsdebugclient/qpacketprotocol_p.h \ -../../libs/qmljsdebugclient/qdeclarativedebugclient_p.h - - -SOURCES += \ -../../libs/qmljsdebugclient/qdeclarativedebug.cpp \ -../../libs/qmljsdebugclient/qpacketprotocol.cpp \ -../../libs/qmljsdebugclient/qdeclarativedebugclient.cpp - - - diff --git a/qmldebugcontrol/qmljsdebugclient/qpacketprotocol.cpp b/qmldebugcontrol/qmljsdebugclient/qpacketprotocol.cpp deleted file mode 100644 index 3f0bf67..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qpacketprotocol.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qpacketprotocol.h" - -#include - -namespace QmlJsDebugClient { - -/*! - \class QPacketProtocol - \internal - - \brief The QPacketProtocol class encapsulates communicating discrete packets - across fragmented IO channels, such as TCP sockets. - - QPacketProtocol makes it simple to send arbitrary sized data "packets" across - fragmented transports such as TCP and UDP. - - As transmission boundaries are not respected, sending packets over protocols - like TCP frequently involves "stitching" them back together at the receiver. - QPacketProtocol makes this easier by performing this task for you. Packet - data sent using QPacketProtocol is prepended with a 4-byte size header - allowing the receiving QPacketProtocol to buffer the packet internally until - it has all been received. QPacketProtocol does not perform any sanity - checking on the size or on the data, so this class should only be used in - prototyping or trusted situations where DOS attacks are unlikely. - - QPacketProtocol does not perform any communications itself. Instead it can - operate on any QIODevice that supports the QIODevice::readyRead() signal. A - logical "packet" is encapsulated by the companion QPacket class. The - following example shows two ways to send data using QPacketProtocol. The - transmitted data is equivalent in both. - - \code - QTcpSocket socket; - // ... connect socket ... - - QPacketProtocol protocol(&socket); - - // Send packet the quick way - protocol.send() << "Hello world" << 123; - - // Send packet the longer way - QPacket packet; - packet << "Hello world" << 123; - protocol.send(packet); - \endcode - - Likewise, the following shows how to read data from QPacketProtocol, assuming - that the QPacketProtocol::readyRead() signal has been emitted. - - \code - // ... QPacketProtocol::readyRead() is emitted ... - - int a; - QByteArray b; - - // Receive packet the quick way - protocol.read() >> a >> b; - - // Receive packet the longer way - QPacket packet = protocol.read(); - p >> a >> b; - \endcode - - \ingroup io - \sa QPacket -*/ - -/*! - Construct a QPacketProtocol instance that works on \a dev with the - specified \a parent. - */ -QPacketProtocol::QPacketProtocol(QIODevice * dev, QObject * parent) -: QObject(parent), d(new QPacketProtocolPrivate(this, dev)) -{ - Q_ASSERT(dev); -} - -/*! - Destroys the QPacketProtocol instance. - */ -QPacketProtocol::~QPacketProtocol() -{ -} - -/*! - Returns the maximum packet size allowed. By default this is - 2,147,483,647 bytes. - - If a packet claiming to be larger than the maximum packet size is received, - the QPacketProtocol::invalidPacket() signal is emitted. - - \sa QPacketProtocol::setMaximumPacketSize() - */ -qint32 QPacketProtocol::maximumPacketSize() const -{ - return d->maxPacketSize; -} - -/*! - Sets the maximum allowable packet size to \a max. - - \sa QPacketProtocol::maximumPacketSize() - */ -qint32 QPacketProtocol::setMaximumPacketSize(qint32 max) -{ - if (max > (signed)sizeof(qint32)) - d->maxPacketSize = max; - return d->maxPacketSize; -} - -/*! - Returns a streamable object that is transmitted on destruction. For example - - \code - protocol.send() << "Hello world" << 123; - \endcode - - will send a packet containing "Hello world" and 123. To construct more - complex packets, explicitly construct a QPacket instance. - */ -QPacketAutoSend QPacketProtocol::send() -{ - return QPacketAutoSend(this); -} - -/*! - \fn void QPacketProtocol::send(const QPacket & packet) - - Transmit the \a packet. - */ -void QPacketProtocol::send(const QPacket & p) -{ - if (p.b.isEmpty()) - return; // We don't send empty packets - - qint64 sendSize = p.b.size() + sizeof(qint32); - - d->sendingPackets.append(sendSize); - qint32 sendSize32 = sendSize; - qint64 writeBytes = d->dev->write((char *)&sendSize32, sizeof(qint32)); - Q_ASSERT(writeBytes == sizeof(qint32)); - writeBytes = d->dev->write(p.b); - Q_ASSERT(writeBytes == p.b.size()); -} - -/*! - Returns the number of received packets yet to be read. - */ -qint64 QPacketProtocol::packetsAvailable() const -{ - return d->packets.count(); -} - -/*! - Discard any unread packets. - */ -void QPacketProtocol::clear() -{ - d->packets.clear(); -} - -/*! - Return the next unread packet, or an invalid QPacket instance if no packets - are available. This method does NOT block. - */ -QPacket QPacketProtocol::read() -{ - if (0 == d->packets.count()) - return QPacket(); - - QPacket rv(d->packets.at(0)); - d->packets.removeFirst(); - return rv; -} - -/*! - Return the QIODevice passed to the QPacketProtocol constructor. -*/ -QIODevice * QPacketProtocol::device() -{ - return d->dev; -} - -/*! - \fn void QPacketProtocol::readyRead() - - Emitted whenever a new packet is received. Applications may use - QPacketProtocol::read() to retrieve this packet. - */ - -/*! - \fn void QPacketProtocol::invalidPacket() - - A packet larger than the maximum allowable packet size was received. The - packet will be discarded and, as it indicates corruption in the protocol, no - further packets will be received. - */ - -/*! - \fn void QPacketProtocol::packetWritten() - - Emitted each time a packet is completing written to the device. This signal - may be used for communications flow control. - */ - -/*! - \class QPacket - \internal - - \brief The QPacket class encapsulates an unfragmentable packet of data to be - transmitted by QPacketProtocol. - - The QPacket class works together with QPacketProtocol to make it simple to - send arbitrary sized data "packets" across fragmented transports such as TCP - and UDP. - - QPacket provides a QDataStream interface to an unfragmentable packet. - Applications should construct a QPacket, propagate it with data and then - transmit it over a QPacketProtocol instance. For example: - \code - QPacketProtocol protocol(...); - - QPacket myPacket; - myPacket << "Hello world!" << 123; - protocol.send(myPacket); - \endcode - - As long as both ends of the connection are using the QPacketProtocol class, - the data within this packet will be delivered unfragmented at the other end, - ready for extraction. - - \code - QByteArray greeting; - int count; - - QPacket myPacket = protocol.read(); - - myPacket >> greeting >> count; - \endcode - - Only packets returned from QPacketProtocol::read() may be read from. QPacket - instances constructed by directly by applications are for transmission only - and are considered "write only". Attempting to read data from them will - result in undefined behavior. - - \ingroup io - \sa QPacketProtocol - */ - -/*! - Constructs an empty write-only packet. - */ -QPacket::QPacket() -: QDataStream(), buf(0) -{ - buf = new QBuffer(&b); - buf->open(QIODevice::WriteOnly); - setDevice(buf); -} - -/*! - Destroys the QPacket instance. - */ -QPacket::~QPacket() -{ - if (buf) { - delete buf; - buf = 0; - } -} - -/*! - Creates a copy of \a other. The initial stream positions are shared, but the - two packets are otherwise independent. - */ -QPacket::QPacket(const QPacket & other) -: QDataStream(), b(other.b), buf(0) -{ - buf = new QBuffer(&b); - buf->open(other.buf->openMode()); - setDevice(buf); -} - -/*! - \internal - */ -QPacket::QPacket(const QByteArray & ba) -: QDataStream(), b(ba), buf(0) -{ - buf = new QBuffer(&b); - buf->open(QIODevice::ReadOnly); - setDevice(buf); -} - -/*! - Returns true if this packet is empty - that is, contains no data. - */ -bool QPacket::isEmpty() const -{ - return b.isEmpty(); -} - -/*! - Clears data in the packet. This is useful for reusing one writable packet. - For example - \code - QPacketProtocol protocol(...); - - QPacket packet; - - packet << "Hello world!" << 123; - protocol.send(packet); - - packet.clear(); - packet << "Goodbyte world!" << 789; - protocol.send(packet); - \endcode - */ -void QPacket::clear() -{ - QBuffer::OpenMode oldMode = buf->openMode(); - buf->close(); - b.clear(); - buf->setBuffer(&b); // reset QBuffer internals with new size of b. - buf->open(oldMode); -} - -/*! - \class QPacketAutoSend - \internal - - \internal - */ -QPacketAutoSend::QPacketAutoSend(QPacketProtocol * _p) -: QPacket(), p(_p) -{ -} - -QPacketAutoSend::~QPacketAutoSend() -{ - if (!b.isEmpty()) - p->send(*this); -} - -} // namespace QmlJsDebugClient - -#include diff --git a/qmldebugcontrol/qmljsdebugclient/qpacketprotocol.h b/qmldebugcontrol/qmljsdebugclient/qpacketprotocol.h deleted file mode 100644 index f1c5c74..0000000 --- a/qmldebugcontrol/qmljsdebugclient/qpacketprotocol.h +++ /dev/null @@ -1,221 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QPACKETPROTOCOL_H -#define QPACKETPROTOCOL_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QIODevice; -class QBuffer; -QT_END_NAMESPACE - -namespace QmlJsDebugClient { - -class QPacket; -class QPacketAutoSend; - -class QPacketProtocolPrivate; - -class QPacketProtocol : public QObject -{ - Q_OBJECT - -public: - explicit QPacketProtocol(QIODevice *dev, QObject *parent = 0); - virtual ~QPacketProtocol(); - - qint32 maximumPacketSize() const; - qint32 setMaximumPacketSize(qint32); - - QPacketAutoSend send(); - void send(const QPacket &); - - qint64 packetsAvailable() const; - QPacket read(); - - void clear(); - - QIODevice *device(); - -Q_SIGNALS: - void readyRead(); - void invalidPacket(); - void packetWritten(); - -private: - QPacketProtocolPrivate *d; -}; - - -class QPacket : public QDataStream -{ -public: - QPacket(); - QPacket(const QPacket &); - virtual ~QPacket(); - - void clear(); - bool isEmpty() const; - -protected: - friend class QPacketProtocol; - QPacket(const QByteArray &ba); - QByteArray b; - QBuffer *buf; -}; - -class QPacketAutoSend : public QPacket -{ -public: - virtual ~QPacketAutoSend(); - -private: - friend class QPacketProtocol; - QPacketAutoSend(QPacketProtocol *); - QPacketProtocol *p; -}; - -static const unsigned int MAX_PACKET_SIZE = 0x7FFFFFFF; - -class QPacketProtocolPrivate : public QObject -{ - Q_OBJECT - -public: - QPacketProtocolPrivate(QPacketProtocol *parent, QIODevice *_dev) - : QObject(parent), inProgressSize(-1), maxPacketSize(MAX_PACKET_SIZE), - dev(_dev) - { - Q_ASSERT(4 == sizeof(qint32)); - - QObject::connect(this, SIGNAL(readyRead()), - parent, SIGNAL(readyRead())); - QObject::connect(this, SIGNAL(packetWritten()), - parent, SIGNAL(packetWritten())); - QObject::connect(this, SIGNAL(invalidPacket()), - parent, SIGNAL(invalidPacket())); - QObject::connect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::connect(dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::connect(dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); - } - -Q_SIGNALS: - void readyRead(); - void packetWritten(); - void invalidPacket(); - -public Q_SLOTS: - void aboutToClose() - { - inProgress.clear(); - sendingPackets.clear(); - inProgressSize = -1; - } - - void bytesWritten(qint64 bytes) - { - Q_ASSERT(!sendingPackets.isEmpty()); - - while (bytes) { - if (sendingPackets.at(0) > bytes) { - sendingPackets[0] -= bytes; - bytes = 0; - } else { - bytes -= sendingPackets.at(0); - sendingPackets.removeFirst(); - emit packetWritten(); - } - } - } - - void readyToRead() - { - while (true) { - // Need to get trailing data - if (-1 == inProgressSize) { - // We need a size header of sizeof(qint32) - if (sizeof(qint32) > (uint)dev->bytesAvailable()) - return; - - // Read size header - int read = dev->read((char *)&inProgressSize, sizeof(qint32)); - Q_ASSERT(read == sizeof(qint32)); - Q_UNUSED(read); - - // Check sizing constraints - if (inProgressSize > maxPacketSize) { - QObject::disconnect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::disconnect(dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); - dev = 0; - emit invalidPacket(); - return; - } - - inProgressSize -= sizeof(qint32); - } else { - inProgress.append(dev->read(inProgressSize - inProgress.size())); - - if (inProgressSize == inProgress.size()) { - // Packet has arrived! - packets.append(inProgress); - inProgressSize = -1; - inProgress.clear(); - - emit readyRead(); - } else - return; - } - } - } - -public: - QList sendingPackets; - QList packets; - QByteArray inProgress; - qint32 inProgressSize; - qint32 maxPacketSize; - QIODevice * dev; -}; - -} // QmlJsDebugClient - - -#endif diff --git a/qmldebugcontrol/qmljsdebugger/CMakeLists.txt b/qmldebugcontrol/qmljsdebugger/CMakeLists.txt deleted file mode 100644 index dab196c..0000000 --- a/qmldebugcontrol/qmljsdebugger/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -project(qmljsdebugger) - -#find_package(Qt4 REQUIRED) - -include(${QT_USE_FILE}) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/protocol - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${QT_INCLUDES} -) - -remove_definitions(-DQT_NO_CAST_TO_ASCII) -remove_definitions(-DQT_NO_CAST_FROM_ASCII) - -add_subdirectory(editor) -add_subdirectory(protocol) - -set(qmljsdebugger_SRCS - jsdebuggeragent.cpp - qdeclarativeviewinspector_p.cpp - qdeclarativeinspectorservice.cpp - qdeclarativeviewobserver.cpp -) - -qt4_automoc(${qmljsdebugger_SRCS}) - -add_definitions(-DBUILD_QMLJSDEBUGGER_STATIC_LIB) - -add_library(QmlJSDebugger STATIC ${qmljsdebugger_SRCS}) - -target_link_libraries(QmlJSDebugger - ${QT_QTDECLARATIVE_LIBRARIES} - ${QT_QTSCRIPT_LIBRARIES} - editor - protocol -) diff --git a/qmldebugcontrol/qmljsdebugger/editor/CMakeLists.txt b/qmldebugcontrol/qmljsdebugger/editor/CMakeLists.txt deleted file mode 100644 index 0a9f626..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -project(editor) - -set(editor_SRCS - abstractliveedittool.cpp - liveselectiontool.cpp - livelayeritem.cpp - livesingleselectionmanipulator.cpp - liverubberbandselectionmanipulator.cpp - liveselectionrectangle.cpp - liveselectionindicator.cpp - boundingrecthighlighter.cpp - subcomponentmasklayeritem.cpp - zoomtool.cpp - colorpickertool.cpp - qmltoolbar.cpp - toolbarcolorbox.cpp -) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) - -qt4_automoc( - abstractliveedittool.cpp - liveselectiontool.cpp - livelayeritem.cpp - boundingrecthighlighter.cpp - zoomtool.cpp - colorpickertool.cpp - qmltoolbar.cpp - toolbarcolorbox.cpp -) - -qt4_add_resources(_editor_rcc_src editor.qrc OPTIONS -root "/") - -add_library(editor ${editor_SRCS} ${_editor_rcc_src}) - -target_link_libraries(editor - ${QT_QTCORE_LIBRARIES} - ${QT_QTGUI_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARIES} -) diff --git a/qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.cpp b/qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.cpp deleted file mode 100644 index 1ab3415..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "abstractliveedittool.h" -#include "qdeclarativeviewinspector.h" -#include "../qdeclarativeviewinspector_p.h" - -#include - -#include -#include -#include - -namespace QmlJSDebugger { - -AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) - : QObject(editorView), m_inspector(editorView) -{ -} - - -AbstractLiveEditTool::~AbstractLiveEditTool() -{ -} - -QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const -{ - return m_inspector; -} - -QDeclarativeView *AbstractLiveEditTool::view() const -{ - return m_inspector->declarativeView(); -} - -QGraphicsScene* AbstractLiveEditTool::scene() const -{ - return view()->scene(); -} - -void AbstractLiveEditTool::updateSelectedItems() -{ - selectedItemsChanged(items()); -} - -QList AbstractLiveEditTool::items() const -{ - return inspector()->selectedItems(); -} - -bool AbstractLiveEditTool::topItemIsMovable(const QList & itemList) -{ - QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); - if (firstSelectableItem == 0) - return false; - if (toQDeclarativeItem(firstSelectableItem) != 0) - return true; - - return false; - -} - -bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList &itemList) -{ - QList selectedItems = inspector()->selectedItems(); - - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem - && selectedItems.contains(declarativeItem) - /*&& (declarativeItem->qmlItemNode().hasShowContent() || selectNonContentItems)*/) - return true; - } - - return false; - -} - -bool AbstractLiveEditTool::topItemIsResizeHandle(const QList &/*itemList*/) -{ - return false; -} - -QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item) -{ - return qobject_cast(item->toGraphicsObject()); -} - -QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - if (item->flags().testFlag(QGraphicsItem::ItemIsMovable)) - return item; - } - return 0; -} - -QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList - &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/) - return declarativeItem; - } - - return 0; -} - -QList AbstractLiveEditTool::toGraphicsObjectList(const QList - &itemList) -{ - QList gfxObjects; - foreach (QGraphicsItem *item, itemList) { - QGraphicsObject *obj = item->toGraphicsObject(); - if (obj) - gfxObjects << obj; - } - - return gfxObjects; -} - -QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) -{ - QString className("QGraphicsItem"); - QString objectStringId; - - QString constructedName; - - QGraphicsObject *gfxObject = item->toGraphicsObject(); - if (gfxObject) { - className = gfxObject->metaObject()->className(); - - className.remove(QRegExp("_QMLTYPE_\\d+")); - className.remove(QRegExp("_QML_\\d+")); - if (className.startsWith(QLatin1String("QDeclarative"))) - className = className.remove(QLatin1String("QDeclarative")); - - QDeclarativeItem *declarativeItem = qobject_cast(gfxObject); - if (declarativeItem) { - objectStringId = QDeclarativeViewInspector::idStringForObject(declarativeItem); - } - - if (!objectStringId.isEmpty()) { - constructedName = objectStringId + " (" + className + QLatin1Char(')'); - } else { - if (!gfxObject->objectName().isEmpty()) { - constructedName = gfxObject->objectName() + " (" + className + QLatin1Char(')'); - } else { - constructedName = className; - } - } - } - - return constructedName; -} - - -} // namespace QmlJSDebugger - -#include "abstractliveedittool.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.h b/qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.h deleted file mode 100644 index 8fbfc9a..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/abstractliveedittool.h +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef ABSTRACTLIVEEDITTOOL_H -#define ABSTRACTLIVEEDITTOOL_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QMouseEvent; -class QGraphicsItem; -class QDeclarativeItem; -class QKeyEvent; -class QGraphicsScene; -class QGraphicsObject; -class QWheelEvent; -class QDeclarativeView; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class FormEditorView; - -class AbstractLiveEditTool : public QObject -{ - Q_OBJECT -public: - AbstractLiveEditTool(QDeclarativeViewInspector *inspector); - - virtual ~AbstractLiveEditTool(); - - virtual void mousePressEvent(QMouseEvent *event) = 0; - virtual void mouseMoveEvent(QMouseEvent *event) = 0; - virtual void mouseReleaseEvent(QMouseEvent *event) = 0; - virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0; - - virtual void hoverMoveEvent(QMouseEvent *event) = 0; - virtual void wheelEvent(QWheelEvent *event) = 0; - - virtual void keyPressEvent(QKeyEvent *event) = 0; - virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0; - virtual void itemsAboutToRemoved(const QList &itemList) = 0; - - virtual void clear() = 0; - - void updateSelectedItems(); - QList items() const; - - void enterContext(QGraphicsItem *itemToEnter); - - bool topItemIsMovable(const QList &itemList); - bool topItemIsResizeHandle(const QList &itemList); - bool topSelectedItemIsMovable(const QList &itemList); - - static QString titleForItem(QGraphicsItem *item); - static QList toGraphicsObjectList(const QList &itemList); - static QGraphicsItem* topMovableGraphicsItem(const QList &itemList); - static QDeclarativeItem* topMovableDeclarativeItem(const QList &itemList); - static QDeclarativeItem *toQDeclarativeItem(QGraphicsItem *item); - -protected: - virtual void selectedItemsChanged(const QList &objectList) = 0; - - QDeclarativeViewInspector *inspector() const; - QDeclarativeView *view() const; - QGraphicsScene *scene() const; - -private: - QDeclarativeViewInspector *m_inspector; - QList m_itemList; -}; - -} - -#endif // ABSTRACTLIVEEDITTOOL_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.cpp b/qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.cpp deleted file mode 100644 index dd06251..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "boundingrecthighlighter.h" -#include "qdeclarativeviewinspector.h" -#include "qmlinspectorconstants.h" - -#include - -#include -#include -#include - -namespace QmlJSDebugger { - -BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent) - : QObject(parent), - highlightedObject(itemToHighlight), - highlightPolygon(0), - highlightPolygonEdge(0) -{ - highlightPolygon = new BoundingBoxPolygonItem(parentItem); - highlightPolygonEdge = new BoundingBoxPolygonItem(parentItem); - - highlightPolygon->setPen(QPen(QColor(0, 22, 159))); - highlightPolygonEdge->setPen(QPen(QColor(158, 199, 255))); - - highlightPolygon->setFlag(QGraphicsItem::ItemIsSelectable, false); - highlightPolygonEdge->setFlag(QGraphicsItem::ItemIsSelectable, false); -} - -BoundingBox::~BoundingBox() -{ - highlightedObject.clear(); -} - -BoundingBoxPolygonItem::BoundingBoxPolygonItem(QGraphicsItem *item) : QGraphicsPolygonItem(item) -{ - QPen pen; - pen.setColor(QColor(108, 141, 221)); - pen.setWidth(1); - setPen(pen); -} - -int BoundingBoxPolygonItem::type() const -{ - return Constants::EditorItemType; -} - -BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) : - LiveLayerItem(view->declarativeView()->scene()), - m_view(view) -{ -} - -BoundingRectHighlighter::~BoundingRectHighlighter() -{ - -} - -void BoundingRectHighlighter::clear() -{ - foreach (BoundingBox *box, m_boxes) - freeBoundingBox(box); -} - -BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const -{ - foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == item) - return box; - } - return 0; -} - -void BoundingRectHighlighter::highlight(QList items) -{ - if (items.isEmpty()) - return; - - QList newBoxes; - foreach (QGraphicsObject *itemToHighlight, items) { - BoundingBox *box = boxFor(itemToHighlight); - if (!box) - box = createBoundingBox(itemToHighlight); - - newBoxes << box; - } - qSort(newBoxes); - - if (newBoxes != m_boxes) { - clear(); - m_boxes << newBoxes; - } - - highlightAll(); -} - -void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) -{ - if (!itemToHighlight) - return; - - BoundingBox *box = boxFor(itemToHighlight); - if (!box) { - box = createBoundingBox(itemToHighlight); - m_boxes << box; - qSort(m_boxes); - } - - highlightAll(); -} - -BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight) -{ - if (!m_freeBoxes.isEmpty()) { - BoundingBox *box = m_freeBoxes.last(); - if (box->highlightedObject.isNull()) { - box->highlightedObject = itemToHighlight; - box->highlightPolygon->show(); - box->highlightPolygonEdge->show(); - m_freeBoxes.removeLast(); - return box; - } - } - - BoundingBox *box = new BoundingBox(itemToHighlight, this, this); - - connect(itemToHighlight, SIGNAL(xChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(yChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(widthChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(heightChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(rotationChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*))); - - return box; -} - -void BoundingRectHighlighter::removeBoundingBox(BoundingBox *box) -{ - delete box; - box = 0; -} - -void BoundingRectHighlighter::freeBoundingBox(BoundingBox *box) -{ - if (!box->highlightedObject.isNull()) { - disconnect(box->highlightedObject.data(), SIGNAL(xChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(yChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(widthChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(heightChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(rotationChanged()), this, SLOT(refresh())); - } - - box->highlightedObject.clear(); - box->highlightPolygon->hide(); - box->highlightPolygonEdge->hide(); - m_boxes.removeOne(box); - m_freeBoxes << box; -} - -void BoundingRectHighlighter::itemDestroyed(QObject *obj) -{ - foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == obj) { - freeBoundingBox(box); - break; - } - } -} - -void BoundingRectHighlighter::highlightAll() -{ - foreach (BoundingBox *box, m_boxes) { - if (box && box->highlightedObject.isNull()) { - // clear all highlights - clear(); - return; - } - QGraphicsObject *item = box->highlightedObject.data(); - - QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); - QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); - QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); - QRectF edgeRect = bboxRect; - edgeRect.adjust(-1, -1, 1, 1); - - box->highlightPolygon->setPolygon(QPolygonF(bboxRect)); - box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect)); - } -} - -void BoundingRectHighlighter::refresh() -{ - if (!m_boxes.isEmpty()) - highlightAll(); -} - - -} // namespace QmlJSDebugger - -#include "boundingrecthighlighter.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.h b/qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.h deleted file mode 100644 index 3bb8ef7..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/boundingrecthighlighter.h +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef BOUNDINGRECTHIGHLIGHTER_H -#define BOUNDINGRECTHIGHLIGHTER_H - -#include "livelayeritem.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QPainter) -QT_FORWARD_DECLARE_CLASS(QWidget) -QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QTimer) - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; -class BoundingBox; - -class BoundingRectHighlighter : public LiveLayerItem -{ - Q_OBJECT -public: - explicit BoundingRectHighlighter(QDeclarativeViewInspector *view); - ~BoundingRectHighlighter(); - void clear(); - void highlight(QList items); - void highlight(QGraphicsObject* item); - -private slots: - void refresh(); - void itemDestroyed(QObject *); - -private: - BoundingBox *boxFor(QGraphicsObject *item) const; - void highlightAll(); - BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight); - void removeBoundingBox(BoundingBox *box); - void freeBoundingBox(BoundingBox *box); - -private: - Q_DISABLE_COPY(BoundingRectHighlighter) - - QDeclarativeViewInspector *m_view; - QList m_boxes; - QList m_freeBoxes; -}; - -class BoundingBox : public QObject -{ - Q_OBJECT -public: - explicit BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent = 0); - ~BoundingBox(); - QWeakPointer highlightedObject; - QGraphicsPolygonItem *highlightPolygon; - QGraphicsPolygonItem *highlightPolygonEdge; - -private: - Q_DISABLE_COPY(BoundingBox) - -}; - -class BoundingBoxPolygonItem : public QGraphicsPolygonItem -{ -public: - explicit BoundingBoxPolygonItem(QGraphicsItem *item); - int type() const; -}; - -} // namespace QmlJSDebugger - -#endif // BOUNDINGRECTHIGHLIGHTER_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/colorpickertool.cpp b/qmldebugcontrol/qmljsdebugger/editor/colorpickertool.cpp deleted file mode 100644 index fec4dcc..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/colorpickertool.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "colorpickertool.h" -#include "qdeclarativeviewinspector.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace QmlJSDebugger { - -ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) : - AbstractLiveEditTool(view) -{ - m_selectedColor.setRgb(0,0,0); -} - -ColorPickerTool::~ColorPickerTool() -{ - -} - -void ColorPickerTool::mousePressEvent(QMouseEvent * /*event*/) -{ -} - -void ColorPickerTool::mouseMoveEvent(QMouseEvent *event) -{ - pickColor(event->pos()); -} - -void ColorPickerTool::mouseReleaseEvent(QMouseEvent *event) -{ - pickColor(event->pos()); -} - -void ColorPickerTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ -} - - -void ColorPickerTool::hoverMoveEvent(QMouseEvent * /*event*/) -{ -} - -void ColorPickerTool::keyPressEvent(QKeyEvent * /*event*/) -{ -} - -void ColorPickerTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ -} -void ColorPickerTool::wheelEvent(QWheelEvent * /*event*/) -{ -} - -void ColorPickerTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ -} - -void ColorPickerTool::clear() -{ - view()->setCursor(Qt::CrossCursor); -} - -void ColorPickerTool::selectedItemsChanged(const QList &/*itemList*/) -{ -} - -void ColorPickerTool::pickColor(const QPoint &pos) -{ - QRgb fillColor = view()->backgroundBrush().color().rgb(); - if (view()->backgroundBrush().style() == Qt::NoBrush) - fillColor = view()->palette().color(QPalette::Base).rgb(); - - QRectF target(0,0, 1, 1); - QRect source(pos.x(), pos.y(), 1, 1); - QImage img(1, 1, QImage::Format_ARGB32); - img.fill(fillColor); - QPainter painter(&img); - view()->render(&painter, target, source); - m_selectedColor = QColor::fromRgb(img.pixel(0, 0)); - - emit selectedColorChanged(m_selectedColor); -} - -} // namespace QmlJSDebugger - -#include "colorpickertool.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/colorpickertool.h b/qmldebugcontrol/qmljsdebugger/editor/colorpickertool.h deleted file mode 100644 index d176dde..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/colorpickertool.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef COLORPICKERTOOL_H -#define COLORPICKERTOOL_H - -#include "abstractliveedittool.h" - -#include - -QT_FORWARD_DECLARE_CLASS(QPoint) - -namespace QmlJSDebugger { - -class ColorPickerTool : public AbstractLiveEditTool -{ - Q_OBJECT -public: - explicit ColorPickerTool(QDeclarativeViewInspector *view); - - virtual ~ColorPickerTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - - void wheelEvent(QWheelEvent *event); - - void itemsAboutToRemoved(const QList &itemList); - - void clear(); - -signals: - void selectedColorChanged(const QColor &color); - -protected: - - void selectedItemsChanged(const QList &itemList); - -private: - void pickColor(const QPoint &pos); - -private: - QColor m_selectedColor; -}; - -} // namespace QmlJSDebugger - -#endif // COLORPICKERTOOL_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/editor.qrc b/qmldebugcontrol/qmljsdebugger/editor/editor.qrc deleted file mode 100644 index fb2393c..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/editor.qrc +++ /dev/null @@ -1,24 +0,0 @@ - - - images/resize_handle.png - images/select.png - images/select-marquee.png - images/color-picker.png - images/play.png - images/pause.png - images/from-qml.png - images/to-qml.png - images/color-picker-hicontrast.png - images/zoom.png - images/color-picker-24.png - images/from-qml-24.png - images/pause-24.png - images/play-24.png - images/to-qml-24.png - images/zoom-24.png - images/select-24.png - images/select-marquee-24.png - images/inspectormode.png - images/inspectormode-24.png - - diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/color-picker-24.png b/qmldebugcontrol/qmljsdebugger/editor/images/color-picker-24.png deleted file mode 100644 index cff47212a4f031c73791286788ed0a69c27618ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3440 zcwPZ;4Uh7PP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0007;NklBGK@LbGcrLL~=@{ibRxJ4UHxiGN}v#6^bujxskVE z!S?i2RwkEM@7%pNJ8A7YbeKNS5j$ZtadD7JWxZmtxQ$YwEbsiKmbr675=5z#iXGcB z$~|6Bj)!++&%P`$47`FMoGvK5RssP2UW8C?k<>BfOf0y3UDDmv+5fVsQCCw{iI^A- z>+wva1)Cg9AO(=jaoiofUZ14b>j6spv|8<&3EmCo*qCBhgjm%4=DjZ*!8ANGGc)OT z=ZXZK*-mU-N`>4rH1zdI`O{ioz!WK^(`^nsjpMl2lu|+|CF5>NN*>nL14z*>TPi0MdW;aiXb&wLSm6H5|!0?3# zR9RUEkD0sN-`*N2sjj2sWNvVHAi>;2R%ai`KV%t{ifn}UnLAocr4RNO0_X!U5zeC+ z@kb(zR?^r|^{UlS@#14oy%B&tT=;yIEC-+l-~-_J1r|a9`Kx5+|EC`;ehvV+--@ur SRy=F~0000KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0004_Nkl(i%?ubw`Aa%skt3B53J z#{d8SGcYnT;?u;Gb~_cVP60L-~WA`eUrbyVh@`OSQr=>#6zMJ{_}Ek-B`R} zp2oMYpT9FQGR{4F<<1doiZL`778WLymsg~-v$M1Q`Sbhi^QTW_UOap9?(CI2nARaB zBo+n+2I<1W!s_qezd!o_|NpZ?hYszPk(SoaN=;D4rtkm%|0o8CmXwr~fBpLX(dRG! zpRHeiU>`RRuPFlq0~fXcMmK;>OiaT1{Ka>7E?xcqZ2GJN`?$DpYsO{(-=wMATGwoN zex_eM@mUSoWku^GS_8lG>Ys%C1!z`!8Kz`(#kC~?6IfTaT_XukN*z`*biN)t2y eo{%U3fB^u9y3bY5;Ohba0000;Q#9Y diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/color-picker.png b/qmldebugcontrol/qmljsdebugger/editor/images/color-picker.png deleted file mode 100644 index 026c31b3e1ddaaf4697b077ac693f3ad576b7023..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3173 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 LNkvXXu0mjfG^Y4| diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/from-qml-24.png b/qmldebugcontrol/qmljsdebugger/editor/images/from-qml-24.png deleted file mode 100644 index 0ad21f3dbbf6e57d86351f2f472889e105186b61..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3395 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 Z0RXZUcA=cd4I2Oe002ovPDHLkV1k9EVg~>K diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/from-qml.png b/qmldebugcontrol/qmljsdebugger/editor/images/from-qml.png deleted file mode 100644 index 666382c06dde13aae6cf433729da5cb155cf095b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3205 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/inspectormode.png b/qmldebugcontrol/qmljsdebugger/editor/images/inspectormode.png deleted file mode 100644 index daed21c9448aa789ed398125fb4d46d8f4d6dda0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3539 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/play-24.png b/qmldebugcontrol/qmljsdebugger/editor/images/play-24.png deleted file mode 100644 index e2b9fbcf5126db709e54878dac3b1065e118c9c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3655 zcwPZV4!H4&P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000AWNklC4^6o${aKi}WXr_xSsN1?@}4T(x=hlq(ls7*{4Y)mw91;GeH zA||>r8WrurC7M_*8xu`;x-urRqKtM!qMd2oXbebbND7%UOxv0H{_Z`;g&P6|+ae3k z?%vIl_dVyH_aZaHgDe3LxYVr&M1-CD1`A55J=JpMY-x1&rsU0@`*m%=t^-4z;lue_ z-@rBofU{)j%ekMbKW-Lur$r2*<7qyA>PYs+2gk;Gws!w8JW~41WMe%qh-^d&B?OB3;43fKPtKe&&+IFW4?kZzM?^1g z1at?0fM6wCrlx6f%SIHLh;tnQ9ewAJdGq6=`-{EZ-wuzIJ~x@!u_=Hh;#yoY^|)@9 zlbd!mTd}LANiEx=-odT*o7A@v+p9}7!gg*m8;*ZHEn7w1()i7B}-}VowUWdX{ zp3qtdRE&ruGLfMTQW!k(gy|j)cmDSE<*$ZDhWC=C2_eP&Jps%NH&$-itJ$InREVJp zh3`1R^IR!4qS7E)6KW}i5>mLmf}Z`b-&~!pAG-AYwb$B>_)!2@x+?&fA!^3FnnYB~ z8bnO&DlG!vlR3|qf$Ph_b*1lk(p4H9rG%0SbK4yo^thBXvnK)I=esKafFw#GY9$aQ z5oc_vEhM*_2}fSSfg5w+`0RTL`>w+dY1NpCyc@qXT{8UET)8@PPm6#7Ohk~jGe{Bx zX_^86a4Hq0I)%0ygYU$U^IdSR_+DCphir>Z$L;tdKkv6nqr2f>01TWmQbuTFi&<)r zEU}RmGHE%93{ixRb1_%24f>9OzYs!P@bmt9R|NoB0>~ISW#oj=CWI!kNXsNUe(&t+ zob9TMhJ3qPt{fIZT-azHAR9n7jBFX%0Ahw%sC7Ov@aMqxa4DRup05m{z{&M&S+&+B zTSg{8Fo5}H-Y;G+7IdtqfMEh9&fo6y#uV^BeNeHK#Vf_GzJI}%SB}A);|CM002ovPDHLkV1o4I)3E>m diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/play.png b/qmldebugcontrol/qmljsdebugger/editor/images/play.png deleted file mode 100644 index 011598a746fda2fb68de10ee4233429e474b7908..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3363 zcwPY`4czjHP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0006`NkldY{XMMAU-jf7^V5Cz3Y4}_o~D5w^JZF;CH zH*MTS5DAG=iy+zwXj8jkukl@ndW)#o%=n`X%R`1rJmK0u0Ep-^7tBY*zPZU+wiO5m0ARo_whlG8yIXb+$2$|x5b?}r zK>~geb_Jt?n)@34{YM)PKEJ=v8i&LYG&sgB{$fJ|005;mNh(8KW5k@haY7!ubm(lT zwq}NqhP{$kwIRUs6qcl8JmZp2E;V)U(F0?>vh8?te|4m~L`Z|{t+fhpUDvpdXL5ed zl$3)WI)p(@htId^{#zI1zLtjT@y^5)BA)&eBz`wP@H3 z|NR3Y1h>f+p?Be0@uad|f1siHskwH}`S`zvR}BbhJerA|s!D~zP=*nu)ipa{rxRVt t&1Hdz#;O)Whz9Ri!dkEc_NLSLa{vkZO**>{+_L}x002ovPDHLkV1mT5KYjoJ diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/reload.png b/qmldebugcontrol/qmljsdebugger/editor/images/reload.png deleted file mode 100644 index 7042bec9ae9f1076acd08e9fa72fda4f51118cfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3418 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/resize_handle.png b/qmldebugcontrol/qmljsdebugger/editor/images/resize_handle.png deleted file mode 100644 index 2934f25b7436ea36065f0ef5c249db9e87b04906..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 160 zcwXxa@N?(olHy`uVBq!ia0vp^>>$j+1|*LJg08>v0|Y)Ngp@Y9X>dtiRFwdNdp35* x8LoHgG@eO!3hP`qS@5pkj3XemJwIZ&8Dd)GO4JMt?*R>D@O1TaS?83{1OO0JE(!nu diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/select-24.png b/qmldebugcontrol/qmljsdebugger/editor/images/select-24.png deleted file mode 100644 index 5388a9d16ab38432cb9ec8039e8005297ad71104..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3510 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/select-marquee-24.png b/qmldebugcontrol/qmljsdebugger/editor/images/select-marquee-24.png deleted file mode 100644 index 0111ddae458399551c52279e273334322bfeabf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 2891 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 VAr7tTgFyfQ002ovPDHLkV1hwwQC|Q6 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/select.png b/qmldebugcontrol/qmljsdebugger/editor/images/select.png deleted file mode 100644 index 672285582b5cc30d0cfe457a20c2982e1b056a99..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3308 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/to-qml.png b/qmldebugcontrol/qmljsdebugger/editor/images/to-qml.png deleted file mode 100644 index 2ab951fd082096b1b3838d4e2342d302ce23518d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3227 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/images/zoom.png b/qmldebugcontrol/qmljsdebugger/editor/images/zoom.png deleted file mode 100644 index 17f0da6d64f983dcf256801dd4113e6a075d9a59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 3347 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 diff --git a/qmldebugcontrol/qmljsdebugger/editor/livelayeritem.cpp b/qmldebugcontrol/qmljsdebugger/editor/livelayeritem.cpp deleted file mode 100644 index e154674..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/livelayeritem.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "livelayeritem.h" -#include "qmlinspectorconstants.h" - -#include - -namespace QmlJSDebugger { - -LiveLayerItem::LiveLayerItem(QGraphicsScene* scene) - : QGraphicsObject() -{ - scene->addItem(this); - setZValue(1); - setFlag(QGraphicsItem::ItemIsMovable, false); -} - -LiveLayerItem::~LiveLayerItem() -{ -} - -void LiveLayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, - QWidget * /*widget*/) -{ -} - -int LiveLayerItem::type() const -{ - return Constants::EditorItemType; -} - -QRectF LiveLayerItem::boundingRect() const -{ - return childrenBoundingRect(); -} - -QList LiveLayerItem::findAllChildItems() const -{ - return findAllChildItems(this); -} - -QList LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const -{ - QList itemList(item->childItems()); - - foreach (QGraphicsItem *childItem, item->childItems()) - itemList += findAllChildItems(childItem); - - return itemList; -} - -} // namespace QmlJSDebugger - -#include "livelayeritem.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/livelayeritem.h b/qmldebugcontrol/qmljsdebugger/editor/livelayeritem.h deleted file mode 100644 index f6d4866..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/livelayeritem.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef LIVELAYERITEM_H -#define LIVELAYERITEM_H - -#include - -namespace QmlJSDebugger { - -class LiveLayerItem : public QGraphicsObject -{ -Q_OBJECT -public: - LiveLayerItem(QGraphicsScene *scene); - ~LiveLayerItem(); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - QRectF boundingRect() const; - int type() const; - - QList findAllChildItems() const; - -protected: - QList findAllChildItems(const QGraphicsItem *item) const; -}; - -} - -#endif // LIVELAYERITEM_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp b/qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp deleted file mode 100644 index b7a8ade..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "liverubberbandselectionmanipulator.h" -#include "../qdeclarativeviewinspector_p.h" - -#include - -#include - -namespace QmlJSDebugger { - -LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewInspector *editorView) - : m_selectionRectangleElement(layerItem), - m_editorView(editorView), - m_beginFormEditorItem(0), - m_isActive(false) -{ - m_selectionRectangleElement.hide(); -} - -void LiveRubberBandSelectionManipulator::clear() -{ - m_selectionRectangleElement.clear(); - m_isActive = false; - m_beginPoint = QPointF(); - m_itemList.clear(); - m_oldSelectionList.clear(); -} - -QGraphicsItem *LiveRubberBandSelectionManipulator::topFormEditorItem(const QList - &itemList) -{ - if (itemList.isEmpty()) - return 0; - - return itemList.first(); -} - -void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint) -{ - m_beginPoint = beginPoint; - m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint); - m_selectionRectangleElement.show(); - m_isActive = true; - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(m_editorView); - m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint)); - m_oldSelectionList = m_editorView->selectedItems(); -} - -void LiveRubberBandSelectionManipulator::update(const QPointF &updatePoint) -{ - m_selectionRectangleElement.setRect(m_beginPoint, updatePoint); -} - -void LiveRubberBandSelectionManipulator::end() -{ - m_oldSelectionList.clear(); - m_selectionRectangleElement.hide(); - m_isActive = false; -} - -void LiveRubberBandSelectionManipulator::select(SelectionType selectionType) -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(m_editorView); - QList itemList - = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(), - Qt::IntersectsItemShape); - QList newSelectionList; - - foreach (QGraphicsItem* item, itemList) { - if (item - && item->parentItem() - && !newSelectionList.contains(item) - //&& m_beginFormEditorItem->childItems().contains(item) // TODO activate this test - ) - { - newSelectionList.append(item); - } - } - - if (newSelectionList.isEmpty() && m_beginFormEditorItem) - newSelectionList.append(m_beginFormEditorItem); - - QList resultList; - - switch(selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - resultList.append(newSelectionList); - } - break; - case ReplaceSelection: { - resultList.append(newSelectionList); - } - break; - case RemoveFromSelection: { - QSet oldSelectionSet(m_oldSelectionList.toSet()); - QSet newSelectionSet(newSelectionList.toSet()); - resultList.append(oldSelectionSet.subtract(newSelectionSet).toList()); - } - } - - m_editorView->setSelectedItems(resultList); -} - - -void LiveRubberBandSelectionManipulator::setItems(const QList &itemList) -{ - m_itemList = itemList; -} - -QPointF LiveRubberBandSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -bool LiveRubberBandSelectionManipulator::isActive() const -{ - return m_isActive; -} - -} // namespace QmlJSDebugger diff --git a/qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.h b/qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.h deleted file mode 100644 index 052284a..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liverubberbandselectionmanipulator.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef RUBBERBANDSELECTIONMANIPULATOR_H -#define RUBBERBANDSELECTIONMANIPULATOR_H - - -#include "liveselectionrectangle.h" - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class LiveRubberBandSelectionManipulator -{ -public: - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection - }; - - LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewInspector *editorView); - - void setItems(const QList &itemList); - - void begin(const QPointF& beginPoint); - void update(const QPointF& updatePoint); - void end(); - - void clear(); - - void select(SelectionType selectionType); - - QPointF beginPoint() const; - - bool isActive() const; - -protected: - QGraphicsItem *topFormEditorItem(const QList &itemList); - -private: - QList m_itemList; - QList m_oldSelectionList; - LiveSelectionRectangle m_selectionRectangleElement; - QPointF m_beginPoint; - QDeclarativeViewInspector *m_editorView; - QGraphicsItem *m_beginFormEditorItem; - bool m_isActive; -}; - -} - -#endif // RUBBERBANDSELECTIONMANIPULATOR_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.cpp b/qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.cpp deleted file mode 100644 index 00031f8..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "liveselectionindicator.h" -#include "../qdeclarativeviewinspector_p.h" -#include "qmlinspectorconstants.h" - -#include -#include -#include -#include - -namespace QmlJSDebugger { - -LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, - QGraphicsObject *layerItem) - : m_layerItem(layerItem) - , m_view(viewInspector) -{ -} - -LiveSelectionIndicator::~LiveSelectionIndicator() -{ - clear(); -} - -void LiveSelectionIndicator::show() -{ - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) - item->show(); -} - -void LiveSelectionIndicator::hide() -{ - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) - item->hide(); -} - -void LiveSelectionIndicator::clear() -{ - if (!m_layerItem.isNull()) { - QGraphicsScene *scene = m_layerItem.data()->scene(); - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) { - scene->removeItem(item); - delete item; - } - } - - m_indicatorShapeHash.clear(); - -} - -void LiveSelectionIndicator::setItems(const QList > &itemList) -{ - clear(); - - foreach (const QWeakPointer &object, itemList) { - if (object.isNull()) - continue; - - QGraphicsItem *item = object.data(); - - if (!m_indicatorShapeHash.contains(item)) { - QGraphicsRectItem *selectionIndicator = new QGraphicsRectItem(m_layerItem.data()); - m_indicatorShapeHash.insert(item, selectionIndicator); - - const QRectF boundingRect = m_view->adjustToScreenBoundaries(item->mapRectToScene(item->boundingRect())); - const QRectF boundingRectInLayerItemSpace = m_layerItem.data()->mapRectFromScene(boundingRect); - - selectionIndicator->setData(Constants::EditorItemDataKey, true); - selectionIndicator->setFlag(QGraphicsItem::ItemIsSelectable, false); - selectionIndicator->setRect(boundingRectInLayerItemSpace); - selectionIndicator->setPen(QColor(108, 141, 221)); - } - } -} - -} //namespace QmlJSDebugger diff --git a/qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.h b/qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.h deleted file mode 100644 index 78df3cf..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liveselectionindicator.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef LIVESELECTIONINDICATOR_H -#define LIVESELECTIONINDICATOR_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QGraphicsObject; -class QGraphicsRectItem; -class QGraphicsItem; -class QPolygonF; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class LiveSelectionIndicator -{ -public: - LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem); - ~LiveSelectionIndicator(); - - void show(); - void hide(); - - void clear(); - - void setItems(const QList > &itemList); - -private: - QHash m_indicatorShapeHash; - QWeakPointer m_layerItem; - QDeclarativeViewInspector *m_view; -}; - -} - -#endif // LIVESELECTIONINDICATOR_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.cpp b/qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.cpp deleted file mode 100644 index 86b9507..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "liveselectionrectangle.h" -#include "qmlinspectorconstants.h" - -#include -#include -#include -#include - -#include - -#include - -namespace QmlJSDebugger { - -class SelectionRectShape : public QGraphicsRectItem -{ -public: - SelectionRectShape(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {} - int type() const { return Constants::EditorItemType; } -}; - -LiveSelectionRectangle::LiveSelectionRectangle(QGraphicsObject *layerItem) - : m_controlShape(new SelectionRectShape(layerItem)), - m_layerItem(layerItem) -{ - m_controlShape->setPen(QPen(Qt::black)); - m_controlShape->setBrush(QColor(128, 128, 128, 50)); -} - -LiveSelectionRectangle::~LiveSelectionRectangle() -{ - if (m_layerItem) - m_layerItem.data()->scene()->removeItem(m_controlShape); -} - -void LiveSelectionRectangle::clear() -{ - hide(); -} -void LiveSelectionRectangle::show() -{ - m_controlShape->show(); -} - -void LiveSelectionRectangle::hide() -{ - m_controlShape->hide(); -} - -QRectF LiveSelectionRectangle::rect() const -{ - return m_controlShape->mapFromScene(m_controlShape->rect()).boundingRect(); -} - -void LiveSelectionRectangle::setRect(const QPointF &firstPoint, - const QPointF &secondPoint) -{ - double firstX = std::floor(firstPoint.x()) + 0.5; - double firstY = std::floor(firstPoint.y()) + 0.5; - double secondX = std::floor(secondPoint.x()) + 0.5; - double secondY = std::floor(secondPoint.y()) + 0.5; - QPointF topLeftPoint(firstX < secondX ? firstX : secondX, - firstY < secondY ? firstY : secondY); - QPointF bottomRightPoint(firstX > secondX ? firstX : secondX, - firstY > secondY ? firstY : secondY); - - QRectF rect(topLeftPoint, bottomRightPoint); - m_controlShape->setRect(rect); -} - -} - diff --git a/qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.h b/qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.h deleted file mode 100644 index 1b179e6..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liveselectionrectangle.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef LIVESELECTIONRECTANGLE_H -#define LIVESELECTIONRECTANGLE_H - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem) -QT_FORWARD_DECLARE_CLASS(QPointF) -QT_FORWARD_DECLARE_CLASS(QRectF) - -namespace QmlJSDebugger { - -class LiveSelectionRectangle -{ -public: - LiveSelectionRectangle(QGraphicsObject *layerItem); - ~LiveSelectionRectangle(); - - void show(); - void hide(); - - void clear(); - - void setRect(const QPointF &firstPoint, - const QPointF &secondPoint); - - QRectF rect() const; - -private: - QGraphicsRectItem *m_controlShape; - QWeakPointer m_layerItem; -}; - -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONRECTANGLE_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.cpp b/qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.cpp deleted file mode 100644 index 4fcfd87..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.cpp +++ /dev/null @@ -1,431 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "liveselectiontool.h" -#include "livelayeritem.h" - -#include "../qdeclarativeviewinspector_p.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -namespace QmlJSDebugger { - -LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) : - AbstractLiveEditTool(editorView), - m_rubberbandSelectionMode(false), - m_rubberbandSelectionManipulator( - QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView), - m_singleSelectionManipulator(editorView), - m_selectionIndicator(editorView, - QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer), - //m_resizeIndicator(editorView->manipulatorLayer()), - m_selectOnlyContentItems(true) -{ - -} - -LiveSelectionTool::~LiveSelectionTool() -{ -} - -void LiveSelectionTool::setRubberbandSelectionMode(bool value) -{ - m_rubberbandSelectionMode = value; -} - -LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionType(Qt::KeyboardModifiers - modifiers) -{ - LiveSingleSelectionManipulator::SelectionType selectionType - = LiveSingleSelectionManipulator::ReplaceSelection; - if (modifiers.testFlag(Qt::ControlModifier)) { - selectionType = LiveSingleSelectionManipulator::RemoveFromSelection; - } else if (modifiers.testFlag(Qt::ShiftModifier)) { - selectionType = LiveSingleSelectionManipulator::AddToSelection; - } - return selectionType; -} - -bool LiveSelectionTool::alreadySelected(const QList &itemList) const -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - const QList selectedItems = inspectorPrivate->selectedItems(); - - if (selectedItems.isEmpty()) - return false; - - foreach (QGraphicsItem *item, itemList) - if (selectedItems.contains(item)) - return true; - - return false; -} - -void LiveSelectionTool::mousePressEvent(QMouseEvent *event) -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - QList itemList = inspectorPrivate->selectableItems(event->pos()); - LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers()); - - if (event->buttons() & Qt::LeftButton) { - m_mousePressTimer.start(); - - if (m_rubberbandSelectionMode) { - m_rubberbandSelectionManipulator.begin(event->pos()); - } else { - m_singleSelectionManipulator.begin(event->pos()); - m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems); - } - } else if (event->buttons() & Qt::RightButton) { - createContextMenu(itemList, event->globalPos()); - } -} - -void LiveSelectionTool::createContextMenu(QList itemList, QPoint globalPos) -{ - QMenu contextMenu; - connect(&contextMenu, SIGNAL(hovered(QAction*)), - this, SLOT(contextMenuElementHovered(QAction*))); - - m_contextMenuItemList = itemList; - - contextMenu.addAction("Items"); - contextMenu.addSeparator(); - int shortcutKey = Qt::Key_1; - bool addKeySequence = true; - int i = 0; - - foreach (QGraphicsItem * const item, itemList) { - QString itemTitle = titleForItem(item); - QAction *elementAction = contextMenu.addAction(itemTitle, this, - SLOT(contextMenuElementSelected())); - - if (inspector()->selectedItems().contains(item)) { - QFont boldFont = elementAction->font(); - boldFont.setBold(true); - elementAction->setFont(boldFont); - } - - elementAction->setData(i); - if (addKeySequence) - elementAction->setShortcut(QKeySequence(shortcutKey)); - - shortcutKey++; - if (shortcutKey > Qt::Key_9) - addKeySequence = false; - - ++i; - } - // add root item separately - // QString itemTitle = QString(tr("%1")).arg(titleForItem(view()->currentRootItem())); - // contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected())); - // m_contextMenuItemList.append(view()->currentRootItem()); - - contextMenu.exec(globalPos); - m_contextMenuItemList.clear(); -} - -void LiveSelectionTool::contextMenuElementSelected() -{ - QAction *senderAction = static_cast(sender()); - int itemListIndex = senderAction->data().toInt(); - if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { - - QPointF updatePt(0, 0); - QGraphicsItem *item = m_contextMenuItemList.at(itemListIndex); - m_singleSelectionManipulator.begin(updatePt); - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - QList() << item, - false); - m_singleSelectionManipulator.end(updatePt); - } -} - -void LiveSelectionTool::contextMenuElementHovered(QAction *action) -{ - int itemListIndex = action->data().toInt(); - if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { - QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject(); - QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); - } -} - -void LiveSelectionTool::mouseMoveEvent(QMouseEvent *event) -{ - if (m_singleSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->pos(); - - if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) - && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) - { - m_singleSelectionManipulator.end(event->pos()); - //view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint()); - return; - } - } else if (m_rubberbandSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); - - if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) - && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) { - m_rubberbandSelectionManipulator.update(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::RemoveFromSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::AddToSelection); - else - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::ReplaceSelection); - } - } -} - -void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event) -{ -// ### commented out until move tool is re-enabled -// QList itemList = view()->items(event->pos()); -// if (!itemList.isEmpty() && !m_rubberbandSelectionMode) { -// -// foreach (QGraphicsItem *item, itemList) { -// if (item->type() == Constants::ResizeHandleItemType) { -// ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(item); -// if (resizeHandle) -// view()->changeTool(Constants::ResizeToolMode); -// return; -// } -// } -// if (topSelectedItemIsMovable(itemList)) -// view()->changeTool(Constants::MoveToolMode); -// } - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - - QList selectableItemList = inspectorPrivate->selectableItems(event->pos()); - if (!selectableItemList.isEmpty()) { - QGraphicsObject *item = selectableItemList.first()->toGraphicsObject(); - if (item) - QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); - - return; - } - - QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight(); -} - -void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) -{ - if (m_singleSelectionManipulator.isActive()) { - m_singleSelectionManipulator.end(event->pos()); - } - else if (m_rubberbandSelectionManipulator.isActive()) { - - QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); - if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) { - m_singleSelectionManipulator.begin(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, - m_selectOnlyContentItems); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, - m_selectOnlyContentItems); - else - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - m_selectOnlyContentItems); - - m_singleSelectionManipulator.end(event->pos()); - } else { - m_rubberbandSelectionManipulator.update(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::RemoveFromSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::AddToSelection); - else - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::ReplaceSelection); - - m_rubberbandSelectionManipulator.end(); - } - } -} - -void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ -} - -void LiveSelectionTool::keyPressEvent(QKeyEvent *event) -{ - switch(event->key()) { - case Qt::Key_Left: - case Qt::Key_Right: - case Qt::Key_Up: - case Qt::Key_Down: - // disabled for now, cannot move stuff yet. - //view()->changeTool(Constants::MoveToolMode); - //view()->currentTool()->keyPressEvent(event); - break; - } -} - -void LiveSelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ - -} - -void LiveSelectionTool::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode) - return; - - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - QList itemList = inspectorPrivate->selectableItems(event->pos()); - - if (itemList.isEmpty()) - return; - - int selectedIdx = 0; - if (!inspector()->selectedItems().isEmpty()) { - selectedIdx = itemList.indexOf(inspector()->selectedItems().first()); - if (selectedIdx >= 0) { - if (event->delta() > 0) { - selectedIdx++; - if (selectedIdx == itemList.length()) - selectedIdx = 0; - } else if (event->delta() < 0) { - selectedIdx--; - if (selectedIdx == -1) - selectedIdx = itemList.length() - 1; - } - } else { - selectedIdx = 0; - } - } - - QPointF updatePt(0, 0); - m_singleSelectionManipulator.begin(updatePt); - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::ReplaceSelection, - QList() << itemList.at(selectedIdx), - false); - m_singleSelectionManipulator.end(updatePt); - -} - -void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems) -{ - m_selectOnlyContentItems = selectOnlyContentItems; -} - -void LiveSelectionTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ -} - -void LiveSelectionTool::clear() -{ - view()->setCursor(Qt::ArrowCursor); - m_rubberbandSelectionManipulator.clear(), - m_singleSelectionManipulator.clear(); - m_selectionIndicator.clear(); - //m_resizeIndicator.clear(); -} - -void LiveSelectionTool::selectedItemsChanged(const QList &itemList) -{ - foreach (const QWeakPointer &obj, m_selectedItemList) { - if (!obj.isNull()) { - disconnect(obj.data(), SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); - } - } - - QList objects = toGraphicsObjectList(itemList); - m_selectedItemList.clear(); - - foreach (QGraphicsObject *obj, objects) { - m_selectedItemList.append(obj); - connect(obj, SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); - } - - m_selectionIndicator.setItems(m_selectedItemList); - //m_resizeIndicator.setItems(toGraphicsObjectList(itemList)); -} - -void LiveSelectionTool::repaintBoundingRects() -{ - m_selectionIndicator.setItems(m_selectedItemList); -} - -void LiveSelectionTool::selectUnderPoint(QMouseEvent *event) -{ - m_singleSelectionManipulator.begin(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, - m_selectOnlyContentItems); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, - m_selectOnlyContentItems); - else - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - m_selectOnlyContentItems); - - m_singleSelectionManipulator.end(event->pos()); -} - -} // namespace QmlJSDebugger - -#include "liveselectiontool.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.h b/qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.h deleted file mode 100644 index 4f843e4..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/liveselectiontool.h +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef LIVESELECTIONTOOL_H -#define LIVESELECTIONTOOL_H - - -#include "abstractliveedittool.h" -#include "liverubberbandselectionmanipulator.h" -#include "livesingleselectionmanipulator.h" -#include "liveselectionindicator.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QKeyEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class LiveSelectionTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - LiveSelectionTool(QDeclarativeViewInspector* editorView); - ~LiveSelectionTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void hoverMoveEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void wheelEvent(QWheelEvent *event); - - void itemsAboutToRemoved(const QList &itemList); -// QVariant itemChange(const QList &itemList, -// QGraphicsItem::GraphicsItemChange change, -// const QVariant &value ); - -// void update(); - - void clear(); - - void selectedItemsChanged(const QList &itemList); - - void selectUnderPoint(QMouseEvent *event); - - void setSelectOnlyContentItems(bool selectOnlyContentItems); - - void setRubberbandSelectionMode(bool value); - -private slots: - void contextMenuElementSelected(); - void contextMenuElementHovered(QAction *action); - void repaintBoundingRects(); - -private: - void createContextMenu(QList itemList, QPoint globalPos); - LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers); - bool alreadySelected(const QList &itemList) const; - -private: - bool m_rubberbandSelectionMode; - LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator; - LiveSingleSelectionManipulator m_singleSelectionManipulator; - LiveSelectionIndicator m_selectionIndicator; - //ResizeIndicator m_resizeIndicator; - QTime m_mousePressTimer; - bool m_selectOnlyContentItems; - - QList > m_selectedItemList; - - QList m_contextMenuItemList; -}; - -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONTOOL_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.cpp b/qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.cpp deleted file mode 100644 index bdf8abc..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "livesingleselectionmanipulator.h" -#include "qdeclarativeviewinspector.h" -#include "../qdeclarativeviewinspector_p.h" -#include - -namespace QmlJSDebugger { - -LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView) - : m_editorView(editorView), - m_isActive(false) -{ -} - - -void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint) -{ - m_beginPoint = beginPoint; - m_isActive = true; - m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems(); -} - -void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/) -{ - m_oldSelectionList.clear(); -} - -void LiveSingleSelectionManipulator::clear() -{ - m_beginPoint = QPointF(); - m_oldSelectionList.clear(); -} - - -void LiveSingleSelectionManipulator::end(const QPointF &/*updatePoint*/) -{ - m_oldSelectionList.clear(); - m_isActive = false; -} - -void LiveSingleSelectionManipulator::select(SelectionType selectionType, - const QList &items, - bool /*selectOnlyContentItems*/) -{ - QGraphicsItem *selectedItem = 0; - - foreach (QGraphicsItem* item, items) - { - //FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item); - if (item - /*&& !formEditorItem->qmlItemNode().isRootNode() - && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)*/) - { - selectedItem = item; - break; - } - } - - QList resultList; - - switch(selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - if (selectedItem && !m_oldSelectionList.contains(selectedItem)) - resultList.append(selectedItem); - } - break; - case ReplaceSelection: { - if (selectedItem) - resultList.append(selectedItem); - } - break; - case RemoveFromSelection: { - resultList.append(m_oldSelectionList); - if (selectedItem) - resultList.removeAll(selectedItem); - } - break; - case InvertSelection: { - if (selectedItem - && !m_oldSelectionList.contains(selectedItem)) - { - resultList.append(selectedItem); - } - } - } - - m_editorView->setSelectedItems(resultList); -} - -void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems) -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate = - QDeclarativeViewInspectorPrivate::get(m_editorView); - QList itemList = inspectorPrivate->selectableItems(m_beginPoint); - select(selectionType, itemList, selectOnlyContentItems); -} - - -bool LiveSingleSelectionManipulator::isActive() const -{ - return m_isActive; -} - -QPointF LiveSingleSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -} // namespace QmlJSDebugger diff --git a/qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.h b/qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.h deleted file mode 100644 index 995a78d..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/livesingleselectionmanipulator.h +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef LIVESINGLESELECTIONMANIPULATOR_H -#define LIVESINGLESELECTIONMANIPULATOR_H - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class LiveSingleSelectionManipulator -{ -public: - LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView); - - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection, - InvertSelection - }; - - void begin(const QPointF& beginPoint); - void update(const QPointF& updatePoint); - void end(const QPointF& updatePoint); - - void select(SelectionType selectionType, const QList &items, - bool selectOnlyContentItems); - void select(SelectionType selectionType, bool selectOnlyContentItems); - - void clear(); - - QPointF beginPoint() const; - - bool isActive() const; - -private: - QList m_oldSelectionList; - QPointF m_beginPoint; - QDeclarativeViewInspector *m_editorView; - bool m_isActive; -}; - -} // namespace QmlJSDebugger - -#endif // LIVESINGLESELECTIONMANIPULATOR_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.cpp b/qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.cpp deleted file mode 100644 index d79f1c1..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "qmltoolbar.h" -#include "toolbarcolorbox.h" - -#include -#include -#include -#include - -#include - -namespace QmlJSDebugger { - -QmlToolBar::QmlToolBar(QWidget *parent) - : QToolBar(parent) - , m_emitSignals(true) - , m_paused(false) - , m_animationSpeed(1.0f) - , ui(new Ui) -{ - ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); - ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); - - ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")), - tr("Inspector Mode"), this); - ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); - ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); - ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), - tr("Select (Marquee)"), this); - ui->zoom = new QAction(QIcon(QLatin1String(":/qml/images/zoom-24.png")), tr("Zoom"), this); - ui->colorPicker = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-24.png")), - tr("Color Picker"), this); - ui->toQml = new QAction(QIcon(QLatin1String(":/qml/images/to-qml-24.png")), - tr("Apply Changes to QML Viewer"), this); - ui->fromQml = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-24.png")), - tr("Apply Changes to Document"), this); - ui->designmode->setCheckable(true); - ui->designmode->setChecked(false); - - ui->play->setCheckable(false); - ui->select->setCheckable(true); - ui->selectMarquee->setCheckable(true); - ui->zoom->setCheckable(true); - ui->colorPicker->setCheckable(true); - - setWindowTitle(tr("Tools")); - - addAction(ui->designmode); - addAction(ui->play); - addSeparator(); - - addAction(ui->select); - // disabled because multi selection does not do anything useful without design mode - //addAction(ui->selectMarquee); - addSeparator(); - addAction(ui->zoom); - addAction(ui->colorPicker); - //addAction(ui->fromQml); - - ui->colorBox = new ToolBarColorBox(this); - ui->colorBox->setMinimumSize(24, 24); - ui->colorBox->setMaximumSize(28, 28); - ui->colorBox->setColor(Qt::black); - addWidget(ui->colorBox); - - setWindowFlags(Qt::Tool); - - QMenu *playSpeedMenu = new QMenu(this); - ui->playSpeedMenuActions = new QActionGroup(this); - ui->playSpeedMenuActions->setExclusive(true); - - QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setChecked(true); - speedAction->setData(1.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(2.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(4.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(8.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(10.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - ui->play->setMenu(playSpeedMenu); - - connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool))); - - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - - connect(ui->play, SIGNAL(triggered()), SLOT(activatePlayOnClick())); - - connect(ui->zoom, SIGNAL(triggered()), SLOT(activateZoomOnClick())); - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - connect(ui->select, SIGNAL(triggered()), SLOT(activateSelectToolOnClick())); - connect(ui->selectMarquee, SIGNAL(triggered()), SLOT(activateMarqueeSelectToolOnClick())); - - connect(ui->toQml, SIGNAL(triggered()), SLOT(activateToQml())); - connect(ui->fromQml, SIGNAL(triggered()), SLOT(activateFromQml())); -} - -QmlToolBar::~QmlToolBar() -{ - delete ui; -} - -void QmlToolBar::activateColorPicker() -{ - m_emitSignals = false; - activateColorPickerOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateSelectTool() -{ - m_emitSignals = false; - activateSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateMarqueeSelectTool() -{ - m_emitSignals = false; - activateMarqueeSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateZoom() -{ - m_emitSignals = false; - activateZoomOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::setAnimationSpeed(qreal slowDownFactor) -{ - if (m_animationSpeed == slowDownFactor) - return; - - m_emitSignals = false; - m_animationSpeed = slowDownFactor; - - foreach (QAction *action, ui->playSpeedMenuActions->actions()) { - if (action->data().toReal() == slowDownFactor) { - action->setChecked(true); - break; - } - } - - m_emitSignals = true; -} - -void QmlToolBar::setAnimationPaused(bool paused) -{ - if (m_paused == paused) - return; - - m_paused = paused; - updatePlayAction(); -} - -void QmlToolBar::changeAnimationSpeed() -{ - QAction *action = qobject_cast(sender()); - m_animationSpeed = action->data().toReal(); - emit animationSpeedChanged(m_animationSpeed); -} - -void QmlToolBar::setDesignModeBehavior(bool inDesignMode) -{ - m_emitSignals = false; - ui->designmode->setChecked(inDesignMode); - setDesignModeBehaviorOnClick(inDesignMode); - m_emitSignals = true; -} - -void QmlToolBar::setDesignModeBehaviorOnClick(bool checked) -{ - ui->select->setEnabled(checked); - ui->selectMarquee->setEnabled(checked); - ui->zoom->setEnabled(checked); - ui->colorPicker->setEnabled(checked); - ui->toQml->setEnabled(checked); - ui->fromQml->setEnabled(checked); - - if (m_emitSignals) - emit designModeBehaviorChanged(checked); -} - -void QmlToolBar::setColorBoxColor(const QColor &color) -{ - ui->colorBox->setColor(color); -} - -void QmlToolBar::activatePlayOnClick() -{ - m_paused = !m_paused; - emit animationPausedChanged(m_paused); - updatePlayAction(); -} - -void QmlToolBar::updatePlayAction() -{ - ui->play->setIcon(m_paused ? ui->playIcon : ui->pauseIcon); -} - -void QmlToolBar::activateColorPickerOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - - ui->colorPicker->setChecked(true); - if (m_activeTool != Constants::ColorPickerMode) { - m_activeTool = Constants::ColorPickerMode; - if (m_emitSignals) - emit colorPickerSelected(); - } -} - -void QmlToolBar::activateSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->select->setChecked(true); - if (m_activeTool != Constants::SelectionToolMode) { - m_activeTool = Constants::SelectionToolMode; - if (m_emitSignals) - emit selectToolSelected(); - } -} - -void QmlToolBar::activateMarqueeSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->selectMarquee->setChecked(true); - if (m_activeTool != Constants::MarqueeSelectionToolMode) { - m_activeTool = Constants::MarqueeSelectionToolMode; - if (m_emitSignals) - emit marqueeSelectToolSelected(); - } -} - -void QmlToolBar::activateZoomOnClick() -{ - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->zoom->setChecked(true); - if (m_activeTool != Constants::ZoomMode) { - m_activeTool = Constants::ZoomMode; - if (m_emitSignals) - emit zoomToolSelected(); - } -} - -void QmlToolBar::activateFromQml() -{ - if (m_emitSignals) - emit applyChangesFromQmlFileSelected(); -} - -void QmlToolBar::activateToQml() -{ - if (m_emitSignals) - emit applyChangesToQmlFileSelected(); -} - -} // namespace QmlJSDebugger - -#include "qmltoolbar.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.h b/qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.h deleted file mode 100644 index b1bf62f..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/qmltoolbar.h +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QMLTOOLBAR_H -#define QMLTOOLBAR_H - -#include -#include - -#include "qmlinspectorconstants.h" - -QT_FORWARD_DECLARE_CLASS(QActionGroup) - -namespace QmlJSDebugger { - -class ToolBarColorBox; - -class QmlToolBar : public QToolBar -{ - Q_OBJECT - -public: - explicit QmlToolBar(QWidget *parent = 0); - ~QmlToolBar(); - -public slots: - void setDesignModeBehavior(bool inDesignMode); - void setColorBoxColor(const QColor &color); - void activateColorPicker(); - void activateSelectTool(); - void activateMarqueeSelectTool(); - void activateZoom(); - - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - -signals: - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - - void designModeBehaviorChanged(bool inDesignMode); - void colorPickerSelected(); - void selectToolSelected(); - void marqueeSelectToolSelected(); - void zoomToolSelected(); - - void applyChangesToQmlFileSelected(); - void applyChangesFromQmlFileSelected(); - -private slots: - void setDesignModeBehaviorOnClick(bool inDesignMode); - void activatePlayOnClick(); - void activateColorPickerOnClick(); - void activateSelectToolOnClick(); - void activateMarqueeSelectToolOnClick(); - void activateZoomOnClick(); - - void activateFromQml(); - void activateToQml(); - - void changeAnimationSpeed(); - - void updatePlayAction(); - -private: - class Ui { - public: - QAction *designmode; - QAction *play; - QAction *select; - QAction *selectMarquee; - QAction *zoom; - QAction *colorPicker; - QAction *toQml; - QAction *fromQml; - QIcon playIcon; - QIcon pauseIcon; - ToolBarColorBox *colorBox; - - QActionGroup *playSpeedMenuActions; - }; - - bool m_emitSignals; - bool m_paused; - qreal m_animationSpeed; - - Constants::DesignTool m_activeTool; - - Ui *ui; -}; - -} - -#endif // QMLTOOLBAR_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.cpp b/qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.cpp deleted file mode 100644 index 12197f1..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "subcomponentmasklayeritem.h" -#include "qmlinspectorconstants.h" -#include "qdeclarativeviewinspector.h" -#include - -namespace QmlJSDebugger { - -SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, - QGraphicsItem *parentItem) : - QGraphicsPolygonItem(parentItem), - m_inspector(inspector), - m_currentItem(0), - m_borderRect(new QGraphicsRectItem(this)) -{ - m_borderRect->setRect(0,0,0,0); - m_borderRect->setPen(QPen(QColor(60, 60, 60), 1)); - m_borderRect->setData(Constants::EditorItemDataKey, QVariant(true)); - - setBrush(QBrush(QColor(160,160,160))); - setPen(Qt::NoPen); -} - -int SubcomponentMaskLayerItem::type() const -{ - return Constants::EditorItemType; -} - -static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect) -{ - QRectF result = newRect; - if (oldRect.left() < newRect.left()) - result.setLeft(oldRect.left()); - - if (oldRect.top() < newRect.top()) - result.setTop(oldRect.top()); - - if (oldRect.right() > newRect.right()) - result.setRight(oldRect.right()); - - if (oldRect.bottom() > newRect.bottom()) - result.setBottom(oldRect.bottom()); - - return result; -} - -static QPolygonF regionToPolygon(const QRegion ®ion) -{ - QPainterPath path; - foreach (const QRect &rect, region.rects()) - path.addRect(rect); - return path.toFillPolygon(); -} - -void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) -{ - QGraphicsItem *prevItem = m_currentItem; - m_currentItem = item; - - if (!m_currentItem) - return; - - QRect viewRect = m_inspector->declarativeView()->rect(); - viewRect = m_inspector->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); - - QRectF itemRect = item->boundingRect() | item->childrenBoundingRect(); - itemRect = item->mapRectToScene(itemRect); - - // if updating the same item as before, resize the rectangle only bigger, not smaller. - if (prevItem == item && prevItem != 0) { - m_itemPolyRect = resizeRect(itemRect, m_itemPolyRect); - } else { - m_itemPolyRect = itemRect; - } - QRectF borderRect = m_itemPolyRect; - borderRect.adjust(-1, -1, 1, 1); - m_borderRect->setRect(borderRect); - - const QRegion externalRegion = QRegion(viewRect).subtracted(m_itemPolyRect.toRect()); - setPolygon(regionToPolygon(externalRegion)); -} - -QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const -{ - return m_currentItem; -} - -} // namespace QmlJSDebugger - diff --git a/qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.h b/qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.h deleted file mode 100644 index 02c56a3..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/subcomponentmasklayeritem.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef SUBCOMPONENTMASKLAYERITEM_H -#define SUBCOMPONENTMASKLAYERITEM_H - -#include - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class SubcomponentMaskLayerItem : public QGraphicsPolygonItem -{ -public: - explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, - QGraphicsItem *parentItem = 0); - int type() const; - void setCurrentItem(QGraphicsItem *item); - void setBoundingBox(const QRectF &boundingBox); - QGraphicsItem *currentItem() const; - QRectF itemRect() const; - -private: - QDeclarativeViewInspector *m_inspector; - QGraphicsItem *m_currentItem; - QGraphicsRectItem *m_borderRect; - QRectF m_itemPolyRect; -}; - -} // namespace QmlJSDebugger - -#endif // SUBCOMPONENTMASKLAYERITEM_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.cpp b/qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.cpp deleted file mode 100644 index 2f589fb..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "toolbarcolorbox.h" -#include "qmlinspectorconstants.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace QmlJSDebugger { - -ToolBarColorBox::ToolBarColorBox(QWidget *parent) : - QLabel(parent) -{ - m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")), - tr("Copy Color"), this); - connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); - setScaledContents(false); -} - -void ToolBarColorBox::setColor(const QColor &color) -{ - m_color = color; - - QPixmap pix = createDragPixmap(width()); - setPixmap(pix); - update(); -} - -void ToolBarColorBox::mousePressEvent(QMouseEvent *event) -{ - m_dragBeginPoint = event->pos(); - m_dragStarted = false; -} - -void ToolBarColorBox::mouseMoveEvent(QMouseEvent *event) -{ - - if (event->buttons() & Qt::LeftButton - && (QPoint(event->pos() - m_dragBeginPoint).manhattanLength() - > Constants::DragStartDistance) - && !m_dragStarted) - { - m_dragStarted = true; - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - - mimeData->setText(m_color.name()); - drag->setMimeData(mimeData); - drag->setPixmap(createDragPixmap()); - - drag->exec(); - } -} - -QPixmap ToolBarColorBox::createDragPixmap(int size) const -{ - QPixmap pix(size, size); - QPainter p(&pix); - - QColor borderColor1 = QColor(143, 143 ,143); - QColor borderColor2 = QColor(43, 43, 43); - - p.setBrush(QBrush(m_color)); - p.setPen(QPen(QBrush(borderColor2),1)); - - p.fillRect(0, 0, size, size, borderColor1); - p.drawRect(1,1, size - 3, size - 3); - return pix; -} - -void ToolBarColorBox::contextMenuEvent(QContextMenuEvent *ev) -{ - QMenu contextMenu; - contextMenu.addAction(m_copyHexColor); - contextMenu.exec(ev->globalPos()); -} - -void ToolBarColorBox::copyColorToClipboard() -{ - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(m_color.name()); -} - -} // namespace QmlJSDebugger - -#include "toolbarcolorbox.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.h b/qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.h deleted file mode 100644 index 26029bb..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/toolbarcolorbox.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef TOOLBARCOLORBOX_H -#define TOOLBARCOLORBOX_H - -#include -#include -#include - -QT_FORWARD_DECLARE_CLASS(QContextMenuEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class ToolBarColorBox : public QLabel -{ - Q_OBJECT -public: - explicit ToolBarColorBox(QWidget *parent = 0); - void setColor(const QColor &color); - -protected: - void contextMenuEvent(QContextMenuEvent *ev); - void mousePressEvent(QMouseEvent *ev); - void mouseMoveEvent(QMouseEvent *ev); -private slots: - void copyColorToClipboard(); - -private: - QPixmap createDragPixmap(int size = 24) const; - -private: - bool m_dragStarted; - QPoint m_dragBeginPoint; - QAction *m_copyHexColor; - QColor m_color; -}; - -} // namespace QmlJSDebugger - -#endif // TOOLBARCOLORBOX_H diff --git a/qmldebugcontrol/qmljsdebugger/editor/zoomtool.cpp b/qmldebugcontrol/qmljsdebugger/editor/zoomtool.cpp deleted file mode 100644 index 94d4afd..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/zoomtool.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "zoomtool.h" -#include "../qdeclarativeviewinspector_p.h" - -#include -#include -#include -#include -#include - -#include -#include - -namespace QmlJSDebugger { - -ZoomTool::ZoomTool(QDeclarativeViewInspector *view) : - AbstractLiveEditTool(view), - m_rubberbandManipulator(), - m_smoothZoomMultiplier(0.05f), - m_currentScale(1.0f) -{ - m_zoomTo100Action = new QAction(tr("Zoom to &100%"), this); - m_zoomInAction = new QAction(tr("Zoom In"), this); - m_zoomOutAction = new QAction(tr("Zoom Out"), this); - m_zoomInAction->setShortcut(QKeySequence(Qt::Key_Plus)); - m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus)); - - - LiveLayerItem *layerItem = QDeclarativeViewInspectorPrivate::get(view)->manipulatorLayer; - QGraphicsObject *layerObject = reinterpret_cast(layerItem); - m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view); - - - connect(m_zoomTo100Action, SIGNAL(triggered()), SLOT(zoomTo100())); - connect(m_zoomInAction, SIGNAL(triggered()), SLOT(zoomIn())); - connect(m_zoomOutAction, SIGNAL(triggered()), SLOT(zoomOut())); -} - -ZoomTool::~ZoomTool() -{ - delete m_rubberbandManipulator; -} - -void ZoomTool::mousePressEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - - QPointF scenePos = view()->mapToScene(event->pos()); - - if (event->buttons() & Qt::RightButton) { - QMenu contextMenu; - contextMenu.addAction(m_zoomTo100Action); - contextMenu.addSeparator(); - contextMenu.addAction(m_zoomInAction); - contextMenu.addAction(m_zoomOutAction); - contextMenu.exec(event->globalPos()); - } else if (event->buttons() & Qt::LeftButton) { - m_dragBeginPos = scenePos; - m_dragStarted = false; - } -} - -void ZoomTool::mouseMoveEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - - QPointF scenePos = view()->mapToScene(event->pos()); - - if (event->buttons() & Qt::LeftButton - && (QPointF(scenePos - m_dragBeginPos).manhattanLength() - > Constants::DragStartDistance / 3) - && !m_dragStarted) - { - m_dragStarted = true; - m_rubberbandManipulator->begin(m_dragBeginPos); - return; - } - - if (m_dragStarted) - m_rubberbandManipulator->update(scenePos); - -} - -void ZoomTool::mouseReleaseEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - QPointF scenePos = view()->mapToScene(event->pos()); - - if (m_dragStarted) { - m_rubberbandManipulator->end(); - - int x1 = qMin(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); - int x2 = qMax(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); - int y1 = qMin(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); - int y2 = qMax(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); - - QPointF scenePosTopLeft = QPoint(x1, y1); - QPointF scenePosBottomRight = QPoint(x2, y2); - - QRectF sceneArea(scenePosTopLeft, scenePosBottomRight); - - m_currentScale = qMin(view()->rect().width() / sceneArea.width(), - view()->rect().height() / sceneArea.height()); - - - QTransform transform; - transform.scale(m_currentScale, m_currentScale); - - view()->setTransform(transform); - view()->setSceneRect(sceneArea); - } else { - Qt::KeyboardModifier modifierKey = Qt::ControlModifier; -#ifdef Q_WS_MAC - modifierKey = Qt::AltModifier; -#endif - if (event->modifiers() & modifierKey) { - zoomOut(); - } else { - zoomIn(); - } - } -} - -void ZoomTool::zoomIn() -{ - m_currentScale = nextZoomScale(ZoomIn); - scaleView(view()->mapToScene(m_mousePos)); -} - -void ZoomTool::zoomOut() -{ - m_currentScale = nextZoomScale(ZoomOut); - scaleView(view()->mapToScene(m_mousePos)); -} - -void ZoomTool::mouseDoubleClickEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); -} - - -void ZoomTool::hoverMoveEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); -} - - -void ZoomTool::keyPressEvent(QKeyEvent * /*event*/) -{ -} - -void ZoomTool::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() != Qt::Vertical) - return; - - Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier; - if (event->modifiers() & smoothZoomModifier) { - int numDegrees = event->delta() / 8; - m_currentScale += m_smoothZoomMultiplier * (numDegrees / 15.0f); - - scaleView(view()->mapToScene(m_mousePos)); - - } else if (!event->modifiers()) { - if (event->delta() > 0) { - m_currentScale = nextZoomScale(ZoomIn); - } else if (event->delta() < 0) { - m_currentScale = nextZoomScale(ZoomOut); - } - scaleView(view()->mapToScene(m_mousePos)); - } -} - -void ZoomTool::keyReleaseEvent(QKeyEvent *event) -{ - switch(event->key()) { - case Qt::Key_Plus: - zoomIn(); - break; - case Qt::Key_Minus: - zoomOut(); - break; - case Qt::Key_1: - case Qt::Key_2: - case Qt::Key_3: - case Qt::Key_4: - case Qt::Key_5: - case Qt::Key_6: - case Qt::Key_7: - case Qt::Key_8: - case Qt::Key_9: - { - m_currentScale = ((event->key() - Qt::Key_0) * 1.0f); - scaleView(view()->mapToScene(m_mousePos)); // view()->mapToScene(view()->rect().center()) - break; - } - - default: - break; - } - -} - -void ZoomTool::itemsAboutToRemoved(const QList &/*itemList*/) -{ -} - -void ZoomTool::clear() -{ - view()->setCursor(Qt::ArrowCursor); -} - -void ZoomTool::selectedItemsChanged(const QList &/*itemList*/) -{ -} - -void ZoomTool::scaleView(const QPointF ¢erPos) -{ - - QTransform transform; - transform.scale(m_currentScale, m_currentScale); - view()->setTransform(transform); - - QPointF adjustedCenterPos = centerPos; - QSize rectSize(view()->rect().width() / m_currentScale, - view()->rect().height() / m_currentScale); - - QRectF sceneRect; - if (qAbs(m_currentScale - 1.0f) < Constants::ZoomSnapDelta) { - adjustedCenterPos.rx() = rectSize.width() / 2; - adjustedCenterPos.ry() = rectSize.height() / 2; - } - - if (m_currentScale < 1.0f) { - adjustedCenterPos.rx() = rectSize.width() / 2; - adjustedCenterPos.ry() = rectSize.height() / 2; - sceneRect.setRect(view()->rect().width() / 2 -rectSize.width() / 2, - view()->rect().height() / 2 -rectSize.height() / 2, - rectSize.width(), - rectSize.height()); - } else { - sceneRect.setRect(adjustedCenterPos.x() - rectSize.width() / 2, - adjustedCenterPos.y() - rectSize.height() / 2, - rectSize.width(), - rectSize.height()); - } - - view()->setSceneRect(sceneRect); -} - -void ZoomTool::zoomTo100() -{ - m_currentScale = 1.0f; - scaleView(view()->mapToScene(view()->rect().center())); -} - -qreal ZoomTool::nextZoomScale(ZoomDirection direction) const -{ - static QList zoomScales = - QList() - << 0.125f - << 1.0f / 6.0f - << 0.25f - << 1.0f / 3.0f - << 0.5f - << 2.0f / 3.0f - << 1.0f - << 2.0f - << 3.0f - << 4.0f - << 5.0f - << 6.0f - << 7.0f - << 8.0f - << 12.0f - << 16.0f - << 32.0f - << 48.0f; - - if (direction == ZoomIn) { - for (int i = 0; i < zoomScales.length(); ++i) { - if (zoomScales[i] > m_currentScale || i == zoomScales.length() - 1) - return zoomScales[i]; - } - } else { - for (int i = zoomScales.length() - 1; i >= 0; --i) { - if (zoomScales[i] < m_currentScale || i == 0) - return zoomScales[i]; - } - } - - return 1.0f; -} - -} // namespace QmlJSDebugger - -#include "zoomtool.moc" diff --git a/qmldebugcontrol/qmljsdebugger/editor/zoomtool.h b/qmldebugcontrol/qmljsdebugger/editor/zoomtool.h deleted file mode 100644 index 7eb35bd..0000000 --- a/qmldebugcontrol/qmljsdebugger/editor/zoomtool.h +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef ZOOMTOOL_H -#define ZOOMTOOL_H - -#include "abstractliveedittool.h" -#include "liverubberbandselectionmanipulator.h" - -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class ZoomTool : public AbstractLiveEditTool -{ - Q_OBJECT -public: - enum ZoomDirection { - ZoomIn, - ZoomOut - }; - - explicit ZoomTool(QDeclarativeViewInspector *view); - - virtual ~ZoomTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void itemsAboutToRemoved(const QList &itemList); - - void clear(); -protected: - void selectedItemsChanged(const QList &itemList); - -private slots: - void zoomTo100(); - void zoomIn(); - void zoomOut(); - -private: - qreal nextZoomScale(ZoomDirection direction) const; - void scaleView(const QPointF ¢erPos); - -private: - bool m_dragStarted; - QPoint m_mousePos; // in view coords - QPointF m_dragBeginPos; - QAction *m_zoomTo100Action; - QAction *m_zoomInAction; - QAction *m_zoomOutAction; - LiveRubberBandSelectionManipulator *m_rubberbandManipulator; - - qreal m_smoothZoomMultiplier; - qreal m_currentScale; - -}; - -} // namespace QmlJSDebugger - -#endif // ZOOMTOOL_H diff --git a/qmldebugcontrol/qmljsdebugger/include/jsdebuggeragent.h b/qmldebugcontrol/qmljsdebugger/include/jsdebuggeragent.h deleted file mode 100644 index ba7b3a9..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/jsdebuggeragent.h +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QSCRIPTDEBUGGERAGENT_P_H -#define QSCRIPTDEBUGGERAGENT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include "qt_private/qdeclarativedebugservice_p.h" - -#include "qmljsdebugger_global.h" - -QT_BEGIN_NAMESPACE -class QScriptValue; -class QDeclarativeEngine; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class JSDebuggerAgentPrivate; - -class QMLJSDEBUGGER_EXPORT JSDebuggerAgent - : public QDeclarativeDebugService - , public QScriptEngineAgent -{ - Q_OBJECT - -public: - JSDebuggerAgent(QScriptEngine *engine); - JSDebuggerAgent(QDeclarativeEngine *engine); - ~JSDebuggerAgent(); - - // reimplemented - void scriptLoad(qint64 id, const QString &program, - const QString &fileName, int baseLineNumber); - void scriptUnload(qint64 id); - - void contextPush(); - void contextPop(); - - void functionEntry(qint64 scriptId); - void functionExit(qint64 scriptId, - const QScriptValue &returnValue); - - void positionChange(qint64 scriptId, - int lineNumber, int columnNumber); - - void exceptionThrow(qint64 scriptId, - const QScriptValue &exception, - bool hasHandler); - void exceptionCatch(qint64 scriptId, - const QScriptValue &exception); - - bool supportsExtension(Extension extension) const; - QVariant extension(Extension extension, - const QVariant &argument = QVariant()); - - void messageReceived(const QByteArray &); - void statusChanged(Status status); - void baseMessageReceived(const QByteArray &message); - -public slots: - -private: - JSDebuggerAgentPrivate *d; -}; - -} // namespace QmlJSDebugger - -#endif diff --git a/qmldebugcontrol/qmljsdebugger/include/qdeclarativeinspectorservice.h b/qmldebugcontrol/qmljsdebugger/include/qdeclarativeinspectorservice.h deleted file mode 100644 index c28f0b5..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qdeclarativeinspectorservice.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDESIGNDEBUGSERVER_H -#define QDECLARATIVEDESIGNDEBUGSERVER_H - -#include "qt_private/qdeclarativedebugservice_p.h" -#include "qmlinspectorconstants.h" -#include "qmljsdebugger_global.h" - -#include - -QT_FORWARD_DECLARE_CLASS(QColor) -QT_FORWARD_DECLARE_CLASS(QDeclarativeEngine) -QT_FORWARD_DECLARE_CLASS(QDeclarativeContext) -QT_FORWARD_DECLARE_CLASS(QDeclarativeWatcher) -QT_FORWARD_DECLARE_CLASS(QDataStream) - -namespace QmlJSDebugger { - -class QMLJSDEBUGGER_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService -{ - Q_OBJECT -public: - QDeclarativeInspectorService(); - static QDeclarativeInspectorService *instance(); - - void setDesignModeBehavior(bool inDesignMode); - void setCurrentObjects(QList items); - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - void setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId); - void reloaded(); - void setShowAppOnTop(bool showAppOnTop); - - QString idStringForObject(QObject *obj) const; - - void sendMessage(const QByteArray &message); - -public Q_SLOTS: - void selectedColorChanged(const QColor &color); - -Q_SIGNALS: - void debuggingClientChanged(bool hasDebuggingClient); - - void currentObjectsChanged(const QList &objects); - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void selectToolRequested(); - void selectMarqueeToolRequested(); - void zoomToolRequested(); - void colorPickerToolRequested(); - - void objectCreationRequested(const QString &qml, QObject *parent, - const QStringList &imports, const QString &filename = QString(), int order = -1); - void objectReparentRequested(QObject *object, QObject *newParent); - void objectDeletionRequested(QObject *object); - - // 1 = normal speed, - // 1 < x < 16 = slowdown by some factor - void animationSpeedChangeRequested(qreal speedFactor); - void executionPauseChangeRequested(bool paused); - - void clearComponentCacheRequested(); - -protected: - virtual void statusChanged(Status status); - virtual void messageReceived(const QByteArray &); - -private: - QHash m_stringIdForObjectId; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEDESIGNDEBUGSERVER_H diff --git a/qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewinspector.h b/qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewinspector.h deleted file mode 100644 index 134d642..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewinspector.h +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEVIEWINSPECTOR_H -#define QDECLARATIVEVIEWINSPECTOR_H - -#include "qmljsdebugger_global.h" -#include "qmlinspectorconstants.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QToolBar) - -namespace QmlJSDebugger { - -class CrumblePath; -class QDeclarativeViewInspectorPrivate; - -class QMLJSDEBUGGER_EXPORT QDeclarativeViewInspector : public QObject -{ - Q_OBJECT -public: - - explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewInspector(); - - void setSelectedItems(QList items); - QList selectedItems(); - - QDeclarativeView *declarativeView(); - - static QString idStringForObject(QObject *obj); - QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace); - - bool showAppOnTop() const; - -public Q_SLOTS: - void setDesignModeBehavior(bool value); - bool designModeBehavior(); - - void setShowAppOnTop(bool appOnTop); - - void setAnimationSpeed(qreal factor); - void setAnimationPaused(bool paused); - -Q_SIGNALS: - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void marqueeSelectToolActivated(); - void selectToolActivated(); - void zoomToolActivated(); - void colorPickerActivated(); - void selectedColorChanged(const QColor &color); - - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - - bool leaveEvent(QEvent *); - bool mousePressEvent(QMouseEvent *event); - bool mouseMoveEvent(QMouseEvent *event); - bool mouseReleaseEvent(QMouseEvent *event); - bool keyPressEvent(QKeyEvent *event); - bool keyReleaseEvent(QKeyEvent *keyEvent); - bool mouseDoubleClickEvent(QMouseEvent *event); - bool wheelEvent(QWheelEvent *event); - - void setSelectedItemsForTools(QList items); - -private slots: - void animationSpeedChangeRequested(qreal factor); - void animationPausedChangeRequested(bool paused); - -private: - Q_DISABLE_COPY(QDeclarativeViewInspector) - - inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); } - QScopedPointer data; - friend class QDeclarativeViewInspectorPrivate; - friend class AbstractLiveEditTool; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_H diff --git a/qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewobserver.h b/qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewobserver.h deleted file mode 100644 index 7621a9e..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qdeclarativeviewobserver.h +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEVIEWOBSERVER_H -#define QDECLARATIVEVIEWOBSERVER_H - -#include "qdeclarativeviewinspector.h" - -namespace QmlJSDebugger { - -// Provided for compatibility with QmlApplicationViewer -class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QDeclarativeViewInspector -{ - Q_OBJECT - -public: - explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0) - : QDeclarativeViewInspector(view, parent) - {} -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWOBSERVER_H diff --git a/qmldebugcontrol/qmljsdebugger/include/qmlinspectorconstants.h b/qmldebugcontrol/qmljsdebugger/include/qmlinspectorconstants.h deleted file mode 100644 index eb5ac31..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qmlinspectorconstants.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QMLINSPECTORCONSTANTS_H -#define QMLINSPECTORCONSTANTS_H - -namespace QmlJSDebugger { -namespace Constants { - -enum DesignTool { - NoTool = 0, - SelectionToolMode = 1, - MarqueeSelectionToolMode = 2, - MoveToolMode = 3, - ResizeToolMode = 4, - ColorPickerMode = 5, - ZoomMode = 6 -}; - -enum ToolFlags { - NoToolFlags = 0, - UseCursorPos = 1 -}; - -static const int DragStartTime = 50; - -static const int DragStartDistance = 20; - -static const double ZoomSnapDelta = 0.04; - -static const int EditorItemDataKey = 1000; - -enum GraphicsItemTypes { - EditorItemType = 0xEAAA, - ResizeHandleItemType = 0xEAEA -}; - - -} // namespace Constants -} // namespace QmlJSDebugger - -#endif // QMLINSPECTORCONSTANTS_H diff --git a/qmldebugcontrol/qmljsdebugger/include/qmljsdebugger_global.h b/qmldebugcontrol/qmljsdebugger/include/qmljsdebugger_global.h deleted file mode 100644 index 19f65f7..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qmljsdebugger_global.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QMLJSDEBUGGER_GLOBAL_H -#define QMLJSDEBUGGER_GLOBAL_H - -#include - -# if defined(BUILD_QMLJSDEBUGGER_LIB) -# define QMLJSDEBUGGER_EXPORT Q_DECL_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -# elif defined(BUILD_QMLJSDEBUGGER_STATIC_LIB) -# define QMLJSDEBUGGER_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -# else -# define QMLJSDEBUGGER_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -#endif - -#endif // QMLJSDEBUGGER_GLOBAL_H diff --git a/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h b/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h deleted file mode 100644 index a883d96..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDEBUGHELPER_P_H -#define QDECLARATIVEDEBUGHELPER_P_H - -#include "../qmljsdebugger_global.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QScriptEngine; -class QDeclarativeEngine; - -// Helper methods to access private API through a stable interface -// This is used in the qmljsdebugger library of QtCreator. -class QMLJSDEBUGGER_EXTERN QDeclarativeDebugHelper -{ -public: - static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); - static void setAnimationSlowDownFactor(qreal factor); - - // Enables remote debugging functionality - // Only use this for debugging in a safe environment! - static void enableDebugging(); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h b/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h deleted file mode 100644 index e3771b7..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDEBUGSERVICE_H -#define QDECLARATIVEDEBUGSERVICE_H - -#include "../qmljsdebugger_global.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeDebugServicePrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeDebugService : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugService) - Q_DISABLE_COPY(QDeclarativeDebugService) - -public: - explicit QDeclarativeDebugService(const QString &, QObject *parent = 0); - ~QDeclarativeDebugService(); - - QString name() const; - - enum Status { NotConnected, Unavailable, Enabled }; - Status status() const; - - void sendMessage(const QByteArray &); - - static int idForObject(QObject *); - static QObject *objectForId(int); - - static QString objectToString(QObject *obj); - - static bool isDebuggingEnabled(); - static bool hasDebuggingClient(); - -protected: - virtual void statusChanged(Status); - virtual void messageReceived(const QByteArray &); - -private: - friend class QDeclarativeDebugServer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGSERVICE_H - diff --git a/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativestate_p.h b/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativestate_p.h deleted file mode 100644 index b864fc0..0000000 --- a/qmldebugcontrol/qmljsdebugger/include/qt_private/qdeclarativestate_p.h +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVESTATE_H -#define QDECLARATIVESTATE_H - -#include "../qmljsdebugger_global.h" - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeActionEvent; -class QDeclarativeAbstractBinding; -class QDeclarativeBinding; -class QDeclarativeExpression; -class QMLJSDEBUGGER_EXTERN QDeclarativeAction -{ -public: - QDeclarativeAction(); - QDeclarativeAction(QObject *, const QString &, const QVariant &); - QDeclarativeAction(QObject *, const QString &, - QDeclarativeContext *, const QVariant &); - - bool restore:1; - bool actionDone:1; - bool reverseEvent:1; - bool deletableToBinding:1; - - QDeclarativeProperty property; - QVariant fromValue; - QVariant toValue; - - QDeclarativeAbstractBinding *fromBinding; - QWeakPointer toBinding; - QDeclarativeActionEvent *event; - - //strictly for matching - QObject *specifiedObject; - QString specifiedProperty; - - void deleteFromBinding(); -}; - -class QMLJSDEBUGGER_EXTERN QDeclarativeActionEvent -{ -public: - virtual ~QDeclarativeActionEvent(); - virtual QString typeName() const; - - enum Reason { ActualChange, FastForward }; - - virtual void execute(Reason reason = ActualChange); - virtual bool isReversable(); - virtual void reverse(Reason reason = ActualChange); - virtual void saveOriginals() {} - virtual bool needsCopy() { return false; } - virtual void copyOriginals(QDeclarativeActionEvent *) {} - virtual bool isRewindable() { return isReversable(); } - virtual void rewind() {} - virtual void saveCurrentValues() {} - virtual void saveTargetValues() {} - - virtual bool changesBindings(); - virtual void clearBindings(); - virtual bool override(QDeclarativeActionEvent*other); -}; - -//### rename to QDeclarativeStateChange? -class QDeclarativeStateGroup; -class QDeclarativeState; -class QDeclarativeStateOperationPrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeStateOperation : public QObject -{ - Q_OBJECT -public: - QDeclarativeStateOperation(QObject *parent = 0) - : QObject(parent) {} - typedef QList ActionList; - - virtual ActionList actions(); - - QDeclarativeState *state() const; - void setState(QDeclarativeState *state); - -protected: - QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent = 0); - -private: - Q_DECLARE_PRIVATE(QDeclarativeStateOperation) - Q_DISABLE_COPY(QDeclarativeStateOperation) -}; - -typedef QDeclarativeStateOperation::ActionList QDeclarativeStateActions; - -class QDeclarativeTransition; -class QDeclarativeStatePrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeState : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QDeclarativeBinding *when READ when WRITE setWhen) - Q_PROPERTY(QString extend READ extends WRITE setExtends) - Q_PROPERTY(QDeclarativeListProperty changes READ changes) - Q_CLASSINFO("DefaultProperty", "changes") - Q_CLASSINFO("DeferredPropertyNames", "changes") - -public: - QDeclarativeState(QObject *parent=0); - virtual ~QDeclarativeState(); - - QString name() const; - void setName(const QString &); - bool isNamed() const; - - /*'when' is a QDeclarativeBinding to limit state changes oscillation - due to the unpredictable order of evaluation of bound expressions*/ - bool isWhenKnown() const; - QDeclarativeBinding *when() const; - void setWhen(QDeclarativeBinding *); - - QString extends() const; - void setExtends(const QString &); - - QDeclarativeListProperty changes(); - int operationCount() const; - QDeclarativeStateOperation *operationAt(int) const; - - QDeclarativeState &operator<<(QDeclarativeStateOperation *); - - void apply(QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert); - void cancel(); - - QDeclarativeStateGroup *stateGroup() const; - void setStateGroup(QDeclarativeStateGroup *); - - bool containsPropertyInRevertList(QObject *target, const QString &name) const; - bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue); - bool changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding); - bool removeEntryFromRevertList(QObject *target, const QString &name); - void addEntryToRevertList(const QDeclarativeAction &action); - void removeAllEntriesFromRevertList(QObject *target); - void addEntriesToRevertList(const QList &actions); - QVariant valueInRevertList(QObject *target, const QString &name) const; - QDeclarativeAbstractBinding *bindingInRevertList(QObject *target, const QString &name) const; - - bool isStateActive() const; - -Q_SIGNALS: - void completed(); - -private: - Q_DECLARE_PRIVATE(QDeclarativeState) - Q_DISABLE_COPY(QDeclarativeState) -}; - -QT_END_NAMESPACE - -//QML_DECLARE_TYPE(QDeclarativeStateOperation) -//QML_DECLARE_TYPE(QDeclarativeState) - -QT_END_HEADER - -#endif // QDECLARATIVESTATE_H diff --git a/qmldebugcontrol/qmljsdebugger/jsdebuggeragent.cpp b/qmldebugcontrol/qmljsdebugger/jsdebuggeragent.cpp deleted file mode 100644 index 21c6f69..0000000 --- a/qmldebugcontrol/qmljsdebugger/jsdebuggeragent.cpp +++ /dev/null @@ -1,670 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "jsdebuggeragent.h" -#include "qt_private/qdeclarativedebughelper_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace QmlJSDebugger { - -enum JSDebuggerState -{ - NoState, - SteppingIntoState, - SteppingOverState, - SteppingOutState, - StoppedState -}; - -struct JSAgentWatchData -{ - QByteArray exp; - QByteArray name; - QByteArray value; - QByteArray type; - bool hasChildren; - quint64 objectId; -}; - -QDataStream &operator<<(QDataStream &s, const JSAgentWatchData &data) -{ - return s << data.exp << data.name << data.value - << data.type << data.hasChildren << data.objectId; -} - -struct JSAgentStackData -{ - QByteArray functionName; - QByteArray fileUrl; - qint32 lineNumber; -}; - -QDataStream &operator<<(QDataStream &s, const JSAgentStackData &data) -{ - return s << data.functionName << data.fileUrl << data.lineNumber; -} - -struct JSAgentBreakpointData -{ - QByteArray functionName; - QByteArray fileUrl; - qint32 lineNumber; -}; - -typedef QSet JSAgentBreakpoints; - -QDataStream &operator<<(QDataStream &s, const JSAgentBreakpointData &data) -{ - return s << data.functionName << data.fileUrl << data.lineNumber; -} - -QDataStream &operator>>(QDataStream &s, JSAgentBreakpointData &data) -{ - return s >> data.functionName >> data.fileUrl >> data.lineNumber; -} - -bool operator==(const JSAgentBreakpointData &b1, const JSAgentBreakpointData &b2) -{ - return b1.lineNumber == b2.lineNumber && b1.fileUrl == b2.fileUrl; -} - -uint qHash(const JSAgentBreakpointData &b) -{ - return b.lineNumber ^ qHash(b.fileUrl); -} - -class JSDebuggerAgentPrivate -{ -public: - JSDebuggerAgentPrivate(JSDebuggerAgent *q) - : q(q), state(NoState) - {} - - void continueExec(); - void recordKnownObjects(const QList &); - QList getLocals(QScriptContext *); - void positionChange(qint64 scriptId, int lineNumber, int columnNumber); - QScriptEngine *engine() { return q->engine(); } - void stopped(); - void messageReceived(const QByteArray &message); - void sendMessage(const QByteArray &message) { q->sendMessage(message); } - -public: - JSDebuggerAgent *q; - JSDebuggerState state; - int stepDepth; - int stepCount; - - QEventLoop loop; - typedef QHash FileNameHash; - FileNameHash filenames; - JSAgentBreakpoints breakpoints; - // breakpoints by filename (without path) - QHash fileNameToBreakpoints; - QStringList watchExpressions; - QSet knownObjectIds; -}; - -class SetupExecEnv -{ -public: - SetupExecEnv(JSDebuggerAgentPrivate *a) - : agent(a), - previousState(a->state), - hadException(a->engine()->hasUncaughtException()) - { - agent->state = StoppedState; - } - - ~SetupExecEnv() - { - if (!hadException && agent->engine()->hasUncaughtException()) - agent->engine()->clearExceptions(); - agent->state = previousState; - } - -private: - JSDebuggerAgentPrivate *agent; - JSDebuggerState previousState; - bool hadException; -}; - -static JSAgentWatchData fromScriptValue(const QString &expression, - const QScriptValue &value) -{ - static const QString arrayStr = QCoreApplication::translate - ("Debugger::JSAgentWatchData", "[Array of length %1]"); - static const QString undefinedStr = QCoreApplication::translate - ("Debugger::JSAgentWatchData", ""); - - JSAgentWatchData data; - data.exp = expression.toUtf8(); - data.name = data.exp; - data.hasChildren = false; - data.value = value.toString().toUtf8(); - data.objectId = value.objectId(); - if (value.isArray()) { - data.type = "Array"; - data.value = arrayStr.arg(value.property("length").toString()).toUtf8(); - data.hasChildren = true; - } else if (value.isBool()) { - data.type = "Bool"; - // data.value = value.toBool() ? "true" : "false"; - } else if (value.isDate()) { - data.type = "Date"; - data.value = value.toDateTime().toString().toUtf8(); - } else if (value.isError()) { - data.type = "Error"; - } else if (value.isFunction()) { - data.type = "Function"; - } else if (value.isUndefined()) { - data.type = undefinedStr.toUtf8(); - } else if (value.isNumber()) { - data.type = "Number"; - } else if (value.isRegExp()) { - data.type = "RegExp"; - } else if (value.isString()) { - data.type = "String"; - } else if (value.isVariant()) { - data.type = "Variant"; - } else if (value.isQObject()) { - const QObject *obj = value.toQObject(); - data.type = "Object"; - data.value += '['; - data.value += obj->metaObject()->className(); - data.value += ']'; - data.hasChildren = true; - } else if (value.isObject()) { - data.type = "Object"; - data.hasChildren = true; - data.value = "[Object]"; - } else if (value.isNull()) { - data.type = ""; - } else { - data.type = ""; - } - return data; -} - -static QList expandObject(const QScriptValue &object) -{ - QList result; - QScriptValueIterator it(object); - while (it.hasNext()) { - it.next(); - if (it.flags() & QScriptValue::SkipInEnumeration) - continue; - if (/*object.isQObject() &&*/ it.value().isFunction()) { - // Cosmetics: skip all functions and slot, there are too many of them, - // and it is not useful information in the debugger. - continue; - } - JSAgentWatchData data = fromScriptValue(it.name(), it.value()); - result.append(data); - } - if (result.isEmpty()) { - JSAgentWatchData data; - data.name = ""; - data.hasChildren = false; - data.value = " "; //krazy:exclude=doublequote_chars - data.objectId = 0; - result.append(data); - } - return result; -} - -void JSDebuggerAgentPrivate::recordKnownObjects(const QList& list) -{ - foreach (const JSAgentWatchData &data, list) - knownObjectIds << data.objectId; -} - -QList JSDebuggerAgentPrivate::getLocals(QScriptContext *ctx) -{ - QList locals; - if (ctx) { - QScriptValue activationObject = ctx->activationObject(); - QScriptValue thisObject = ctx->thisObject(); - locals = expandObject(activationObject); - if (thisObject.isObject() - && thisObject.objectId() != engine()->globalObject().objectId() - && QScriptValueIterator(thisObject).hasNext()) - locals.prepend(fromScriptValue("this", thisObject)); - recordKnownObjects(locals); - knownObjectIds << activationObject.objectId(); - } - return locals; -} - -/*! - Constructs a new agent for the given \a engine. The agent will - report debugging-related events (e.g. step completion) to the given - \a backend. -*/ -JSDebuggerAgent::JSDebuggerAgent(QScriptEngine *engine) - : QDeclarativeDebugService("JSDebugger") - , QScriptEngineAgent(engine) - , d(new JSDebuggerAgentPrivate(this)) -{} - -JSDebuggerAgent::JSDebuggerAgent(QDeclarativeEngine *engine) - : QDeclarativeDebugService("JSDebugger") - , QScriptEngineAgent(QDeclarativeDebugHelper::getScriptEngine(engine)) - , d(new JSDebuggerAgentPrivate(this)) -{} - -/*! - Destroys this QScriptDebuggerAgent. -*/ -JSDebuggerAgent::~JSDebuggerAgent() -{ - delete d; -} - -/*! - \reimp -*/ -void JSDebuggerAgent::scriptLoad(qint64 id, const QString &program, - const QString &fileName, int) -{ - Q_UNUSED(program); - d->filenames.insert(id, fileName); -} - -/*! - \reimp -*/ -void JSDebuggerAgent::scriptUnload(qint64 id) -{ - d->filenames.remove(id); -} - -/*! - \reimp -*/ -void JSDebuggerAgent::contextPush() -{ -} - -/*! - \reimp -*/ -void JSDebuggerAgent::contextPop() -{ -} - -/*! - \reimp -*/ -void JSDebuggerAgent::functionEntry(qint64 scriptId) -{ - Q_UNUSED(scriptId); - d->stepDepth++; -} - -/*! - \reimp -*/ -void JSDebuggerAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue) -{ - Q_UNUSED(scriptId); - Q_UNUSED(returnValue); - d->stepDepth--; -} - -/*! - \reimp -*/ -void JSDebuggerAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber) -{ - d->positionChange(scriptId, lineNumber, columnNumber); -} - -QString fileName(const QString &fileUrl) -{ - int lastDelimiterPos = fileUrl.lastIndexOf(QLatin1Char('/')); - return fileUrl.mid(lastDelimiterPos, fileUrl.size() - lastDelimiterPos); -} - -void JSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int columnNumber) -{ - Q_UNUSED(columnNumber); - - if (state == StoppedState) - return; //no re-entrency - - // check breakpoints - if (!breakpoints.isEmpty()) { - FileNameHash::const_iterator it = filenames.constFind(scriptId); - QScriptContext *ctx = engine()->currentContext(); - QScriptContextInfo info(ctx); - if (it == filenames.constEnd()) { - // It is possible that the scripts are loaded before the agent is attached - QString filename = info.fileName(); - - JSAgentStackData frame; - frame.functionName = info.functionName().toUtf8(); - - QPair key = qMakePair(filename, lineNumber); - it = FileNameHash::const_iterator(filenames.insert(scriptId, filename)); - } - - const QString filePath = it->toUtf8(); - JSAgentBreakpoints bps = fileNameToBreakpoints.values(fileName(filePath)).toSet(); - - foreach (const JSAgentBreakpointData &bp, bps) { - if (bp.lineNumber == lineNumber) { - stopped(); - return; - } - } - } - - switch (state) { - case NoState: - case StoppedState: - // Do nothing - break; - case SteppingOutState: - if (stepDepth >= 0) - break; - //fallthough - case SteppingOverState: - if (stepDepth > 0) - break; - //fallthough - case SteppingIntoState: - stopped(); - break; - } - -} - -/*! - \reimp -*/ -void JSDebuggerAgent::exceptionThrow(qint64 scriptId, - const QScriptValue &exception, - bool hasHandler) -{ - Q_UNUSED(scriptId); - Q_UNUSED(exception); - Q_UNUSED(hasHandler); -// qDebug() << Q_FUNC_INFO << exception.toString() << hasHandler; -#if 0 //sometimes, we get exceptions that we should just ignore. - if (!hasHandler && state != StoppedState) - stopped(true, exception); -#endif -} - -/*! - \reimp -*/ -void JSDebuggerAgent::exceptionCatch(qint64 scriptId, const QScriptValue &exception) -{ - Q_UNUSED(scriptId); - Q_UNUSED(exception); -} - -bool JSDebuggerAgent::supportsExtension(Extension extension) const -{ - return extension == QScriptEngineAgent::DebuggerInvocationRequest; -} - -QVariant JSDebuggerAgent::extension(Extension extension, const QVariant &argument) -{ - if (extension == QScriptEngineAgent::DebuggerInvocationRequest) { - d->stopped(); - return QVariant(); - } - return QScriptEngineAgent::extension(extension, argument); -} - -void JSDebuggerAgent::messageReceived(const QByteArray &message) -{ - d->messageReceived(message); -} - -void JSDebuggerAgentPrivate::messageReceived(const QByteArray &message) -{ - QDataStream ds(message); - QByteArray command; - ds >> command; - if (command == "BREAKPOINTS") { - ds >> breakpoints; - - fileNameToBreakpoints.clear(); - foreach (const JSAgentBreakpointData &bp, breakpoints) { - fileNameToBreakpoints.insertMulti(fileName(bp.fileUrl), bp); - } - - //qDebug() << "BREAKPOINTS"; - //foreach (const JSAgentBreakpointData &bp, breakpoints) - // qDebug() << "BREAKPOINT: " << bp.fileName << bp.lineNumber; - } else if (command == "WATCH_EXPRESSIONS") { - ds >> watchExpressions; - } else if (command == "STEPOVER") { - stepDepth = 0; - state = SteppingOverState; - continueExec(); - } else if (command == "STEPINTO" || command == "INTERRUPT") { - stepDepth = 0; - state = SteppingIntoState; - continueExec(); - } else if (command == "STEPOUT") { - stepDepth = 0; - state = SteppingOutState; - continueExec(); - } else if (command == "CONTINUE") { - state = NoState; - continueExec(); - } else if (command == "EXEC") { - SetupExecEnv execEnv(this); - - QByteArray id; - QString expr; - ds >> id >> expr; - - JSAgentWatchData data = fromScriptValue(expr, engine()->evaluate(expr)); - knownObjectIds << data.objectId; - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("RESULT") << id << data; - sendMessage(reply); - } else if (command == "EXPAND") { - SetupExecEnv execEnv(this); - - QByteArray requestId; - quint64 objectId; - ds >> requestId >> objectId; - QScriptValue v; - if (knownObjectIds.contains(objectId)) - v = engine()->objectById(objectId); - - QList result = expandObject(v); - recordKnownObjects(result); - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("EXPANDED") << requestId << result; - sendMessage(reply); - - } else if (command == "ACTIVATE_FRAME") { - SetupExecEnv execEnv(this); - - int frameId; - ds >> frameId; - - int deep = 0; - QScriptContext *ctx = engine()->currentContext(); - while (ctx && deep < frameId) { - ctx = ctx->parentContext(); - deep++; - } - - QList watches; - QList locals = getLocals(ctx); - - // re-evaluate watches given the frame's context - QScriptContext *currentCtx = engine()->pushContext(); - currentCtx->setActivationObject(ctx->activationObject()); - currentCtx->setThisObject(ctx->thisObject()); - foreach (const QString &expr, watchExpressions) - watches << fromScriptValue(expr, engine()->evaluate(expr)); - recordKnownObjects(watches); - engine()->popContext(); - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("LOCALS") << frameId << locals << watches; - sendMessage(reply); - } else if (command == "SET_PROPERTY") { - SetupExecEnv execEnv(this); - - QByteArray id; - qint64 objectId; - QString property; - QString value; - ds >> id >> objectId >> property >> value; - - if (knownObjectIds.contains(objectId)) { - QScriptValue object; - object = engine()->objectById(objectId); - - if (object.isObject()) { - QScriptValue result = engine()->evaluate(value); - object.setProperty(property, result); - } - } - - //TODO: feedback - } else if (command == "PING") { - int ping; - ds >> ping; - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("PONG") << ping; - sendMessage(reply); - } else { - qDebug() << Q_FUNC_INFO << "Unknown command" << command; - } - - q->baseMessageReceived(message); -} - -void JSDebuggerAgentPrivate::stopped() -{ - bool becauseOfException = false; - const QScriptValue &exception = QScriptValue(); - - knownObjectIds.clear(); - state = StoppedState; - QList backtrace; - - for (QScriptContext* ctx = engine()->currentContext(); ctx; ctx = ctx->parentContext()) { - QScriptContextInfo info(ctx); - - JSAgentStackData frame; - frame.functionName = info.functionName().toUtf8(); - if (frame.functionName.isEmpty()) { - if (ctx->parentContext()) { - switch (info.functionType()) { - case QScriptContextInfo::ScriptFunction: - frame.functionName = ""; - break; - case QScriptContextInfo::NativeFunction: - frame.functionName = ""; - break; - case QScriptContextInfo::QtFunction: - case QScriptContextInfo::QtPropertyFunction: - frame.functionName = ""; - break; - } - } else { - frame.functionName = ""; - } - } - frame.lineNumber = info.lineNumber(); - // if the line number is unknown, fallback to the function line number - if (frame.lineNumber == -1) - frame.lineNumber = info.functionStartLineNumber(); - - frame.fileUrl = info.fileName().toUtf8(); - backtrace.append(frame); - } - QList watches; - foreach (const QString &expr, watchExpressions) - watches << fromScriptValue(expr, engine()->evaluate(expr)); - recordKnownObjects(watches); - - QList locals = getLocals(engine()->currentContext()); - - if (!becauseOfException) { - // Clear any exceptions occurred during locals evaluation. - engine()->clearExceptions(); - } - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("STOPPED") << backtrace << watches << locals - << becauseOfException << exception.toString(); - sendMessage(reply); - - loop.exec(QEventLoop::ExcludeUserInputEvents); -} - -void JSDebuggerAgentPrivate::continueExec() -{ - loop.quit(); -} - -void JSDebuggerAgent::statusChanged(Status status) -{ - engine()->setAgent((status == QDeclarativeDebugService::Enabled) ? this : 0); -} - -void JSDebuggerAgent::baseMessageReceived(const QByteArray &message) -{ - QDeclarativeDebugService::messageReceived(message); -} - -} // namespace QmlJSDebugger - -#include "jsdebuggeragent.moc" diff --git a/qmldebugcontrol/qmljsdebugger/jsdebuggeragent.h b/qmldebugcontrol/qmljsdebugger/jsdebuggeragent.h deleted file mode 100644 index ba7b3a9..0000000 --- a/qmldebugcontrol/qmljsdebugger/jsdebuggeragent.h +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QSCRIPTDEBUGGERAGENT_P_H -#define QSCRIPTDEBUGGERAGENT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include "qt_private/qdeclarativedebugservice_p.h" - -#include "qmljsdebugger_global.h" - -QT_BEGIN_NAMESPACE -class QScriptValue; -class QDeclarativeEngine; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class JSDebuggerAgentPrivate; - -class QMLJSDEBUGGER_EXPORT JSDebuggerAgent - : public QDeclarativeDebugService - , public QScriptEngineAgent -{ - Q_OBJECT - -public: - JSDebuggerAgent(QScriptEngine *engine); - JSDebuggerAgent(QDeclarativeEngine *engine); - ~JSDebuggerAgent(); - - // reimplemented - void scriptLoad(qint64 id, const QString &program, - const QString &fileName, int baseLineNumber); - void scriptUnload(qint64 id); - - void contextPush(); - void contextPop(); - - void functionEntry(qint64 scriptId); - void functionExit(qint64 scriptId, - const QScriptValue &returnValue); - - void positionChange(qint64 scriptId, - int lineNumber, int columnNumber); - - void exceptionThrow(qint64 scriptId, - const QScriptValue &exception, - bool hasHandler); - void exceptionCatch(qint64 scriptId, - const QScriptValue &exception); - - bool supportsExtension(Extension extension) const; - QVariant extension(Extension extension, - const QVariant &argument = QVariant()); - - void messageReceived(const QByteArray &); - void statusChanged(Status status); - void baseMessageReceived(const QByteArray &message); - -public slots: - -private: - JSDebuggerAgentPrivate *d; -}; - -} // namespace QmlJSDebugger - -#endif diff --git a/qmldebugcontrol/qmljsdebugger/protocol/CMakeLists.txt b/qmldebugcontrol/qmljsdebugger/protocol/CMakeLists.txt deleted file mode 100644 index ff8a5c4..0000000 --- a/qmldebugcontrol/qmljsdebugger/protocol/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -project(protocol) - -set(protocol_SRCS - inspectorprotocol.cpp -) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) - -qt4_automoc(${protocol_SRCS}) - -add_library(protocol ${protocol_SRCS}) -target_link_libraries(protocol - ${QT_QTCORE_LIBRARIES} - ${QT_QTGUI_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARIES} -) diff --git a/qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.cpp b/qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.cpp deleted file mode 100644 index d736c05..0000000 --- a/qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.cpp +++ /dev/null @@ -1,3 +0,0 @@ - -#include "inspectorprotocol.h" -#include "inspectorprotocol.moc" diff --git a/qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.h b/qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.h deleted file mode 100644 index b80c5e4..0000000 --- a/qmldebugcontrol/qmljsdebugger/protocol/inspectorprotocol.h +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef INSPECTORPROTOCOL_H -#define INSPECTORPROTOCOL_H - -#include -#include -#include -#include - -namespace QmlJSDebugger { - -class InspectorProtocol : public QObject -{ - Q_OBJECT - Q_ENUMS(Message Tool) - -public: - enum Message { - AnimationSpeedChanged = 0, - AnimationPausedChanged = 19, // highest value - ChangeTool = 1, - ClearComponentCache = 2, - ColorChanged = 3, - CreateObject = 5, - CurrentObjectsChanged = 6, - DestroyObject = 7, - MoveObject = 8, - ObjectIdList = 9, - Reload = 10, - Reloaded = 11, - SetAnimationSpeed = 12, - SetAnimationPaused = 18, - SetCurrentObjects = 14, - SetDesignMode = 15, - ShowAppOnTop = 16, - ToolChanged = 17 - }; - - enum Tool { - ColorPickerTool, - SelectMarqueeTool, - SelectTool, - ZoomTool - }; - - static inline QString toString(Message message) - { - return staticMetaObject.enumerator(0).valueToKey(message); - } - - static inline QString toString(Tool tool) - { - return staticMetaObject.enumerator(1).valueToKey(tool); - } -}; - -inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message) -{ - return stream << static_cast(message); -} - -inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message) -{ - quint32 i; - stream >> i; - message = static_cast(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message) -{ - dbg << InspectorProtocol::toString(message); - return dbg; -} - -inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool) -{ - return stream << static_cast(tool); -} - -inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool) -{ - quint32 i; - stream >> i; - tool = static_cast(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool) -{ - dbg << InspectorProtocol::toString(tool); - return dbg; -} - -} // namespace QmlJSDebugger - -#endif // INSPECTORPROTOCOL_H diff --git a/qmldebugcontrol/qmljsdebugger/protocol/protocol.pri b/qmldebugcontrol/qmljsdebugger/protocol/protocol.pri deleted file mode 100644 index dfb18fb..0000000 --- a/qmldebugcontrol/qmljsdebugger/protocol/protocol.pri +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD -HEADERS += $$PWD/inspectorprotocol.h diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.cpp b/qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.cpp deleted file mode 100644 index 2e3bd0d..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "qdeclarativeinspectorservice.h" - -#include - -#include -#include - -namespace QmlJSDebugger { - -Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance) - -QDeclarativeInspectorService::QDeclarativeInspectorService() - : QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode")) -{ -} - -QDeclarativeInspectorService *QDeclarativeInspectorService::instance() -{ - return serviceInstance(); -} - -void QDeclarativeInspectorService::statusChanged(Status status) -{ - emit debuggingClientChanged((status == Enabled)); -} - -void QDeclarativeInspectorService::messageReceived(const QByteArray &message) -{ - QDataStream ds(message); - - InspectorProtocol::Message type; - ds >> type; - - switch (type) { - case InspectorProtocol::SetCurrentObjects: { - int itemCount = 0; - ds >> itemCount; - - QList selectedObjects; - for (int i = 0; i < itemCount; ++i) { - int debugId = -1; - ds >> debugId; - if (QObject *obj = objectForId(debugId)) - selectedObjects << obj; - } - - emit currentObjectsChanged(selectedObjects); - break; - } - case InspectorProtocol::Reload: { - emit reloadRequested(); - break; - } - case InspectorProtocol::SetAnimationSpeed: { - qreal speed; - ds >> speed; - emit animationSpeedChangeRequested(speed); - break; - } - case InspectorProtocol::SetAnimationPaused: { - bool paused; - ds >> paused; - emit executionPauseChangeRequested(paused); - break; - } - case InspectorProtocol::ChangeTool: { - InspectorProtocol::Tool tool; - ds >> tool; - switch (tool) { - case InspectorProtocol::ColorPickerTool: - emit colorPickerToolRequested(); - break; - case InspectorProtocol::SelectTool: - emit selectToolRequested(); - break; - case InspectorProtocol::SelectMarqueeTool: - emit selectMarqueeToolRequested(); - break; - case InspectorProtocol::ZoomTool: - emit zoomToolRequested(); - break; - default: - qWarning() << "Warning: Unhandled tool:" << tool; - } - break; - } - case InspectorProtocol::SetDesignMode: { - bool inDesignMode; - ds >> inDesignMode; - emit designModeBehaviorChanged(inDesignMode); - break; - } - case InspectorProtocol::ShowAppOnTop: { - bool showOnTop; - ds >> showOnTop; - emit showAppOnTopChanged(showOnTop); - break; - } - case InspectorProtocol::CreateObject: { - QString qml; - int parentId; - QString filename; - QStringList imports; - ds >> qml >> parentId >> imports >> filename; - int order = -1; - if (!ds.atEnd()) { - ds >> order; - } - emit objectCreationRequested(qml, objectForId(parentId), imports, filename, order); - break; - } - case InspectorProtocol::DestroyObject: { - int debugId; - ds >> debugId; - if (QObject* obj = objectForId(debugId)) { - emit objectDeletionRequested(obj); - } - break; - } - case InspectorProtocol::MoveObject: { - int debugId, newParent; - ds >> debugId >> newParent; - emit objectReparentRequested(objectForId(debugId), objectForId(newParent)); - break; - } - case InspectorProtocol::ObjectIdList: { - int itemCount; - ds >> itemCount; - m_stringIdForObjectId.clear(); - for (int i = 0; i < itemCount; ++i) { - int itemDebugId; - QString itemIdString; - ds >> itemDebugId - >> itemIdString; - - m_stringIdForObjectId.insert(itemDebugId, itemIdString); - } - break; - } - case InspectorProtocol::ClearComponentCache: { - emit clearComponentCacheRequested(); - break; - } - default: - qWarning() << "Warning: Not handling message:" << type; - } -} - -void QDeclarativeInspectorService::setDesignModeBehavior(bool inDesignMode) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::SetDesignMode - << inDesignMode; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setCurrentObjects(QList objects) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::CurrentObjectsChanged - << objects.length(); - - foreach (QObject *object, objects) { - int id = idForObject(object); - ds << id; - } - - sendMessage(message); -} - -void QDeclarativeInspectorService::setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ToolChanged - << toolId; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setAnimationSpeed(qreal slowDownFactor) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::AnimationSpeedChanged - << slowDownFactor; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setAnimationPaused(bool paused) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::AnimationPausedChanged - << paused; - - sendMessage(message); -} - -void QDeclarativeInspectorService::reloaded() -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::Reloaded; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setShowAppOnTop(bool showAppOnTop) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ShowAppOnTop << showAppOnTop; - - sendMessage(message); -} - -void QDeclarativeInspectorService::selectedColorChanged(const QColor &color) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ColorChanged - << color; - - sendMessage(message); -} - -QString QDeclarativeInspectorService::idStringForObject(QObject *obj) const -{ - int id = idForObject(obj); - QString idString = m_stringIdForObjectId.value(id, QString()); - return idString; -} - -void QDeclarativeInspectorService::sendMessage(const QByteArray &message) -{ - if (status() != Enabled) - return; - - QDeclarativeDebugService::sendMessage(message); -} - -} // namespace QmlJSDebugger - -#include "qdeclarativeinspectorservice.moc" - diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.h b/qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.h deleted file mode 100644 index c28f0b5..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeinspectorservice.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDESIGNDEBUGSERVER_H -#define QDECLARATIVEDESIGNDEBUGSERVER_H - -#include "qt_private/qdeclarativedebugservice_p.h" -#include "qmlinspectorconstants.h" -#include "qmljsdebugger_global.h" - -#include - -QT_FORWARD_DECLARE_CLASS(QColor) -QT_FORWARD_DECLARE_CLASS(QDeclarativeEngine) -QT_FORWARD_DECLARE_CLASS(QDeclarativeContext) -QT_FORWARD_DECLARE_CLASS(QDeclarativeWatcher) -QT_FORWARD_DECLARE_CLASS(QDataStream) - -namespace QmlJSDebugger { - -class QMLJSDEBUGGER_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService -{ - Q_OBJECT -public: - QDeclarativeInspectorService(); - static QDeclarativeInspectorService *instance(); - - void setDesignModeBehavior(bool inDesignMode); - void setCurrentObjects(QList items); - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - void setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId); - void reloaded(); - void setShowAppOnTop(bool showAppOnTop); - - QString idStringForObject(QObject *obj) const; - - void sendMessage(const QByteArray &message); - -public Q_SLOTS: - void selectedColorChanged(const QColor &color); - -Q_SIGNALS: - void debuggingClientChanged(bool hasDebuggingClient); - - void currentObjectsChanged(const QList &objects); - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void selectToolRequested(); - void selectMarqueeToolRequested(); - void zoomToolRequested(); - void colorPickerToolRequested(); - - void objectCreationRequested(const QString &qml, QObject *parent, - const QStringList &imports, const QString &filename = QString(), int order = -1); - void objectReparentRequested(QObject *object, QObject *newParent); - void objectDeletionRequested(QObject *object); - - // 1 = normal speed, - // 1 < x < 16 = slowdown by some factor - void animationSpeedChangeRequested(qreal speedFactor); - void executionPauseChangeRequested(bool paused); - - void clearComponentCacheRequested(); - -protected: - virtual void statusChanged(Status status); - virtual void messageReceived(const QByteArray &); - -private: - QHash m_stringIdForObjectId; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEDESIGNDEBUGSERVER_H diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.cpp b/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.cpp deleted file mode 100644 index f5aff74..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -#include "qdeclarativeviewinspector.h" -#include "qdeclarativeviewinspector.moc" - diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.h b/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.h deleted file mode 100644 index 134d642..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector.h +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEVIEWINSPECTOR_H -#define QDECLARATIVEVIEWINSPECTOR_H - -#include "qmljsdebugger_global.h" -#include "qmlinspectorconstants.h" - -#include -#include - -QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QToolBar) - -namespace QmlJSDebugger { - -class CrumblePath; -class QDeclarativeViewInspectorPrivate; - -class QMLJSDEBUGGER_EXPORT QDeclarativeViewInspector : public QObject -{ - Q_OBJECT -public: - - explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewInspector(); - - void setSelectedItems(QList items); - QList selectedItems(); - - QDeclarativeView *declarativeView(); - - static QString idStringForObject(QObject *obj); - QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace); - - bool showAppOnTop() const; - -public Q_SLOTS: - void setDesignModeBehavior(bool value); - bool designModeBehavior(); - - void setShowAppOnTop(bool appOnTop); - - void setAnimationSpeed(qreal factor); - void setAnimationPaused(bool paused); - -Q_SIGNALS: - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void marqueeSelectToolActivated(); - void selectToolActivated(); - void zoomToolActivated(); - void colorPickerActivated(); - void selectedColorChanged(const QColor &color); - - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - - bool leaveEvent(QEvent *); - bool mousePressEvent(QMouseEvent *event); - bool mouseMoveEvent(QMouseEvent *event); - bool mouseReleaseEvent(QMouseEvent *event); - bool keyPressEvent(QKeyEvent *event); - bool keyReleaseEvent(QKeyEvent *keyEvent); - bool mouseDoubleClickEvent(QMouseEvent *event); - bool wheelEvent(QWheelEvent *event); - - void setSelectedItemsForTools(QList items); - -private slots: - void animationSpeedChangeRequested(qreal factor); - void animationPausedChangeRequested(bool paused); - -private: - Q_DISABLE_COPY(QDeclarativeViewInspector) - - inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); } - QScopedPointer data; - friend class QDeclarativeViewInspectorPrivate; - friend class AbstractLiveEditTool; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_H diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.cpp b/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.cpp deleted file mode 100644 index 2c47127..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.cpp +++ /dev/null @@ -1,934 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "qdeclarativeviewinspector.h" -#include "qdeclarativeviewinspector_p.h" -#include "qdeclarativeinspectorservice.h" -#include "editor/liveselectiontool.h" -#include "editor/zoomtool.h" -#include "editor/colorpickertool.h" -#include "editor/livelayeritem.h" -#include "editor/boundingrecthighlighter.h" -#include "editor/qmltoolbar.h" - -#include "qt_private/qdeclarativedebughelper_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "qt_private/qdeclarativestate_p.h" - -static inline void initEditorResource() { Q_INIT_RESOURCE(editor); } - -namespace QmlJSDebugger { - -const char * const KEY_TOOLBOX_GEOMETRY = "toolBox/geometry"; - -const int SceneChangeUpdateInterval = 5000; - - -ToolBox::ToolBox(QWidget *parent) - : QWidget(parent, Qt::Tool) - , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this) - , m_toolBar(new QmlToolBar) -{ - setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); - setWindowTitle(tr("Qt Quick Toolbox")); - - QVBoxLayout *verticalLayout = new QVBoxLayout; - verticalLayout->setMargin(0); - verticalLayout->addWidget(m_toolBar); - setLayout(verticalLayout); - - restoreGeometry(m_settings.value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray()); -} - -ToolBox::~ToolBox() -{ - m_settings.setValue(QLatin1String(KEY_TOOLBOX_GEOMETRY), saveGeometry()); -} - - -QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) : - q(q), - designModeBehavior(false), - showAppOnTop(false), - animationPaused(false), - slowDownFactor(1.0f), - toolBox(0) -{ -} - -QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate() -{ -} - -QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent) : - QObject(parent), data(new QDeclarativeViewInspectorPrivate(this)) -{ - initEditorResource(); - - data->view = view; - data->manipulatorLayer = new LiveLayerItem(view->scene()); - data->selectionTool = new LiveSelectionTool(this); - data->zoomTool = new ZoomTool(this); - data->colorPickerTool = new ColorPickerTool(this); - data->boundingRectHighlighter = new BoundingRectHighlighter(this); - data->currentTool = data->selectionTool; - - // to capture ChildRemoved event when viewport changes - data->view->installEventFilter(this); - - data->setViewport(data->view->viewport()); - - data->debugService = QDeclarativeInspectorService::instance(); - - // tool box is disabled - //connect(data->debugService, SIGNAL(debuggingClientChanged(bool)), - // data.data(), SLOT(_q_setToolBoxVisible(bool))); - - connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)), - SLOT(setDesignModeBehavior(bool))); - connect(data->debugService, SIGNAL(showAppOnTopChanged(bool)), - SLOT(setShowAppOnTop(bool))); - connect(data->debugService, SIGNAL(reloadRequested()), data.data(), SLOT(_q_reloadView())); - connect(data->debugService, SIGNAL(currentObjectsChanged(QList)), - data.data(), SLOT(_q_onCurrentObjectsChanged(QList))); - connect(data->debugService, SIGNAL(animationSpeedChangeRequested(qreal)), - SLOT(animationSpeedChangeRequested(qreal))); - connect(data->debugService, SIGNAL(executionPauseChangeRequested(bool)), - SLOT(animationPausedChangeRequested(bool))); - connect(data->debugService, SIGNAL(colorPickerToolRequested()), - data.data(), SLOT(_q_changeToColorPickerTool())); - connect(data->debugService, SIGNAL(selectMarqueeToolRequested()), - data.data(), SLOT(_q_changeToMarqueeSelectTool())); - connect(data->debugService, SIGNAL(selectToolRequested()), data.data(), SLOT(_q_changeToSingleSelectTool())); - connect(data->debugService, SIGNAL(zoomToolRequested()), data.data(), SLOT(_q_changeToZoomTool())); - connect(data->debugService, - SIGNAL(objectCreationRequested(QString,QObject*,QStringList,QString,int)), - data.data(), SLOT(_q_createQmlObject(QString,QObject*,QStringList,QString,int))); - connect(data->debugService, - SIGNAL(objectDeletionRequested(QObject *)), data.data(), SLOT(_q_deleteQmlObject(QObject *))); - connect(data->debugService, - SIGNAL(objectReparentRequested(QObject *, QObject *)), - data.data(), SLOT(_q_reparentQmlObject(QObject *, QObject *))); - connect(data->debugService, SIGNAL(clearComponentCacheRequested()), - data.data(), SLOT(_q_clearComponentCache())); - connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)), - data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status))); - - connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), - SIGNAL(selectedColorChanged(QColor))); - connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), - data->debugService, SLOT(selectedColorChanged(QColor))); - - data->_q_changeToSingleSelectTool(); -} - -QDeclarativeViewInspector::~QDeclarativeViewInspector() -{ -} - -void QDeclarativeViewInspectorPrivate::_q_setToolBoxVisible(bool visible) -{ -#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) - if (!toolBox && visible) - createToolBox(); - if (toolBox) - toolBox->setVisible(visible); -#else - Q_UNUSED(visible) -#endif -} - -void QDeclarativeViewInspectorPrivate::_q_reloadView() -{ - clearHighlight(); - emit q->reloadRequested(); -} - -void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget) -{ - if (viewport.data() == widget) - return; - - if (viewport) - viewport.data()->removeEventFilter(q); - - viewport = widget; - if (viewport) { - // make sure we get mouse move events - viewport.data()->setMouseTracking(true); - viewport.data()->installEventFilter(q); - } -} - -void QDeclarativeViewInspectorPrivate::clearEditorItems() -{ - clearHighlight(); - setSelectedItems(QList()); -} - -bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == data->view) { - // Event from view - if (event->type() == QEvent::ChildRemoved) { - // Might mean that viewport has changed - if (data->view->viewport() != data->viewport.data()) - data->setViewport(data->view->viewport()); - } - return QObject::eventFilter(obj, event); - } - - // Event from viewport - switch (event->type()) { - case QEvent::Leave: { - if (leaveEvent(event)) - return true; - break; - } - case QEvent::MouseButtonPress: { - if (mousePressEvent(static_cast(event))) - return true; - break; - } - case QEvent::MouseMove: { - if (mouseMoveEvent(static_cast(event))) - return true; - break; - } - case QEvent::MouseButtonRelease: { - if (mouseReleaseEvent(static_cast(event))) - return true; - break; - } - case QEvent::KeyPress: { - if (keyPressEvent(static_cast(event))) - return true; - break; - } - case QEvent::KeyRelease: { - if (keyReleaseEvent(static_cast(event))) - return true; - break; - } - case QEvent::MouseButtonDblClick: { - if (mouseDoubleClickEvent(static_cast(event))) - return true; - break; - } - case QEvent::Wheel: { - if (wheelEvent(static_cast(event))) - return true; - break; - } - default: { - break; - } - } //switch - - // standard event processing - return QObject::eventFilter(obj, event); -} - -bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/) -{ - if (!data->designModeBehavior) - return false; - data->clearHighlight(); - return true; -} - -bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) - return false; - data->cursorPos = event->pos(); - data->currentTool->mousePressEvent(event); - return true; -} - -bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) { - data->clearEditorItems(); - return false; - } - data->cursorPos = event->pos(); - - QList selItems = data->selectableItems(event->pos()); - if (!selItems.isEmpty()) { - declarativeView()->setToolTip(AbstractLiveEditTool::titleForItem(selItems.first())); - } else { - declarativeView()->setToolTip(QString()); - } - if (event->buttons()) { - data->currentTool->mouseMoveEvent(event); - } else { - data->currentTool->hoverMoveEvent(event); - } - return true; -} - -bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) - return false; - - data->cursorPos = event->pos(); - data->currentTool->mouseReleaseEvent(event); - return true; -} - -bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event) -{ - if (!data->designModeBehavior) - return false; - - data->currentTool->keyPressEvent(event); - return true; -} - -bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event) -{ - if (!data->designModeBehavior) - return false; - - switch(event->key()) { - case Qt::Key_V: - data->_q_changeToSingleSelectTool(); - break; -// disabled because multiselection does not do anything useful without design mode -// case Qt::Key_M: -// data->_q_changeToMarqueeSelectTool(); -// break; - case Qt::Key_I: - data->_q_changeToColorPickerTool(); - break; - case Qt::Key_Z: - data->_q_changeToZoomTool(); - break; - case Qt::Key_Space: - setAnimationPaused(!data->animationPaused); - break; - default: - break; - } - - data->currentTool->keyReleaseEvent(event); - return true; -} - -bool insertObjectInListProperty(QDeclarativeListReference &fromList, int position, QObject *object) -{ - QList tmpList; - int i; - - if (!(fromList.canCount() && fromList.canAt() && fromList.canAppend() && fromList.canClear())) - return false; - - if (position == fromList.count()) { - fromList.append(object); - return true; - } - - for (i=0; i tmpList; - int i; - - if (!(fromList.canCount() && fromList.canAt() && fromList.canAppend() && fromList.canClear())) - return false; - - for (i=0; iengine()->contextForObject(parent); - QDeclarativeComponent component(view->engine(), q); - QByteArray constructedQml = QString(imports + qml).toLatin1(); - - component.setData(constructedQml, filename); - QObject *newObject = component.create(parentContext); - if (newObject) { - newObject->setParent(parent); - do { - // add child item - QDeclarativeItem *parentItem = qobject_cast(parent); - QDeclarativeItem *newItem = qobject_cast(newObject); - if (parentItem && newItem) { - newItem->setParentItem(parentItem); - break; - } - - // add property change - QDeclarativeState *parentState = qobject_cast(parent); - QDeclarativeStateOperation *newPropertyChanges = qobject_cast(newObject); - if (parentState && newPropertyChanges) { - (*parentState) << newPropertyChanges; - break; - } - - // add states - QDeclarativeState *newState = qobject_cast(newObject); - if (parentItem && newState) { - QDeclarativeListReference statesList(parentItem, "states"); - statesList.append(newObject); - break; - } - - // add animation to transition - if (parent->inherits("QDeclarativeTransition") && - newObject->inherits("QDeclarativeAbstractAnimation")) { - QDeclarativeListReference animationsList(parent, "animations"); - animationsList.append(newObject); - break; - } - - // add animation to animation - if (parent->inherits("QDeclarativeAnimationGroup") && - newObject->inherits("QDeclarativeAbstractAnimation")) { - QDeclarativeListReference animationsList(parent, "animations"); - if (order==-1) { - animationsList.append(newObject); - } else { - if (!insertObjectInListProperty(animationsList, order, newObject)) { - animationsList.append(newObject); - } - } - break; - } - - // add transition - if (parentItem && newObject->inherits("QDeclarativeTransition")) { - QDeclarativeListReference transitionsList(parentItem,"transitions"); - if (transitionsList.count() == 1 && transitionsList.at(0) == 0) { - transitionsList.clear(); - } - transitionsList.append(newObject); - break; - } - - } while (false); - } -} - -void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) -{ - if (!newParent) - return; - - object->setParent(newParent); - QDeclarativeItem *newParentItem = qobject_cast(newParent); - QDeclarativeItem *item = qobject_cast(object); - if (newParentItem && item) - item->setParentItem(newParentItem); -} - -void QDeclarativeViewInspectorPrivate::_q_deleteQmlObject(QObject *object) -{ - // special cases for transitions/animations - if (object->inherits("QDeclarativeAbstractAnimation")) { - if (object->parent()) { - QDeclarativeListReference animationsList(object->parent(), "animations"); - if (removeObjectFromListProperty(animationsList, object)) - object->deleteLater(); - return; - } - } - - if (object->inherits("QDeclarativeTransition")) { - QDeclarativeListReference transitionsList(object->parent(), "transitions"); - if (removeObjectFromListProperty(transitionsList, object)) - object->deleteLater(); - return; - } -} - -void QDeclarativeViewInspectorPrivate::_q_clearComponentCache() -{ - view->engine()->clearComponentCache(); -} - -void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj) -{ - QList items = selectedItems(); - if (QGraphicsItem *item = qobject_cast(obj)) - items.removeOne(item); - setSelectedItems(items); -} - -bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ - if (!data->designModeBehavior) - return false; - - return true; -} - -bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event) -{ - if (!data->designModeBehavior) - return false; - data->currentTool->wheelEvent(event); - return true; -} - -void QDeclarativeViewInspector::setDesignModeBehavior(bool value) -{ - emit designModeBehaviorChanged(value); - - if (data->toolBox) - data->toolBox->toolBar()->setDesignModeBehavior(value); - data->debugService->setDesignModeBehavior(value); - - data->designModeBehavior = value; - - if (!data->designModeBehavior) - data->clearEditorItems(); -} - -bool QDeclarativeViewInspector::designModeBehavior() -{ - return data->designModeBehavior; -} - -bool QDeclarativeViewInspector::showAppOnTop() const -{ - return data->showAppOnTop; -} - -void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop) -{ - if (data->view) { - QWidget *window = data->view->window(); - Qt::WindowFlags flags = window->windowFlags(); - if (appOnTop) - flags |= Qt::WindowStaysOnTopHint; - else - flags &= ~Qt::WindowStaysOnTopHint; - - window->setWindowFlags(flags); - window->show(); - } - - data->showAppOnTop = appOnTop; - data->debugService->setShowAppOnTop(appOnTop); - - emit showAppOnTopChanged(appOnTop); -} - -void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool, - Constants::ToolFlags /*flags*/) -{ - switch(tool) { - case Constants::SelectionToolMode: - _q_changeToSingleSelectTool(); - break; - case Constants::NoTool: - default: - currentTool = 0; - break; - } -} - -void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(QList items) -{ - foreach (const QWeakPointer &obj, currentSelection) { - if (QGraphicsItem *item = obj.data()) { - if (!items.contains(item)) { - QObject::disconnect(obj.data(), SIGNAL(destroyed(QObject*)), - this, SLOT(_q_removeFromSelection(QObject*))); - currentSelection.removeOne(obj); - } - } - } - - foreach (QGraphicsItem *item, items) { - if (QGraphicsObject *obj = item->toGraphicsObject()) { - if (!currentSelection.contains(obj)) { - QObject::connect(obj, SIGNAL(destroyed(QObject*)), - this, SLOT(_q_removeFromSelection(QObject*))); - currentSelection.append(obj); - } - } - } - - currentTool->updateSelectedItems(); -} - -void QDeclarativeViewInspectorPrivate::setSelectedItems(QList items) -{ - QList > oldList = currentSelection; - setSelectedItemsForTools(items); - if (oldList != currentSelection) { - QList objectList; - foreach (const QWeakPointer &graphicsObject, currentSelection) { - if (graphicsObject) - objectList << graphicsObject.data(); - } - - debugService->setCurrentObjects(objectList); - } -} - -QList QDeclarativeViewInspectorPrivate::selectedItems() -{ - QList selection; - foreach (const QWeakPointer &selectedObject, currentSelection) { - if (selectedObject.data()) - selection << selectedObject.data(); - } - - return selection; -} - -void QDeclarativeViewInspector::setSelectedItems(QList items) -{ - data->setSelectedItems(items); -} - -QList QDeclarativeViewInspector::selectedItems() -{ - return data->selectedItems(); -} - -QDeclarativeView *QDeclarativeViewInspector::declarativeView() -{ - return data->view; -} - -void QDeclarativeViewInspectorPrivate::clearHighlight() -{ - boundingRectHighlighter->clear(); -} - -void QDeclarativeViewInspectorPrivate::highlight(const QList &items) -{ - if (items.isEmpty()) - return; - - QList objectList; - foreach (QGraphicsItem *item, items) { - QGraphicsItem *child = item; - - if (child) { - QGraphicsObject *childObject = child->toGraphicsObject(); - if (childObject) - objectList << childObject; - } - } - - boundingRectHighlighter->highlight(objectList); -} - -QList QDeclarativeViewInspectorPrivate::selectableItems( - const QPointF &scenePos) const -{ - QList itemlist = view->scene()->items(scenePos); - return filterForSelection(itemlist); -} - -QList QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const -{ - QList itemlist = view->items(pos); - return filterForSelection(itemlist); -} - -QList QDeclarativeViewInspectorPrivate::selectableItems( - const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const -{ - QList itemlist = view->scene()->items(sceneRect, selectionMode); - return filterForSelection(itemlist); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool() -{ - currentToolMode = Constants::SelectionToolMode; - selectionTool->setRubberbandSelectionMode(false); - - changeToSelectTool(); - - emit q->selectToolActivated(); - debugService->setCurrentTool(Constants::SelectionToolMode); -} - -void QDeclarativeViewInspectorPrivate::changeToSelectTool() -{ - if (currentTool == selectionTool) - return; - - currentTool->clear(); - currentTool = selectionTool; - currentTool->clear(); - currentTool->updateSelectedItems(); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool() -{ - changeToSelectTool(); - currentToolMode = Constants::MarqueeSelectionToolMode; - selectionTool->setRubberbandSelectionMode(true); - - emit q->marqueeSelectToolActivated(); - debugService->setCurrentTool(Constants::MarqueeSelectionToolMode); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool() -{ - currentToolMode = Constants::ZoomMode; - currentTool->clear(); - currentTool = zoomTool; - currentTool->clear(); - - emit q->zoomToolActivated(); - debugService->setCurrentTool(Constants::ZoomMode); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool() -{ - if (currentTool == colorPickerTool) - return; - - currentToolMode = Constants::ColorPickerMode; - currentTool->clear(); - currentTool = colorPickerTool; - currentTool->clear(); - - emit q->colorPickerActivated(); - debugService->setCurrentTool(Constants::ColorPickerMode); -} - -void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor) -{ - Q_ASSERT(slowDownFactor > 0); - if (data->slowDownFactor == slowDownFactor) - return; - - animationSpeedChangeRequested(slowDownFactor); - data->debugService->setAnimationSpeed(slowDownFactor); -} - -void QDeclarativeViewInspector::setAnimationPaused(bool paused) -{ - if (data->animationPaused == paused) - return; - - animationPausedChangeRequested(paused); - data->debugService->setAnimationPaused(paused); -} - -void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor) -{ - if (data->slowDownFactor != factor) { - data->slowDownFactor = factor; - emit animationSpeedChanged(factor); - } - - const float effectiveFactor = data->animationPaused ? 0 : factor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); -} - -void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused) -{ - if (data->animationPaused != paused) { - data->animationPaused = paused; - emit animationPausedChanged(paused); - } - - const float effectiveFactor = paused ? 0 : data->slowDownFactor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); -} - - -void QDeclarativeViewInspectorPrivate::_q_applyChangesFromClient() -{ -} - - -QList QDeclarativeViewInspectorPrivate::filterForSelection( - QList &itemlist) const -{ - foreach (QGraphicsItem *item, itemlist) { - if (isEditorItem(item)) - itemlist.removeOne(item); - } - - return itemlist; -} - -bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const -{ - return (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType - || item->data(Constants::EditorItemDataKey).toBool()); -} - -void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status) -{ - if (status == QDeclarativeView::Ready) - debugService->reloaded(); -} - -void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList objects) -{ - QList items; - QList gfxObjects; - foreach (QObject *obj, objects) { - if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { - items << declarativeItem; - gfxObjects << declarativeItem; - } - } - if (designModeBehavior) { - setSelectedItemsForTools(items); - clearHighlight(); - highlight(gfxObjects); - } -} - -QString QDeclarativeViewInspector::idStringForObject(QObject *obj) -{ - return QDeclarativeInspectorService::instance()->idStringForObject(obj); -} - -// adjusts bounding boxes on edges of screen to be visible -QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) -{ - int marginFromEdge = 1; - QRectF boundingRect(boundingRectInSceneSpace); - if (qAbs(boundingRect.left()) - 1 < 2) - boundingRect.setLeft(marginFromEdge); - - QRect rect = data->view->rect(); - - if (boundingRect.right() >= rect.right()) - boundingRect.setRight(rect.right() - marginFromEdge); - - if (qAbs(boundingRect.top()) - 1 < 2) - boundingRect.setTop(marginFromEdge); - - if (boundingRect.bottom() >= rect.bottom()) - boundingRect.setBottom(rect.bottom() - marginFromEdge); - - return boundingRect; -} - -void QDeclarativeViewInspectorPrivate::createToolBox() -{ - toolBox = new ToolBox(q->declarativeView()); - - QmlToolBar *toolBar = toolBox->toolBar(); - - QObject::connect(q, SIGNAL(selectedColorChanged(QColor)), - toolBar, SLOT(setColorBoxColor(QColor))); - - QObject::connect(q, SIGNAL(designModeBehaviorChanged(bool)), - toolBar, SLOT(setDesignModeBehavior(bool))); - - QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)), - q, SLOT(setDesignModeBehavior(bool))); - QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), q, SLOT(setAnimationSpeed(qreal))); - QObject::connect(toolBar, SIGNAL(animationPausedChanged(bool)), q, SLOT(setAnimationPaused(bool))); - QObject::connect(toolBar, SIGNAL(colorPickerSelected()), this, SLOT(_q_changeToColorPickerTool())); - QObject::connect(toolBar, SIGNAL(zoomToolSelected()), this, SLOT(_q_changeToZoomTool())); - QObject::connect(toolBar, SIGNAL(selectToolSelected()), this, SLOT(_q_changeToSingleSelectTool())); - QObject::connect(toolBar, SIGNAL(marqueeSelectToolSelected()), - this, SLOT(_q_changeToMarqueeSelectTool())); - - QObject::connect(toolBar, SIGNAL(applyChangesFromQmlFileSelected()), - this, SLOT(_q_applyChangesFromClient())); - - QObject::connect(q, SIGNAL(animationSpeedChanged(qreal)), toolBar, SLOT(setAnimationSpeed(qreal))); - QObject::connect(q, SIGNAL(animationPausedChanged(bool)), toolBar, SLOT(setAnimationPaused(bool))); - - QObject::connect(q, SIGNAL(selectToolActivated()), toolBar, SLOT(activateSelectTool())); - - // disabled features - //connect(d->m_toolBar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient())); - //connect(q, SIGNAL(resizeToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); - //connect(q, SIGNAL(moveToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); - - QObject::connect(q, SIGNAL(colorPickerActivated()), toolBar, SLOT(activateColorPicker())); - QObject::connect(q, SIGNAL(zoomToolActivated()), toolBar, SLOT(activateZoom())); - QObject::connect(q, SIGNAL(marqueeSelectToolActivated()), - toolBar, SLOT(activateMarqueeSelectTool())); -} - -} // namespace QmlJSDebugger - -#include "qdeclarativeviewinspector.moc" -#include "qdeclarativeviewinspector_p.moc" diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.h b/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.h deleted file mode 100644 index 0e95b80..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewinspector_p.h +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEVIEWINSPECTOR_P_H -#define QDECLARATIVEVIEWINSPECTOR_P_H - -#include -#include -#include - -#include "qdeclarativeviewinspector.h" -#include "qdeclarativeinspectorservice.h" - -namespace QmlJSDebugger { - -class JSDebuggerAgent; -class QDeclarativeViewInspector; -class LiveSelectionTool; -class ZoomTool; -class ColorPickerTool; -class LiveLayerItem; -class BoundingRectHighlighter; -class ToolBox; -class CrumblePath; -class AbstractLiveEditTool; - -class QDeclarativeViewInspectorPrivate : public QObject -{ - Q_OBJECT -public: - QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *); - ~QDeclarativeViewInspectorPrivate(); - - QDeclarativeView *view; - QDeclarativeViewInspector *q; - QDeclarativeInspectorService *debugService; - QWeakPointer viewport; - - QPointF cursorPos; - QList > currentSelection; - - Constants::DesignTool currentToolMode; - AbstractLiveEditTool *currentTool; - - LiveSelectionTool *selectionTool; - ZoomTool *zoomTool; - ColorPickerTool *colorPickerTool; - LiveLayerItem *manipulatorLayer; - - BoundingRectHighlighter *boundingRectHighlighter; - - bool designModeBehavior; - bool showAppOnTop; - - bool animationPaused; - qreal slowDownFactor; - - ToolBox *toolBox; - - void setViewport(QWidget *widget); - - void clearEditorItems(); - void createToolBox(); - void changeToSelectTool(); - QList filterForSelection(QList &itemlist) const; - - QList selectableItems(const QPoint &pos) const; - QList selectableItems(const QPointF &scenePos) const; - QList selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; - - void setSelectedItemsForTools(QList items); - void setSelectedItems(QList items); - QList selectedItems(); - - void changeTool(Constants::DesignTool tool, - Constants::ToolFlags flags = Constants::NoToolFlags); - - void clearHighlight(); - void highlight(const QList &item); - inline void highlight(QGraphicsObject *item) - { highlight(QList() << item); } - - bool isEditorItem(QGraphicsItem *item) const; - -public slots: - void _q_setToolBoxVisible(bool visible); - - void _q_reloadView(); - void _q_onStatusChanged(QDeclarativeView::Status status); - void _q_onCurrentObjectsChanged(QList objects); - void _q_applyChangesFromClient(); - void _q_createQmlObject(const QString &qml, QObject *parent, - const QStringList &imports, const QString &filename = QString(), int order = 0); - void _q_reparentQmlObject(QObject *, QObject *); - void _q_deleteQmlObject(QObject *); - - void _q_changeToSingleSelectTool(); - void _q_changeToMarqueeSelectTool(); - void _q_changeToZoomTool(); - void _q_changeToColorPickerTool(); - void _q_clearComponentCache(); - void _q_removeFromSelection(QObject *); - -public: - static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); } -}; - -class QmlToolBar; - -class ToolBox : public QWidget -{ - Q_OBJECT - -public: - ToolBox(QWidget *parent = 0); - ~ToolBox(); - - QmlToolBar *toolBar() const { return m_toolBar; } - -private: - QSettings m_settings; - QmlToolBar *m_toolBar; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.cpp b/qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.cpp deleted file mode 100644 index 4d1c840..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -#include "qdeclarativeviewobserver.h" -#include "qdeclarativeviewobserver.moc" - diff --git a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.h b/qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.h deleted file mode 100644 index 7621a9e..0000000 --- a/qmldebugcontrol/qmljsdebugger/qdeclarativeviewobserver.h +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEVIEWOBSERVER_H -#define QDECLARATIVEVIEWOBSERVER_H - -#include "qdeclarativeviewinspector.h" - -namespace QmlJSDebugger { - -// Provided for compatibility with QmlApplicationViewer -class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QDeclarativeViewInspector -{ - Q_OBJECT - -public: - explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0) - : QDeclarativeViewInspector(view, parent) - {} -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWOBSERVER_H diff --git a/qmldebugcontrol/qmljsdebugger/qmlinspectorconstants.h b/qmldebugcontrol/qmljsdebugger/qmlinspectorconstants.h deleted file mode 100644 index eb5ac31..0000000 --- a/qmldebugcontrol/qmljsdebugger/qmlinspectorconstants.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QMLINSPECTORCONSTANTS_H -#define QMLINSPECTORCONSTANTS_H - -namespace QmlJSDebugger { -namespace Constants { - -enum DesignTool { - NoTool = 0, - SelectionToolMode = 1, - MarqueeSelectionToolMode = 2, - MoveToolMode = 3, - ResizeToolMode = 4, - ColorPickerMode = 5, - ZoomMode = 6 -}; - -enum ToolFlags { - NoToolFlags = 0, - UseCursorPos = 1 -}; - -static const int DragStartTime = 50; - -static const int DragStartDistance = 20; - -static const double ZoomSnapDelta = 0.04; - -static const int EditorItemDataKey = 1000; - -enum GraphicsItemTypes { - EditorItemType = 0xEAAA, - ResizeHandleItemType = 0xEAEA -}; - - -} // namespace Constants -} // namespace QmlJSDebugger - -#endif // QMLINSPECTORCONSTANTS_H diff --git a/qmldebugcontrol/qmljsdebugger/qmljsdebugger-lib.pri b/qmldebugcontrol/qmljsdebugger/qmljsdebugger-lib.pri deleted file mode 100644 index b3bf465..0000000 --- a/qmldebugcontrol/qmljsdebugger/qmljsdebugger-lib.pri +++ /dev/null @@ -1,18 +0,0 @@ -# This file is part of Qt Creator -# It enables debugging of Qt Quick applications - -QT += declarative script -INCLUDEPATH += $$PWD/include - -symbian { - LIBNAME = QmLJSDebugger.lib -} else { - windows:CONFIG(debug, debug|release) { - LIBNAME = QmlJSDebuggerd - } else { - LIBNAME = QmlJSDebugger - } -} -LIBS += -L$$PWD -l$$LIBNAME - -DEFINES += QMLJSDEBUGGER diff --git a/qmldebugcontrol/qmljsdebugger/qmljsdebugger-src.pri b/qmldebugcontrol/qmljsdebugger/qmljsdebugger-src.pri deleted file mode 100644 index 4e93f43..0000000 --- a/qmldebugcontrol/qmljsdebugger/qmljsdebugger-src.pri +++ /dev/null @@ -1,51 +0,0 @@ -INCLUDEPATH += $$PWD/include - -include($$PWD/protocol/protocol.pri) - -HEADERS += \ - $$PWD/include/jsdebuggeragent.h \ - $$PWD/include/qmljsdebugger_global.h - -SOURCES += \ - $$PWD/jsdebuggeragent.cpp - -HEADERS += \ - $$PWD/include/qdeclarativeviewinspector.h \ - $$PWD/include/qdeclarativeviewobserver.h \ - $$PWD/include/qdeclarativeinspectorservice.h \ - $$PWD/include/qmlinspectorconstants.h \ - $$PWD/editor/abstractliveedittool.h \ - $$PWD/editor/liveselectiontool.h \ - $$PWD/editor/livelayeritem.h \ - $$PWD/editor/livesingleselectionmanipulator.h \ - $$PWD/editor/liverubberbandselectionmanipulator.h \ - $$PWD/editor/liveselectionrectangle.h \ - $$PWD/editor/liveselectionindicator.h \ - $$PWD/editor/boundingrecthighlighter.h \ - $$PWD/editor/subcomponentmasklayeritem.h \ - $$PWD/editor/zoomtool.h \ - $$PWD/editor/colorpickertool.h \ - $$PWD/editor/qmltoolbar.h \ - $$PWD/editor/toolbarcolorbox.h \ - $$PWD/qdeclarativeviewinspector_p.h - -SOURCES += \ - $$PWD/qdeclarativeviewinspector.cpp \ - $$PWD/qdeclarativeinspectorservice.cpp \ - $$PWD/editor/abstractliveedittool.cpp \ - $$PWD/editor/liveselectiontool.cpp \ - $$PWD/editor/livelayeritem.cpp \ - $$PWD/editor/livesingleselectionmanipulator.cpp \ - $$PWD/editor/liverubberbandselectionmanipulator.cpp \ - $$PWD/editor/liveselectionrectangle.cpp \ - $$PWD/editor/liveselectionindicator.cpp \ - $$PWD/editor/boundingrecthighlighter.cpp \ - $$PWD/editor/subcomponentmasklayeritem.cpp \ - $$PWD/editor/zoomtool.cpp \ - $$PWD/editor/colorpickertool.cpp \ - $$PWD/editor/qmltoolbar.cpp \ - $$PWD/editor/toolbarcolorbox.cpp - -RESOURCES += $$PWD/editor/editor.qrc - -DEFINES += QMLJSDEBUGGER diff --git a/qmldebugcontrol/qmljsdebugger/qmljsdebugger.pro b/qmldebugcontrol/qmljsdebugger/qmljsdebugger.pro deleted file mode 100644 index a6d841e..0000000 --- a/qmldebugcontrol/qmljsdebugger/qmljsdebugger.pro +++ /dev/null @@ -1,18 +0,0 @@ -# This file is part of Qt Creator -# It enables debugging of Qt Quick applications - -TEMPLATE = lib -CONFIG += staticlib -QT += declarative script - -DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB - -unix:QMAKE_CXXFLAGS_DEBUG += -O3 - -DESTDIR = $$PWD -TARGET=QmlJSDebugger -CONFIG(debug, debug|release) { - windows:TARGET=QmlJSDebuggerd -} - -include(qmljsdebugger-src.pri) diff --git a/qmldebugcontrol/qmljsdebugger/qmljsdebugger_global.h b/qmldebugcontrol/qmljsdebugger/qmljsdebugger_global.h deleted file mode 100644 index 19f65f7..0000000 --- a/qmldebugcontrol/qmljsdebugger/qmljsdebugger_global.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QMLJSDEBUGGER_GLOBAL_H -#define QMLJSDEBUGGER_GLOBAL_H - -#include - -# if defined(BUILD_QMLJSDEBUGGER_LIB) -# define QMLJSDEBUGGER_EXPORT Q_DECL_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -# elif defined(BUILD_QMLJSDEBUGGER_STATIC_LIB) -# define QMLJSDEBUGGER_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -# else -# define QMLJSDEBUGGER_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -#endif - -#endif // QMLJSDEBUGGER_GLOBAL_H diff --git a/qmldebugcontrol/qmlprofiler.pro b/qmldebugcontrol/qmlprofiler.pro deleted file mode 100644 index 69ed6b3..0000000 --- a/qmldebugcontrol/qmlprofiler.pro +++ /dev/null @@ -1,65 +0,0 @@ -TEMPLATE = lib -TARGET = QmlProfiler - -DEFINES += PROFILER_LIBRARY - -include(../../qtcreatorplugin.pri) -include(../../plugins/coreplugin/coreplugin.pri) -include(../../plugins/analyzerbase/analyzerbase.pri) -include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri) -include(../../plugins/qt4projectmanager/qt4projectmanager.pri) -include(../../plugins/remotelinux/remotelinux.pri) -include(../../libs/qmljsdebugclient/qmljsdebugclient-lib.pri) -include(../../libs/extensionsystem/extensionsystem.pri) - -QT += network script declarative - -include(canvas/canvas.pri) - -SOURCES += \ - qmlprofilerplugin.cpp \ - qmlprofilertool.cpp \ - qmlprofilerengine.cpp \ - tracewindow.cpp \ - timelineview.cpp \ - qmlprofilerattachdialog.cpp \ - localqmlprofilerrunner.cpp \ - codaqmlprofilerrunner.cpp \ - remotelinuxqmlprofilerrunner.cpp \ - qmlprofilertraceclient.cpp \ - qmlprofilereventview.cpp \ - qmlprofilerruncontrolfactory.cpp - -HEADERS += \ - qmlprofilerconstants.h \ - qmlprofiler_global.h \ - qmlprofilerplugin.h \ - qmlprofilertool.h \ - qmlprofilerengine.h \ - tracewindow.h \ - timelineview.h \ - qmlprofilerattachdialog.h \ - abstractqmlprofilerrunner.h \ - localqmlprofilerrunner.h \ - codaqmlprofilerrunner.h \ - remotelinuxqmlprofilerrunner.h \ - qmlprofilertraceclient.h \ - qmlprofilereventview.h \ - qmlprofilereventtypes.h \ - qmlprofilerruncontrolfactory.h - -RESOURCES += \ - qml/qml.qrc - -OTHER_FILES += \ - qml/Detail.qml \ - qml/Elapsed.qml \ - qml/Label.qml \ - qml/MainView.qml \ - qml/RangeDetails.qml \ - qml/RangeMover.qml \ - qml/MainView.js \ - qml/TimeDisplay.qml - -FORMS += \ - qmlprofilerattachdialog.ui diff --git a/qmldebugcontrol/qmlprofiler_global.h b/qmldebugcontrol/qmlprofiler_global.h deleted file mode 100644 index a241f06..0000000 --- a/qmldebugcontrol/qmlprofiler_global.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILER_GLOBAL_H -#define QMLPROFILER_GLOBAL_H - -#include - -#if defined(QMLPROFILERPLUGIN_LIBRARY) -# define QMLPROFILERPLUGINSHARED_EXPORT Q_DECL_EXPORT -#else -# define QMLPROFILERPLUGINSHARED_EXPORT Q_DECL_IMPORT -#endif - -#endif // QMLPROFILER_GLOBAL_H - diff --git a/qmldebugcontrol/qmlprofilerattachdialog.cpp b/qmldebugcontrol/qmlprofilerattachdialog.cpp deleted file mode 100644 index a5f52a1..0000000 --- a/qmldebugcontrol/qmlprofilerattachdialog.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilerattachdialog.h" -#include "ui_qmlprofilerattachdialog.h" - -namespace QmlProfiler { -namespace Internal { - -QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::QmlProfilerAttachDialog) -{ - ui->setupUi(this); -} - -QmlProfilerAttachDialog::~QmlProfilerAttachDialog() -{ - delete ui; -} - -QString QmlProfilerAttachDialog::address() const -{ - return ui->addressLineEdit->text(); -} - -uint QmlProfilerAttachDialog::port() const -{ - return ui->portSpinBox->value(); -} - -void QmlProfilerAttachDialog::setAddress(const QString &address) -{ - ui->addressLineEdit->setText(address); -} - -void QmlProfilerAttachDialog::setPort(uint port) -{ - ui->portSpinBox->setValue(port); -} - -} // namespace Internal -} // namespace QmlProfiler diff --git a/qmldebugcontrol/qmlprofilerattachdialog.h b/qmldebugcontrol/qmlprofilerattachdialog.h deleted file mode 100644 index 400e4d8..0000000 --- a/qmldebugcontrol/qmlprofilerattachdialog.h +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERATTACHDIALOG_H -#define QMLPROFILERATTACHDIALOG_H - -#include - -namespace QmlProfiler { -namespace Internal { - -namespace Ui { - class QmlProfilerAttachDialog; -} - -class QmlProfilerAttachDialog : public QDialog -{ - Q_OBJECT - -public: - explicit QmlProfilerAttachDialog(QWidget *parent = 0); - ~QmlProfilerAttachDialog(); - - QString address() const; - uint port() const; - - void setAddress(const QString &address); - void setPort(uint port); - -private: - Ui::QmlProfilerAttachDialog *ui; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERATTACHDIALOG_H diff --git a/qmldebugcontrol/qmlprofilerattachdialog.ui b/qmldebugcontrol/qmlprofilerattachdialog.ui deleted file mode 100644 index 5bae9fe..0000000 --- a/qmldebugcontrol/qmlprofilerattachdialog.ui +++ /dev/null @@ -1,109 +0,0 @@ - - - QmlProfiler::Internal::QmlProfilerAttachDialog - - - - 0 - 0 - 164 - 96 - - - - Dialog - - - - - - - - Address: - - - - - - - 127.0.0.1 - - - - - - - Port: - - - - - - - 1 - - - 65535 - - - 3768 - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - QmlProfiler::Internal::QmlProfilerAttachDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - QmlProfiler::Internal::QmlProfilerAttachDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/qmldebugcontrol/qmlprofilerconstants.h b/qmldebugcontrol/qmlprofilerconstants.h deleted file mode 100644 index 0a21fd7..0000000 --- a/qmldebugcontrol/qmlprofilerconstants.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERCONSTANTS_H -#define QMLPROFILERCONSTANTS_H - -namespace QmlProfiler { -namespace Constants { - -const char * const ATTACH = "Menu.Analyzer.Attach"; - -} // namespace Constants -} // namespace QmlProfiler - -#endif // QMLPROFILERCONSTANTS_H diff --git a/qmldebugcontrol/qmlprofilerengine.cpp b/qmldebugcontrol/qmlprofilerengine.cpp deleted file mode 100644 index 27f3405..0000000 --- a/qmldebugcontrol/qmlprofilerengine.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilerengine.h" - -#include "canvas/qdeclarativecanvas_p.h" -#include "canvas/qdeclarativecontext2d_p.h" -#include "canvas/qdeclarativetiledcanvas_p.h" -#include "codaqmlprofilerrunner.h" -#include "localqmlprofilerrunner.h" -#include "remotelinuxqmlprofilerrunner.h" -#include "qmlprofilerplugin.h" -#include "qmlprofilertool.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace Analyzer; -using namespace ProjectExplorer; - -namespace QmlProfiler { -namespace Internal { - -// -// QmlProfilerEnginePrivate -// - -class QmlProfilerEngine::QmlProfilerEnginePrivate -{ -public: - QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {} - ~QmlProfilerEnginePrivate() {} - - bool attach(const QString &address, uint port); - static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration, - QObject *parent); - - QmlProfilerEngine *q; - - //AnalyzerStartParameters m_params; - AbstractQmlProfilerRunner *m_runner; - bool m_running; - bool m_fetchingData; - bool m_delayedDelete; -}; - -AbstractQmlProfilerRunner * -QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *runConfiguration, - QObject *parent) -{ - AbstractQmlProfilerRunner *runner = 0; - if (QmlProjectManager::QmlProjectRunConfiguration *rc1 = - qobject_cast(runConfiguration)) { - // This is a "plain" .qmlproject. - LocalQmlProfilerRunner::Configuration conf; - conf.executable = rc1->observerPath(); - conf.executableArguments = rc1->viewerArguments(); - conf.workingDirectory = rc1->workingDirectory(); - conf.environment = rc1->environment(); - conf.port = rc1->qmlDebugServerPort(); - runner = new LocalQmlProfilerRunner(conf, parent); - } else if (LocalApplicationRunConfiguration *rc2 = - qobject_cast(runConfiguration)) { - // FIXME: Check. - LocalQmlProfilerRunner::Configuration conf; - conf.executable = rc2->executable(); - conf.executableArguments = rc2->commandLineArguments(); - conf.workingDirectory = rc2->workingDirectory(); - conf.environment = rc2->environment(); - conf.port = rc2->qmlDebugServerPort(); - runner = new LocalQmlProfilerRunner(conf, parent); - } else if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config = - qobject_cast(runConfiguration)) { - runner = new CodaQmlProfilerRunner(s60Config, parent); - } else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig = - qobject_cast(runConfiguration)) { - runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent); - } else { - QTC_ASSERT(false, /**/); - } - return runner; -} - -// -// QmlProfilerEngine -// - -QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool, - ProjectExplorer::RunConfiguration *runConfiguration) - : IAnalyzerEngine(tool, runConfiguration) - , d(new QmlProfilerEnginePrivate(this)) -{ - d->m_running = false; - d->m_fetchingData = false; - d->m_delayedDelete = false; -} - -QmlProfilerEngine::~QmlProfilerEngine() -{ - if (d->m_running) - stop(); - delete d; -} - -void QmlProfilerEngine::start() -{ - QTC_ASSERT(!d->m_runner, return); - d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this); - - - connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped())); - connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), - this, SLOT(logApplicationMessage(QString,Utils::OutputFormat))); - - d->m_runner->start(); - - d->m_running = true; - d->m_delayedDelete = false; - - AnalyzerManager::handleToolStarted(); -} - -void QmlProfilerEngine::stop() -{ - if (d->m_fetchingData) { - if (d->m_running) - d->m_delayedDelete = true; - // will result in dataReceived() call - emit stopRecording(); - } else { - finishProcess(); - } -} - -void QmlProfilerEngine::stopped() -{ - d->m_running = false; - AnalyzerManager::stopTool(); // FIXME: Needed? - emit finished(); -} - -void QmlProfilerEngine::setFetchingData(bool b) -{ - d->m_fetchingData = b; -} - -void QmlProfilerEngine::dataReceived() -{ - if (d->m_delayedDelete) - finishProcess(); - d->m_delayedDelete = false; -} - -void QmlProfilerEngine::finishProcess() -{ - // user stop? - if (d->m_running) { - d->m_running = false; - d->m_runner->stop(); - emit finished(); - } -} - -void QmlProfilerEngine::filterApplicationMessage(const QString &msg) -{ - static const QString qddserver = QLatin1String("QDeclarativeDebugServer: "); - static const QString cannotRetrieveDebuggingOutput = ProjectExplorer::ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput(); - - const int index = msg.indexOf(qddserver); - if (index != -1) { - QString status = msg; - status.remove(0, index + qddserver.length()); // chop of 'QDeclarativeDebugServer: ' - - static QString waitingForConnection = QLatin1String("Waiting for connection "); - static QString unableToListen = QLatin1String("Unable to listen "); - static QString debuggingNotEnabled = QLatin1String("Ignoring \"-qmljsdebugger="); - static QString debuggingNotEnabled2 = QLatin1String("Ignoring\"-qmljsdebugger="); // There is (was?) a bug in one of the error strings - safest to handle both - static QString connectionEstablished = QLatin1String("Connection established"); - - QString errorMessage; - if (status.startsWith(waitingForConnection)) { - emit processRunning(d->m_runner->debugPort()); - } else if (status.startsWith(unableToListen)) { - //: Error message shown after 'Could not connect ... debugger:" - errorMessage = tr("The port seems to be in use."); - } else if (status.startsWith(debuggingNotEnabled) || status.startsWith(debuggingNotEnabled2)) { - //: Error message shown after 'Could not connect ... debugger:" - errorMessage = tr("The application is not set up for QML/JS debugging."); - } else if (status.startsWith(connectionEstablished)) { - // nothing to do - } else { - qWarning() << "Unknown QDeclarativeDebugServer status message: " << status; - } - - if (!errorMessage.isEmpty()) { - Core::ICore * const core = Core::ICore::instance(); - QMessageBox *infoBox = new QMessageBox(core->mainWindow()); - infoBox->setIcon(QMessageBox::Critical); - infoBox->setWindowTitle(tr("Qt Creator")); - //: %1 is detailed error message - infoBox->setText(tr("Could not connect to the in-process QML debugger:\n%1") - .arg(errorMessage)); - infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help); - infoBox->setDefaultButton(QMessageBox::Ok); - infoBox->setModal(true); - - connect(infoBox, SIGNAL(finished(int)), - this, SLOT(wrongSetupMessageBoxFinished(int))); - - infoBox->show(); - } - } else if (msg.contains(cannotRetrieveDebuggingOutput)) { - // we won't get debugging output, so just try to connect ... - emit processRunning(d->m_runner->debugPort()); - } -} - -void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputFormat format) -{ - emit outputReceived(msg, format); - - filterApplicationMessage(msg); -} - -void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button) -{ - if (button == QMessageBox::Help) { - Core::HelpManager *helpManager = Core::HelpManager::instance(); - helpManager->handleHelpRequest("creator-qml-performance-monitor.html"); - } -} - -} // namespace Internal -} // namespace QmlProfiler diff --git a/qmldebugcontrol/qmlprofilerengine.h b/qmldebugcontrol/qmlprofilerengine.h deleted file mode 100644 index 02dceaf..0000000 --- a/qmldebugcontrol/qmlprofilerengine.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERENGINE_H -#define QMLPROFILERENGINE_H - -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerEngine : public Analyzer::IAnalyzerEngine -{ - Q_OBJECT - -public: - QmlProfilerEngine(Analyzer::IAnalyzerTool *tool, - ProjectExplorer::RunConfiguration *runConfiguration); - ~QmlProfilerEngine(); - -signals: - void processRunning(int port); - void stopRecording(); - -public slots: - void start(); - void stop(); - -private slots: - void stopped(); - - void setFetchingData(bool); - void dataReceived(); - void finishProcess(); - void logApplicationMessage(const QString &msg, Utils::OutputFormat format); - void filterApplicationMessage(const QString &msg); - void wrongSetupMessageBoxFinished(int); - -private: - class QmlProfilerEnginePrivate; - QmlProfilerEnginePrivate *d; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERENGINE_H diff --git a/qmldebugcontrol/qmlprofilereventtypes.h b/qmldebugcontrol/qmlprofilereventtypes.h deleted file mode 100644 index 1739f90..0000000 --- a/qmldebugcontrol/qmlprofilereventtypes.h +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILEREVENTTYPES_H -#define QMLPROFILEREVENTTYPES_H - -namespace QmlProfiler { -namespace Internal { - -enum QmlEventType { - Painting, - Compiling, - Creating, - Binding, - HandlingSignal, - - MaximumQmlEventType -}; - -} -} - -#endif //QMLPROFILEREVENTTYPES_H diff --git a/qmldebugcontrol/qmlprofilereventview.cpp b/qmldebugcontrol/qmlprofilereventview.cpp deleted file mode 100644 index c0e965b..0000000 --- a/qmldebugcontrol/qmlprofilereventview.cpp +++ /dev/null @@ -1,545 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilereventview.h" - -#include -#include - -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class EventsViewItem : public QStandardItem -{ -public: - EventsViewItem(const QString &text) : QStandardItem(text) {} - - virtual bool operator<(const QStandardItem &other) const - { - if (data().type() == QVariant::String) { - // first column - return data(FilenameRole).toString() == other.data(FilenameRole).toString() ? - data(LineRole).toInt() < other.data(LineRole).toInt() : - data(FilenameRole).toString() < other.data(FilenameRole).toString(); - } - - return data().toDouble() < other.data().toDouble(); - } -}; - - -//////////////////////////////////////////////////////////////////////////////////// - -class QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate -{ -public: - QmlProfilerEventStatisticsPrivate(QmlProfilerEventStatistics *qq) : q(qq) {} - - void postProcess(); - - QmlProfilerEventStatistics *q; - QmlEventHash m_rootHash; - QHash m_pendingEvents; - int m_lastLevel; -}; - - -//////////////////////////////////////////////////////////////////////////////////// - -class QmlProfilerEventsView::QmlProfilerEventsViewPrivate -{ -public: - QmlProfilerEventsViewPrivate(QmlProfilerEventsView *qq) : q(qq) {} - - void buildModelFromList(const QmlEventList &list, QStandardItem *parentItem, const QmlEventList &visitedFunctionsList = QmlEventList() ); - int getFieldCount(); - QString displayTime(double time) const; - QString nameForType(int typeNumber) const; - - - QmlProfilerEventsView *q; - - QmlProfilerEventStatistics *m_eventStatistics; - QStandardItemModel *m_model; - QList m_fieldShown; - bool m_showAnonymous; - int m_firstNumericColumn; -}; - - -//////////////////////////////////////////////////////////////////////////////////// - -QmlProfilerEventStatistics::QmlProfilerEventStatistics(QObject *parent) : - QObject(parent), d(new QmlProfilerEventStatisticsPrivate(this)) -{ - setObjectName("QmlProfilerEventStatistics"); - d->m_lastLevel = -1; -} - -QmlProfilerEventStatistics::~QmlProfilerEventStatistics() -{ - clear(); -} - -void QmlProfilerEventStatistics::clear() -{ - foreach (int levelNumber, d->m_pendingEvents.keys()) - d->m_pendingEvents[levelNumber].clear(); - - d->m_lastLevel = -1; - - foreach (QmlEventData *binding, d->m_rootHash.values()) - delete binding; - d->m_rootHash.clear(); -} - -QList QmlProfilerEventStatistics::getEventList() -{ - return d->m_rootHash.values(); -} - -void QmlProfilerEventStatistics::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line) -{ - Q_UNUSED(startTime); - Q_UNUSED(nestingInType); - - const QChar colon = QLatin1Char(':'); - QString localName, displayName, location, details; - - if (data.isEmpty()) - details = tr("Source code not available"); - else { - details = data.join(" ").replace('\n'," ").simplified(); - QRegExp rewrite("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)"); - bool match = rewrite.exactMatch(details); - if (match) { - details = rewrite.cap(1) + ": " + rewrite.cap(3); - } - if (details.startsWith(QString("file://"))) - details = details.mid(details.lastIndexOf(QChar('/')) + 1); - } - - if (fileName.isEmpty()) { - displayName = tr(""); - location = QString("--:%1:%2").arg(QString::number(type), details); - } else { - localName = QUrl(fileName).toLocalFile(); - displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line); - location = fileName+colon+QString::number(line); - } - - - // New Data: if it's not in the hash, put it there - // if it's in the hash, get the reference from the hash - QmlEventData *newBinding; - QmlEventHash::iterator it = d->m_rootHash.find(location); - if (it != d->m_rootHash.end()) { - newBinding = it.value(); - newBinding->duration += length; - newBinding->calls++; - if (newBinding->maxTime < length) - newBinding->maxTime = length; - if (newBinding->minTime > length) - newBinding->minTime = length; - } else { - newBinding = new QmlEventData; - newBinding->calls = 1; - newBinding->duration = length; - newBinding->displayname = new QString(displayName); - newBinding->filename = new QString(fileName); - newBinding->location = new QString(location); - newBinding->line = line; - newBinding->minTime = length; - newBinding->maxTime = length; - newBinding->level = nestingLevel; - newBinding->eventType = (QmlEventType)type; - newBinding->details = new QString(details); - newBinding->parentList = new QmlEventList(); - newBinding->childrenList = new QmlEventList(); - d->m_rootHash.insert(location, newBinding); - } - - if (nestingLevel < d->m_lastLevel) { - // I'm the parent of the former - if (d->m_pendingEvents.contains(nestingLevel+1)) { - foreach (QmlEventData *child, d->m_pendingEvents[nestingLevel + 1]) { - if (!newBinding->childrenList->contains(child)) - newBinding->childrenList->append(child); - if (!child->parentList->contains(newBinding)) - child->parentList->append(newBinding); - } - d->m_pendingEvents[nestingLevel + 1].clear(); - } - - } - - if (nestingLevel > 1 && !d->m_pendingEvents[nestingLevel].contains(newBinding)) { - // I'm not root... there will come a parent later - d->m_pendingEvents[nestingLevel].append(newBinding); - } - - d->m_lastLevel = nestingLevel; -} - -void QmlProfilerEventStatistics::complete() -{ - d->postProcess(); - emit dataReady(); -} - -void QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate::postProcess() -{ - double totalTime = 0; - - foreach (QmlEventData *binding, m_rootHash.values()) - totalTime += binding->duration; - - foreach (QmlEventData *binding, m_rootHash.values()) { - binding->percentOfTime = binding->duration * 100.0 / totalTime; - binding->timePerCall = binding->calls > 0 ? double(binding->duration) / binding->calls : 0; - } -} - -//////////////////////////////////////////////////////////////////////////////////// - -QmlProfilerEventsView::QmlProfilerEventsView(QWidget *parent, QmlProfilerEventStatistics *model) : - QTreeView(parent), d(new QmlProfilerEventsViewPrivate(this)) -{ - setObjectName("QmlProfilerEventsView"); - header()->setResizeMode(QHeaderView::Interactive); - header()->setDefaultSectionSize(100); - header()->setMinimumSectionSize(50); - setSortingEnabled(false); - setFrameStyle(QFrame::NoFrame); - - d->m_model = new QStandardItemModel(this); - setModel(d->m_model); - connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); - - d->m_eventStatistics = 0; - setEventStatisticsModel(model); - - d->m_showAnonymous = false; - d->m_firstNumericColumn = 0; - - // default view - setViewType(EventsView); -} - -QmlProfilerEventsView::~QmlProfilerEventsView() -{ - clear(); - delete d->m_model; -} - -void QmlProfilerEventsView::setEventStatisticsModel( QmlProfilerEventStatistics *model ) -{ - if (d->m_eventStatistics) - disconnect(d->m_eventStatistics,SIGNAL(dataReady()),this,SLOT(buildModel())); - d->m_eventStatistics = model; - connect(d->m_eventStatistics,SIGNAL(dataReady()),this,SLOT(buildModel())); -} - -void QmlProfilerEventsView::setFieldViewable(Fields field, bool show) -{ - if (field < MaxFields) { - int length = d->m_fieldShown.count(); - if (field >= length) { - for (int i=length; im_fieldShown << false; - } - d->m_fieldShown[field] = show; - } -} - -void QmlProfilerEventsView::setViewType(ViewTypes type) -{ - switch (type) { - case EventsView: { - setObjectName("QmlProfilerEventsView"); - setFieldViewable(Name, true); - setFieldViewable(Type, true); - setFieldViewable(Percent, true); - setFieldViewable(TotalDuration, true); - setFieldViewable(CallCount, true); - setFieldViewable(TimePerCall, true); - setFieldViewable(MaxTime, true); - setFieldViewable(MinTime, true); - setFieldViewable(Details, false); - setFieldViewable(Parents, false); - setFieldViewable(Children, false); - setShowAnonymousEvents(false); - break; - } - case CallersView: { - setObjectName("QmlProfilerCallersView"); - setFieldViewable(Name, true); - setFieldViewable(Type, true); - setFieldViewable(Percent, false); - setFieldViewable(TotalDuration, false); - setFieldViewable(CallCount, false); - setFieldViewable(TimePerCall, false); - setFieldViewable(MaxTime, false); - setFieldViewable(MinTime, false); - setFieldViewable(Details, true); - setFieldViewable(Parents, true); - setFieldViewable(Children, false); - setShowAnonymousEvents(true); - break; - } - case CalleesView: { - setObjectName("QmlProfilerCalleesView"); - setFieldViewable(Name, true); - setFieldViewable(Type, true); - setFieldViewable(Percent, false); - setFieldViewable(TotalDuration, false); - setFieldViewable(CallCount, false); - setFieldViewable(TimePerCall, false); - setFieldViewable(MaxTime, false); - setFieldViewable(MinTime, false); - setFieldViewable(Details, true); - setFieldViewable(Parents, false); - setFieldViewable(Children, true); - setShowAnonymousEvents(true); - break; - } - default: break; - } - - buildModel(); -} - -void QmlProfilerEventsView::setShowAnonymousEvents( bool showThem ) -{ - d->m_showAnonymous = showThem; -} - -void QmlProfilerEventsView::setHeaderLabels() -{ - int fieldIndex = 0; - d->m_firstNumericColumn = 0; - - if (d->m_fieldShown[Name]) { - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location"))); - d->m_firstNumericColumn++; - } - if (d->m_fieldShown[Type]) { - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type"))); - d->m_firstNumericColumn++; - } - if (d->m_fieldShown[Percent]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent"))); - if (d->m_fieldShown[TotalDuration]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time"))); - if (d->m_fieldShown[CallCount]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls"))); - if (d->m_fieldShown[TimePerCall]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time per Call"))); - if (d->m_fieldShown[MaxTime]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time"))); - if (d->m_fieldShown[MinTime]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time"))); - if (d->m_fieldShown[Details]) - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details"))); -} - -void QmlProfilerEventsView::clear() -{ - d->m_model->clear(); - d->m_model->setColumnCount(d->getFieldCount()); - - setHeaderLabels(); - setSortingEnabled(false); -} - -int QmlProfilerEventsView::QmlProfilerEventsViewPrivate::getFieldCount() -{ - int count = 0; - for (int i=0; i < m_fieldShown.count(); ++i) - if (m_fieldShown[i] && i != Parents && i != Children) - count++; - return count; -} - -void QmlProfilerEventsView::buildModel() -{ - if (d->m_eventStatistics) { - clear(); - d->buildModelFromList( d->m_eventStatistics->getEventList(), d->m_model->invisibleRootItem() ); - - bool hasBranches = d->m_fieldShown[Parents] || d->m_fieldShown[Children]; - setRootIsDecorated(hasBranches); - - setSortingEnabled(!hasBranches); - - if (!hasBranches) - sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder); - - expandAll(); - if (d->m_fieldShown[Name]) - resizeColumnToContents(0); - - if (d->m_fieldShown[Type]) - resizeColumnToContents(d->m_fieldShown[Name]?1:0); - collapseAll(); - } -} - -void QmlProfilerEventsView::QmlProfilerEventsViewPrivate::buildModelFromList( const QmlEventList &list, QStandardItem *parentItem, const QmlEventList &visitedFunctionsList ) -{ - foreach (QmlEventData *binding, list) { - if (visitedFunctionsList.contains(binding)) - continue; - - if ((!m_showAnonymous) && binding->filename->isEmpty()) - continue; - - QList newRow; - if (m_fieldShown[Name]) { - newRow << new EventsViewItem(*binding->displayname); - } - - if (m_fieldShown[Type]) { - newRow << new EventsViewItem(nameForType(binding->eventType)); - newRow.last()->setData(QVariant(binding->eventType)); - } - - if (m_fieldShown[Percent]) { - newRow << new EventsViewItem(QString::number(binding->percentOfTime,'f',2)+QLatin1String(" %")); - newRow.last()->setData(QVariant(binding->eventType)); - } - - if (m_fieldShown[TotalDuration]) { - newRow << new EventsViewItem(displayTime(binding->duration)); - newRow.last()->setData(QVariant(binding->duration)); - } - - if (m_fieldShown[CallCount]) { - newRow << new EventsViewItem(QString::number(binding->calls)); - newRow.last()->setData(QVariant(binding->calls)); - } - - if (m_fieldShown[TimePerCall]) { - newRow << new EventsViewItem(displayTime(binding->timePerCall)); - newRow.last()->setData(QVariant(binding->timePerCall)); - } - - if (m_fieldShown[MaxTime]) { - newRow << new EventsViewItem(displayTime(binding->maxTime)); - newRow.last()->setData(QVariant(binding->maxTime)); - } - - if (m_fieldShown[MinTime]) { - newRow << new EventsViewItem(displayTime(binding->minTime)); - newRow.last()->setData(QVariant(binding->minTime)); - } - - if (m_fieldShown[Details]) { - newRow << new EventsViewItem(*binding->details); - } - - if (!newRow.isEmpty()) { - // no edit - foreach (QStandardItem *item, newRow) - item->setEditable(false); - - // metadata - newRow.at(0)->setData(QVariant(*binding->location),LocationRole); - newRow.at(0)->setData(QVariant(*binding->filename),FilenameRole); - newRow.at(0)->setData(QVariant(binding->line),LineRole); - - // append - parentItem->appendRow(newRow); - - if (m_fieldShown[Parents] && !binding->parentList->isEmpty()) { - QmlEventList newParentList(visitedFunctionsList); - newParentList.append(binding); - - buildModelFromList(*binding->parentList, newRow.at(0), newParentList); - } - - if (m_fieldShown[Children] && !binding->childrenList->isEmpty()) { - QmlEventList newChildrenList(visitedFunctionsList); - newChildrenList.append(binding); - - buildModelFromList(*binding->childrenList, newRow.at(0), newChildrenList); - } - } - } -} - -QString QmlProfilerEventsView::QmlProfilerEventsViewPrivate::displayTime(double time) const -{ - if (time < 1e6) - return QString::number(time/1e3,'f',3) + QLatin1String(" us"); - if (time < 1e9) - return QString::number(time/1e6,'f',3) + QLatin1String(" ms"); - - return QString::number(time/1e9,'f',3) + QLatin1String(" s"); -} - -QString QmlProfilerEventsView::QmlProfilerEventsViewPrivate::nameForType(int typeNumber) const -{ - switch (typeNumber) { - case 0: return QmlProfilerEventsView::tr("Paint"); - case 1: return QmlProfilerEventsView::tr("Compile"); - case 2: return QmlProfilerEventsView::tr("Create"); - case 3: return QmlProfilerEventsView::tr("Binding"); - case 4: return QmlProfilerEventsView::tr("Signal"); - } - return QString(); -} - -void QmlProfilerEventsView::jumpToItem(const QModelIndex &index) -{ - QStandardItem *clickedItem = d->m_model->itemFromIndex(index); - QStandardItem *infoItem; - if (clickedItem->parent()) - infoItem = clickedItem->parent()->child(clickedItem->row(), 0); - else - infoItem = d->m_model->item(index.row(), 0); - - int line = infoItem->data(LineRole).toInt(); - if (line == -1) - return; - QString fileName = infoItem->data(FilenameRole).toString(); - emit gotoSourceLocation(fileName, line); -} - -} // namespace Internal -} // namespace QmlProfiler - -#include "qmlprofilereventview.moc" diff --git a/qmldebugcontrol/qmlprofilereventview.h b/qmldebugcontrol/qmlprofilereventview.h deleted file mode 100644 index eac510a..0000000 --- a/qmldebugcontrol/qmlprofilereventview.h +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILEREVENTVIEW_H -#define QMLPROFILEREVENTVIEW_H - -#include -#include "qmlprofilereventtypes.h" - -namespace QmlProfiler { -namespace Internal { - -struct QmlEventData -{ - QmlEventData() : displayname(0) , filename(0) , location(0) , details(0), - line(0), eventType(MaximumQmlEventType), level(-1), parentList(0), childrenList(0) {} - ~QmlEventData() { - delete displayname; - delete filename; - delete location; - delete parentList; - delete childrenList; - } - QString *displayname; - QString *filename; - QString *location; - QString *details; - int line; - QmlEventType eventType; - qint64 level; - QList< QmlEventData *> *parentList; - QList< QmlEventData *> *childrenList; - qint64 duration; - qint64 calls; - qint64 minTime; - qint64 maxTime; - double timePerCall; - double percentOfTime; -}; - - -typedef QHash QmlEventHash; -typedef QList QmlEventList; - -enum ItemRole { - LocationRole = Qt::UserRole+1, - FilenameRole = Qt::UserRole+2, - LineRole = Qt::UserRole+3 -}; - -class QmlProfilerEventStatistics : public QObject -{ - Q_OBJECT -public: - - explicit QmlProfilerEventStatistics(QObject *parent = 0); - ~QmlProfilerEventStatistics(); - - QmlEventList getEventList(); - -signals: - void dataReady(); - -public slots: - void clear(); - void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line); - void complete(); - -private: - class QmlProfilerEventStatisticsPrivate; - QmlProfilerEventStatisticsPrivate *d; -}; - -class QmlProfilerEventsView : public QTreeView -{ - Q_OBJECT -public: - enum Fields { - Name, - Type, - Percent, - TotalDuration, - CallCount, - TimePerCall, - MaxTime, - MinTime, - Details, - Parents, - Children, - - MaxFields - }; - - enum ViewTypes { - EventsView, - CallersView, - CalleesView, - - MaxViewTypes - }; - - explicit QmlProfilerEventsView(QWidget *parent, QmlProfilerEventStatistics *model); - ~QmlProfilerEventsView(); - - void setEventStatisticsModel( QmlProfilerEventStatistics *model ); - void setFieldViewable(Fields field, bool show); - void setViewType(ViewTypes type); - void setShowAnonymousEvents( bool showThem ); - -signals: - void gotoSourceLocation(const QString &fileName, int lineNumber); - -public slots: - void clear(); - void jumpToItem(const QModelIndex &index); - void buildModel(); - -private: - void setHeaderLabels(); - -private: - class QmlProfilerEventsViewPrivate; - QmlProfilerEventsViewPrivate *d; - -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILEREVENTVIEW_H diff --git a/qmldebugcontrol/qmlprofilerplugin.cpp b/qmldebugcontrol/qmlprofilerplugin.cpp deleted file mode 100644 index 995a13c..0000000 --- a/qmldebugcontrol/qmlprofilerplugin.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilerplugin.h" - -#include "qmlprofilertool.h" -#include "qmlprofilerruncontrolfactory.h" - -#include - -#include - -using namespace Analyzer; -using namespace QmlProfiler::Internal; - -bool QmlProfilerPlugin::debugOutput = false; - -bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) -{ - Q_UNUSED(arguments) - Q_UNUSED(errorString) - addAutoReleasedObject(new QmlProfilerRunControlFactory()); - StartModes modes; - // They are handled the same actually. - //modes.append(StartMode(StartRemote)); - modes.append(StartMode(StartLocal)); - AnalyzerManager::addTool(new QmlProfilerTool(this), modes); - return true; -} - -void QmlProfilerPlugin::extensionsInitialized() -{ - // Retrieve objects from the plugin manager's object pool. - // "In the extensionsInitialized method, a plugin can be sure that all - // plugins that depend on it are completely initialized." -} - -ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown() -{ - // Save settings. - // Disconnect from signals that are not needed during shutdown - // Hide UI (if you add UI that is not in the main window directly) - return SynchronousShutdown; -} - -Q_EXPORT_PLUGIN(QmlProfilerPlugin) - diff --git a/qmldebugcontrol/qmlprofilerplugin.h b/qmldebugcontrol/qmlprofilerplugin.h deleted file mode 100644 index e6ce2b1..0000000 --- a/qmldebugcontrol/qmlprofilerplugin.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERPLUGIN_H -#define QMLPROFILERPLUGIN_H - -#include "qmlprofiler_global.h" - -#include - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerPlugin : public ExtensionSystem::IPlugin -{ - Q_OBJECT - -public: - QmlProfilerPlugin() {} - - bool initialize(const QStringList &arguments, QString *errorString); - void extensionsInitialized(); - ShutdownFlag aboutToShutdown(); - - static bool debugOutput; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERPLUGIN_H - diff --git a/qmldebugcontrol/qmlprofilerruncontrolfactory.cpp b/qmldebugcontrol/qmlprofilerruncontrolfactory.cpp deleted file mode 100644 index 1b0edfe..0000000 --- a/qmldebugcontrol/qmlprofilerruncontrolfactory.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilerruncontrolfactory.h" -#include "qmlprojectmanager/qmlprojectrunconfiguration.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include - -using namespace Analyzer; -using namespace ProjectExplorer; -using namespace QmlProfiler::Internal; -using namespace QmlProjectManager; - -QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent) - : IRunControlFactory(parent) -{ - setObjectName(QLatin1String("QmlProfilerRunControlFactory")); -} - -bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const -{ - // FIXME: Should this just accept all mode == QLatin1String("QmlProfiler"); ? - if (qobject_cast(runConfiguration)) - return mode == QLatin1String("QmlProfiler"); - if (qobject_cast(runConfiguration)) - return mode == QLatin1String("QmlProfiler"); - if (qobject_cast(runConfiguration)) - return mode == QLatin1String("QmlProfiler"); - if (qobject_cast(runConfiguration)) - return mode == QLatin1String("QmlProfiler"); - return false; -} - -RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) -{ - QTC_ASSERT(canRun(runConfiguration, mode), return 0); - AnalyzerStartParameters sp; - sp.toolId = "QmlProfiler"; - sp.startMode = StartQml; // FIXME: The parameter struct is not needed/not used. - - - // FIXME: This is only used to communicate the connParams settings. - if (QmlProjectRunConfiguration *rc1 = - qobject_cast(runConfiguration)) { - // This is a "plain" .qmlproject. - sp.environment = rc1->environment(); - sp.workingDirectory = rc1->workingDirectory(); - sp.debuggee = rc1->observerPath(); - sp.debuggeeArgs = rc1->viewerArguments(); - sp.displayName = rc1->displayName(); - sp.connParams.host = QLatin1String("localhost"); - sp.connParams.port = rc1->qmlDebugServerPort(); - } else if (LocalApplicationRunConfiguration *rc2 = - qobject_cast(runConfiguration)) { - sp.environment = rc2->environment(); - sp.workingDirectory = rc2->workingDirectory(); - sp.debuggee = rc2->executable(); - sp.debuggeeArgs = rc2->commandLineArguments(); - sp.displayName = rc2->displayName(); - sp.connParams.host = QLatin1String("localhost"); - sp.connParams.port = rc2->qmlDebugServerPort(); - } else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 = - qobject_cast(runConfiguration)) { - sp.debuggee = rc3->remoteExecutableFilePath(); - sp.debuggeeArgs = rc3->arguments(); - sp.connParams = rc3->deviceConfig()->sshParameters(); - sp.analyzerCmdPrefix = rc3->commandPrefix(); - sp.displayName = rc3->displayName(); - } else if (Qt4ProjectManager::S60DeviceRunConfiguration *rc4 = - qobject_cast(runConfiguration)) { - //sp.environment = rc4->environment(); - //sp.workingDirectory = rc4->workingDirectory(); - //sp.debuggee = rc4->executable(); - sp.debuggeeArgs = rc4->commandLineArguments(); - sp.displayName = rc4->displayName(); - sp.connParams.host = QLatin1String("localhost"); - sp.connParams.port = rc4->qmlDebugServerPort(); - } else { - // What could that be? - QTC_ASSERT(false, return 0); - } - - IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1()); - AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration); - QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); - return rc; -} - -QString QmlProfilerRunControlFactory::displayName() const -{ - return tr("QML Profiler"); -} - -IRunConfigurationAspect *QmlProfilerRunControlFactory::createRunConfigurationAspect() -{ - return new AnalyzerProjectSettings; -} - -RunConfigWidget *QmlProfilerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration) -{ - QmlProjectManager::QmlProjectRunConfiguration *localRc = - qobject_cast(runConfiguration); - if (!localRc) - return 0; - - AnalyzerProjectSettings *settings = runConfiguration->extraAspect(); - if (!settings) - return 0; - - Analyzer::AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget; - - ret->setRunConfiguration(runConfiguration); - return ret; -} diff --git a/qmldebugcontrol/qmlprofilerruncontrolfactory.h b/qmldebugcontrol/qmlprofilerruncontrolfactory.h deleted file mode 100644 index d360fb3..0000000 --- a/qmldebugcontrol/qmlprofilerruncontrolfactory.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERRUNCONTROLFACTORY_H -#define QMLPROFILERRUNCONTROLFACTORY_H - -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerRunControlFactory : public ProjectExplorer::IRunControlFactory -{ - Q_OBJECT - -public: - typedef ProjectExplorer::RunConfiguration RunConfiguration; - - QmlProfilerRunControlFactory(QObject *parent = 0); - - // IRunControlFactory implementation - QString displayName() const; - bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; - ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode); - ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); - ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); - -signals: - void runControlCreated(Analyzer::AnalyzerRunControl *); -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERRUNCONTROLFACTORY_H diff --git a/qmldebugcontrol/qmlprofilertool.cpp b/qmldebugcontrol/qmlprofilertool.cpp deleted file mode 100644 index 7f33191..0000000 --- a/qmldebugcontrol/qmlprofilertool.cpp +++ /dev/null @@ -1,558 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilertool.h" -#include "qmlprofilerconstants.h" -#include "qmlprofilereventview.h" - -#include "tracewindow.h" -#include "timelineview.h" - -#include - - -#include "canvas/qdeclarativecanvas.h" -#include "canvas/qdeclarativecontext2d.h" -#include "canvas/qdeclarativetiledcanvas.h" - - - - -#include - -#include -#include -#include -#include -#include -#include - -using namespace QmlProfiler::Internal; -using namespace QmlJsDebugClient; - -class QmlProfilerTool::QmlProfilerToolPrivate -{ -public: - QmlProfilerToolPrivate(QmlProfilerTool *qq) : q(qq) {} - ~QmlProfilerToolPrivate() {} - - QmlProfilerTool *q; - - QDeclarativeDebugConnection *m_client; - QTimer m_connectionTimer; - int m_connectionAttempts; - TraceWindow *m_traceWindow; - QmlProfilerEventStatistics *m_statistics; - QmlProfilerEventsView *m_eventsView; - QmlProfilerEventsView *m_calleeView; - QmlProfilerEventsView *m_callerView; -// ProjectExplorer::Project *m_project; -// Utils::FileInProjectFinder m_projectFinder; -// ProjectExplorer::RunConfiguration *m_runConfiguration; - bool m_isAttached; - QAction *m_attachAction; - QToolButton *m_recordButton; - QToolButton *m_clearButton; - bool m_recordingEnabled; - - enum ConnectMode { - TcpConnection, OstConnection - }; - - ConnectMode m_connectMode; - QString m_tcpHost; - quint64 m_tcpPort; - QString m_ostDevice; -}; - -QmlProfilerTool::QmlProfilerTool(QWidget *parent) - : QWidget(parent), d(new QmlProfilerToolPrivate(this)) -{ - setObjectName("QmlProfilerTool"); - d->m_client = 0; - d->m_connectionAttempts = 0; - d->m_traceWindow = 0; - d->m_isAttached = false; - d->m_attachAction = 0; - d->m_recordingEnabled = true; - - d->m_connectMode = QmlProfilerToolPrivate::TcpConnection; - - d->m_connectionTimer.setInterval(200); - connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect())); - - qmlRegisterType("Monitor", 1, 0, "Canvas"); - qmlRegisterType("Monitor", 1, 0, "TiledCanvas"); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType("Monitor", 1, 0,"TimelineView"); -} - -QmlProfilerTool::~QmlProfilerTool() -{ - delete d->m_client; - delete d; -} - -QByteArray QmlProfilerTool::id() const -{ - return "QmlProfiler"; -} - -QString QmlProfilerTool::displayName() const -{ - return tr("QML Profiler"); -} - -QString QmlProfilerTool::description() const -{ - return tr("The QML Profiler can be used to find performance bottlenecks in " - "applications using QML."); -} - - -#if 0 -IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) -{ - QmlProfilerEngine *engine = new QmlProfilerEngine(this, runConfiguration); - - // Check minimum Qt Version. We cannot really be sure what the Qt version - // at runtime is, but guess that the active build configuraiton has been used. - QtSupport::QtVersionNumber minimumVersion(4, 7, 4); - if (Qt4ProjectManager::Qt4BuildConfiguration *qt4Config - = qobject_cast( - runConfiguration->target()->activeBuildConfiguration())) { - if (qt4Config->qtVersion()->isValid() && qt4Config->qtVersion()->qtVersion() < minimumVersion) { - int result = QMessageBox::warning(QApplication::activeWindow(), tr("QML Profiler"), - "The QML profiler requires Qt 4.7.4 or newer.\n" - "The Qt version configured in your active build configuration is too old.\n" - "Do you want to continue?", QMessageBox::Yes, QMessageBox::No); - if (result == QMessageBox::No) - return 0; - } - } - - d->m_connectMode = QmlProfilerToolPrivate::TcpConnection; - - if (Qt4ProjectManager::S60DeployConfiguration *deployConfig - = qobject_cast( - runConfiguration->target()->activeDeployConfiguration())) { - if (deployConfig->communicationChannel() - == Qt4ProjectManager::S60DeployConfiguration::CommunicationCodaSerialConnection) { - d->m_connectMode = QmlProfilerToolPrivate::OstConnection; - d->m_ostDevice = deployConfig->serialPortName(); - } - } - - // FIXME: Check that there's something sensible in sp.connParams - if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) { - d->m_tcpHost = sp.connParams.host; - d->m_tcpPort = sp.connParams.port; - } - - d->m_runConfiguration = runConfiguration; - d->m_project = runConfiguration->target()->project(); - if (d->m_project) { - d->m_projectFinder.setProjectDirectory(d->m_project->projectDirectory()); - updateProjectFileList(); - connect(d->m_project, SIGNAL(fileListChanged()), this, SLOT(updateProjectFileList())); - } - - connect(engine, SIGNAL(processRunning(int)), this, SLOT(connectClient(int))); - connect(engine, SIGNAL(finished()), this, SLOT(disconnectClient())); - connect(engine, SIGNAL(stopRecording()), this, SLOT(stopRecording())); - connect(d->m_traceWindow, SIGNAL(viewUpdated()), engine, SLOT(dataReceived())); - connect(this, SIGNAL(connectionFailed()), engine, SLOT(finishProcess())); - connect(this, SIGNAL(fetchingData(bool)), engine, SLOT(setFetchingData(bool))); - emit fetchingData(d->m_recordButton->isChecked()); - - return engine; -} -#endif - -void QmlProfilerTool::toolSelected() -{ - updateAttachAction(true); -} - -void QmlProfilerTool::toolDeselected() -{ - updateAttachAction(false); -} - -QWidget *QmlProfilerTool::createWidgets() -{ -// Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance(); -// Utils::FancyMainWindow *mw = analyzerMgr->mainWindow(); - - QWidget *mw = this; - d->m_traceWindow = new TraceWindow(mw); - d->m_traceWindow->reset(d->m_client); - - connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int))); - connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal))); - - d->m_statistics = new QmlProfilerEventStatistics(mw); - d->m_eventsView = new QmlProfilerEventsView(mw, d->m_statistics); - d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView); - - connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), - d->m_statistics, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); - connect(d->m_traceWindow, SIGNAL(viewUpdated()), - d->m_statistics, SLOT(complete())); - connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)), - this, SLOT(gotoSourceLocation(QString,int))); - - d->m_calleeView = new QmlProfilerEventsView(mw, d->m_statistics); - d->m_calleeView->setViewType(QmlProfilerEventsView::CalleesView); - connect(d->m_calleeView, SIGNAL(gotoSourceLocation(QString,int)), - this, SLOT(gotoSourceLocation(QString,int))); - - d->m_callerView = new QmlProfilerEventsView(mw, d->m_statistics); - d->m_callerView->setViewType(QmlProfilerEventsView::CallersView); - connect(d->m_callerView, SIGNAL(gotoSourceLocation(QString,int)), - this, SLOT(gotoSourceLocation(QString,int))); - -#if 0 - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); - Core::ActionContainer *manalyzer = am->actionContainer(Analyzer::Constants::M_DEBUG_ANALYZER); - const Core::Context globalcontext(Core::Constants::C_GLOBAL); - - d->m_attachAction = new QAction(tr("Attach..."), manalyzer); - Core::Command *command = am->registerAction(d->m_attachAction, - Constants::ATTACH, globalcontext); - command->setAttribute(Core::Command::CA_UpdateText); - //manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP); - connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach())); - - updateAttachAction(false); - - QDockWidget *eventsDock = AnalyzerManager::createDockWidget - (this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea); - QDockWidget *timelineDock = AnalyzerManager::createDockWidget - (this, tr("Timeline"), d->m_traceWindow, Qt::BottomDockWidgetArea); - QDockWidget *calleeDock = AnalyzerManager::createDockWidget - (this, tr("Callees"), d->m_calleeView, Qt::BottomDockWidgetArea); - QDockWidget *callerDock = AnalyzerManager::createDockWidget - (this, tr("Callers"), d->m_callerView, Qt::BottomDockWidgetArea); - - mw->splitDockWidget(mw->toolBarDockWidget(), eventsDock, Qt::Vertical); - mw->tabifyDockWidget(eventsDock, timelineDock); - mw->tabifyDockWidget(timelineDock, calleeDock); - mw->tabifyDockWidget(calleeDock, callerDock); -#endif - QTabWidget *tabWidget = new QTabWidget; - tabWidget->addTab(d->m_eventsView, tr("Events")); - tabWidget->addTab(d->m_traceWindow, tr("Timeline")); - tabWidget->addTab(d->m_calleeView, tr("Callees")); - tabWidget->addTab(d->m_callerView, tr("Callers")); - - // - // Toolbar - // - QWidget *toolbarWidget = new QWidget; - toolbarWidget->setObjectName(QLatin1String("QmlProfilerToolBarWidget")); - - QHBoxLayout *layout = new QHBoxLayout; - layout->setMargin(0); - layout->setSpacing(0); - - d->m_recordButton = new QToolButton(toolbarWidget); - // icon and tooltip set in setRecording(), called later - d->m_recordButton->setCheckable(true); - - connect(d->m_recordButton,SIGNAL(toggled(bool)), this, SLOT(setRecording(bool))); - d->m_recordButton->setChecked(true); - layout->addWidget(d->m_recordButton); - - d->m_clearButton = new QToolButton(toolbarWidget); - d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png"))); - d->m_clearButton->setToolTip(tr("Discard data")); - connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay())); - layout->addWidget(d->m_clearButton); - - QLabel *timeLabel = new QLabel(tr("Elapsed: 0 s")); - QPalette palette = timeLabel->palette(); - palette.setColor(QPalette::WindowText, Qt::white); - timeLabel->setPalette(palette); - timeLabel->setIndent(10); - - connect(this, SIGNAL(setTimeLabel(QString)), timeLabel, SLOT(setText(QString))); - layout->addWidget(timeLabel); - - toolbarWidget->setLayout(layout); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->addWidget(toolbarWidget); - mainLayout->addWidget(tabWidget); - - return toolbarWidget; -} - -void QmlProfilerTool::connectClient(int port) -{ -// QTC_ASSERT(!d->m_client, return;) - d->m_client = new QDeclarativeDebugConnection; - d->m_traceWindow->reset(d->m_client); - connect(d->m_client, SIGNAL(stateChanged(QAbstractSocket::SocketState)), - this, SLOT(connectionStateChanged())); - d->m_connectionTimer.start(); - d->m_tcpPort = port; - d->m_tcpHost = "localhost"; -} - -void QmlProfilerTool::connectToClient() -{ - if (!d->m_client || d->m_client->state() != QAbstractSocket::UnconnectedState) - return; - - if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) { -// if (QmlProfilerPlugin::debugOutput) -// qWarning("QML Profiler: Connecting to %s:%lld ...", qPrintable(d->m_tcpHost), d->m_tcpPort); - - d->m_client->connectToHost(d->m_tcpHost, d->m_tcpPort); - } else { -// if (QmlProfilerPlugin::debugOutput) -// qWarning("QML Profiler: Connecting to ost device %s...", qPrintable(d->m_ostDevice)); - - d->m_client->connectToOst(d->m_ostDevice); - } -} - -void QmlProfilerTool::disconnectClient() -{ - // this might be actually be called indirectly by QDDConnectionPrivate::readyRead(), therefore allow - // method to complete before deleting object - if (d->m_client) { - d->m_client->deleteLater(); - d->m_client = 0; - } -} - -void QmlProfilerTool::startRecording() -{ - if (d->m_client && d->m_client->isConnected()) { - clearDisplay(); - d->m_traceWindow->setRecording(true); - } - emit fetchingData(true); -} - -void QmlProfilerTool::stopRecording() -{ - d->m_traceWindow->setRecording(false); - emit fetchingData(false); -} - -void QmlProfilerTool::setRecording(bool recording) -{ - d->m_recordingEnabled = recording; - - // update record button - d->m_recordButton->setToolTip( d->m_recordingEnabled ? tr("Disable profiling") : tr("Enable profiling")); - d->m_recordButton->setIcon(QIcon(d->m_recordingEnabled ? QLatin1String(":/qmlprofiler/recordOn.png") : - QLatin1String(":/qmlprofiler/recordOff.png"))); - - if (recording) - startRecording(); - else - stopRecording(); -} - -void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber) -{ - if (lineNumber < 0 || fileUrl.isEmpty()) - return; - -#if 0 - const QString fileName = QUrl(fileUrl).toLocalFile(); - const QString projectFileName = d->m_projectFinder.findFile(fileName); - - Core::EditorManager *editorManager = Core::EditorManager::instance(); - Core::IEditor *editor = editorManager->openEditor(projectFileName); - TextEditor::ITextEditor *textEditor = qobject_cast(editor); - - if (textEditor) { - editorManager->addCurrentPositionToNavigationHistory(); - textEditor->gotoLine(lineNumber); - textEditor->widget()->setFocus(); - } -#endif -} - -void QmlProfilerTool::updateTimer(qreal elapsedSeconds) -{ - QString timeString = QString::number(elapsedSeconds,'f',1); - timeString = QString(" ").left(6-timeString.length()) + timeString; - emit setTimeLabel(tr("Elapsed: %1 s").arg(timeString)); -} - -void QmlProfilerTool::updateProjectFileList() -{ -#if 0 - d->m_projectFinder.setProjectFiles( - d->m_project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)); -#endif -} - -void QmlProfilerTool::clearDisplay() -{ - d->m_traceWindow->clearDisplay(); - d->m_statistics->clear(); - d->m_eventsView->clear(); - d->m_calleeView->clear(); - d->m_callerView->clear(); -} - -void QmlProfilerTool::attach() -{ - if (!d->m_isAttached) { -// QmlProfilerAttachDialog dialog; -// int result = dialog.exec(); - -// if (result == QDialog::Rejected) -// return; - -// TODO -// d->m_tcpPort = dialog.port(); -// d->m_tcpHost = dialog.address(); - - connectClient(d->m_tcpPort); -// AnalyzerManager::showMode(); - } else { - stopRecording(); - } - - d->m_isAttached = !d->m_isAttached; - updateAttachAction(true); -} - -void QmlProfilerTool::updateAttachAction(bool isCurrentTool) -{ - if (d->m_isAttached) - d->m_attachAction->setText(tr("Detach")); - else - d->m_attachAction->setText(tr("Attach...")); - d->m_attachAction->setEnabled(isCurrentTool); -} - -void QmlProfilerTool::tryToConnect() -{ - ++d->m_connectionAttempts; - - if (d->m_client && d->m_client->isConnected()) { - d->m_connectionTimer.stop(); - d->m_connectionAttempts = 0; - } else if (d->m_connectionAttempts == 50) { - d->m_connectionTimer.stop(); - d->m_connectionAttempts = 0; -// if (QmlProfilerPlugin::debugOutput) { -// if (d->m_client) { -// qWarning("QML Profiler: Failed to connect: %s", qPrintable(d->m_client->errorString())); -// // } else { -// qWarning("QML Profiler: Failed to connect."); -// } -// } - emit connectionFailed(); - } else { - connectToClient(); - } -} - -void QmlProfilerTool::connectionStateChanged() -{ - if (!d->m_client) - return; - switch (d->m_client->state()) { - case QAbstractSocket::UnconnectedState: - { -// if (QmlProfilerPlugin::debugOutput) -// qWarning("QML Profiler: disconnected"); - break; - } - case QAbstractSocket::HostLookupState: - break; - case QAbstractSocket::ConnectingState: { -// if (QmlProfilerPlugin::debugOutput) -// qWarning("QML Profiler: Connecting to debug server ..."); - break; - } - case QAbstractSocket::ConnectedState: - { -// if (QmlProfilerPlugin::debugOutput) -// qWarning("QML Profiler: connected and running"); - updateRecordingState(); - break; - } - case QAbstractSocket::ClosingState: -// if (QmlProfilerPlugin::debugOutput) -// qWarning("QML Profiler: closing ..."); - break; - case QAbstractSocket::BoundState: - case QAbstractSocket::ListeningState: - break; - } -} - -void QmlProfilerTool::updateRecordingState() -{ - if (d->m_client->isConnected()) { - d->m_traceWindow->setRecording(d->m_recordingEnabled); - } else { - d->m_traceWindow->setRecording(false); - } - - if (d->m_traceWindow->isRecording()) - clearDisplay(); -} - -#if 0 -void QmlProfilerTool::startTool(StartMode mode) -{ - Q_UNUSED(mode); - - using namespace ProjectExplorer; - - // Make sure mode is shown. - AnalyzerManager::showMode(); - - ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); - // ### not sure if we're supposed to check if the RunConFiguration isEnabled - Project *pro = pe->startupProject(); - pe->runProject(pro, id()); -} -#endif - -#include "qmlprofilertool.moc" diff --git a/qmldebugcontrol/qmlprofilertool.h b/qmldebugcontrol/qmlprofilertool.h deleted file mode 100644 index 4630877..0000000 --- a/qmldebugcontrol/qmlprofilertool.h +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERTOOL_H -#define QMLPROFILERTOOL_H - -#include - - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerTool : public QWidget // Analyzer::IAnalyzerTool -{ - Q_OBJECT - -public: - explicit QmlProfilerTool(QWidget *parent); - ~QmlProfilerTool(); - - QByteArray id() const; - QString displayName() const; - QString description() const; - - void extensionsInitialized() {} - void toolSelected(); - void toolDeselected(); - -// Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, -// ProjectExplorer::RunConfiguration *runConfiguration = 0); - - QWidget *createWidgets(); -// void startTool(Analyzer::StartMode mode); - -public slots: - void connectClient(int port); - void disconnectClient(); - - void startRecording(); - void stopRecording(); - void setRecording(bool recording); - - void gotoSourceLocation(const QString &fileUrl, int lineNumber); - void updateTimer(qreal elapsedSeconds); - - void clearDisplay(); - -signals: - void setTimeLabel(const QString &); - void fetchingData(bool); - void connectionFailed(); - -private slots: - void updateProjectFileList(); - void attach(); - void tryToConnect(); - void connectionStateChanged(); - -private: - void updateAttachAction(bool isCurrentTool); - void connectToClient(); - void updateRecordingState(); - void ensureWidgets(); - - class QmlProfilerToolPrivate; - QmlProfilerToolPrivate *d; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERTOOL_H diff --git a/qmldebugcontrol/qmlprofilertraceclient.cpp b/qmldebugcontrol/qmlprofilertraceclient.cpp deleted file mode 100644 index 1adb9d3..0000000 --- a/qmldebugcontrol/qmlprofilertraceclient.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilertraceclient.h" -#include - -using namespace QmlProfiler::Internal; -using namespace QmlJsDebugClient; - -static const int GAP_TIME = 150; - -QmlProfilerTraceClient::QmlProfilerTraceClient(QDeclarativeDebugConnection *client) - : QDeclarativeDebugClient(QLatin1String("CanvasFrameRate"), client), - m_inProgressRanges(0), m_maximumTime(0), m_recording(false), m_nestingLevel(0) -{ - ::memset(m_rangeCount, 0, MaximumQmlEventType * sizeof(int)); - ::memset(m_nestingInType, 0, MaximumQmlEventType * sizeof(int)); -} - -void QmlProfilerTraceClient::clearView() -{ - ::memset(m_rangeCount, 0, MaximumQmlEventType * sizeof(int)); - ::memset(m_nestingInType, 0, MaximumQmlEventType * sizeof(int)); - m_nestingLevel = 0; - emit clear(); -} - -void QmlProfilerTraceClient::setRecording(bool v) -{ - if (v == m_recording) - return; - - if (status() == Enabled) { - QByteArray ba; - QDataStream stream(&ba, QIODevice::WriteOnly); - stream << v; - sendMessage(ba); - } - - m_recording = v; - emit recordingChanged(v); -} - -void QmlProfilerTraceClient::statusChanged(Status status) -{ - if (status == Enabled) { - m_recording = !m_recording; - setRecording(!m_recording); - emit enabled(); - } -} - -void QmlProfilerTraceClient::messageReceived(const QByteArray &data) -{ - QByteArray rwData = data; - QDataStream stream(&rwData, QIODevice::ReadOnly); - - qint64 time; - int messageType; - - stream >> time >> messageType; - -// qDebug() << __FUNCTION__ << messageType; - - if (messageType >= MaximumMessage) - return; - - if (time > (m_maximumTime + GAP_TIME) && 0 == m_inProgressRanges) - emit gap(time); - - if (messageType == Event) { - int event; - stream >> event; - - if (event < MaximumEventType) { - emit this->event((EventType)event, time); - m_maximumTime = qMax(time, m_maximumTime); - } - } else if (messageType == Complete) { - emit complete(); - } else { - int range; - stream >> range; - - if (range >= MaximumQmlEventType) - return; - - if (messageType == RangeStart) { - m_rangeStartTimes[range].push(time); - m_inProgressRanges |= (static_cast(1) << range); - ++m_rangeCount[range]; - ++m_nestingLevel; - ++m_nestingInType[range]; - } else if (messageType == RangeData) { - QString data; - stream >> data; - - int count = m_rangeCount[range]; - if (count > 0) { - while (m_rangeDatas[range].count() < count) - m_rangeDatas[range].push(QStringList()); - m_rangeDatas[range][count-1] << data; - } - - } else if (messageType == RangeLocation) { - QString fileName; - int line; - stream >> fileName >> line; - - if (m_rangeCount[range] > 0) { - m_rangeLocations[range].push(Location(fileName, line)); - } - } else { - if (m_rangeCount[range] > 0) { - --m_rangeCount[range]; - if (m_inProgressRanges & (static_cast(1) << range)) - m_inProgressRanges &= ~(static_cast(1) << range); - - m_maximumTime = qMax(time, m_maximumTime); - QStringList data = m_rangeDatas[range].count() ? m_rangeDatas[range].pop() : QStringList(); - Location location = m_rangeLocations[range].count() ? m_rangeLocations[range].pop() : Location(); - - qint64 startTime = m_rangeStartTimes[range].pop(); - emit this->range((QmlEventType)range, m_nestingLevel, m_nestingInType[range], startTime, - time - startTime, data, location.fileName, location.line); - --m_nestingLevel; - --m_nestingInType[range]; - if (m_rangeCount[range] == 0) { - int count = m_rangeDatas[range].count() + - m_rangeStartTimes[range].count() + - m_rangeLocations[range].count(); - if (count != 0) - qWarning() << "incorrectly nested data"; - } - } - } - } -} - -#include "qmlprofilertraceclient.moc" diff --git a/qmldebugcontrol/qmlprofilertraceclient.h b/qmldebugcontrol/qmlprofilertraceclient.h deleted file mode 100644 index 507bf8d..0000000 --- a/qmldebugcontrol/qmlprofilertraceclient.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERTRACECLIENT_H -#define QMLPROFILERTRACECLIENT_H - -#include -#include -#include - -#include "qmlprofilereventtypes.h" - -namespace QmlProfiler { -namespace Internal { - -struct Location -{ - Location() : line(-1) {} - Location(const QString &file, int lineNumber) : fileName(file), line(lineNumber) {} - QString fileName; - int line; -}; - -class QmlProfilerTraceClient : public QmlJsDebugClient::QDeclarativeDebugClient -{ - Q_OBJECT - Q_PROPERTY(bool recording READ isRecording WRITE setRecording NOTIFY recordingChanged) - -public: - QmlProfilerTraceClient(QmlJsDebugClient::QDeclarativeDebugConnection *client); - - enum EventType { - FramePaint, - Mouse, - Key, - - MaximumEventType - }; - - enum Message { - Event, - RangeStart, - RangeData, - RangeLocation, - RangeEnd, - Complete, - - MaximumMessage - }; - - enum RangeType { - Painting, - Compiling, - Creating, - Binding, - HandlingSignal, - - MaximumRangeType - }; - - bool isRecording() const { return m_recording; } - -public slots: - void setRecording(bool); - void clearView(); - -signals: - void complete(); - void gap(qint64); - void event(int event, qint64 time); - void range(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line); - - void sample(int, int, int, bool); - - void recordingChanged(bool arg); - - void enabled(); - void clear(); - -protected: - virtual void statusChanged(Status); - virtual void messageReceived(const QByteArray &); - -private: - qint64 m_inProgressRanges; - QStack m_rangeStartTimes[MaximumQmlEventType]; - QStack m_rangeDatas[MaximumQmlEventType]; - QStack m_rangeLocations[MaximumQmlEventType]; - int m_rangeCount[MaximumQmlEventType]; - qint64 m_maximumTime; - bool m_recording; - int m_nestingLevel; - int m_nestingInType[MaximumQmlEventType]; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERTRACECLIENT_H diff --git a/qmldebugcontrol/qt_private/qdeclarativedebughelper_p.h b/qmldebugcontrol/qt_private/qdeclarativedebughelper_p.h deleted file mode 100644 index a883d96..0000000 --- a/qmldebugcontrol/qt_private/qdeclarativedebughelper_p.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDEBUGHELPER_P_H -#define QDECLARATIVEDEBUGHELPER_P_H - -#include "../qmljsdebugger_global.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QScriptEngine; -class QDeclarativeEngine; - -// Helper methods to access private API through a stable interface -// This is used in the qmljsdebugger library of QtCreator. -class QMLJSDEBUGGER_EXTERN QDeclarativeDebugHelper -{ -public: - static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); - static void setAnimationSlowDownFactor(qreal factor); - - // Enables remote debugging functionality - // Only use this for debugging in a safe environment! - static void enableDebugging(); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/qmldebugcontrol/qt_private/qdeclarativedebugservice_p.h b/qmldebugcontrol/qt_private/qdeclarativedebugservice_p.h deleted file mode 100644 index e3771b7..0000000 --- a/qmldebugcontrol/qt_private/qdeclarativedebugservice_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVEDEBUGSERVICE_H -#define QDECLARATIVEDEBUGSERVICE_H - -#include "../qmljsdebugger_global.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeDebugServicePrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeDebugService : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugService) - Q_DISABLE_COPY(QDeclarativeDebugService) - -public: - explicit QDeclarativeDebugService(const QString &, QObject *parent = 0); - ~QDeclarativeDebugService(); - - QString name() const; - - enum Status { NotConnected, Unavailable, Enabled }; - Status status() const; - - void sendMessage(const QByteArray &); - - static int idForObject(QObject *); - static QObject *objectForId(int); - - static QString objectToString(QObject *obj); - - static bool isDebuggingEnabled(); - static bool hasDebuggingClient(); - -protected: - virtual void statusChanged(Status); - virtual void messageReceived(const QByteArray &); - -private: - friend class QDeclarativeDebugServer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGSERVICE_H - diff --git a/qmldebugcontrol/qt_private/qdeclarativestate_p.h b/qmldebugcontrol/qt_private/qdeclarativestate_p.h deleted file mode 100644 index b864fc0..0000000 --- a/qmldebugcontrol/qt_private/qdeclarativestate_p.h +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef QDECLARATIVESTATE_H -#define QDECLARATIVESTATE_H - -#include "../qmljsdebugger_global.h" - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeActionEvent; -class QDeclarativeAbstractBinding; -class QDeclarativeBinding; -class QDeclarativeExpression; -class QMLJSDEBUGGER_EXTERN QDeclarativeAction -{ -public: - QDeclarativeAction(); - QDeclarativeAction(QObject *, const QString &, const QVariant &); - QDeclarativeAction(QObject *, const QString &, - QDeclarativeContext *, const QVariant &); - - bool restore:1; - bool actionDone:1; - bool reverseEvent:1; - bool deletableToBinding:1; - - QDeclarativeProperty property; - QVariant fromValue; - QVariant toValue; - - QDeclarativeAbstractBinding *fromBinding; - QWeakPointer toBinding; - QDeclarativeActionEvent *event; - - //strictly for matching - QObject *specifiedObject; - QString specifiedProperty; - - void deleteFromBinding(); -}; - -class QMLJSDEBUGGER_EXTERN QDeclarativeActionEvent -{ -public: - virtual ~QDeclarativeActionEvent(); - virtual QString typeName() const; - - enum Reason { ActualChange, FastForward }; - - virtual void execute(Reason reason = ActualChange); - virtual bool isReversable(); - virtual void reverse(Reason reason = ActualChange); - virtual void saveOriginals() {} - virtual bool needsCopy() { return false; } - virtual void copyOriginals(QDeclarativeActionEvent *) {} - virtual bool isRewindable() { return isReversable(); } - virtual void rewind() {} - virtual void saveCurrentValues() {} - virtual void saveTargetValues() {} - - virtual bool changesBindings(); - virtual void clearBindings(); - virtual bool override(QDeclarativeActionEvent*other); -}; - -//### rename to QDeclarativeStateChange? -class QDeclarativeStateGroup; -class QDeclarativeState; -class QDeclarativeStateOperationPrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeStateOperation : public QObject -{ - Q_OBJECT -public: - QDeclarativeStateOperation(QObject *parent = 0) - : QObject(parent) {} - typedef QList ActionList; - - virtual ActionList actions(); - - QDeclarativeState *state() const; - void setState(QDeclarativeState *state); - -protected: - QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent = 0); - -private: - Q_DECLARE_PRIVATE(QDeclarativeStateOperation) - Q_DISABLE_COPY(QDeclarativeStateOperation) -}; - -typedef QDeclarativeStateOperation::ActionList QDeclarativeStateActions; - -class QDeclarativeTransition; -class QDeclarativeStatePrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeState : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QDeclarativeBinding *when READ when WRITE setWhen) - Q_PROPERTY(QString extend READ extends WRITE setExtends) - Q_PROPERTY(QDeclarativeListProperty changes READ changes) - Q_CLASSINFO("DefaultProperty", "changes") - Q_CLASSINFO("DeferredPropertyNames", "changes") - -public: - QDeclarativeState(QObject *parent=0); - virtual ~QDeclarativeState(); - - QString name() const; - void setName(const QString &); - bool isNamed() const; - - /*'when' is a QDeclarativeBinding to limit state changes oscillation - due to the unpredictable order of evaluation of bound expressions*/ - bool isWhenKnown() const; - QDeclarativeBinding *when() const; - void setWhen(QDeclarativeBinding *); - - QString extends() const; - void setExtends(const QString &); - - QDeclarativeListProperty changes(); - int operationCount() const; - QDeclarativeStateOperation *operationAt(int) const; - - QDeclarativeState &operator<<(QDeclarativeStateOperation *); - - void apply(QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert); - void cancel(); - - QDeclarativeStateGroup *stateGroup() const; - void setStateGroup(QDeclarativeStateGroup *); - - bool containsPropertyInRevertList(QObject *target, const QString &name) const; - bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue); - bool changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding); - bool removeEntryFromRevertList(QObject *target, const QString &name); - void addEntryToRevertList(const QDeclarativeAction &action); - void removeAllEntriesFromRevertList(QObject *target); - void addEntriesToRevertList(const QList &actions); - QVariant valueInRevertList(QObject *target, const QString &name) const; - QDeclarativeAbstractBinding *bindingInRevertList(QObject *target, const QString &name) const; - - bool isStateActive() const; - -Q_SIGNALS: - void completed(); - -private: - Q_DECLARE_PRIVATE(QDeclarativeState) - Q_DISABLE_COPY(QDeclarativeState) -}; - -QT_END_NAMESPACE - -//QML_DECLARE_TYPE(QDeclarativeStateOperation) -//QML_DECLARE_TYPE(QDeclarativeState) - -QT_END_HEADER - -#endif // QDECLARATIVESTATE_H diff --git a/qmldebugcontrol/remotelinuxqmlprofilerrunner.cpp b/qmldebugcontrol/remotelinuxqmlprofilerrunner.cpp deleted file mode 100644 index efccff1..0000000 --- a/qmldebugcontrol/remotelinuxqmlprofilerrunner.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "remotelinuxqmlprofilerrunner.h" -#include -#include -#include -#include - -using namespace ExtensionSystem; -using namespace ProjectExplorer; -using namespace QmlProfiler::Internal; -using namespace RemoteLinux; - -RemoteLinuxQmlProfilerRunner::RemoteLinuxQmlProfilerRunner( - RemoteLinuxRunConfiguration *runConfiguration, QObject *parent) - : AbstractQmlProfilerRunner(parent) - , m_port(-1) - , m_runControl(0) -{ - // find run control factory - IRunControlFactory *runControlFactory = 0; - QList runControlFactories - = PluginManager::instance()->getObjects(); - - foreach (IRunControlFactory *factory, runControlFactories) { - if (factory->canRun(runConfiguration, ProjectExplorer::Constants::RUNMODE)) { - runControlFactory = factory; - break; - } - } - - QTC_ASSERT(runControlFactory, return); - - // create run control - RunControl *runControl = runControlFactory->create(runConfiguration, - ProjectExplorer::Constants::RUNMODE); - - m_runControl = qobject_cast(runControl); - QTC_ASSERT(m_runControl, return); - - connect(runner(), SIGNAL(readyForExecution()), this, SLOT(getPorts())); - connect(runner(), SIGNAL(error(QString)), this, SLOT(handleError(QString))); - connect(runner(), SIGNAL(remoteErrorOutput(QByteArray)), this, SLOT(handleStdErr(QByteArray))); - connect(runner(), SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleStdOut(QByteArray))); - - connect(runner(), SIGNAL(remoteProcessStarted()), this, SLOT(handleRemoteProcessStarted())); - connect(runner(), SIGNAL(remoteProcessFinished(qint64)), - this, SLOT(handleRemoteProcessFinished(qint64))); - connect(runner(), SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString))); -} - -RemoteLinuxQmlProfilerRunner::~RemoteLinuxQmlProfilerRunner() -{ - delete m_runControl; -} - -void RemoteLinuxQmlProfilerRunner::start() -{ - QTC_ASSERT(runner(), return); - runner()->start(); -} - -void RemoteLinuxQmlProfilerRunner::stop() -{ - QTC_ASSERT(runner(), return); - runner()->stop(); -} - -int RemoteLinuxQmlProfilerRunner::debugPort() const -{ - return m_port; -} - -void RemoteLinuxQmlProfilerRunner::getPorts() -{ - QTC_ASSERT(runner(), return); - m_port = runner()->freePorts()->getNext(); - if (m_port == -1) { - emit appendMessage(tr("Not enough free ports on device for analyzing.\n"), - Utils::ErrorMessageFormat); - runner()->stop(); - } else { - emit appendMessage(tr("Starting remote process ...\n"), Utils::NormalMessageFormat); - - QString arguments = runner()->arguments(); - if (!arguments.isEmpty()) - arguments.append(QLatin1Char(' ')); - arguments.append(QString(QLatin1String("-qmljsdebugger=port:%1,block")).arg(m_port)); - - runner()->startExecution(QString::fromLocal8Bit("%1 %2 %3") - .arg(runner()->commandPrefix()) - .arg(runner()->remoteExecutable()) - .arg(arguments).toUtf8()); - } -} - -void RemoteLinuxQmlProfilerRunner::handleError(const QString &msg) -{ - emit appendMessage(msg + QLatin1Char('\n'), Utils::ErrorMessageFormat); -} - -void RemoteLinuxQmlProfilerRunner::handleStdErr(const QByteArray &msg) -{ - emit appendMessage(QString::fromUtf8(msg), Utils::StdErrFormat); -} - -void RemoteLinuxQmlProfilerRunner::handleStdOut(const QByteArray &msg) -{ - emit appendMessage(QString::fromUtf8(msg), Utils::StdOutFormat); -} - -void RemoteLinuxQmlProfilerRunner::handleRemoteProcessStarted() -{ - emit started(); -} - -void RemoteLinuxQmlProfilerRunner::handleRemoteProcessFinished(qint64 exitCode) -{ - if (exitCode != RemoteLinuxApplicationRunner::InvalidExitCode) { - appendMessage(tr("Finished running remote process. Exit code was %1.\n") - .arg(exitCode), Utils::NormalMessageFormat); - } - - emit stopped(); -} - -void RemoteLinuxQmlProfilerRunner::handleProgressReport(const QString &progressString) -{ - appendMessage(progressString + QLatin1Char('\n'), Utils::NormalMessageFormat); -} - -RemoteLinuxApplicationRunner *RemoteLinuxQmlProfilerRunner::runner() const -{ - if (!m_runControl) - return 0; - return m_runControl->runner(); -} - diff --git a/qmldebugcontrol/remotelinuxqmlprofilerrunner.h b/qmldebugcontrol/remotelinuxqmlprofilerrunner.h deleted file mode 100644 index cf7a444..0000000 --- a/qmldebugcontrol/remotelinuxqmlprofilerrunner.h +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef REMOTELINUXQMLPROFILERRUNNER_H -#define REMOTELINUXQMLPROFILERRUNNER_H - -#include "abstractqmlprofilerrunner.h" -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class RemoteLinuxQmlProfilerRunner : public AbstractQmlProfilerRunner -{ - Q_OBJECT - Q_DISABLE_COPY(RemoteLinuxQmlProfilerRunner) - - using AbstractQmlProfilerRunner::appendMessage; // don't hide signal -public: - explicit RemoteLinuxQmlProfilerRunner(RemoteLinux::RemoteLinuxRunConfiguration *configuration, - QObject *parent = 0); - ~RemoteLinuxQmlProfilerRunner(); - - // AbstractQmlProfilerRunner - virtual void start(); - virtual void stop(); - virtual int debugPort() const; - -private slots: - void getPorts(); - void handleError(const QString &msg); - void handleStdErr(const QByteArray &msg); - void handleStdOut(const QByteArray &msg); - void handleRemoteProcessStarted(); - void handleRemoteProcessFinished(qint64); - void handleProgressReport(const QString &progressString); - -private: - RemoteLinux::RemoteLinuxApplicationRunner *runner() const; - - int m_port; - RemoteLinux::AbstractRemoteLinuxRunControl *m_runControl; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // REMOTELINUXQMLPROFILERRUNNER_H diff --git a/qmldebugcontrol/timelineview.cpp b/qmldebugcontrol/timelineview.cpp deleted file mode 100644 index 3d7c04e..0000000 --- a/qmldebugcontrol/timelineview.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "timelineview.h" - -#include -#include - -using namespace QmlProfiler::Internal; - -TimelineView::TimelineView(QDeclarativeItem *parent) : - QDeclarativeItem(parent), m_delegate(0), m_startTime(0), m_endTime(0), m_startX(0), - prevMin(0), prevMax(0), m_totalWidth(0) -{ -} - -void TimelineView::componentComplete() -{ - QDeclarativeItem::componentComplete(); -} - -void TimelineView::clearData() -{ - m_rangeList.clear(); - m_items.clear(); - m_startTime = 0; - m_endTime = 0; - m_startX = 0; - prevMin = 0; - prevMax = 0; - m_prevLimits.clear(); - m_totalWidth = 0; - -} - -void TimelineView::setRanges(const QScriptValue &value) -{ - //TODO clear old values (always?) - m_ranges = value; - - //### below code not yet used anywhere - int length = m_ranges.property("length").toInt32(); - - for (int i = 0; i < length; ++i) { - int type = m_ranges.property(i).property("type").toNumber(); - Q_ASSERT(type >= 0); - while (m_rangeList.count() <= type) - m_rangeList.append(ValueList()); - m_rangeList[type] << m_ranges.property(i); - } - - for (int i = 0; i < m_rangeList.count(); ++i) - m_prevLimits << PrevLimits(0, 0); - - qreal startValue = m_ranges.property(0).property("start").toNumber(); - m_starts.clear(); - m_starts.reserve(length); - m_ends.clear(); - m_ends.reserve(length); - for (int i = 0; i < length; ++i) { - m_starts.append(m_ranges.property(i).property("start").toNumber() - startValue); - m_ends.append(m_ranges.property(i).property("start").toNumber() + m_ranges.property(i).property("duration").toNumber() - startValue); - } -} - -void TimelineView::setStartX(qreal arg) -{ - if (arg == m_startX) - return; - - if (!m_ranges.isArray()) - return; - - qreal window = m_endTime - m_startTime; - if (window == 0) //### - return; - qreal spacing = width() / window; - qreal oldStart = m_startTime; - m_startTime = arg / spacing; - m_endTime += m_startTime - oldStart; - - updateTimeline(false); - m_startX = arg; - emit startXChanged(m_startX); -} - -void TimelineView::updateTimeline(bool updateStartX) -{ - if (!m_delegate) - return; - - if (!m_ranges.isArray()) - return; - - int length = m_ranges.property("length").toInt32(); - - qreal startValue = m_ranges.property(0).property("start").toNumber(); - qreal endValue = m_ranges.property(length-1).property("start").toNumber() + m_ranges.property(length-1).property("duration").toNumber(); - - qreal totalRange = endValue - startValue; - qreal window = m_endTime - m_startTime; - - if (window == 0) //### - return; - - qreal spacing = width() / window; - qreal oldtw = m_totalWidth; - m_totalWidth = totalRange * spacing; - - // Find region samples - int minsample = 0; - int maxsample = 0; - - for (int i = 0; i < length; ++i) { - if (m_ends.at(i) >= m_startTime) - break; - minsample = i; - } - - for (int i = minsample + 1; i < length; ++i) { - maxsample = i; - if (m_starts.at(i) > m_endTime) - break; - } - - //### overkill (if we can expose whether or not data is nested) - for (int i = maxsample + 1; i < length; ++i) { - if (m_starts.at(i) < m_endTime) - maxsample = i; - } - - //qDebug() << maxsample - minsample; - - if (updateStartX) { - qreal oldStartX = m_startX; - m_startX = qRound(m_startTime * spacing); - if (m_startX != oldStartX) { - emit startXChanged(m_startX); - } - } - - //### emitting this before startXChanged was causing issues - if (m_totalWidth != oldtw) - emit totalWidthChanged(m_totalWidth); - - //clear items no longer in view - while (prevMin < minsample) { - delete m_items.take(prevMin); - ++prevMin; - } - while (prevMax > maxsample) { - delete m_items.take(prevMax); - --prevMax; - } - - // Show items - int z = 0; - for (int i = maxsample-1; i >= minsample; --i) { - QDeclarativeItem *item = 0; - item = m_items.value(i); - bool creating = false; - if (!item) { - QDeclarativeContext *ctxt = new QDeclarativeContext(qmlContext(this)); - item = qobject_cast(m_delegate->beginCreate(ctxt)); - m_items.insert(i, item); - creating = true; - - int type = m_ranges.property(i).property("type").toNumber(); - - ctxt->setParent(item); //### QDeclarative_setParent_noEvent(ctxt, item); instead? - ctxt->setContextProperty("duration", qMax(qRound(m_ranges.property(i).property("duration").toNumber()/qreal(1000)),1)); - ctxt->setContextProperty("fileName", m_ranges.property(i).property("fileName").toString()); - ctxt->setContextProperty("line", m_ranges.property(i).property("line").toNumber()); - ctxt->setContextProperty("index", i); - ctxt->setContextProperty("nestingLevel", m_ranges.property(i).property("nestingLevel").toNumber()); - ctxt->setContextProperty("nestingDepth", m_ranges.property(i).property("nestingDepth").toNumber()); - QString label; - QVariantList list = m_ranges.property(i).property("label").toVariant().value(); - for (int i = 0; i < list.size(); ++i) { - if (i > 0) - label += QLatin1Char('\n'); - QString sub = list.at(i).toString(); - - //### only do rewrite for bindings... - if (type == 3) { - //### don't construct in loop - QRegExp rewrite("\\(function \\$(\\w+)\\(\\) \\{ return (.+) \\}\\)"); - bool match = rewrite.exactMatch(sub); - if (match) - sub = rewrite.cap(1) + ": " + rewrite.cap(2); - } - - label += sub; - } - ctxt->setContextProperty("label", label); - ctxt->setContextProperty("type", type); - item->setParentItem(this); - } - if (item) { - item->setX(m_starts.at(i)*spacing); - qreal width = (m_ends.at(i)-m_starts.at(i)) * spacing; - item->setWidth(width > 1 ? width : 1); - item->setZValue(++z); - } - if (creating) - m_delegate->completeCreate(); - } - - prevMin = minsample; - prevMax = maxsample; -} - -#include "timelineview.moc" diff --git a/qmldebugcontrol/timelineview.h b/qmldebugcontrol/timelineview.h deleted file mode 100644 index ca0bffc..0000000 --- a/qmldebugcontrol/timelineview.h +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef TIMELINEVIEW_H -#define TIMELINEVIEW_H - -#include -#include - -namespace QmlProfiler { -namespace Internal { - -class TimelineView : public QDeclarativeItem -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) - Q_PROPERTY(qint64 startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged) - Q_PROPERTY(qint64 endTime READ endTime WRITE setEndTime NOTIFY endTimeChanged) - Q_PROPERTY(qreal startX READ startX WRITE setStartX NOTIFY startXChanged) - Q_PROPERTY(qreal totalWidth READ totalWidth NOTIFY totalWidthChanged) - -public: - explicit TimelineView(QDeclarativeItem *parent = 0); - - QDeclarativeComponent * delegate() const - { - return m_delegate; - } - - qint64 startTime() const - { - return m_startTime; - } - - qint64 endTime() const - { - return m_endTime; - } - - qreal startX() const - { - return m_startX; - } - - qreal totalWidth() const - { - return m_totalWidth; - } - -signals: - void delegateChanged(QDeclarativeComponent * arg); - void startTimeChanged(qint64 arg); - void endTimeChanged(qint64 arg); - void startXChanged(qreal arg); - void totalWidthChanged(qreal arg); - -public slots: - void clearData(); - void setRanges(const QScriptValue &value); - void updateTimeline(bool updateStartX = true); - - void setDelegate(QDeclarativeComponent * arg) - { - if (m_delegate != arg) { - m_delegate = arg; - emit delegateChanged(arg); - } - } - - void setStartTime(qint64 arg) - { - if (m_startTime != arg) { - m_startTime = arg; - emit startTimeChanged(arg); - } - } - - void setEndTime(qint64 arg) - { - if (m_endTime != arg) { - m_endTime = arg; - emit endTimeChanged(arg); - } - } - - void setStartX(qreal arg); - -protected: - void componentComplete(); - -private: - QDeclarativeComponent * m_delegate; - QScriptValue m_ranges; - typedef QList ValueList; - QList m_rangeList; - QHash m_items; - qint64 m_startTime; - qint64 m_endTime; - qreal m_startX; - int prevMin; - int prevMax; - QList m_starts; - QList m_ends; - - struct PrevLimits { - PrevLimits(int _min, int _max) : min(_min), max(_max) {} - int min; - int max; - }; - - QList m_prevLimits; - qreal m_totalWidth; -}; - -} // namespace Internal -} // namespace QmlProfiler - -QML_DECLARE_TYPE(QmlProfiler::Internal::TimelineView) - -#endif // TIMELINEVIEW_H diff --git a/qmldebugcontrol/tracewindow.cpp b/qmldebugcontrol/tracewindow.cpp deleted file mode 100644 index 55c69a1..0000000 --- a/qmldebugcontrol/tracewindow.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "tracewindow.h" - -#include "qmlprofilertraceclient.h" - -#include - -#include -#include -#include -#include -#include - -namespace QmlProfiler { -namespace Internal { - -TraceWindow::TraceWindow(QWidget *parent) - : QWidget(parent) -{ - setObjectName("QML Profiler"); - - QVBoxLayout *groupLayout = new QVBoxLayout; - groupLayout->setContentsMargins(0, 0, 0, 0); - groupLayout->setSpacing(0); - - m_view = new QDeclarativeView(this); - -// if (QmlProfilerPlugin::debugOutput) { - //new QmlJSDebugger::JSDebuggerAgent(m_view->engine()); - //new QmlJSDebugger::QDeclarativeViewObserver(m_view, m_view); -// } - -// Utils::StyledBar *bar = new Utils::StyledBar(this); -// bar->setSingleRow(true); -// bar->setMinimumWidth(150); - QHBoxLayout *toolBarLayout = new QHBoxLayout(); - groupLayout->addLayout(toolBarLayout); - toolBarLayout->setMargin(0); - toolBarLayout->setSpacing(0); - QToolButton *buttonPrev= new QToolButton; - buttonPrev->setIcon(QIcon(":/qmlprofiler/prev.png")); - buttonPrev->setToolTip(tr("Jump to previous event")); - connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev())); - connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool))); - QToolButton *buttonNext= new QToolButton; - buttonNext->setIcon(QIcon(":/qmlprofiler/next.png")); - buttonNext->setToolTip(tr("Jump to next event")); - connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext())); - connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool))); - QToolButton *buttonZoomIn = new QToolButton; - buttonZoomIn->setIcon(QIcon(":/qmlprofiler/magnifier-plus.png")); - buttonZoomIn->setToolTip(tr("Zoom in 10%")); - connect(buttonZoomIn, SIGNAL(clicked()), this, SIGNAL(zoomIn())); - connect(this, SIGNAL(enableToolbar(bool)), buttonZoomIn, SLOT(setEnabled(bool))); - QToolButton *buttonZoomOut = new QToolButton; - buttonZoomOut->setIcon(QIcon(":/qmlprofiler/magnifier-minus.png")); - buttonZoomOut->setToolTip(tr("Zoom out 10%")); - connect(buttonZoomOut, SIGNAL(clicked()), this, SIGNAL(zoomOut())); - connect(this, SIGNAL(enableToolbar(bool)), buttonZoomOut, SLOT(setEnabled(bool))); - - toolBarLayout->addWidget(buttonPrev); - toolBarLayout->addWidget(buttonNext); - toolBarLayout->addWidget(buttonZoomIn); - toolBarLayout->addWidget(buttonZoomOut); - - - - m_view->setResizeMode(QDeclarativeView::SizeRootObjectToView); - m_view->setFocus(); - groupLayout->addWidget(m_view); - - setLayout(groupLayout); - - // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin - setMinimumHeight(170); -} - -TraceWindow::~TraceWindow() -{ - delete m_plugin.data(); -} - -void TraceWindow::reset(QmlJsDebugClient::QDeclarativeDebugConnection *conn) -{ - if (m_plugin) - disconnect(m_plugin.data(), SIGNAL(complete()), this, SIGNAL(viewUpdated())); - delete m_plugin.data(); - m_plugin = new QmlProfilerTraceClient(conn); - connect(m_plugin.data(), SIGNAL(complete()), this, SIGNAL(viewUpdated())); - connect(m_plugin.data(), SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), - this, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int))); - - m_view->rootContext()->setContextProperty("connection", m_plugin.data()); - m_view->setSource(QUrl("qrc:/qmlprofiler/MainView.qml")); - - updateToolbar(); - - connect(m_view->rootObject(), SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition())); - connect(m_view->rootObject(), SIGNAL(updateTimer()), this, SLOT(updateTimer())); - connect(m_view->rootObject(), SIGNAL(dataAvailableChanged()), this, SLOT(updateToolbar())); - connect(this, SIGNAL(jumpToPrev()), m_view->rootObject(), SLOT(prevEvent())); - connect(this, SIGNAL(jumpToNext()), m_view->rootObject(), SLOT(nextEvent())); - connect(this, SIGNAL(zoomIn()), m_view->rootObject(), SLOT(zoomIn())); - connect(this, SIGNAL(zoomOut()), m_view->rootObject(), SLOT(zoomOut())); - - connect(this, SIGNAL(internalClearDisplay()), m_view->rootObject(), SLOT(clearAll())); -} - -void TraceWindow::updateCursorPosition() -{ - emit gotoSourceLocation(m_view->rootObject()->property("fileName").toString(), - m_view->rootObject()->property("lineNumber").toInt()); -} - -void TraceWindow::updateTimer() -{ - emit timeChanged(m_view->rootObject()->property("elapsedTime").toDouble()); -} - -void TraceWindow::clearDisplay() -{ - if (m_plugin) - m_plugin.data()->clearView(); - else - emit internalClearDisplay(); -} - -void TraceWindow::updateToolbar() -{ - bool dataAvailable = m_view->rootObject()->property("dataAvailable").toBool(); - emit enableToolbar(dataAvailable); -} - -void TraceWindow::setRecording(bool recording) -{ - if (m_plugin) - m_plugin.data()->setRecording(recording); -} - -bool TraceWindow::isRecording() const -{ - return m_plugin.data()->isRecording(); -} - -} // namespace Internal -} // namespace QmlProfiler - -#include "tracewindow.moc" diff --git a/qmldebugcontrol/tracewindow.h b/qmldebugcontrol/tracewindow.h deleted file mode 100644 index ffd414d..0000000 --- a/qmldebugcontrol/tracewindow.h +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef TRACEWINDOW_H -#define TRACEWINDOW_H - -#include "qmlprofilertraceclient.h" - -#include -#include - -QT_BEGIN_NAMESPACE -class QDeclarativeView; -QT_END_NAMESPACE - -namespace QmlProfiler { -namespace Internal { - -class TraceWindow : public QWidget -{ - Q_OBJECT - -public: - TraceWindow(QWidget *parent = 0); - ~TraceWindow(); - - void reset(QmlJsDebugClient::QDeclarativeDebugConnection *conn); - - void setRecording(bool recording); - bool isRecording() const; - - -public slots: - void updateCursorPosition(); - void updateTimer(); - void clearDisplay(); - void updateToolbar(); - -signals: - void viewUpdated(); - void gotoSourceLocation(const QString &fileUrl, int lineNumber); - void timeChanged(qreal newTime); - void range(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, const QStringList &data, const QString &fileName, int line); - - void internalClearDisplay(); - void jumpToPrev(); - void jumpToNext(); - void zoomIn(); - void zoomOut(); - void enableToolbar(bool); - -private: - QWeakPointer m_plugin; - QSize m_sizeHint; - - QDeclarativeView *m_view; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // TRACEWINDOW_H - diff --git a/qmljsdebugger_global.h b/qmljsdebugger_global.h index 80715b9..1dc6d40 100644 --- a/qmljsdebugger_global.h +++ b/qmljsdebugger_global.h @@ -53,8 +53,8 @@ ** **************************************************************************/ -#ifndef QMLJSDEBUGGER_GLOBAL_H -#define QMLJSDEBUGGER_GLOBAL_H +#ifndef GAMMARAY_QMLJSDEBUGGER_GLOBAL_H +#define GAMMARAY_QMLJSDEBUGGER_GLOBAL_H #include diff --git a/resources/classes/README b/resources/classes/README new file mode 100644 index 0000000..95a0c86 --- /dev/null +++ b/resources/classes/README @@ -0,0 +1 @@ +images taken from Qt Designer diff --git a/resources/classes/calendarwidget.png b/resources/classes/calendarwidget.png new file mode 100644 index 0000000000000000000000000000000000000000..26737b88389095fef9bcbc9b5ad053adef9b2192 GIT binary patch literal 968 zcwPa>12_DMP)LFKLqG7pmVbA94UGzu8Fbx1Vmyof&+(GL z<~db7VH^d+u;wZ~PWUTSeEK$45?^nC(a4x2LDO^*T+U8(EW_ftHPhzSw$$O^_Qhr6 zd3pg>I2U=XfJ$$9aOb7_u!$9R_r(X?>-kU~Y)qV#Qsv6#bX8WDH`d_ic;v5ZX%uIh zw83Xg6JVbzX@P)GU0CNrOZ}q10{m`{y5jsRhu+)U>tKqa7^><*JRbjNr8H-{-(ShP zySwWN42MH03oeHI2}){d3MQc7cI*K=^PUFd{ z)#y8P7_mo>EhvqFKv2$Rvk{@V7%ZSeL+Cqv1i4rYnc)#j?Z+!u@$vE%gxcGY`SJxX zckkir!vabk4Ep6`S=T`&sGR5@n$BlsY>FBn!7F_ymJR0uUH8!F$HcseahN;yr)OZso^legnLLx zK3~Tb%P_$-niko;i)WDF30WHK|@M7Sgt z>|j&9BUojX!aShl;2>TfI0R=Xgyw5kQQ&I?<+T+I{@cr}H=OViD`_hSSDa5IENFgg z41Ig|LE?wLT#H8nyM-@fokxUASgl&!c|NwJFALiF+6sds$QKsI_Z6aQs zH46>5q5{fWjh2*2Ff4Gfh1%P|+%9PR0om<_!V`s$c3SNv4$|qgpuE0BngE+t4qUx) z1A^;Ytx{BP+Y0}d&7!8}*2xJ-p3bBv?s9?6-&`x+_8ufy~p_z0#J^Twc6ia)m5QCfm0000)XgCX(I1ezh|N7TW0U5?rfuprA12#H z?Rge-({)gE83bLF;*I#HeER&3=agHfQwSQoVY1)vwX?(bcT@pT{fkupEzH*gmSI75 zi(UH#^Hs;xOv4(Ow#JOCxH~X_=grLmdd1o$ONQ0KU=U8H6Eib2H8njwjn2+aq)a9p zjgI0wukk6P6_qYdhBX3xv$uy#<~6d}EONOV@~lwEqgX7WR4SreE=g;m(J02p$0hW5 zVgf%1zGJf|@OySsfg8kC2y|s-1us`u5s5?yM6kZLhK-GN#A7ie5^+4Ao5S$%a0U97 zJvl)?vd64Nfwcn8W;17?8?~Zen1gk&#tK;ce1R@4F2ZKB!DuwX>+v8Fk74e7l($&* zg56`y?D`+DKuz2{-`k5Voeo1oL-2Uq=b@q`8)dg8R7}}vIG@kKHaRJw$5ty2+uIT6 z#v3c@SD^j< z{g|4XQs77IF1t~2@)TH%mD}xx!SE2<{79e&O-(pxX~DND)NZ%K<(gGs8|x9ynQ)14 zj8outxuE0y{lqKZudl}kF3VM+Vg&tuzXDrX_g~?1sl*A0OXFp=SP*Dz#8)mUD`;Pz zbm|0}PN%W35L95xx$s`OjLppiwzf7A4u>%^VuDjXQF`8IyInz3oS-a1q2=0Oaa;wu zv$Kt4GRadIhLzJ{Fc{!)IHX^aP7&piFBS{@^3cWb*w`52JP2N|7e1d)IuPQdiT6I= zGpRtp5Am=HEiWM)3SmAFxDako{T}wKWM*B$sfNXKSjY78BFiN*%lpKBO*O2RAKW_m vo4YSjm%LBxS69PV{STs**K6ecbqf3w-V8QQ2TjG^00000NkvXXu0mjfV}F1m literal 0 HcwPel00001 diff --git a/resources/classes/columnview.png b/resources/classes/columnview.png new file mode 100644 index 0000000000000000000000000000000000000000..4132ee6b1da27ddb1dcac96264323d64d8c711e0 GIT binary patch literal 518 zcwPYp0{Q)kP)r zmA`7jP#DEOZJJQDg@RJW#dpY}xVsg62%X)1fIfmtU&6&dxQUBz;2?sFi&PLH{z*)3 z@3A)_>eV(0(gR1lNAk<@GknGvV{{M2gdeycx#Pl7pc;&mnuN)oN@o7%=`}BzL=ARw|V+TOEz#Xj&)~sM&1Nd_MPD~=fp4X@>X#!c{cyOjd2!5x#%i_t5DO%f&=kP#A zV+INOS^QyynHt<*?!SjBfC=$F77~ojX1a|@!2ON_wuSGbZ++~5^|eSWe*gdg07*qo IM6N<$g1jj0P5=M^ literal 0 HcwPel00001 diff --git a/resources/classes/combobox.png b/resources/classes/combobox.png new file mode 100644 index 0000000000000000000000000000000000000000..bf3ed79f7ec26c340158750fa2adba33bb090514 GIT binary patch literal 853 zcwPZj1FHOqP)In z<3^(G2WCQ7B!xq+vqrZ^Y4(_}_uZEX#r zD4KC76vFK6EH*YaTGk1K5C{T~VDSHYsHz6Getmr%`FtKs!qwGPAE*gDFwn2(a?^aH z(Kx#>^p#}=OG}SXE|sykxQNNgNsNt+VQy}&ZH^#G((jp>dkMzGUugovFw9Y{R)78fV|n>0l1a(U;rRgh zC-7-dUDu&$8pg*bkYBj({^ktbwl812D*J#B4r(S7rU-3z*P4ksv%2X^i6o6Rx{>bM zNF?HrIP?K;ec8g3Hx-1t#FLVl=++6GlMvg&-n=`|z|HIZNJK?=>(nB}As0jPa;Brc zJ}!R7QBy%w~gx!aOAf5I@&F6k7 z*tZ6+a)f_cGZUB^tA+B9V)}EyEcr^bYkpY zCtTw;boG|u_}K(xTLTfRkNh({JiMB}tMUjYXy(=@@KH+uE)9qnoU&tZ(vE=%JBQoR zf5(oS<94{l?C2Y{qwT7QqQhD|`BWG}LPF{}oGk;>_GzVc%^I}yq~pe@gzLi+z8{is z?Y4xAHzZuRF5${e364Gq-}Xwl?38e_Egc1t8V^T?-q-1L8{EgTxKZ7-{g2Nxoc&=l zF1SRT?-kMM6w%ZrV)EVyZjbiB)@ViR6%j2C5zUuH*xEN?cfEj@wrLR@96Z9oK?`6G zeSsQ9&?6lTwk|!Iy3J_(&Wtk-Gfp&SV)oY=&=?+b;)8}PeA;ftskRIpu*IRUPJrd0 zfY^jJ&}y~ivMiNjsG#l>w7#98u2qF&=OXb*hXD=e47^bW96WBuFSFA!ynnD8d-kQ^ z{gaPiR~?g~1(JYgp4Sq%nHni8pL9x+nuju!pJ1@^$(C9*thN5I9?;>P{eiGluES41 zPss2d=S95udH|m@4;5R+?e|%%-{LJpcf2d$wL%7sMl;KqkI7(i6p8;(6GLvP0M~#6|7FbmJ%=>2w+zjz z6!5Br!PnQ9z$O_?HYG>Zo?)o|jN#2PEq3mW!rPTm5X+;mqcjS6C6D5*;&m7qbIH)V zlf&4W6Nj9Vd1!8#fb=W|wOZ|Ruh@&cPd45EB}2^@4DZ<(s!lOfG%%DNV<f3Io*>U24(t%-2ccmR z0s)$M#V*N;MQ|0R6a@--e>Es=Us)+ZpIb5A7Qq>%6a@--pKMBwBJq<>NmA5(rBUO` z_G1@AJ>DS7y%t1)Lf$8vlA}ocq*IcV(tT=_Zq*xPrPcFN^IEHj-lRO&D!(&N@BRb# WWB+-F*HLBw0000u2v literal 0 HcwPel00001 diff --git a/resources/classes/dateedit.png b/resources/classes/dateedit.png new file mode 100644 index 0000000000000000000000000000000000000000..6827fa742ef25f13abc3b802e3c6396351d309c4 GIT binary patch literal 672 zcwPaZ0$=@!P)Z0pH-S`novS^kD146s&DzwW|p(6DUrJ#jMjit8w^4{$tc_u01AB+cvJKVW* z=FH(3Rizt?i;HhEnangmqtSS~u(0r$GjP$IoN;G5m&=jMK&&y% zIKoAOmDbv6Z2nISpMSu}kdhe;86Jp8H~(_%g+XTsEI2WUX?v&;#R@TqQN$=99LFBQ z#AsE@<+An*ZLW4IOiRl0^71+9x)`&wv!`4FAR;}7m#LGFIyKpMa~V~oQmJUMSnP}9 zN~J=vSTr}LxW{AY_}pDb z6#4OutEHk^t!klA=u0Z9)hdNT;pS3d0JE~P66f>zz9_EMYRt^chy#4`N}}dEXmfc7 zq>VAGuC8926i!o-Hh>4lfZM<=AfRQ@RiMBL@EbS)zW)QM4OLm?iTd9F0000x;P z2(2QK5)+k+$`KX4z`+X#Ng(k^LQD*y2ffjx2?q@qJc!g#pe_HUEd~0|ux;Ni?c2BW z=8cDKOCcMUgWqH_`OW<1o6r36n-SJpmg@NN74+c=ly>8@ZmPfs8XIRb7p5I zlOdDI0PHMh`XYG_fcT|u5&Ia27LvJe;lfjUOZB`wyDuw*wH9%@&VJwWB~l1(O-wL7 zH;0mv`c#UoP0c7Nk)m`tYc0k`^b8L%p34zg%d%vG^($6ltmWw4Q`pb5!T~^AhP^@V z=Z8qTF_LMQgd4-UGxTN0i8%^KDgca)D24`+)YQ5fUu!&FlBIFa8+_InZa#wAge6_2NyQB{VS&Jv zR5^l}0!Ip@n6IG)6IqBr3X2pLkOYwndZEzP(%IQ*|1ZsZ&3A<;p>%b1J*T_CSiwl4 zmQba^O_Ub3k7GPmRZa2n-aU(65uOH`+bN9G)e~f*Z0$aAPLrH<>%}}@e6)yJOr1Ppn zUR#=}elgec67dhG&M}_Tbgaws)|+pX9*7Asp&{^nj4?!!VMFG1_HT6<&xHg!I#7`~NHk&s zkBw_r0u~b)jEN`|17`igVjM+=Z5vi$f*in(io{ojAF(_ZAdzIJ9#ISm=uo2rjg*Q| zhXlodsp%}f?^9nBQ4Gzdio_NLLJ)=;VV$beM3DXGm;=Qmnss!y>Si0 zp5W50iPAr!6qDWr1Ebd{CN%9GZ6p&39HqECIK|L(gfXUH0HV9QJKDW_ciETchj8rA z80qR5KX%me+S=79sR)Vz0zteg4i<8=1wK7-o$1^xxyQ4$4&W{jFHktjW(J+|9=L`z=Q<_5Jpa| zYj~O^TwF~{j)jG#x<9C@GX^5U#KZ(74b9c`jg^25D_7;$yw%>043CD$p!k1rh zF|-qwRpniE)qBl#|BW}JHeJowd^2I&^}KDj)3@KrFn1N3vNmqYF6;PmwW)h-rtP)K zZr7f^$1SHrXTd4Qyl$O^ryUobaawrRY0-|7#pj%soOfPw0f=0d?y4y4(=D2)zv7DP z%43-;uezDJh*i%r@l8}%e#m;756I`=LQu9{`sw#c<=mQmNTfXTb8C-1U3dU@4}tLvY? zz4P|tllPxr{P^{C)rF9#kdVv3Fm);k@(X5QWMSjv;ujPWk(7~FP*Ty-v9PptaBy-9 z4A0Cft!ZuRpE!N-vSn*_@4ImE(v92qA3S~f{Q0ZbU%q_*@%JAXNU9XG0#iu2r;B5V zM0oCnvtEZCL|7kqs`ZL3UTHG%)`BHlTVFU`Xzk##YqDFHRe~e7|3)nsBLjlWhF5qGR2CFW<%g7TEU6GA_{hs7K1d%C(gxd(D=d zo1A>^sJR4Fbg3g(v|z7wvWUu_Keuhf zz6-aUXjs4-r5HGA>Y9*~-!|Jt=N*1sDtCXoDd zET8?WOV~bo&sg^K4#P^Gjknb|I?COTmzeLcGj(D}<3fRJ8eJ79mMiRkr`y}mx7fgA z#Tm(te78=P2UAr}XI}hk^Ja}6E5p+{)2}MY&#$|1c+Kw8EKsKLboFyt=akR{04fBZ AO8@`> literal 0 HcwPel00001 diff --git a/resources/classes/dialogbuttonbox.png b/resources/classes/dialogbuttonbox.png new file mode 100644 index 0000000000000000000000000000000000000000..b1f89fbb36f17920935f3118d2bf4cb7988eb16e GIT binary patch literal 1003 zcwPbP0~Gv;P)LKVx5A{$)_0k^@8dOldL@yQu z-3zRQNXxETm=#v5Rz|gMxohNJTz7V6PUp<*Of#EW1HV0U&Ybg^-}!!jXNMFQd%jjw zRJZ{Um@Z0@a#7PbO?gf&|+dA9E{;l3YlQmfvc9n(R~Xc|5dxKBgFB zT2R#0)kOpj(I;A=*6>Gr@LlvG9g|SxTxfa82tfs7Gh=`sd_Rl9^ezmMqj`$zJ)tD4|6js zM}?Y$=O}1ks~kLJSwd^@0($6u*aLZ3RdB!p)8@z)@Slv6Qlvupgce^tx}zYnB-nD9Ego)bGk}sLL6&6mk+z;B zy-rhO=*=5MZroI%(u@+dO+0yuSW~kKRN;EYW+_s)Z_bw2YoN9ci3l@_mDR-4r=ZN7 zp=LQ$e-4Szpay4sOI3^p*5gO*QHUQusd~B&9)Qf|Iri;U`wA<$_{r0wXPgSt$D$n_ zh&_7-;&#JXvjJqEH09PgNGzIgxu002ovPDHLkV1fhR#=HOk literal 0 HcwPel00001 diff --git a/resources/classes/dockwidget.png b/resources/classes/dockwidget.png new file mode 100644 index 0000000000000000000000000000000000000000..9eee04f701917da08dc036ee9da189dde473eaeb GIT binary patch literal 638 zcwPa10)hRBP)u`|P@|xZm&B6u^j42M4{ih|qQ zUkD-SblM0ZNRkAtbCe2EO3`lL1EAOI)jckXVui=HvLKG5xdk~|=eVvz7=|of2ThJs z6a|Z`^f=2hrqd}>wvbZJ8>KayvMd8&=irPc$IJ7))+wAn$Kwe?h|0$_9bv5{3zq#ZmY%h)|U=kd!=Rlaj@R?ExUCPzpqH*+65j?e%jHDoeii-v)^4{e zr>Cb)U@`|FB9(Hv%<%AV^bQRTkB;&(BXjK0bJVf9LJ(jZUXS zr_*6#VggmI0ObBN?#cYK)G!PYkwo-;pY82!eBUPsg6N+}<2Z1Zem`Rn1Z-_>;kquK z=h197ql6LT?&P<%}E|-^=_`c88)fJ6KgD?!!8UGekM5x#6?Ck9HI3*6;qp_;; z`ufW8@o@t5(r7feySt-auOlLijg289tgWr#c^-RvdjoA5NfFn0b90kgtrjhMd3ixqX|-CJ zOyicz)VQB_A-QF`+=$|)oK;b^LTi8V0?U>m6et3mi{fM zh+vFiV`GEq>1o#2*D=PV+pT-H#?RQeL#(wuV^w8jWQ5h#)xIt5w%ct=r4o+gFgiL) zu~?*7EcTqwg+hURK94b`$M-=H@csSG{rx>6;sO|JEsKkbQ(+i3Rkbo`*9TltE>OF@ fy}dSnb(#JH+v>SwVvk$N00000NkvXXu0mjfbB$*s literal 0 HcwPel00001 diff --git a/resources/classes/editform.png b/resources/classes/editform.png new file mode 100644 index 0000000000000000000000000000000000000000..452fcd8878b7c7999b5317aae0cb90c28df36a36 GIT binary patch literal 349 zcwXxa@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaAH3s;Exc>kD-yx!b0Sq7veaE;9 zZ~w1<_&>d>dCTMfPrm)1e&hd?>;F%@{eSk&|CsXTqT1#wAOD|x_y5k<|B+?Q*FOD^ zDr-)uY~FO|?YdiU(<+;fJbe4)`~QHL#69=ko_hEH?31_8zWu-X>3@Dr^Na8QJ);r} zYnv}Wd;9j+|FF13u3tCz0BvP23GxeOIHRmz!M#NFa^z2-P>ZLFV@O5Z)^pqWm;wcy z18p|h qN|^S&FIe>O;x>H?NrUgN_cE?u%DJ9J=l)Sp_;|YdxvXkDp8*COA{z7^CW_Gpxx{xL4Lsu+{*eDOU^i-u-gd~YVmY&45^4)du}@)Q=ouz z;Jq`C&d!`u{OdozOHtz!rY_OTa~_F3zBr+qK_N(@VC^c+rb7lNH%a>>-gs8YA1?8% z(56{?{`2JEAGR}gvp)TPr~0;@ph#PBpiTnU;iWp)3tAJWsz~qn@O|g{b+;8Yc=~tU sJ1o+cep%)L*I`3n|ANF5ch-Mrd+aIjaL(c~Gf?<=y85}Sb4q9e0BilN6aWAK literal 0 HcwPel00001 diff --git a/resources/classes/edithlayout.png b/resources/classes/edithlayout.png new file mode 100644 index 0000000000000000000000000000000000000000..4dd3f0ce467d85487c16aa133cb536a630ea27f1 GIT binary patch literal 455 zcwPa=0XY7NP)Vo_CgIm}L12lDk~|M2VtIB4<7{q5;_Dg!`OQB{Vc@$7k} z`cPKS-BYQ<(Rc>*QkkkY3INIGkE>yw`!fH~|F6q?y;F--S5=j6i0Z`F}7s zz}g^ACVwoe?ID&6Xn=VNa??1qSs`(jN0_f5whf8QQ&9ND>crw(6ewg0a{^>Q5vf5c za}}5>6H$3PJpk)H#b++_x$a34h%XoJHX`V_`-S}u=toi x0?Q5zv2PV3(xdtl^=s1-cvsa`GTZgFM)+}t`kIwxQMXJuv8(b0uKU0od$6BBD|YkPb9*z)G0+U63#dCTFm+n)U2b>MJfMf1LA|MxxrfAG}#q^j1`>egeg{vUt& zKfAg)r?&OvyZ@)&{Xg^O|C#sybE})rz5jpy{r|k0<_jPGU;6O>^0T*BKK{S{>Hp2o z|8IZ(e+P)Z{=fU>|NXE3AASA*f@eTu|5g?A!n6-~Ye({y)^BZWS=R z^h$#Kf*BZDSXsHb`Gl2~RkZbu-F^K->eUBt-hTjs zh1t1!z-YGdba4#P2=1Ne>wP#t!1er|N>8bYUeaCyt_6x6i#YQB>i&z`zH7p(bvpt( zLNZrhoz;K+`6B;GOUq5$PtVxHd_sq0SSNz}CNNvp2h<^I|r}NZE;oHXwX4{@VX3$+% zzt4TO+o9eZ#aP`d?Jl;`Iu8p?XDw6T@Vlf;UTE^0PfInz-oO4H8YshK>~G-Wvo+v2 zzu)Y|QAtj#&C}i$hh7TU_vVUuhQXpa8}q02nO?2A{jBG(mU2<+dKuMqpWL2ksieu@ zVG6iBsUkDp8*COA{z7^<#wb5U*clw zKJxJGiMRhxzWaab-T#!z=CsP@nDXYcPu`w=^Z&xz|CgV=z4Gz@wNL+Ve)@ms>;EU; z{y+Kt|Jk?yFTVeO`|E$b-WpY)_3R}vp~u i)-d@V(=;=D-DUBw^Cc7n&pPe`1&gPvpUXO@geCwz+o#?D literal 0 HcwPel00001 diff --git a/resources/classes/editvlayoutsplit.png b/resources/classes/editvlayoutsplit.png new file mode 100644 index 0000000000000000000000000000000000000000..720e18bb32f1945fb20a32b3facc14fcff525a7d GIT binary patch literal 740 zcwXxa@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbQ|Pfzda>C&cyt|NjhN0Aawn$bt|c zDJcmT>FMc#FdQNpnwy&^Po4}{rtcUBky^caHAI1HOp|9q8<3q{e!Kl%1wLPA1TR#r(#$=23()9!<8Y;5Z4>hV>rr46lB6K3^Hoi**o|Cu-c&s(-? z#l8Ql?*HF-Hc=P_lhu>!TZov4E_H=O!sfe3*7;f4@1t ze_`V?J8r#58qLiEXVyoQdf|M}iV89RwFr8ib;>RS~NecimY*=%Rw?G7BS8 z3$BXkNN{)U?LLshy;g=u9#*@6G$V*XN}(lQA(!`-eN{at40)@IU7~ zt+%(gGB7X@;UOfY1fWnTOifHoyaZsT)9H>(CWB>JJgg=sb1$F-CZM1X4E8*vVW89f{UH@MPKwn;_dg>JO*({e*DV9&1;CJBG z+8XO+Zri@i>))S>xSsnTjX}xxUFOCwp?y8VV!h6dp&^bRJ4QaACvoNsug2rd%*?dF z5!0-sl6^a*BD6~gL6}#uS}wD2{yd&-Gv3p~n+FcCva+K7i-*vE%iLmw)M>!yzxa|^ zsmw2?N#@;mFiivB_d;llrZmJ>;0CY>wF(7(8y&?4W?xM6+2Pj-0)Yqugb36<2xBgn zTiO6F7K@b1B?W36=hkg1SFTW-yvFuwm5QNrZN!r&L4O0w0pg}hBGyV1>ERM zk=A^c|GcLFNK|w^kEm%9sD97_O9?_q5}lpwbn5CZrD__L@4m-y9HwJYj-LEbJ>F=l z@>c|Cnuh0lg#H3-tax#8k&eV8h~WO1)oLtVyG|J>WDaupsl6%>GK@6urBVsk^YJ|o zxzP#%NQ5u3EeC+wH|L007FWBvc>DbiaO*ysNeGGW`?#(P>#YDavvh@k{GGgdL{u&8 z>}Bq18oS;)Le(lGYptc>pQtLQIm3?Q0J6y)kmlT&-Hew(Yjf(*_3z$CAn9E1IT>_1_7UMe5!<%4bv* ojhyly)uTOo_I^G*Jp2{F-%53J+_JrO%K!iX07*qoM6N<$f|R7xr2qf` literal 0 HcwPel00001 diff --git a/resources/classes/frame.png b/resources/classes/frame.png new file mode 100644 index 0000000000000000000000000000000000000000..68f5da0a363b599fdce0121ad67afbbe05a494d8 GIT binary patch literal 721 zcwPa~0xtcDP)d>E{C`wY){5j1G3pY1$(slz~a3wF!oVjO?=U!hcV+{8Z*1f0# z>glV)J1uKtFvhUDNdZbJETwME%K-d1c>YgZF5=niuZb|g%lBWQmLf)i;Lf!oSX{I zWFBk^XEGTom9h~1exG)`EqG_ANVQrKJRVPIHk*PS$03`|Z3<_zSy>zoheT0JaG{XL zbzQ;p`J5mK&{_jv+cv)MvD$qiyjYCmm@sTgQZ{Sjc^;OPY&FIZ1OagzU*{=2uaPpA z5?(q9naySiX<7Kbk8RtsCyH8JUJeDj?ry4>Hws5li}83YxY2lw<1AaK-Tpf)|ET!f`xfFc=6?t5w?w|Ju0j3N@CoMZ-00000NkvXXu0mjf DPhU54 literal 0 HcwPel00001 diff --git a/resources/classes/graphicsview.png b/resources/classes/graphicsview.png new file mode 100644 index 0000000000000000000000000000000000000000..93fe7603ae8b4b9c8af8947afc8608369c579aed GIT binary patch literal 1182 zcwPaX1Y!G$P)b z)oV;sXB@|IP4>b!%d#wSS+bezs+(@vCY#e`b|cQj5dvG>4FN$ZlyWKb0!kJ^I$JJd zWy;0UmV)hR!CEd`p&melGQ~xlV1QCq91x)t8Hh4zOYLt@yRAVH#Vl*`P5PqebDli; z=igNTR{bBX=tr@!vFj8HWno4}M$>5h1(v227?bySP`6*l(bPMqm;S1{WtgSci@HB zo!A(39?x%^M8M8z$%YVSc259P%_F_KEKEjd9ru(Jtd>uZWMqJuswS8R`>M;a=lC?i zfT(gHMh%pWvuLt;z zfNQ}GZB-RSxdjAO{fm41?!K_HvAsV+3a}cBk)D+Uo}|u)CDsGU4L}MFaGQZ4+YBg; z7Ak`Y+nFVc;X9K0cfmVSbsqEJ)zr?; z&Tj<*!886h)ODI2@-tl!x7u+e{~KJfj-p6w#LSJG5S6HLr1d(6uG!Js+Y6n6#_a4Y zbah4qM9cAI=1=J9A3~-u=bY7Q9p>}-jefYP#b~zE$?$fuDiM`O55S}s!amv$N?i#X zoq~z6tI%q-kd~`Jovg?F{5%-phjFr{7eysf1jJNE5NkDq!Fa+CYgC$)k){Ja_*X>; zjCq0hz1xVnxm!>wm5?cv=rdbDQ53c^75FO40PiP?a~RjBXOSf?^j-;L$r9plI8XMp zm0_Ib;upFUPNxH@TrSL(-%u)*;XQ&~>Kg`4)7ZRUiTHwMa$*Mp!_r~uvY?~mXMDyI zuJ>Bq-Q64Rn!URETD!DN>Xt|(7rdv@)zhB2KW~$J?L%0a442I#n3|e`Addolz7N@A zGSAU6BubibYiTpCz4p w09r~~^T_Z&_+z9*QVnT>G)O8Z1ugf?Uqik&$H?zCga7~l07*qoM6N<$g1;^*CjbBd literal 0 HcwPel00001 diff --git a/resources/classes/groupbox.png b/resources/classes/groupbox.png new file mode 100644 index 0000000000000000000000000000000000000000..4025b4dc512b2314a43e1b6c0f2a853034fa1ba5 GIT binary patch literal 439 zcwPaw0Z9IdP)hzOj1mBp!eB9ImJ{$eykrQQFPn?Sg!K&Q9`Qkf`@%|Ns7<&m z;0TU+=3ONS9&eStK9lxa>ye+*zT2b5oKbJw>D@r7bN?i!= zaqEyN1ERvY3oPJq2x*gs#msO7u6SWWx`HdzFa#Va4(b*K4k)uvm9T;}JCp&32e1|e z9-nWlV~xfWvfgP6;BbJ#U={HFsKb!@TAO? hWZ%kQP+PFz@t@=lnvuN#3#tGB002ovPDHLkV1jyox{?3@ literal 0 HcwPel00001 diff --git a/resources/classes/groupboxcollapsible.png b/resources/classes/groupboxcollapsible.png new file mode 100644 index 0000000000000000000000000000000000000000..62fd1ad56c2b2d2a14ee565f961328164f1741a9 GIT binary patch literal 702 zcwXxa@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EaHVU^EKw332`Z|33q9z}D6l!ib27 zFf}zbHa4!Utp##}f`Z^`cJ0~)VeH<$d*{xbYHDh5DLXqm7Z;ZoFJ4TXIC1&%a8lwr$&7U0s2)pFe;8{{8#9b?e^0fA8t(dG+emxpU{vn>X*yojZ|{kz2NGxp3ja z_3PIsO`3G^;>9OVo^0N{8R(41j~~B!_3Fx%D-Rz&{QC84T3Xu6moI<(`0?n`qqlG0 zu3EL~_U+q?7cV}1`0)Dm>mNLLaP#I(psViQz1!d4@95~bW5p}ZW)ZY<=V3Bdl}x{3dqVmgqmt+mTY;z}Ju+hK#@ASUOn{*+?&;zfQV}=x z!qGftLlK9I&l5R{Pd#wtFm|3fQ}W+`@mHO}u5XvUnm9iEm~!;VV9b^abjD6q}CkIQwC3iK6qyY xId2vasnBZ(m~+MA)5QM2AM0fQDIC~e!>GH?^r)mfV>&2}c)I$ztaD0e0szeyI^O^Q literal 0 HcwPel00001 diff --git a/resources/classes/hscrollbar.png b/resources/classes/hscrollbar.png new file mode 100644 index 0000000000000000000000000000000000000000..466c58de5bf9ef818002f3b6453fead298fb5256 GIT binary patch literal 408 zcwPaR0cZY+P)@lMQt}3;PA<3 zQ*n@nSkm=FL+8w}cWpSh$xy6(PL#?$Zdyp@cclVNq~@br!|A=@{2@cJ@_F$$&qB|M zS9T2Bmxkjz!^NZF>N!KP^1n>H*mKAIO#H)+zb1Yu_$s<#$GW@sg6{Z(oP?{W`rS3i z9BKKE`laRljc~^kF0YX(QYX^`Q1|{?`0|GGulNKIPwQ3En2RF-00005P)9G1&8sskV7c%Jv;`@ZMlzhr zW$}x$g5UUxGh+fjP=@ECAwEWQaa~LKRbA{JF~t4E9%3iUYrxUm zB3+vFnjEM_?D@PdKJ`H0JBfRT4RJl(BDM<|dPE`-WV2aKJUOS}7l}{a*Tsj=>x1I) zIMV4fR8>VjpWi^CP(Z0v(mYh#&Em~O%H?u_GOUT8eo*j}#3wQW-$;BYtc!gUlQP#V@qd@yJ%b5x$de)%G+@euph zXWS+?ocE=h#p7=j+$%Y8eL~Oh&}Bo+(q8!jyK2Bu+^xB4rDAMGL8j=$=s0Egw!mPl ziBwb{5VzZn%#_|AE~Es`UZuT_w0=OW4u@lI=#nnCH9AJf-=|wmr00000 LNkvXXu0mjfVa`}| literal 0 HcwPel00001 diff --git a/resources/classes/hsplit.png b/resources/classes/hsplit.png new file mode 100644 index 0000000000000000000000000000000000000000..1ea8f2ac0e0715d546b4748d6ec1a44dfdaedee9 GIT binary patch literal 164 zcwXxa@N?(olHy`uVBq!ia0vp^k|4~)3?z59=Y9ZEoB=)|uK)l42QqndnN9uJT3(kg2YIF6*2U FngE;KHpTz| literal 0 HcwPel00001 diff --git a/resources/classes/label.png b/resources/classes/label.png new file mode 100644 index 0000000000000000000000000000000000000000..5d7d7b4cc9c575724f7604354e5ec160730140bf GIT binary patch literal 953 zcwPay14jIbP)3(&@4Y^os<2hzeSy5kygGk)bJ} zCTgLH3PLZCQE2lmC@Ly@Tk71F(`wtl^KAFpHt(!Hbl}GxE_c73opYWe0wDSy{62_8 zb8>QWpw()j)9Jim&s8cF$b!BpXqjmxqih;r4l1mnfO|v!Kd<#FkVf8p|KPOg8>$c1rCP; zlarG$zv{+leLmWcC9~{%!^6X8G}KGX>Rp@>h2hJ|E_$2JPD}YpR``b9Zim@yhVkW7e7seNJBQ;z z&3qpi7?{qNg-?4e_h30uQJB6Ay$vP!F)$rFbmUn${(%%;fmN{c;>;w8r6LFv%8TO(88?@a zL?Tf}*dATh!ZtdL+2Zw+yEwc(3JEbGOm>`5c#a2?2NH`2IhT2>RxL-@^`rRq<&B{9 zSw{^D)R9;nC1#QfL?*Gucc^7tNfvW*6{|Th(pItqrnmiG(%z10(V08Sze6q6K0pRr@b0^Dj8NSo0jHr*|I@c>MM@-IP>yoVmnbw zSQ}68gQ2qqxvB^uX#&@yg+j|Cg5S?Ra+Y}|@uP^wapi1MevXC20-3Y2WUz*E8}SmM z6_R=_dVg|{%=w0{<4VJB>^82ZUQ)kefgkdeN4v(!J?lzWqkN=)E%uSKWfkVSUGAGI bxa@xc$n3O$6DLQj00000NkvXXu0mjfZN0ZO literal 0 HcwPel00001 diff --git a/resources/classes/lcdnumber.png b/resources/classes/lcdnumber.png new file mode 100644 index 0000000000000000000000000000000000000000..c3cac182659b239a4f4bba0d073317140e22cb73 GIT binary patch literal 555 zcwXxa@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EW)6_X2!ETp36Q?d|PaT3QfxXJ;pn z{Qv(ygA0gz@ZiA@A3nTz@#4*!H;*4bK7Rc8{rmUR)6TNsIdkUo z=g$)+OeiiczIyfQo;`b>K7G1#=gw))W?)`}gnPvSrJUA3xTvUAuAP#y@}l ztXj3|)TvX;mMyz>?b_S7Zx=0Ebouh-moHz=pFe-joH@I8?YeX4&dixJA3l88+uIu% z8F}yCy}y6|e*gach5XHCptB@Og8YKje0c>`d91uSxTRT@+?m+ZkDNGnBdUjC{@a`- zKs8T1T^vIy;zBQ^<}(}eG$d}fJa)Vge|6h2tXi2u*>Ao*@JSx_QeRt>D zNp*-EdiZ<2rgSqyesOKmuBmW0~`E#z-U19f&&$atDcksqP?fU$@X@OMP$)D--fz;tjL**51 zcMJE$3xyn(v$Ve|rF1Rgy8fK>;LF;n)%(uymdKI;Vst E08cam*8l(j literal 0 HcwPel00001 diff --git a/resources/classes/line.png b/resources/classes/line.png new file mode 100644 index 0000000000000000000000000000000000000000..5c64dfb591c000cb76b66e7246fff5ed08ed2565 GIT binary patch literal 287 zcwXxa@N?(olHy`uVBq!ia0vp^Vj#@H0wnYHF4+L2SkfJR9T^y|-MHc(VFct$mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-&H=;`7ZqH%ufdYl8!hO`$i{0`1rT_nDmGs<@2+>HlwRu-td2pjF-w72Cky%O&Zi*gz=FCf0 z_7+(=ot2gCv~I)E00q8NpI)xhez0MRhkp7+(<>n<#XA=*OXs+tpX%AUbSd`*z2p=9 z(suHcf?kEsVbp25@A&t;ucLK6UXEpB}P literal 0 HcwPel00001 diff --git a/resources/classes/lineedit.png b/resources/classes/lineedit.png new file mode 100644 index 0000000000000000000000000000000000000000..75fc890f407f698ee43245fd97dc3de1237bf2fc GIT binary patch literal 405 zcwPaO0c!qR4C8o zl08eqP#8uJDg6jdh76rL2!&)2|A1W_3)b#}tB|38qCY@E6bGT3larH+lMbR&LCBCH zPIhSrX=p(gd0cKw3Q2XB!*e+o9xl9>7x8!a2W3iBuyJq;aj>aSg3{^vVAfYy$gy@) zhBUCDGMFv&y^)ESvqJ;yzP|LC3nouO?6Cz-sJT)zL%Oo1r%Lr8#6CW_p+1DBnrbRc z*8N_H0|IbEO)~#8&e+(TcS7_``CTYcqC}Xi`)#)TCKM@BBowV)Ufv_!WXrKexnOd= zDm#aI)$;}(btyy_AL`pL7aHoSkTV^Lm<}zd5iT>E+U;Lz@5( zEUI`kY2g#(;?tsuM-_oZnHu%NC3UD%qm1l zXSRF2Z7~wrbThNp-DjVjd1hkyd|oUrF5>@(fDp>o>kVvgZ}Zp0{QNxD*T2d?MQ^M0 zgCO8ZzVG|!bUJ9>G!4k3-$$YER2+Q%^d(#;VzC%ImsgiKJakYly+ox_L8H-N76k75 zbcrAOzTc4-`D}@fJ!!*!ZX1^-v@?_#LMoN!!^vb4>GWs_NQ@PrVy-PsAp*9p>zcqi z1Q!?Q*xK5}^wbn;wJLrd9E2f>hDNdWLq8smqgWh)>-7QK_9P!1AJ1Xs{R(ehSa^X# zVW!Kp$Bw4wc|1eE<1yO-#<^Thf(e|So?>(BJKnx|hyDFMRH{`Yd75dz51FFbnOU^m z_F#WHV#z(}7+X z$abIZDKH9$9_e((1g57Q*N?HW@eLnVSMg(a2ae+mNG%Kjt-C6rCzOiC@D&Cyv3W9* zLa9{b&H1N!3`@z8R-=hywv;%Xv~Cikg*Cv~_1aQ$7nsORpxJCn|I#Rgs4CcYFX~A4 z(egHciRJaxHL6kxh3NuLPEJs*)gsmA_h#T5YqJ#?1)_kn*({b{FEgXLxjERj&CEzf zoUFDR`efT}HCwILovn!(XEIs2xsKhvT`av?;^ft8zd{X1rz&w(#zN{p`6wA`SoDXY zUv9(6$8tT2`;N2oGX*XT#$rHjngvtU<=a;GuHU)~LKaDY3P+kKDm@$5I;vx6|l1QV%yYX#@Q&P~UEEZ!ja< bryhR*e#vOLcrHAt00000NkvXXu0mjf<4kxu literal 0 HcwPel00001 diff --git a/resources/classes/listview.png b/resources/classes/listview.png new file mode 100644 index 0000000000000000000000000000000000000000..d1308d5758804bf47f5b9a70431d9590cd2a29c8 GIT binary patch literal 756 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 literal 0 HcwPel00001 diff --git a/resources/classes/pushbutton.png b/resources/classes/pushbutton.png new file mode 100644 index 0000000000000000000000000000000000000000..61f779ce2bf0c468f3c2e72c8b0d6cd15576be62 GIT binary patch literal 408 zcwPaR0cZY+P)=6A zNtD}P!MXXTj0QTumrDxf^Y0b8H3quGH)kw&M%3&Z!Vt# ztp0P)=8v%5p)27NN&e7YR|;DU2J;QYTZXGJT=WqD0000S literal 0 HcwPel00001 diff --git a/resources/classes/radiobutton.png b/resources/classes/radiobutton.png new file mode 100644 index 0000000000000000000000000000000000000000..10c1d8c3efdfc8c9285e79f5befa6e130e3e4871 GIT binary patch literal 586 zcwPZY0=4~#P)e-}uYe3$jjbfsHmPMlsq}ERvv6ED#AYLMWrdDD_}rb;xWO2^JA#hczNf zg1QXqlD11khrxC!X%tE?WD!LjcNo4b{@)J97XOqw#&iAf@Vxwl{=M{HV%cQKE~i{_ z$tk-G*;c_aPN$9(c2?G!KC`{jT}lneBZrI?u$p>v+vi7_;x%O+GE8itds05R)nvgk zj^|F+UhthSeC88#ykm-GPW+*dFiQ9x1JJa&XAzK3* zhYBNn9GkUTOP*uJCkfH`J3S6`x!JhvEQb5(J9Wp7|-i&^3g zFNxIgMsnOB!x~cw`Q>b2SBv?KR}=}?aT|9S=PDjkNd@Hk4R5X7WSS@R*YQEJj4{ZD zsuepsO8pdg!~{JA337nTTw{oR#AdBy*!K^F7P8#uE)!(A&Nx>%%TfGG;f!@bL!Ld8 z9kmfIG0H_QFw7|q6Z;Vnspuc?UJjDn@+qXa5=ttmgyIUV7^Gj_9rDO4zXA%#FYl@m{d@R- Y0&Fzl}$?mQ51#`{e%8Qn?Uz1 z+eAb$k|a1_5C#$M3JL;Ug|v#2DIE72E@mOLE8N&7aN);BXCt@}+-L?Oh@S4bd1aa} zYG#x0aL*hs5AR%N&VZsQcgbXO7>mVFmSv1aqkJ_({oeopQN{|SQmJ91(ZKn9&Y8_- z7Q}yMn$6}93WWl)fbUGa4wQ5{onj`F!B8kM}S<%$rKRA3N?dE(J%#Kn}9 zq`&zYkHW}8e89zn!GMeD7AehN#PT`d;U(a<3|4W!-}fv&y9c~@1l&J0iK*!IdY;AC zPk=WX@Z^@n-EP;j`1Tp_;T7=c%0}Gjbole?MXbC4=H390Q#MDT>$>N}j^aop!e!L> zS7OIA_A7RLD*TEa-#ou!hgsoY>@eNF#qD;RZ%n7te5FlhsBgw)9)}?wkAD=4MXXdR zSglsEUa#{BCoo?dvHOBBsm|wdB9Tzp%kdcq1ds>@gD7foEqbDMgGo>L7la)bTVa*4 m#@JwNF?JZc4(z!>KH>{b2U6CCu7TMA0000zW|YCVqqzmwu+4dWNBJyO(Qjvq_UCCG;%Wym|BCD|d^EihO~fV`1&$ z9a;5VH=n(WZlC9vT2WI|lbf5%DNKi#D? zy(U_1|Ls?K)n4aW=Jl&_Z?;eUKJWA+>v?Ohc|8w1))->M=eJ0vNBL=*p8Cx=)pO6; zb#=u0k2Dq;wX26PE{#es>n)u5lkxZX Z{rj$`j59a3>VOgwgQu&X%Q~loCIEOu7VZE5 literal 0 HcwPel00001 diff --git a/resources/classes/spinbox.png b/resources/classes/spinbox.png new file mode 100644 index 0000000000000000000000000000000000000000..cdd9fe141324c16758bd305b945339be013f1bc7 GIT binary patch literal 680 zcwPah0$2TsP)a zoyP8k=kpoub{j&7w^_LRPg2;xZjf9qhg2#BA%rhbyQp_k*il|-Y6E`)6+(Dx{A#j0 zi+7TE0(${GGWKHcHo(i`*^?)e2~<_Zdc8)eRPwF!TaAeb)oK-$O2xM$9+^LB?3dMO zG{Ss7cXn*CScIY|uYvs*iin^n3U<34w%aW-nG9;Rn)jCW3(7eMV+_q^6Zw1|jYb2E zF>hDctlbBa?F!p^?r+g(6!m)j?UvS8s}&N71d_=l;_*0Qu^3{p*xmUY3WX312EiD+ zbCGG9xZQ5pY&PJW>j1!n5Ga?+UzTNQL?nNz`iCn@2k^aKuYcHIU8cWiH_ACDVfTgr O0000M272 literal 0 HcwPel00001 diff --git a/resources/classes/tabbar.png b/resources/classes/tabbar.png new file mode 100644 index 0000000000000000000000000000000000000000..d5d37836b5322efb8c77e9740278eb313b72ae31 GIT binary patch literal 623 zcwXxa@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EaHVU^EKw332`Z|33o_fU2r$?E(== zNy&^Z#)XGv3;IN|dKe4(MWQMg7ao#TQBj$^i&0EWtZ1Uh^nHwKYHF>kMAADLebX4T z`xuuTl`WjgS~-Wmc!G4{RL10HMjaiUrAIUxRx&oNVQg8?*tU_eV+&)~HpcE9jJ>-V z`}Zlb#>xeZ6ZSJUE)_{_W9(QfQaX##E1A(dh0#BQ zF(8vMFq<(bmoX%dF|>d&tdKFhm@%T1F|v#?s+`d?k+E~VNcSd@-mN078yIsZFlKZz zPT$K|zer@-9>%>U4?#gGQxfDC%)qPW%fihe$)?2U!ozB8z+|N%5~vvyCod|ZZWrQ298e79DD*CELDwf!j&&rm^3*$sd;ee zT%Q*EKFY`UFi+lj<~LkvepdV%wK>;eYLy1=Z}L2PE;&yE|JLC8$9b= kxx@z(g>8a4s$KOzSeKf4OqTJK1tl#8Pgg&ebxsLQ07HJga{vGU literal 0 HcwPel00001 diff --git a/resources/classes/table.png b/resources/classes/table.png new file mode 100644 index 0000000000000000000000000000000000000000..4bbd9c2d081f15879cd05dfb1818683af9c156ad GIT binary patch literal 483 zcwPbH0UZ8`P)q?8P7XJO4mU&%5=EcEsjtyzh;WMH9E_A2T_g~qKL@8d zHB^Imi+J8~z3=aRd!EpG`Mlm8_a*=U0Im&B&-M&VL%ZI6+Pe?7bsYeJfoC|`e6Zly zRcMcU_ax|AmjECo7TK`uHnb<+YCy+|cL3m2jbE^&6AGS4aEKiM(AdFO2<=di5kyz&oxz%~Fl^cX(?0hJ1zTT=mm zR3QNY2TE{h)q4Q&U4`F(fQM$_Gx`7^^)Uhjlu7_407xY&K){hXfR6xRDDf8%&^H0! zumu3p7JdQ(QUXW-P)j5rG}kH#AOS!v%}t=zgl2epvbiV$BLMKn$jlcmR5Ik*-irkr zz&-$g*Kpy;jd@4|$CfP#EdT&etK1lyhBS5MR!3U_000_kZfY7$U6dwf+6n~#0BAH) Z%K!KgkpVaS25JBR002ovPDHLkV1oTdvk}@P)|`T3V$EmNFr7||JkRkPnWibT*^J3#g0&VAK}34@q9|Hf4}?H&0F&oAkB_gY>IDd>!q0ik z$qPuHyrvEhk?q^aUEt<}s=u3SU1rtG<2t zL>ZY!JBhL8J2`=G74Z2SCz+eQ3KGDap(4l-2=i z2eqJWjK+Werb~VY80vKyw^>~02Z0y!;v)TTqXUbq4{eijk^x08<4vF*xB#kU^V%A& z0sXBM6;Nvrye3q&2ks9c*#xSqQ^T}}d!EO9eCsvQWzp78Ti=U`xJ(6-i`D721El|O zVm<=SjVtzDr@O#t184>$KqjsnBjA>^W&?2P;OU1{H literal 0 HcwPel00001 diff --git a/resources/classes/textedit.png b/resources/classes/textedit.png new file mode 100644 index 0000000000000000000000000000000000000000..32e897d972759d27d3371b07b477c7ac701c474d GIT binary patch literal 823 zcwPZF1IYY|P)k|>DHMF^e*Bh?U$NhR*iOb=zZyV*p0 zabTD?GjIO$-v7OMqba3$h!y}?US1xQQYM8EF)1ZdN`w$t@_loMoKs3IWHOn(0DzP- zIWjU5i$o%xoA2_daW9+A#x^!KlE5n;fDj@Ui9~2?YqNVW7{u@QwrfE{I z*SWd5p<1nSeSJ-(QlVTfQ!bYo7#KiG8MCR7Qo3$#ZLa9f2Q`{^oD#cZqa1jcJ-FrEI-gt>#L%roa{r>D@HL zFNf)S)@K7mpGOhj1*fG`dY<;!V6|G!^~{~#yMmY6N%7&!2lU6f4SHF*WcTMT+`#(R zbr;XoYPIRZ@o+pdJj3*xX_r#xlTMb#msm_JdH|eMG+OTBxcgl<_qC(vV`KF8_Oi0FV)O3-E`BOv7{=ve_){?d^1QbPx`Q(RCeN*Io5F5D4J+`_VMbmG_2WaC>{p;o%`dh#Y{X zlwxXXYS1*zq?9st$G7u8UsMiQI5;@i(;n(G{R2@4iLGj8ABX?|002ovPDHLkV1mzY Bd945d literal 0 HcwPel00001 diff --git a/resources/classes/timeedit.png b/resources/classes/timeedit.png new file mode 100644 index 0000000000000000000000000000000000000000..c66d91b2f78c740ff59a0490da286a05a916e877 GIT binary patch literal 1353 zcwPZX1-AN$P)ljZo6!Y-2&BGgce$YRIs)hAN&Ct z3=ckN)L4m8qyK;rqA}5+(HD(Bh>7~3G5$z|_#-BU2cwB#B1%l~M@w3468V_kufG`im9Fd@>y~>gYqS8&R5eG7 z!Y^Sf*I%}pa%9cqZ1niM4-P!zz%2^C{n>AJ^mOE&o1BdZqGN3B5(fMG$+xvp{JqHZ ziD~*b^;4RkXZXknAB|K=n!4!BH!(3?-uc19S3Um^@Xb#jTEC(-GhB|X-q0|{mQAbZ z@4uXeh717v_wVQMw};ueV*tLnU4>S@$R8BY$nMxD6KW`ZF%y5u7g2u z3j)=5v~Y?WSI6}A^&ujNSgcsAv!pg9F=^emViB=)uIyy{RV^GXoFWKRALwm$urV^| zoMUZnj!W0|paWg2Oa$iyCypdBRI3S2Tun|85x~*iwTkum5a%4mFz_eXx`9$GbmR;= zqY1-G9V+4wC!|S2T#ak7g}8G<6orUb)+}$J6br`ML0EVoiFE_B<&@>^31KB-DxRXF z<05<=;Cl+?`&7ymy1Q0mti_37MX=T|Jw1(cj_wr!v!f{@?$3%-Yl%}qDJWMeRLT|b zJlsN$(=_3ypT{}$%^`jm9>!RMbAsnVWnq1wHE}AWwl?nyK%DozIG9bAu(Gq0-gUhw zrBKR8DTVL*?09GgLwDZE3%g%pd}5-W?_JkRPj3%}84qzaRvm1u8A(#Z=_o@KMm5+u zsPgfZj}8L1Zr#c~cW>vFmtW5g9e&IDC2uTYj6Q{la#% zukn=P_xU1cqY}QaFxIf?%8f)4(w5Jol#dgkICF-t3JxO{Pr1>0#p7+IJxa_(Vb1c| zc)--;6rNHjrD)1z$z~d9X=)+R0lx2Z-8I+J+}wgviZF_J=iofQ&Ki`MiSf45o;uj= zx+6)_^nTCA$;T5u2SF?Ybj5@8!Yq*KYYTP2#tcYMEyaYFVgi}Dm{n)2J!NnYGn z;L&|&NvdViB!2t&Yqxy4__ygjq4Ib2zUd*`rJ>p1(9yyTJ({&E8d=kx!S^-46cc_b zCVVzlWn^*=m6WVQy*s;S{66QNkVV1gY{}4DH>ot;>pb1+{D2^nCDWJ%Ag+d_afoMA zJZI)42!<+q@BQ@e49_`-=Xn9J^gOlDuymO}@W2q+Wg7?@J3!?Ca8f1-PZAb?wBNn) z5lLwVm|xJ@1Q4ofonR_D%ZW6js`X{6t7j0TnOYv(_GzBXNidZ+rf1s=S8;XmHZuB>ZZW2;V z+LU%7bP;f4!A)BuscD*%+BUsZc7F0LFnoK7cWXm6a8o zbEpWSiU=GX9g)doz&REc7Fb+d#P_`5zaRo4?X$)h(&@zz{L=@p*5aJQ)a$6~S;pfD zlF4bZ*(~{do@8>0rgI>Is-U8XSVVB0Lnf`yFdrji&(7G zXtZjyT<3PGARefLZ(r?j#cieC4T8d8MTH=h0M_+CJUuT5s6*&*AePb8GWr)XJP;V5tQmIg@ z@3XgKI}q*lebl$G@$Z8{uq~BJynMv}idwknTfq(;4_036AE9NS_7`D3{1eH&-4Xx* N002ovPDHLkV1g}mVk7_n literal 0 HcwPel00001 diff --git a/resources/classes/toolbutton.png b/resources/classes/toolbutton.png new file mode 100644 index 0000000000000000000000000000000000000000..0bff069a5df3ac4dccbd9cfcd2dc8e4b822ae7b5 GIT binary patch literal 1167 zcwPaI1aSL_P)0#0?im+f}R$5h6g;*?xWHNaoDS_5g^qw?{Rj8^028$xpQg~P~ z6Wh4_cs!1yqoWf^_xJZPF)@L@zCLtyeU6Tf4wRObLf3T&VWaf}n8=|pm{_JvBoZ=? z!}9VnrlzK_zP^sTcZV@MJA;9N0bIJ&f(sX#k(rqxg_+P;tVPT%VB%xdawXB|9$H%3 z;P+RexcC&FJ^KUq?~ll}#>Pe*9!kYfRnYB_sa&@jz}2{@g(xO(*p9y|zPetwRX(ZFgX#oXLH zwznf7aL(uXD7jYkLg<$G)16rvQyOKi1a!mH#f&CgzggQisJxM z5JDrB0jYLoW*SePJmO^1cBfBQke{#f0I9z<@Oa$RiX$5EOB5CsA}`PFCgNO`nfN|s z627(g_EHo`WtEiy+_=$+iV7dQgv#HhM86;u8s+^|&6<4bx`u1lu2WJU``Vyn4#C8H zNrytAkJzKU(YhYF3cdrp-U8W*f&wohk!?JG{yQD*T}pU{?u@5QDl0g9HgHHDPjSTx z0D~e(!DFw*`+<@b;PT}wWWldfRLz@6Wa|;NVup!Xbryxkj2!doQwhATnCG9YPg*pM ze%dqXxO=j*bMo`^J&cUv;v&s3jO|1s`4?I4DU&8B_9(*qG%K(%q4jSPi^UZ_|9n*G z$a4ZaEoIXjoQ7d{kwOO%s*0jS9S+AoA-P$EE+qf}002ovPDHLkV1hb~FP{Ja literal 0 HcwPel00001 diff --git a/resources/classes/vline.png b/resources/classes/vline.png new file mode 100644 index 0000000000000000000000000000000000000000..35a7300a580a121f815819409ed7a3a69b9d8c24 GIT binary patch literal 314 zcwPZI0mc4_P)eJoN>#n0|v8NirueRF<`-oIErrz$ui@-fa`u@6iY`{Ror|bOkLMf zaP?%ImvFr%9){sb>@v~!7yrdyEq-{?VqkvK3vtKULhOCg8pU}DiGg_ujpJz3H08{2 z*0!w_dzX;P^V}8PZ^V7ybMw45r)jcH({Pq?=Hy~$c-Q9J7X6Q(8|hxroEq~LdjJ3c M07*qoM6N<$f|gi?2mk;8 literal 0 HcwPel00001 diff --git a/resources/classes/vscrollbar.png b/resources/classes/vscrollbar.png new file mode 100644 index 0000000000000000000000000000000000000000..28b7c40c6e2c596a7cfecc8be3ad14941e8899c8 GIT binary patch literal 415 zcwXxa@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4foCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#Dl5R22v2|&P<#HS#}^oU2n zj`PU>jSrL^WLSg#|Nmdl<|M%qv9N6w^T)qWPf!29zvwBK#Q8av!spmJnV;r2ToKMT zP!~AOu+j8H>WQ|dA1B(JW6yc6Ie5om4bKrdgXYAxLk4FGH0IBaXs&FC5bdZlVKFbe@tfS=8dEv2wlh;c;|#&6a*EiTX@lTA)5=#pxR8ZO^HQFm{b^p z5|cv67@3$2GbO1&NQz1bD;S~%dS!KC{R>YQzJq0G3%%^(;l23I`Mu|RIOjb`Vlx4G zfF0On&b+PSf6M&~v=G<>BmeO0U=95r7; zha>1nD>~YSYGTOOf&3Rxtatt5>!a(|xm>O<8!OKCH~}n}w)z)+1i~9V&hCo+K&`Q* z!31{)gF$t6c4iuy5AK<;E5lPzBTg;g*&b_4V~-z*WFL6H{SwiVee- z%jA_ANJD#jyOPOd23(fYCcX{#VwRv)?mB-2W3?6O;c zj78fH0!iI~6o~BPC2N7CwojBpejAYC<>jTTt7~Fn;^X7v=;)Zxv!uDXIjg?w=CgP6 z=g%*gv}D@$6HAvag(VjNd8W5$e#h=|hC((6y&1P2HE)lQ3y zjO<;wDlsuJJv}`)H#e-hzjpDC$!m5M6%{2^v`<{Wf9tth6%`eAb#=T#!iyI#j&7fK z?8c+6uCBvZ?m8Fu`1<-znl#BOtL6N?XO5{AH8nu@H~V%h6jD$%Gcz;v3^O)1wzs!; zb#-lCvOOcDrxECSy^FVjvo_)S_Q7I*G zNA&$W_iozS*zP{jIqRG99)a$578TpZCLuE&(H4LH-3h@>vuEu_4&W( z{B62-&UeTEqRd@#ds-JJy2%x`d_Jd<{CGV>zDBk9z0Ehz>)-zO@BdzAy|5qo@8ezP V8Er`Fk1+$qx~Hq3%Q~loCIF@o6%hac literal 0 HcwPel00001 diff --git a/resources/classes/widget.png b/resources/classes/widget.png new file mode 100644 index 0000000000000000000000000000000000000000..1cf960e61befdb4657cbf3f0b6646f09d9bcd926 GIT binary patch literal 716 zcwPa_0yF)IP)WGajZqH6;Dcu>pHYr zEoB>z$0SLr@MC^9n{j)4TS*TgwVE1#e}9kf`xHe1 zl*JqlJ!-XDRoF1f*DT8jf{}8n*G)XnQ@oTC-}lL~3@H2A^9I!Gb=HrT<1&(fJYRLd za5&UDAPmREaiXx}>}$n*QaB99ESF1#2ZI9|jfTS0={M%{xx(FU7t69Vz9KxCOjs-y zim>fIySuvzFBS`~udfyEblTWR>Si=wzkw>A`C;4r0f7GB?kwtR?ILANz+vE>jR=xj*s6w&I(6IR>k(W{KiFJ yNLfCGL?S6uC;@>GAP^Wvx$K`>_~O62^L_ya)C>E9Py`780000T zl}k%iQ5462YoC*^UT7&oUm$7{1ql{7?F%#!B8cJ=O`=(YC`ScBj+&JpAjc7vp=lyY z54`3zjouJ+)#}`?uX`T5!P)yf(9}T-7Mr`yxxe*aYp;8kXsrtgKvKTwLs|R;!y5Jr3y39M7#Lk7p&z=lLh-2De zz&*|18CAoa`}zZ#JK|vI+X8l{icP7<&Ijuh-#(*~ckD1O%?{Jx0P};Ole@EE*M)pP zU*C5VrS=?n5upT>1L7EQ8vKM8=1-7Vv7}`ly^v81py19~l}?DH;Boe-7{`1z$pRgF9vG!y&+~|=<$egsWo9Np z1i}FPH3N<^inYJK6;o4F&zr|*y6T$%o%V6vDKT{BC7jq7Llb>gag=Gr^z`)I>1(tC zhuDU7w!o=&@N=yQAo3wxN>aI6>wXdW1nemk3eURvfL9#YGC`;zw34f{5UfIF5?~Gp zT=VD)u*>s2g2q~^WE1lvShAJBy=udAz$4&~1^))tipAo@2&LnVDto^h+iC!l6#(7? zH-Rd!40u3U%mxvl4mb;3B>p4Wj?Dp&frr36P%-djv75!Lr(Hms@!iC8{;yS~fxswT zFurVJVHPaF4xq_+9pG#M4uP5hCTmJ-ttGn)4cy^BEY`mcmO(at>WXLp0000(PGD8ik2PrecqGU!XnH2Vt64FI_ zDSFr*iXwz))1erewFE^meX&q;vF2qYBxG5`9%feaQqks?mzqv(?&6qEaq0fQ&VOz4 z*KO)-@MULb=Y0NW=V5?|;EIKYTZv>Cz?k!$3btSugt$MK%Q61BTyK8WYwY`=nPvly z9ZEw};W@PT-*k*6ipiQy>wy<_ykykgdyQ?ts{Q!;=+}OQO(LJbPeXI4)>Cr8A=rVo zM@qC;E75kb6?K^r>pFE01mWb%p*f9EW>HlwP&x^=^_j4>+laF7)|#5y<6Ki=mR9RwCCqOUHFw~X3UOsT`R^C1>8u44Rp9eEF22~)jLJ=+o0ZhoJ!fIZi6PLYLu?;c=|Na;lBHL!H2 zJrIm`xb$x`nX~Zrpzgc|hY#Grez?noZ`{sJ>HJ06sEInX$j)F(`)d?6J+U^_^3&XF zyxm_UPCxCW%q2P}tY&rNFkEqepPHH)FK&=dQxt_t^!}FoL!9S zux?aC*Pow|QoH-bc(nAKH=F>$kXc~lpd$2pJbPo6q}i7L_~xE06b2*Cd|B3 zp-|`-x+YAcMMXuX=H_O<&{bg?Ehs23H8nN)jrxRXG(SJz*x1;(A=E2Oqq(`cMu|kS zVblYrQGq~U6pO|Gg)W0>G&?)nAQFjuqU068%suB5rcpkhZ>X=Y_drR3q##l-DTK6{ z6h_+W8q@P0|KUK8WFC*_4L#-pwv(bryGhZm@ix~(e4ZM(TyFmg)I=7ZB^@LskPegf zl6JWswCWWs!Q@`QF;ENHz#*L=u}QI{$n|2&;H0FaQ*m)|s_^je0kZKjDbDqC{l=L6 Y1zDAa4!5w!`Tzg`07*qoM6N<$f?1iPWdHyG literal 0 HcwPel00001 diff --git a/resources/gammaray.qrc b/resources/gammaray.qrc index e6ee689..4ce6e99 100644 --- a/resources/gammaray.qrc +++ b/resources/gammaray.qrc @@ -10,5 +10,62 @@ kdablogo160.png splashscreen.png kdab-gammary-logo.png + + + classes/datetimeedit.png + classes/textedit.png + classes/calendarwidget.png + classes/progress.png + classes/scrollarea.png + + classes/lineedit.png + classes/dockwidget.png + classes/vscrollbar.png + + classes/combobox.png + + classes/hsplit.png + classes/commandlinkbutton.png + classes/wizard.png + classes/widget.png + classes/spinbox.png + + classes/hscrollbar.png + classes/checkbox.png + classes/tabwidget.png + classes/dateedit.png + classes/label.png + classes/listbox.png + classes/columnview.png + classes/dial.png + classes/frame.png + + classes/tabbar.png + classes/hslider.png + classes/groupbox.png + classes/graphicsview.png + classes/mdiarea.png + classes/fontcombobox.png + classes/dialogbuttonbox.png + classes/toolbox.png + classes/timeedit.png + classes/plaintextedit.png + classes/vslider.png + classes/doublespinbox.png + classes/lcdnumber.png + classes/toolbutton.png + classes/table.png + classes/widgetstack.png + classes/radiobutton.png + classes/pushbutton.png + classes/listview.png + + classes/edithlayoutsplit.png + classes/edithlayout.png + classes/editgrid.png + classes/editvlayoutsplit.png + classes/editvlayout.png + classes/editform.png + diff --git a/sidepane.cpp b/sidepane.cpp index a389106..80d1b26 100644 --- a/sidepane.cpp +++ b/sidepane.cpp @@ -30,20 +30,20 @@ using namespace GammaRay; class Delegate : public QStyledItemDelegate { -public: - explicit Delegate(QObject *parent = 0) - : QStyledItemDelegate(parent) - { - } - - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const - { - static const int heightMargin = 10; - - QSize size = QStyledItemDelegate::sizeHint(option, index); - size.setHeight(size.height() + heightMargin); - return size; - } + public: + explicit Delegate(QObject *parent = 0) + : QStyledItemDelegate(parent) + { + } + + virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const + { + static const int heightMargin = 10; + + QSize size = QStyledItemDelegate::sizeHint(option, index); + size.setHeight(size.height() + heightMargin); + return size; + } }; SidePane::SidePane(QWidget *parent) diff --git a/sidepane.h b/sidepane.h index 09b0183..65b6e66 100644 --- a/sidepane.h +++ b/sidepane.h @@ -31,15 +31,14 @@ namespace GammaRay { class SidePane : public QListView { Q_OBJECT + public: + explicit SidePane(QWidget *parent = 0); + virtual ~SidePane(); -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); + virtual QSize sizeHint() const; - virtual QSize sizeHint() const; - -protected: - virtual void resizeEvent(QResizeEvent *e); + protected: + virtual void resizeEvent(QResizeEvent *e); }; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt dissimilarity index 84% index de318db..bfc12c3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,21 +1,30 @@ -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -qt4_automoc(test_connections.cpp) -add_executable(connectiontest test_connections.cpp) -target_link_libraries(connectiontest ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY}) - -qt4_automoc(attachhelper.cpp) -add_executable(attachhelper attachhelper.cpp) -target_link_libraries(attachhelper ${QT_QTCORE_LIBRARY}) - -if(UNIX AND NOT APPLE) - add_test(connectiontest-preload ${CMAKE_BINARY_DIR}/gammaray -unittest -i preload ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - add_test(connectiontest-preload-filter ${CMAKE_BINARY_DIR}/gammaray -unittest -filtertest -i preload ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - add_test(connectiontest-preload-filter-modeltest ${CMAKE_BINARY_DIR}/gammaray -unittest -modeltest -filtertest -i preload ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - add_test(connectiontest-gdb ${CMAKE_BINARY_DIR}/gammaray -unittest -i gdb ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - add_test(connectiontest-gdb-filter ${CMAKE_BINARY_DIR}/gammaray -unittest -filtertest -i gdb ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - add_test(connectiontest-style ${CMAKE_BINARY_DIR}/gammaray -unittest -i style ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - add_test(connectiontest-style-filter ${CMAKE_BINARY_DIR}/gammaray -unittest -filtertest -i style ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) - - add_test(attachtest-gdb ${CMAKE_CURRENT_BINARY_DIR}/attachhelper ${CMAKE_BINARY_DIR}/gammaray gdb ${CMAKE_CURRENT_BINARY_DIR}/connectiontest) -endif(UNIX AND NOT APPLE) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +qt4_automoc(test_connections.cpp) +add_executable(connectiontest test_connections.cpp) +target_link_libraries(connectiontest ${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES} ${QT_QTTEST_LIBRARIES}) + +qt4_automoc(attachhelper.cpp) +add_executable(attachhelper attachhelper.cpp) +target_link_libraries(attachhelper ${QT_QTCORE_LIBRARIES}) + +if(UNIX AND NOT APPLE) + add_test(connectiontest-preload ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -i preload ${PROJECT_BINARY_DIR}/bin/connectiontest) + add_test(connectiontest-style ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -i style ${PROJECT_BINARY_DIR}/bin/connectiontest) + + set(RUN_FILTER_TESTS OFF CACHE BOOL "Run filter tests which fail due to a bug in QSortFilterProxyModel") + if(RUN_FILTER_TESTS) + add_test(connectiontest-preload-filter ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -filtertest -i preload ${PROJECT_BINARY_DIR}/bin/connectiontest) + add_test(connectiontest-preload-filter-modeltest ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -modeltest -filtertest -i preload ${PROJECT_BINARY_DIR}/bin/connectiontest) + add_test(connectiontest-style-filter ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -filtertest -i style ${PROJECT_BINARY_DIR}/bin/connectiontest) + endif() + + find_program(GDB_EXECUTABLE gdb) + if(GDB_EXECUTABLE) + add_test(connectiontest-gdb ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -i gdb ${PROJECT_BINARY_DIR}/bin/connectiontest) + add_test(attachtest-gdb ${PROJECT_BINARY_DIR}/bin/attachhelper ${PROJECT_BINARY_DIR}/bin/gammaray gdb ${PROJECT_BINARY_DIR}/bin/connectiontest) + if(RUN_FILTER_TESTS) + add_test(connectiontest-gdb-filter ${PROJECT_BINARY_DIR}/bin/gammaray -unittest -filtertest -i gdb ${PROJECT_BINARY_DIR}/bin/connectiontest) + endif() + endif() +endif() diff --git a/tests/attachhelper.h b/tests/attachhelper.h index 83379e6..aa0c531 100644 --- a/tests/attachhelper.h +++ b/tests/attachhelper.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef ATTACHHELPER_H -#define ATTACHHELPER_H +#ifndef TEST_GAMMARAY_ATTACHHELPER_H +#define TEST_GAMMARAY_ATTACHHELPER_H #include diff --git a/tests/hooktest/main.cpp b/tests/hooktest/main.cpp index 49067bb..89ee94e 100644 --- a/tests/hooktest/main.cpp +++ b/tests/hooktest/main.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . */ -#include +#include #include #include "mainwindow.h" @@ -35,7 +35,7 @@ static inline void * page_align(void *addr) { - assert(addr != NULL); + assert(addr != 0); return (void *)((size_t)addr & ~(0xFFFF)); } diff --git a/tests/hooktest/mainwindow.h b/tests/hooktest/mainwindow.h index b359e2a..35fd591 100644 --- a/tests/hooktest/mainwindow.h +++ b/tests/hooktest/mainwindow.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef TEST_GAMMARAY_MAINWINDOW_H +#define TEST_GAMMARAY_MAINWINDOW_H #include diff --git a/tests/test_connections.cpp b/tests/test_connections.cpp index 598baa3..87772d4 100644 --- a/tests/test_connections.cpp +++ b/tests/test_connections.cpp @@ -24,7 +24,7 @@ #include "test_connections.h" #include -#include +#include #include #include #include @@ -119,7 +119,7 @@ void TestConnections::timeout() for (int i = 0; i < OBJECTS; ++i) { QObject *obj = new TestObject(this); m_objects << obj; - connect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(dummySlot())); + connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(dummySlot())); } } } @@ -205,6 +205,18 @@ void TestWaiter::startThreadsAndWaitForFinished() //END TestWaiter //BEGIN TestMain + +TestMain::TestMain(int argc, char **argv) + : m_argc(argc), m_argv(argv) +{ + QMetaObject::invokeMethod(this, "startTests", Qt::QueuedConnection); +} + +void TestMain::startTests() +{ + qApp->exit(QTest::qExec(this, m_argc, m_argv)); +} + void TestMain::run_data() { QTest::addColumn("type"); @@ -231,7 +243,7 @@ void TestMain::run() void TestMain::threading() { TestWaiter waiter; - const int timeouts = 100; + const int timeouts = 10; // some testers to be run in the main thread // with varying timouts TestConnections tester1(TestConnections::NoEventLoop, timeouts, 10); @@ -260,6 +272,9 @@ void TestMain::threading() } //END TestMain -QTEST_MAIN(TestMain) - +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + TestMain tc(argc, argv); + return app.exec(); +} #include "test_connections.moc" diff --git a/tests/test_connections.h b/tests/test_connections.h index baee691..921e719 100644 --- a/tests/test_connections.h +++ b/tests/test_connections.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef TEST_CONNECTIONS_H -#define TEST_CONNECTIONS_H +#ifndef TEST_GAMMARAY_CONNECTIONS_H +#define TEST_GAMMARAY_CONNECTIONS_H #include #include @@ -94,10 +94,17 @@ class TestThread : public QThread class TestMain : public QObject { Q_OBJECT + public: + TestMain(int argc, char **m_argv); + public slots: + void startTests(); private slots: void run_data(); void run(); void threading(); + private: + int m_argc; + char **m_argv; }; class TestWaiter : public QObject diff --git a/toolmodel.cpp b/toolmodel.cpp index a37d1ed..bb0f5e9 100644 --- a/toolmodel.cpp +++ b/toolmodel.cpp @@ -28,19 +28,21 @@ #include "tools/codecbrowser/codecbrowser.h" #include "tools/connectioninspector/connectioninspector.h" #include "tools/fontbrowser/fontbrowser.h" +#include "tools/localeinspector/localeinspector.h" #include "tools/metatypebrowser/metatypebrowser.h" #include "tools/modelinspector/modelinspector.h" #include "tools/objectinspector/objectinspector.h" #include "tools/resourcebrowser/resourcebrowser.h" #include "tools/sceneinspector/sceneinspector.h" -#include "tools/scriptenginedebugger/scriptenginedebugger.h" #include "tools/selectionmodelinspector/selectionmodelinspector.h" -#include "tools/statemachineinspector/statemachineinspector.h" #include "tools/textdocumentinspector/textdocumentinspector.h" -#include "tools/webinspector/webinspector.h" #include "tools/widgetinspector/widgetinspector.h" #include "tools/messagehandler/messagehandler.h" +#ifdef BUILD_TIMER_PLUGIN +#include "tools/timertop/timertop.h" +#endif +#include "pluginmanager.h" #include "probe.h" #include "readorwritelocker.h" @@ -48,7 +50,6 @@ #include #include #include -#include #include using namespace GammaRay; @@ -60,31 +61,21 @@ ToolModel::ToolModel(QObject *parent): QAbstractListModel(parent) m_tools.push_back(new WidgetInspectorFactory(this)); m_tools.push_back(new ModelInspector(this)); m_tools.push_back(new SceneInspectorFactory(this)); - m_tools.push_back(new ScriptEngineDebuggerFactory(this)); - m_tools.push_back(new WebInspectorFactory(this)); m_tools.push_back(new ConnectionInspectorFactory(this)); m_tools.push_back(new ResourceBrowserFactory(this)); - m_tools.push_back(new StateMachineInspectorFactory(this)); m_tools.push_back(new MetaTypeBrowserFactory(this)); m_tools.push_back(new SelectionModelInspectorFactory(this)); m_tools.push_back(new FontBrowserFactory(this)); m_tools.push_back(new CodecBrowserFactory(this)); m_tools.push_back(new TextDocumentInspectorFactory(this)); m_tools.push_back(new MessageHandlerFactory(this)); + m_tools.push_back(new LocaleInspectorFactory(this)); +#ifdef BUILD_TIMER_PLUGIN + m_tools.push_back(new TimerTopFactory(this)); +#endif - // tool plugins - foreach (const QString &pluginFile, plugins()) { - QPluginLoader *loader = new QPluginLoader(pluginFile, this); - if (loader->load()) { - ToolFactory *factory = qobject_cast(loader->instance()); - if (factory) { - m_tools.push_back(factory); - continue; - } - } else { - qWarning() << "could not load plugin:" << loader->errorString(); - } - delete loader; + Q_FOREACH (ToolFactory *factory, PluginManager::instance()->plugins()) { + m_tools.push_back(factory); } // everything but the object inspector is inactive initially @@ -186,24 +177,4 @@ void ToolModel::objectAdded(const QMetaObject *mo) } } -QStringList ToolModel::plugins() const -{ - QStringList r; - - if (!QCoreApplication::libraryPaths().contains(QLatin1String(GAMMARAY_PLUGIN_INSTALL_DIR))) { - QCoreApplication::addLibraryPath(QLatin1String(GAMMARAY_PLUGIN_INSTALL_DIR)); - } - - foreach (const QString &pluginDir, QCoreApplication::libraryPaths()) { - QDir dir(pluginDir + QLatin1String("/gammaray/")); - foreach (const QString &plugin, dir.entryList(QDir::Files)) { - const QString pluginFile = dir.absoluteFilePath(plugin); - if (QLibrary::isLibrary(pluginFile)) { - r.push_back(pluginFile); - } - } - } - return r; -} - #include "toolmodel.moc" diff --git a/toolmodel.h b/toolmodel.h index 249434d..4d46b4f 100644 --- a/toolmodel.h +++ b/toolmodel.h @@ -66,9 +66,6 @@ class ToolModel : public QAbstractListModel */ void objectAdded(const QMetaObject *mo); - /** List all possible tool plugin files. */ - QStringList plugins() const; - private: QVector m_tools; QHash m_toolWidgets; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..ec66164 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(objectvisualizer) +add_subdirectory(scriptenginedebugger) +add_subdirectory(statemachineviewer) + +# Disabled in Qt5 mode, unless it was actually found. +if(NOT Qt5Core_FOUND OR Qt5Webkit_FOUND) + add_subdirectory(webinspector) +endif() + +add_subdirectory(widgetinspector) diff --git a/tools/codecbrowser/codecmodel.h b/tools/codecbrowser/codecmodel.h index 3b15dc5..4809391 100644 --- a/tools/codecbrowser/codecmodel.h +++ b/tools/codecbrowser/codecmodel.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef CODECMODEL_H -#define CODECMODEL_H +#ifndef GAMMARAY_CODECMODEL_H +#define GAMMARAY_CODECMODEL_H #include #include diff --git a/tools/connectioninspector/connectioninspector.cpp b/tools/connectioninspector/connectioninspector.cpp index dcb633c..d6650e5 100644 --- a/tools/connectioninspector/connectioninspector.cpp +++ b/tools/connectioninspector/connectioninspector.cpp @@ -29,6 +29,8 @@ #include +#include "proxydetacher.h" + using namespace GammaRay; ConnectionInspector::ConnectionInspector(ProbeInterface *probe, QWidget *parent) @@ -37,10 +39,10 @@ ConnectionInspector::ConnectionInspector(ProbeInterface *probe, QWidget *parent) { ui->setupUi(this); - QSortFilterProxyModel *connectionFilterProxy = new ConnectionFilterProxyModel(this); - connectionFilterProxy->setSourceModel(probe->connectionModel()); - ui->connectionSearchLine->setProxy(connectionFilterProxy); - ui->connectionView->setModel(connectionFilterProxy); + ConnectionFilterProxyModel *proxy = new ConnectionFilterProxyModel(this); + new ProxyDetacher(ui->connectionView, proxy, probe->connectionModel()); + ui->connectionSearchLine->setProxy(proxy); + ui->connectionView->setModel(proxy); if (qgetenv("GAMMARAY_TEST_FILTER") == "1") { QMetaObject::invokeMethod(ui->connectionSearchLine->lineEdit(), "setText", diff --git a/tools/fontbrowser/fontmodel.h b/tools/fontbrowser/fontmodel.h index cd478bc..9471104 100644 --- a/tools/fontbrowser/fontmodel.h +++ b/tools/fontbrowser/fontmodel.h @@ -21,11 +21,11 @@ along with this program. If not, see . */ -#ifndef FONTMODEL_H -#define FONTMODEL_H +#ifndef GAMMARAY_FONTMODEL_H +#define GAMMARAY_FONTMODEL_H #include -#include +#include namespace GammaRay { diff --git a/tools/localeinspector/localeaccessormodel.cpp b/tools/localeinspector/localeaccessormodel.cpp new file mode 100644 index 0000000..ebb8417 --- /dev/null +++ b/tools/localeinspector/localeaccessormodel.cpp @@ -0,0 +1,93 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Stephen Kelly + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "localeaccessormodel.h" +#include +#include "localedataaccessor.h" + +#include + +using namespace GammaRay; + +LocaleAccessorModel::LocaleAccessorModel(QObject *parent) + : QAbstractTableModel(parent) +{ +} + +int LocaleAccessorModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) { + return 0; + } + int area = LocaleDataAccessorRegistry::accessors().size(); + return qSqrt(area); +} + +int LocaleAccessorModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid()) { + return 0; + } + int area = LocaleDataAccessorRegistry::accessors().size(); + return qCeil((float)area / (int)qSqrt(area)); +} + +Qt::ItemFlags LocaleAccessorModel::flags(const QModelIndex &index) const +{ + return QAbstractItemModel::flags(index) | Qt::ItemIsUserCheckable; +} + +QVariant LocaleAccessorModel::data(const QModelIndex &index, int role) const +{ + QVector acc = LocaleDataAccessorRegistry::accessors(); + int offset = (index.row() * columnCount()) + index.column(); + if (offset >= acc.size()) { + return QVariant(); + } + + LocaleDataAccessor *accessor = acc.at(offset); + switch(role) { + case Qt::DisplayRole: + return accessor->accessorName(); + case Qt::CheckStateRole: + return + LocaleDataAccessorRegistry::enabledAccessors().contains(accessor) ? + Qt::Checked : + Qt::Unchecked; + case AccessorRole: + return QVariant::fromValue(accessor); + default: + return QVariant(); + } +} + +bool LocaleAccessorModel::setData(const QModelIndex &index, const QVariant &value, int role) +{ + if (role != Qt::CheckStateRole) { + return QAbstractItemModel::setData(index, value, role); + } + bool enabled = value.toInt() == Qt::Checked; + LocaleDataAccessor *accessor = index.data(AccessorRole).value(); + LocaleDataAccessorRegistry::setAccessorEnabled(accessor, enabled); + return false; +} + +#include "localeaccessormodel.moc" diff --git a/tools/metatypebrowser/metatypesmodel.h b/tools/localeinspector/localeaccessormodel.h similarity index 61% copy from tools/metatypebrowser/metatypesmodel.h copy to tools/localeinspector/localeaccessormodel.h index 3aaaef3..1faf893 100644 --- a/tools/metatypebrowser/metatypesmodel.h +++ b/tools/localeinspector/localeaccessormodel.h @@ -1,10 +1,8 @@ /* - metatypesmodel.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Stephen Kelly This program is free software; you can redistribute it and/or modify @@ -21,33 +19,38 @@ along with this program. If not, see . */ -#ifndef METATYPESMODEL_H -#define METATYPESMODEL_H +#ifndef GAMMARAY_LOCALEACCESSORMODEL_H +#define GAMMARAY_LOCALEACCESSORMODEL_H -#include +#include +#include -class MetaTypesModel : public QAbstractItemModel +namespace GammaRay { - Q_OBJECT - public: - MetaTypesModel(QObject *parent = 0); - virtual QVariant headerData(int section, - Qt::Orientation orientation, - int role = Qt::DisplayRole) const; +struct LocaleDataAccessor; - virtual QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; - - virtual QModelIndex parent(const QModelIndex &child) const; +class LocaleAccessorModel : public QAbstractTableModel +{ + Q_OBJECT + Q_ENUMS(CustomRoles) + public: + enum CustomRoles { + AccessorRole = Qt::UserRole + 1 + }; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + explicit LocaleAccessorModel(QObject *parent = 0); virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); private: - int m_lastMetaType; + QVector enabledAccessors; }; +} + #endif diff --git a/tools/localeinspector/localedataaccessor.cpp b/tools/localeinspector/localedataaccessor.cpp new file mode 100644 index 0000000..d6feba7 --- /dev/null +++ b/tools/localeinspector/localedataaccessor.cpp @@ -0,0 +1,173 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Stephen Kelly + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "localedataaccessor.h" + +#include + +using namespace GammaRay; + +Q_GLOBAL_STATIC(LocaleDataAccessorRegistry, instance) + +LocaleDataAccessorRegistry::LocaleDataAccessorRegistry() +{ +} + +LocaleDataAccessorRegistry *LocaleDataAccessorRegistry::instance() +{ + return ::instance(); +} + +QVector< LocaleDataAccessor * > LocaleDataAccessorRegistry::accessors() +{ + return ::instance()->m_accessors; +} + +QVector< LocaleDataAccessor * > LocaleDataAccessorRegistry::enabledAccessors() +{ + return ::instance()->m_enabledAccessors; +} + +void LocaleDataAccessorRegistry::registerAccessor(LocaleDataAccessor *accessor) +{ + ::instance()->m_accessors.push_back(accessor); +} + +void LocaleDataAccessorRegistry::setAccessorEnabled(LocaleDataAccessor *accessor, bool enabled) +{ + QVector< LocaleDataAccessor * > &accessors = ::instance()->m_enabledAccessors; + if (enabled && !accessors.contains(accessor)) { + accessors.push_back(accessor); + } else { + int idx = accessors.indexOf(accessor); + if (idx >= 0) { + accessors.remove(idx); + } + } + emit ::instance()->accessorsChanged(); +} + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(Name, + return locale.name(); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(Language, + return QLocale::languageToString(locale.language()); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(Country, + return QLocale::countryToString(locale.country()); +) + +#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) +LOCALE_SIMPLE_ACCESSOR(Script, + return QLocale::scriptToString(locale.script()); +) + +LOCALE_SIMPLE_ACCESSOR(Currency, + return locale.currencySymbol(QLocale::CurrencySymbol) + + QLatin1String(" (") + + locale.currencySymbol(QLocale::CurrencyIsoCode) + + QLatin1String(") - ") + + locale.currencySymbol(QLocale::CurrencyDisplayName); +) + +#endif +LOCALE_SIMPLE_ACCESSOR(TextDirection, + return locale.textDirection() == Qt::LeftToRight ? "LTR" : "RTL"; +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(TimeFormatLong, + return locale.timeFormat(QLocale::LongFormat); +) + +LOCALE_SIMPLE_ACCESSOR(TimeFormatShort, + return locale.timeFormat(QLocale::ShortFormat); +) + +LOCALE_SIMPLE_ACCESSOR(TimeFormatNarrow, + return locale.timeFormat(QLocale::NarrowFormat); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(DateFormatLong, + return locale.dateFormat(QLocale::LongFormat); +) + +LOCALE_SIMPLE_ACCESSOR(DateFormatShort, + return locale.dateFormat(QLocale::ShortFormat); +) + +LOCALE_SIMPLE_ACCESSOR(DateFormatNarrow, + return locale.dateFormat(QLocale::NarrowFormat); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(DateTimeFormatLong, + return locale.dateTimeFormat(QLocale::LongFormat); +) + +LOCALE_SIMPLE_ACCESSOR(DateTimeFormatShort, + return locale.dateTimeFormat(QLocale::ShortFormat); +) + +LOCALE_SIMPLE_ACCESSOR(DateTimeFormatNarrow, + return locale.dateTimeFormat(QLocale::NarrowFormat); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(MeasurementSystem, + return locale.measurementSystem() == QLocale::ImperialSystem ? "Imperial" : "Metric"; +) + +LOCALE_SIMPLE_ACCESSOR(AmText, + return locale.amText(); +) + +LOCALE_SIMPLE_ACCESSOR(PmText, + return locale.pmText(); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(FloatFormat, + return locale.toString(10000.1); +) + +#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) +LOCALE_SIMPLE_ACCESSOR(NativeCountry, + return locale.nativeCountryName(); +) + +LOCALE_SIMPLE_ACCESSOR(NativeLanguage, + return locale.nativeLanguageName(); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(FirstDayOfWeek, + return QLocale().dayName(locale.firstDayOfWeek()); +) + +LOCALE_SIMPLE_DEFAULT_ACCESSOR(WeekDays, + QStringList resultList; + Q_FOREACH (const Qt::DayOfWeek &dayNumber, locale.weekdays()) { + resultList << QLocale().dayName(dayNumber); + } + return QLocale().createSeparatedList(resultList); +) +#endif + +#include "localedataaccessor.moc" + diff --git a/tools/localeinspector/localedataaccessor.h b/tools/localeinspector/localedataaccessor.h new file mode 100644 index 0000000..6e3fb39 --- /dev/null +++ b/tools/localeinspector/localedataaccessor.h @@ -0,0 +1,115 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation toolocale. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Stephen Kelly + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_LOCALEDATAACCESSOR_H +#define GAMMARAY_LOCALEDATAACCESSOR_H + +#include +#include +#include +#include + +namespace GammaRay { + +struct LocaleDataAccessor; + +class LocaleDataAccessorRegistry : public QObject +{ + Q_OBJECT + public: + LocaleDataAccessorRegistry(); + + static LocaleDataAccessorRegistry *instance(); + + static void registerAccessor(LocaleDataAccessor *accessor); + static void setAccessorEnabled(LocaleDataAccessor *accessor, bool enabled); + static QVector accessors(); + static QVector enabledAccessors(); + + Q_SIGNALS: + void accessorsChanged(); + + private: + QVector m_accessors; + QVector m_enabledAccessors; +}; + +struct LocaleDataAccessor +{ + LocaleDataAccessor(bool defaultAccessor = false) + { + LocaleDataAccessorRegistry::registerAccessor(this); + if (defaultAccessor) { + LocaleDataAccessorRegistry::setAccessorEnabled(this, true); + } + } + + virtual QString accessorName() = 0; + + QString data(const QLocale &locale, int role) + { + if (role == Qt::DisplayRole) { + return display(locale); + } + return QString(); + } + virtual QString display(const QLocale &) + { + return QString(); + } +}; + +#define LOCALE_DISPLAY_ACCESSOR(NAME) \ +struct Locale##NAME##Accessor : LocaleDataAccessor \ +{ \ + QString accessorName() { return #NAME ; } \ + QString display(const QLocale &locale) \ + { \ + +#define LOCALE_DEFAULT_DISPLAY_ACCESSOR(NAME) \ +struct Locale##NAME##Accessor : LocaleDataAccessor \ +{ \ + Locale##NAME##Accessor() : LocaleDataAccessor(true) {} \ + \ + QString accessorName() { return #NAME ; } \ + QString display(const QLocale &locale) \ + { \ + +#define LOCALE_DISPLAY_ACCESSOR_END(NAME) \ + return QString(); \ + } \ +} locale##NAME##Accessor; + +#define LOCALE_SIMPLE_ACCESSOR(NAME, IMPLEMENTATION) \ + LOCALE_DISPLAY_ACCESSOR(NAME) \ + IMPLEMENTATION \ + LOCALE_DISPLAY_ACCESSOR_END(NAME) + +#define LOCALE_SIMPLE_DEFAULT_ACCESSOR(NAME, IMPLEMENTATION) \ + LOCALE_DEFAULT_DISPLAY_ACCESSOR(NAME) \ + IMPLEMENTATION \ + LOCALE_DISPLAY_ACCESSOR_END(NAME) + +} + +Q_DECLARE_METATYPE(GammaRay::LocaleDataAccessor*) + +#endif diff --git a/injector/abstractinjector.cpp b/tools/localeinspector/localeinspector.cpp similarity index 52% copy from injector/abstractinjector.cpp copy to tools/localeinspector/localeinspector.cpp index dae96a8..9b6ef44 100644 --- a/injector/abstractinjector.cpp +++ b/tools/localeinspector/localeinspector.cpp @@ -1,11 +1,9 @@ /* - abstractinjector.cpp - This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause + Author: Stephen Kelly This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,33 +19,33 @@ along with this program. If not, see . */ -#include "abstractinjector.h" +#include "localeinspector.h" +#include "ui_localeinspector.h" + +#include "localemodel.h" +#include "localeaccessormodel.h" -#include -#include +#include using namespace GammaRay; -AbstractInjector::~AbstractInjector() +LocaleInspector::LocaleInspector(ProbeInterface *probe, QWidget *parent) + : QWidget(parent), + ui(new Ui::LocaleInspector) { -} + Q_UNUSED(probe); -bool AbstractInjector::launch(const QStringList &programAndArgs, - const QString &probeDll, - const QString &probeFunc) -{ - Q_UNUSED(programAndArgs); - Q_UNUSED(probeDll); - Q_UNUSED(probeFunc); - qWarning() << "Injection on launch not supported by this injector."; - return false; -} + LocaleModel *model = new LocaleModel(this); + LocaleAccessorModel *accessorModel = new LocaleAccessorModel(this); -bool AbstractInjector::attach(int pid, const QString &probeDll, const QString &probeFunc) -{ - Q_UNUSED(pid); - Q_UNUSED(probeDll); - Q_UNUSED(probeFunc); - qWarning() << "Attaching to a running process is not supported by this injector."; - return false; + ui->setupUi(this); + + ui->localeTable->setModel(model); + ui->accessorTable->setModel(accessorModel); + + ui->accessorTable->resizeColumnsToContents(); + ui->localeTable->resizeColumnsToContents(); + connect(model, SIGNAL(modelReset()), ui->localeTable, SLOT(resizeColumnsToContents())); } + +#include "localeinspector.moc" diff --git a/tools/webinspector/webinspector.h b/tools/localeinspector/localeinspector.h similarity index 51% copy from tools/webinspector/webinspector.h copy to tools/localeinspector/localeinspector.h index 3bf4c8f..3064b9e 100644 --- a/tools/webinspector/webinspector.h +++ b/tools/localeinspector/localeinspector.h @@ -1,11 +1,9 @@ /* - webinspector.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Stephen Kelly This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,40 +19,40 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_WEBINSPECTOR_H -#define GAMMARAY_WEBINSPECTOR_H +#ifndef GAMMARAY_LOCALEINSPECTOR_H +#define GAMMARAY_LOCALEINSPECTOR_H -#include #include -#include +#include +namespace Ui { class LocaleInspector; } namespace GammaRay { -namespace Ui { class WebInspector; } +class LocaleModel; -class WebInspector : public QWidget +class LocaleInspector : public QWidget { Q_OBJECT public: - explicit WebInspector(GammaRay::ProbeInterface *probe, QWidget *parent = 0); + explicit LocaleInspector(ProbeInterface *probe, QWidget *parent = 0); - private slots: - void webPageSelected(int index); +// private slots: +// void updateFonts(const QItemSelection &selected, const QItemSelection &deselected); private: - QScopedPointer ui; + QScopedPointer< ::Ui::LocaleInspector> ui; + LocaleModel *m_localeModel; }; -class WebInspectorFactory - : public QObject, public StandardToolFactory +class LocaleInspectorFactory : public QObject, public StandardToolFactory { Q_OBJECT Q_INTERFACES(GammaRay::ToolFactory) public: - explicit WebInspectorFactory(QObject *parent) : QObject(parent) {} - inline QString name() const { return tr("Web Pages"); } + explicit LocaleInspectorFactory(QObject *parent) : QObject(parent) {} + virtual inline QString name() const { return tr("Locales"); } }; } -#endif // GAMMARAY_WEBINSPECTOR_H +#endif // GAMMARAY_LOCALEINSPECTOR_H diff --git a/tools/localeinspector/localeinspector.ui b/tools/localeinspector/localeinspector.ui new file mode 100644 index 0000000..c6da1ef --- /dev/null +++ b/tools/localeinspector/localeinspector.ui @@ -0,0 +1,30 @@ + + + LocaleInspector + + + + 0 + 0 + 654 + 506 + + + + Form + + + + + + Qt::Vertical + + + + + + + + + + diff --git a/tools/localeinspector/localemodel.cpp b/tools/localeinspector/localemodel.cpp new file mode 100644 index 0000000..7e39de5 --- /dev/null +++ b/tools/localeinspector/localemodel.cpp @@ -0,0 +1,107 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Stephen Kelly + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "localemodel.h" + +#include "localedataaccessor.h" + +#include +#include + +using namespace GammaRay; + +LocaleModel::LocaleModel(QObject *parent) + : QAbstractTableModel(parent) +{ + init(); + connect(LocaleDataAccessorRegistry::instance(), SIGNAL(accessorsChanged()), SLOT(reinit())); +} + +int LocaleModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) { + return 0; + } + return m_localeData.size(); +} + +QVariant LocaleModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || + index.row() >= m_locales.size() || + index.column() >= m_localeData.size()) { + return QVariant(); + } + + const QLocale l = m_locales.at(index.row()); + return m_localeData.at(index.column())->data(l, role); +} + +QVariant LocaleModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole) { + return QAbstractItemModel::headerData(section, orientation, role); + } + if (orientation == Qt::Vertical) { + return QAbstractItemModel::headerData(section, orientation, role); + } + LocaleDataAccessor *d = m_localeData.at(section); + return d->accessorName(); +} + +void LocaleModel::init() +{ + m_localeData = LocaleDataAccessorRegistry::enabledAccessors(); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) + m_locales = + QLocale::matchingLocales(QLocale::AnyLanguage, + QLocale::AnyScript, QLocale::AnyCountry).toVector(); +#else + m_locales.clear(); + QLocale::Language l = QLocale::C; + while (QLocale::languageToString(l) != QLatin1String("Unknown")) + { + QList countries = QLocale::countriesForLanguage(l); + Q_FOREACH (const QLocale::Country &c, countries) { + m_locales.append(QLocale(l, c)); + } + l = (QLocale::Language)((int)(l) + 1); + } +#endif +} + +void LocaleModel::reinit() +{ + beginResetModel(); + init(); + endResetModel(); +} + +int LocaleModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid()) { + return 0; + } + return m_locales.size(); +} + +#include "localemodel.moc" diff --git a/tools/metatypebrowser/metatypesmodel.h b/tools/localeinspector/localemodel.h similarity index 64% copy from tools/metatypebrowser/metatypesmodel.h copy to tools/localeinspector/localemodel.h index 3aaaef3..4dcd506 100644 --- a/tools/metatypebrowser/metatypesmodel.h +++ b/tools/localeinspector/localemodel.h @@ -1,10 +1,8 @@ /* - metatypesmodel.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Stephen Kelly This program is free software; you can redistribute it and/or modify @@ -21,33 +19,41 @@ along with this program. If not, see . */ -#ifndef METATYPESMODEL_H -#define METATYPESMODEL_H +#ifndef GAMMARAY_LOCALEMODEL_H +#define GAMMARAY_LOCALEMODEL_H + +#include +#include +#include -#include +namespace GammaRay { -class MetaTypesModel : public QAbstractItemModel +struct LocaleDataAccessor; + +class LocaleModel : public QAbstractTableModel { Q_OBJECT public: - MetaTypesModel(QObject *parent = 0); + explicit LocaleModel(QObject *parent = 0); - virtual QVariant headerData(int section, - Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - - virtual QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual QModelIndex parent(const QModelIndex &child) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + private: + void init(); - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + private slots: + void reinit(); private: - int m_lastMetaType; + QVector m_locales; + QVector m_localeData; }; +} + #endif diff --git a/tools/messagehandler/backtrace.h b/tools/messagehandler/backtrace.h index df801b1..93fe822 100644 --- a/tools/messagehandler/backtrace.h +++ b/tools/messagehandler/backtrace.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef BACKTRACE_H -#define BACKTRACE_H +#ifndef GAMMARAY_BACKTRACE_H +#define GAMMARAY_BACKTRACE_H #include diff --git a/splashscreen.h b/tools/messagehandler/backtrace_dummy.cpp similarity index 70% copy from splashscreen.h copy to tools/messagehandler/backtrace_dummy.cpp index 1181348..4950c8d 100644 --- a/splashscreen.h +++ b/tools/messagehandler/backtrace_dummy.cpp @@ -1,11 +1,11 @@ /* - attachdialog.h + backtrace_dummy.cpp This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Milian Wolff + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,14 +21,10 @@ along with this program. If not, see . */ -#ifndef SPLASHSCREEN_H -#define SPLASHSCREEN_H - -namespace GammaRay { - -void showSplashScreen(); -void hideSplashScreen(); +#include "backtrace.h" +Backtrace getBacktrace(int levels) +{ + Q_UNUSED(levels); + return Backtrace(); } - -#endif // SPLASHSCREEN_H diff --git a/tools/messagehandler/messagehandler.cpp b/tools/messagehandler/messagehandler.cpp index 3a1181e..9e7acd5 100644 --- a/tools/messagehandler/messagehandler.cpp +++ b/tools/messagehandler/messagehandler.cpp @@ -27,7 +27,7 @@ #include "messagemodel.h" -#include +#include #include #include #include diff --git a/tools/messagehandler/messagehandler.h b/tools/messagehandler/messagehandler.h index 1a07b08..3830f5f 100644 --- a/tools/messagehandler/messagehandler.h +++ b/tools/messagehandler/messagehandler.h @@ -20,12 +20,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef MESSAGEHANDLER_H -#define MESSAGEHANDLER_H +#ifndef GAMMARAY_MESSAGEHANDLER_H +#define GAMMARAY_MESSAGEHANDLER_H #include -#include +#include class QSortFilterProxyModel; diff --git a/tools/messagehandler/messagemodel.h b/tools/messagehandler/messagemodel.h index f6a0c41..c5c3729 100644 --- a/tools/messagehandler/messagemodel.h +++ b/tools/messagehandler/messagemodel.h @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef MESSAGEMODEL_H -#define MESSAGEMODEL_H +#ifndef GAMMARAY_MESSAGEMODEL_H +#define GAMMARAY_MESSAGEMODEL_H #include #include diff --git a/tools/metatypebrowser/metatypesmodel.h b/tools/metatypebrowser/metatypesmodel.h index 3aaaef3..6b985fe 100644 --- a/tools/metatypebrowser/metatypesmodel.h +++ b/tools/metatypebrowser/metatypesmodel.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef METATYPESMODEL_H -#define METATYPESMODEL_H +#ifndef GAMMARAY_METATYPESMODEL_H +#define GAMMARAY_METATYPESMODEL_H #include diff --git a/tools/modelinspector/modelmodel.h b/tools/modelinspector/modelmodel.h index 5d842a8..3403d92 100644 --- a/tools/modelinspector/modelmodel.h +++ b/tools/modelinspector/modelmodel.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef MODELMODEL_H -#define MODELMODEL_H +#ifndef GAMMARAY_MODELMODEL_H +#define GAMMARAY_MODELMODEL_H #include "objectmodelbase.h" #include diff --git a/tools/modelinspector/modeltest.cpp b/tools/modelinspector/modeltest.cpp index e649591..437f6f8 100644 --- a/tools/modelinspector/modeltest.cpp +++ b/tools/modelinspector/modeltest.cpp @@ -23,7 +23,7 @@ //krazy:excludeall=style #include "modeltest.h" -#include +#include Q_DECLARE_METATYPE ( QModelIndex ) diff --git a/tools/modelinspector/modeltest.h b/tools/modelinspector/modeltest.h index 0ed70be..50fe1f2 100644 --- a/tools/modelinspector/modeltest.h +++ b/tools/modelinspector/modeltest.h @@ -22,8 +22,8 @@ ****************************************************************************/ //krazy:excludeall=style -#ifndef MODELTEST_H -#define MODELTEST_H +#ifndef GAMMARAY_MODELTEST_H +#define GAMMARAY_MODELTEST_H #include #include diff --git a/tools/modelinspector/modeltester.cpp b/tools/modelinspector/modeltester.cpp index 42ebf3b..3d0115d 100644 --- a/tools/modelinspector/modeltester.cpp +++ b/tools/modelinspector/modeltester.cpp @@ -92,7 +92,7 @@ void ModelTester::failure(QAbstractItemModel *model, const char *file, int line, // - change Q_ASSERT to non-fatal reporting // - suppress qDebug etc, since those trigger qobject creating and thus // infinite loops when model-testing the object model -#include // avoid interference with any include used by modeltest +#include // avoid interference with any include used by modeltest #include "modeltest.moc" #undef Q_ASSERT #define Q_ASSERT(x) (!(x) ? static_cast(static_cast(this)->parent())->failure(this->model, __FILE__, __LINE__, #x) : qt_noop()) diff --git a/tools/objectvisualizer/CMakeLists.txt b/tools/objectvisualizer/CMakeLists.txt new file mode 100644 index 0000000..5dda45b --- /dev/null +++ b/tools/objectvisualizer/CMakeLists.txt @@ -0,0 +1,32 @@ +if(VTK_FOUND) + +add_definitions(-DHAVE_VTK) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${VTK_INCLUDE_DIRS} +) + +link_directories(${VTK_LIBRARY_DIRS}) + +set(gammaray_objectvisualizer_plugin_srcs + objectvisualizer.cpp + vtkcontainer.cpp + vtkpanel.cpp + vtkwidget.cpp + + ${CMAKE_SOURCE_DIR}/3rdparty/kde/kfilterproxysearchline.cpp + ${CMAKE_SOURCE_DIR}/3rdparty/kde/krecursivefilterproxymodel.cpp + ${CMAKE_SOURCE_DIR}/util.cpp +) +qt4_automoc(${gammaray_objectvisualizer_plugin_srcs}) + +gammaray_add_plugin(gammaray_objectvisualizer_plugin gammaray_objectvisualizer.desktop ${gammaray_objectvisualizer_plugin_srcs}) +target_link_libraries(gammaray_objectvisualizer_plugin + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} + QVTK +) + +endif() + diff --git a/tools/objectvisualizer/gammaray_objectvisualizer.desktop b/tools/objectvisualizer/gammaray_objectvisualizer.desktop new file mode 100644 index 0000000..2c0eab1 --- /dev/null +++ b/tools/objectvisualizer/gammaray_objectvisualizer.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Name=Object Visualization +X-GammaRay-Types=QObject; +Exec=gammaray_objectvisualizer_plugin diff --git a/tools/objectvisualizer/objectvisualizer.cpp b/tools/objectvisualizer/objectvisualizer.cpp new file mode 100644 index 0000000..2613ee9 --- /dev/null +++ b/tools/objectvisualizer/objectvisualizer.cpp @@ -0,0 +1,117 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "objectvisualizer.h" + +#include "vtkcontainer.h" +#include "vtkwidget.h" +#include "vtkpanel.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace GammaRay; + +GraphViewer::GraphViewer(ProbeInterface *probe, QWidget *parent) + : QWidget(parent), + mWidget(new GraphWidget(this)), + mProbeIface(probe) +{ + QSortFilterProxyModel *objectFilter = new KRecursiveFilterProxyModel(this); + objectFilter->setSourceModel(probe->objectTreeModel()); + objectFilter->setDynamicSortFilter(true); + + QVBoxLayout *vbox = new QVBoxLayout; + KFilterProxySearchLine *objectSearchLine = new KFilterProxySearchLine(this); + objectSearchLine->setProxy(objectFilter); + vbox->addWidget(objectSearchLine); + QTreeView *objectTreeView = new QTreeView(this); + objectTreeView->setModel(objectFilter); + objectTreeView->setSortingEnabled(true); + vbox->addWidget(objectTreeView); + connect(objectTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), + SLOT(handleRowChanged(QModelIndex))); + mObjectTreeView = objectTreeView; + + QWidget *treeViewWidget = new QWidget(this); + treeViewWidget->setLayout(vbox); + + QSplitter *splitter = new QSplitter(this); + splitter->addWidget(treeViewWidget); + splitter->addWidget(mWidget); + QHBoxLayout *hbox = new QHBoxLayout(this); + hbox->addWidget(splitter); + + QMetaObject::invokeMethod(this, "delayedInit", Qt::QueuedConnection); +} + +GraphViewer::~GraphViewer() +{ +} + +void GraphViewer::delayedInit() +{ + // make all existing objects known to the vtk widget + const QAbstractItemModel *listModel = mProbeIface->objectListModel(); + for (int i = 0; i < listModel->rowCount(); ++i) { + const QModelIndex index = listModel->index(i, 0); + QObject *object = index.data(ObjectModel::ObjectRole).value(); + Q_ASSERT(object); + mWidget->vtkWidget()->addObject(object); + } + connect(mProbeIface->probe(), SIGNAL(objectCreated(QObject*)), + mWidget->vtkWidget(), SLOT(addObject(QObject*))); + connect(mProbeIface->probe(), SIGNAL(objectDestroyed(QObject*)), + mWidget->vtkWidget(), SLOT(removeObject(QObject*))); + + // select the qApp object (if any) in the object treeView + const QAbstractItemModel *viewModel = mObjectTreeView->model(); + const QModelIndexList matches = viewModel->match(viewModel->index(0, 0), + ObjectModel::ObjectRole, + QVariant::fromValue(qApp)); + if (!matches.isEmpty()) { + mObjectTreeView->setCurrentIndex(matches.first()); + } +} + +void GraphViewer::handleRowChanged(const QModelIndex &index) +{ + QObject *object = index.data(ObjectModel::ObjectRole).value(); + Q_ASSERT(object); + mWidget->vtkWidget()->setObjectFilter(object); +} + +Q_EXPORT_PLUGIN(GraphViewerFactory) + +#include "objectvisualizer.moc" diff --git a/tools/widgetinspector/widgetinspector.h b/tools/objectvisualizer/objectvisualizer.h similarity index 56% copy from tools/widgetinspector/widgetinspector.h copy to tools/objectvisualizer/objectvisualizer.h index 52c9f42..7fae1a8 100644 --- a/tools/widgetinspector/widgetinspector.h +++ b/tools/objectvisualizer/objectvisualizer.h @@ -1,11 +1,9 @@ /* - widgetinspector.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause + Author: Kevin Funk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,45 +19,54 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_WIDGETINSPECTOR_H -#define GAMMARAY_WIDGETINSPECTOR_H +#ifndef GAMMARAY_GRAPHVIEWER_H +#define GAMMARAY_GRAPHVIEWER_H + +#include -#include #include +class QTreeView; class QModelIndex; namespace GammaRay { -class OverlayWidget; +class GraphWidget; +class ProbeInterface; -namespace Ui { class WidgetInspector; } - -class WidgetInspector : public QWidget +class GraphViewer : public QWidget { Q_OBJECT + public: - explicit WidgetInspector(ProbeInterface *probe, QWidget *parent = 0); + explicit GraphViewer(ProbeInterface *probe, QWidget *parent = 0); + virtual ~GraphViewer(); - private slots: - void widgetSelected(const QModelIndex &index); - void widgetSelected(QWidget *widget); + private Q_SLOTS: + void delayedInit(); + + void handleRowChanged(const QModelIndex &index); private: - OverlayWidget *m_overlayWidget; - QScopedPointer ui; + QTreeView *mObjectTreeView; + GraphWidget *mWidget; + ProbeInterface *mProbeIface; }; -class WidgetInspectorFactory - : public QObject, public StandardToolFactory +class GraphViewerFactory : public QObject, public StandardToolFactory { Q_OBJECT Q_INTERFACES(GammaRay::ToolFactory) + public: - explicit WidgetInspectorFactory(QObject *parent) : QObject(parent) {} - inline QString name() const { return tr("Widgets"); } + explicit GraphViewerFactory(QObject *parent = 0) : QObject(parent) {} + + virtual inline QString name() const + { + return tr("Object Visualizer"); + } }; } -#endif // GAMMARAY_WIDGETINSPECTOR_H +#endif // GAMMARAY_GRAPHVIEWER_H diff --git a/sidepane.h b/tools/objectvisualizer/vtkcontainer.cpp similarity index 64% copy from sidepane.h copy to tools/objectvisualizer/vtkcontainer.cpp index 09b0183..bc63fa9 100644 --- a/sidepane.h +++ b/tools/objectvisualizer/vtkcontainer.cpp @@ -1,6 +1,4 @@ /* - sidepane.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +19,31 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H +#include "vtkcontainer.h" -#include +#include +#include -namespace GammaRay { +#include "vtkwidget.h" +#include "vtkpanel.h" -class SidePane : public QListView -{ - Q_OBJECT +using namespace GammaRay; -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); +GraphWidget::GraphWidget(QWidget *parent) + : QWidget(parent) +{ + QVBoxLayout *vbox = new QVBoxLayout(this); - virtual QSize sizeHint() const; + m_vtkWidget = new VtkWidget(this); -protected: - virtual void resizeEvent(QResizeEvent *e); -}; + m_vtkPanel = new VtkPanel(m_vtkWidget, this); + vbox->addWidget(m_vtkPanel); + vbox->addWidget(m_vtkWidget); +} +GraphWidget::~GraphWidget() +{ + qDebug() << Q_FUNC_INFO; } -#endif // GAMMARAY_SIDEPANE_H +#include "vtkcontainer.moc" diff --git a/sidepane.h b/tools/objectvisualizer/vtkcontainer.h similarity index 65% copy from sidepane.h copy to tools/objectvisualizer/vtkcontainer.h index 09b0183..1a17ee3 100644 --- a/sidepane.h +++ b/tools/objectvisualizer/vtkcontainer.h @@ -1,6 +1,4 @@ /* - sidepane.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +19,39 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H +#ifndef GAMMARAY_GRAPHWIDGET_H +#define GAMMARAY_GRAPHWIDGET_H -#include +#include namespace GammaRay { -class SidePane : public QListView +class VtkPanel; +class VtkWidget; + +class GraphWidget : public QWidget { Q_OBJECT -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); + public: + explicit GraphWidget(QWidget *parent = 0); + virtual ~GraphWidget(); + + VtkWidget *vtkWidget() const + { + return m_vtkWidget; + } - virtual QSize sizeHint() const; + VtkPanel *vtkPanel() const + { + return m_vtkPanel; + } -protected: - virtual void resizeEvent(QResizeEvent *e); + private: + VtkWidget *m_vtkWidget; + VtkPanel *m_vtkPanel; }; } -#endif // GAMMARAY_SIDEPANE_H +#endif // GAMMARAY_GRAPHWIDGET_H diff --git a/tools/objectvisualizer/vtkpanel.cpp b/tools/objectvisualizer/vtkpanel.cpp new file mode 100644 index 0000000..aef53f1 --- /dev/null +++ b/tools/objectvisualizer/vtkpanel.cpp @@ -0,0 +1,125 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "vtkpanel.h" + +#include +#include +#include + +#include "vtkwidget.h" +#include +#include +#include +#include +#include +#include + +using namespace GammaRay; + +VtkPanel::VtkPanel(VtkWidget *vtkWidget, QWidget *parent) + : QToolBar(parent), + m_vtkWidget(vtkWidget), + m_currentLayout("spanTree") +{ + addWidget(new QLabel(tr("Layout:"))); + m_layoutBox = new QComboBox; +#if 0 + m_layoutBox->addItem(tr("Tree Layout"), "tree"); +#endif + + m_layoutBox->addItem(tr("Span Tree Layout"), "spanTree"); + m_layoutBox->addItem(tr("Force Directed Layout"), "forceDirected"); + m_layoutBox->addItem(tr("Force Directed Layout (3D)"), "forceDirected3D"); + m_layoutBox->addItem(tr("Simple 2D Layout"), "simple2D"); + connect(m_layoutBox, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged(int))); + addWidget(m_layoutBox); + + addWidget(new QLabel(tr("Stereo:"))); + m_stereoBox = new QComboBox; + m_stereoBox->addItem(tr("Off"), 0); + m_stereoBox->addItem(tr("Crystal Eyes"), VTK_STEREO_CRYSTAL_EYES); + m_stereoBox->addItem(tr("Red/Blue"), VTK_STEREO_RED_BLUE); + m_stereoBox->addItem(tr("Interlaced"), VTK_STEREO_INTERLACED); + m_stereoBox->addItem(tr("Left"), VTK_STEREO_LEFT); + m_stereoBox->addItem(tr("Right"), VTK_STEREO_RIGHT); + m_stereoBox->addItem(tr("Dresden"), VTK_STEREO_DRESDEN); + m_stereoBox->addItem(tr("Anaglyph"), VTK_STEREO_ANAGLYPH); + m_stereoBox->addItem(tr("Checkboard"), VTK_STEREO_CHECKERBOARD); + connect(m_stereoBox, SIGNAL(currentIndexChanged(int)), SLOT(stereoModeChanged(int))); + addWidget(m_stereoBox); +} + +static vtkGraphLayoutStrategy *layoutStrategyForName(const QString &layoutName) +{ + if (layoutName == "tree") { + vtkTreeLayoutStrategy *strategy = vtkTreeLayoutStrategy::New(); + strategy->SetRadial(true); + return strategy; + } else if (layoutName == "spanTree") { + return vtkSpanTreeLayoutStrategy::New(); + } else if (layoutName == "forceDirected") { + return vtkForceDirectedLayoutStrategy::New(); + } else if (layoutName == "forceDirected3D") { + vtkForceDirectedLayoutStrategy *strategy = vtkForceDirectedLayoutStrategy::New(); + strategy->SetThreeDimensionalLayout(true); + return strategy; + } else if (layoutName == "simple2D") { + return vtkSimple2DLayoutStrategy::New(); + } else { + return 0; + } +} + +void VtkPanel::currentIndexChanged(int index) +{ + const QString layoutName = m_layoutBox->itemData(index).toString(); + if (m_currentLayout == layoutName) { + return; + } + + // update + vtkGraphLayoutStrategy *strategy = layoutStrategyForName(layoutName); + m_vtkWidget->layoutView()->SetLayoutStrategy(strategy); + m_vtkWidget->layoutView()->ResetCamera(); + m_vtkWidget->layoutView()->Render(); + m_vtkWidget->GetInteractor()->Start(); + m_currentLayout = layoutName; +} + +void VtkPanel::stereoModeChanged(int index) +{ + const int stereoMode = m_stereoBox->itemData(index).toInt(); + if (stereoMode <= 0) { + m_vtkWidget->layoutView()->GetRenderWindow()->SetStereoRender(false); + } else { + m_vtkWidget->layoutView()->GetRenderWindow()->SetStereoRender(true); + m_vtkWidget->layoutView()->GetRenderWindow()->SetStereoType(stereoMode); + } + m_vtkWidget->layoutView()->GetRenderWindow()->StereoUpdate(); +} + +VtkPanel::~VtkPanel() +{ + +} + +#include "vtkpanel.moc" diff --git a/sidepane.h b/tools/objectvisualizer/vtkpanel.h similarity index 65% copy from sidepane.h copy to tools/objectvisualizer/vtkpanel.h index 09b0183..7d4c6c8 100644 --- a/sidepane.h +++ b/tools/objectvisualizer/vtkpanel.h @@ -1,6 +1,4 @@ /* - sidepane.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +19,37 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H +#ifndef GAMMARAY_VTKPANEL_H +#define GAMMARAY_VTKPANEL_H + +#include -#include +class QComboBox; namespace GammaRay { -class SidePane : public QListView +class VtkWidget; + +class VtkPanel : public QToolBar { Q_OBJECT -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); + public: + explicit VtkPanel(VtkWidget *vtkWidget, QWidget *parent = 0); + virtual ~VtkPanel(); + + public slots: + void currentIndexChanged(int); + void stereoModeChanged(int); - virtual QSize sizeHint() const; + private: + VtkWidget *m_vtkWidget; -protected: - virtual void resizeEvent(QResizeEvent *e); + QComboBox *m_layoutBox; + QComboBox *m_stereoBox; + QString m_currentLayout; }; } -#endif // GAMMARAY_SIDEPANE_H +#endif // GAMMARAY_VTKPANEL_H diff --git a/tools/objectvisualizer/vtkwidget.cpp b/tools/objectvisualizer/vtkwidget.cpp new file mode 100644 index 0000000..d0362dc --- /dev/null +++ b/tools/objectvisualizer/vtkwidget.cpp @@ -0,0 +1,396 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "vtkwidget.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +using namespace GammaRay; + +//#define WITH_DEBUG + +#ifdef WITH_DEBUG +#define DEBUG(msg) std::cout << Q_FUNC_INFO << " " << msg << std::endl; +#else +#define DEBUG(msg) qt_noop(); +#endif + +#define VTK_CREATE(type, name) \ + vtkSmartPointer name = vtkSmartPointer::New() + +VtkWidget::VtkWidget(QWidget *parent) + : QVTKWidget(parent), + m_mousePressed(false), + m_updateTimer(new QTimer(this)), + m_objectFilter(0), + m_colorIndex(0) +{ + setupRenderer(); + setupGraph(); + show(); + + m_updateTimer->setInterval(0); + m_updateTimer->setSingleShot(true); + connect(m_updateTimer, SIGNAL(timeout()), SLOT(renderViewImpl())); +} + +VtkWidget::~VtkWidget() +{ + clear(); + + DEBUG("") +} + +void VtkWidget::setupRenderer() +{ +} + +void VtkWidget::resetCamera() +{ + m_view->ResetCamera(); +} + +void VtkWidget::mousePressEvent(QMouseEvent *event) +{ + m_mousePressed = true; + + QVTKWidget::mousePressEvent(event); +} + +void VtkWidget::mouseReleaseEvent(QMouseEvent *event) +{ + m_mousePressed = false; + + QVTKWidget::mouseReleaseEvent(event); +} + +void VtkWidget::setupGraph() +{ + DEBUG("start") + + VTK_CREATE(vtkMutableDirectedGraph, graph); + m_graph = graph; + + VTK_CREATE(vtkVariantArray, vertexPropertyArr); + vertexPropertyArr->SetNumberOfValues(3); + m_vertexPropertyArr = vertexPropertyArr; + + VTK_CREATE(vtkStringArray, vertexProp0Array); + vertexProp0Array->SetName("labels"); + m_graph->GetVertexData()->AddArray(vertexProp0Array); + + // currently not used + VTK_CREATE(vtkIntArray, vertexProp1Array); + vertexProp1Array->SetName("weight"); + m_graph->GetVertexData()->AddArray(vertexProp1Array); + + // coloring + vtkSmartPointer vertexColors = vtkSmartPointer::New(); + vertexColors->SetName("Color"); + m_graph->GetVertexData()->AddArray(vertexColors); + + vtkSmartPointer colorLookupTable = vtkSmartPointer::New(); + colorLookupTable->Build(); + + vtkSmartPointer theme = vtkSmartPointer::New(); + theme->SetPointLookupTable(colorLookupTable); + + vtkGraphLayoutView *graphLayoutView = vtkGraphLayoutView::New(); + graphLayoutView->AddRepresentationFromInput(graph); + graphLayoutView->SetVertexLabelVisibility(true); + graphLayoutView->SetVertexLabelArrayName("labels"); + graphLayoutView->SetLayoutStrategyToSpanTree(); + graphLayoutView->SetVertexColorArrayName("Color"); + graphLayoutView->SetColorVertices(true); + graphLayoutView->ApplyViewTheme(theme); + m_view = graphLayoutView; + + VTK_CREATE(vtkInteractorStyleTrackballCamera, style); + + vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); + renderWindowInteractor->SetRenderWindow(graphLayoutView->GetRenderWindow()); + renderWindowInteractor->SetInteractorStyle(style); + renderWindowInteractor->Initialize(); + SetRenderWindow(graphLayoutView->GetRenderWindow()); + + // code for generating edge arrow heads, needs some love + // currently it modifies the layouting + // how to use: + // comment the AddRepresentationFromInput call to vtkGraphLayoutView and uncomment this +#if 0 + VTK_CREATE(vtkGraphLayout, layout); + layout->SetInput(graph); + layout->SetLayoutStrategy(strategy); + + // Tell the view to use the vertex layout we provide + graphLayoutView->SetLayoutStrategyToPassThrough(); + // The arrows will be positioned on a straight line between two + // vertices so tell the view not to draw arcs for parallel edges + graphLayoutView->SetEdgeLayoutStrategyToPassThrough(); + + // Add the graph to the view. This will render vertices and edges, + // but not edge arrows. + graphLayoutView->AddRepresentationFromInputConnection(layout->GetOutputPort()); + + // Manually create an actor containing the glyphed arrows. + VTK_CREATE(vtkGraphToPolyData, graphToPoly); + graphToPoly->SetInputConnection(layout->GetOutputPort()); + graphToPoly->EdgeGlyphOutputOn(); + + // Set the position (0: edge start, 1: edge end) where + // the edge arrows should go. + graphToPoly->SetEdgeGlyphPosition(0.98); + + // Make a simple edge arrow for glyphing. + VTK_CREATE(vtkGlyphSource2D, arrowSource); + arrowSource->SetGlyphTypeToEdgeArrow(); + arrowSource->SetScale(0.001); + arrowSource->Update(); + + // Use Glyph3D to repeat the glyph on all edges. + VTK_CREATE(vtkGlyph3D, arrowGlyph); + arrowGlyph->SetInputConnection(0, graphToPoly->GetOutputPort(1)); + arrowGlyph->SetInputConnection(1, arrowSource->GetOutputPort()); + + // Add the edge arrow actor to the view. + VTK_CREATE(vtkPolyDataMapper, arrowMapper); + arrowMapper->SetInputConnection(arrowGlyph->GetOutputPort()); + VTK_CREATE(vtkActor, arrowActor); + arrowActor->SetMapper(arrowMapper); + graphLayoutView->GetRenderer()->AddActor(arrowActor); +#endif + + graphLayoutView->ResetCamera(); + graphLayoutView->Render(); + graphLayoutView->GetInteractor()->Start(); + + DEBUG("end") +} + +bool VtkWidget::addObject(QObject *object) +{ + m_availableObjects << object; + + return addObjectInternal(object); +} + +bool VtkWidget::addObjectInternal(QObject *object) +{ + // ignore new objects during scene interaction + // TODO: Add some code to add the objects later on => queue objects + if (m_mousePressed) { + DEBUG("Ignoring new object during scene interaction: " + << object + << " " + << object->metaObject()->className()) + return false; + } + + const QString className = QLatin1String(object->metaObject()->className()); + if (className == "QVTKInteractorInternal") { + return false; + } + + if (m_objectIdMap.contains(object)) { + return false; + } + + if (!filterAcceptsObject(object)) { + return false; + } + + const QString label = Util::displayString(object); + const int weight = 1; // TODO: Make weight somewhat usable? + m_vertexPropertyArr->SetValue(0, vtkUnicodeString::from_utf16(label.utf16())); + m_vertexPropertyArr->SetValue(1, weight); + static int colorIndex = 0; + colorIndex = colorIndex % 10; + + QMap< QString, int >::const_iterator it = m_typeColorMap.constFind(className); + if (it != m_typeColorMap.constEnd()) { + m_vertexPropertyArr->SetValue(2, it.value()); + } else { + m_vertexPropertyArr->SetValue(2, m_colorIndex); + m_typeColorMap.insert(className, m_colorIndex); + ++m_colorIndex; + } + + const vtkIdType type = m_graph->AddVertex(m_vertexPropertyArr); + DEBUG("Add: " << type << " " << object->metaObject()->className()) + m_objectIdMap[object] = type; + + QObject *parentObject = object->parent(); + if (parentObject) { + if (!m_objectIdMap.contains(parentObject)) { + addObject(parentObject); + } + if (m_objectIdMap.contains(parentObject)) { + const vtkIdType parentType = m_objectIdMap[parentObject]; + m_graph->AddEdge(parentType, type); + } + } + + renderView(); + return true; +} + +bool VtkWidget::removeObject(QObject *object) +{ + m_availableObjects.remove(object); + + return removeObjectInternal(object); +} + +bool VtkWidget::removeObjectInternal(QObject *object) +{ + if (!m_objectIdMap.contains(object)) { + return false; + } + + // Remove id-for-object from VTK's graph data structure + const vtkIdType type = m_objectIdMap[object]; + const int size = m_graph->GetNumberOfVertices(); + m_graph->RemoveVertex(type); + + // VTK re-orders the vertex IDs after removal! + // we have to copy this behavior to track the associated QObject instances + const vtkIdType lastId = m_objectIdMap.size() - 1; + DEBUG("Type: " << type << " Last: " << lastId) + if (type != lastId) { + QObject *lastObject = m_objectIdMap.key(lastId); + Q_ASSERT(lastObject); + m_objectIdMap[lastObject] = type; + } + + // Remove object from our map + if (size > m_graph->GetNumberOfVertices()) { + const bool count = m_objectIdMap.remove(object); + Q_ASSERT(count == 1); + } else { + DEBUG("Warning: Should not happen: Could not remove vertice with id: " << type) + } + + renderView(); + return true; +} + +/// Schedules the re-rendering of the VTK view +void VtkWidget::renderView() +{ + m_updateTimer->start(); +} + +void VtkWidget::clear() +{ + // TODO: there must be an easier/faster way to clean the graph data + // Just re-create the vtk graph data object? + Q_FOREACH (QObject *object, m_objectIdMap.keys()) { + removeObjectInternal(object); + } + m_objectIdMap.clear(); + + renderView(); +} + +void VtkWidget::renderViewImpl() +{ + DEBUG("") + + m_view->Render(); + m_view->ResetCamera(); +} + +void VtkWidget::setObjectFilter(QObject *object) +{ + if (m_objectFilter == object) { + return; + } + + m_objectFilter = object; + repopulate(); + resetCamera(); +} + +void VtkWidget::repopulate() +{ + DEBUG("") + + clear(); + + Q_FOREACH (QObject *object, m_availableObjects) { + addObject(object); + } +} + +// TODO: Move to Util.h? +static bool descendantOf(QObject *ascendant, QObject *obj) +{ + QObject *parent = obj->parent(); + if (!parent) { + return false; + } + if (parent == ascendant) { + return true; + } + return descendantOf(ascendant, parent); +} + +bool VtkWidget::filterAcceptsObject(QObject *object) const +{ + if (m_objectFilter) { + if (object == m_objectFilter) { + return true; + } else if (descendantOf(m_objectFilter, object)) { + return true; + } else { + return false; + } + } + return true; +} + +#include "vtkwidget.moc" diff --git a/tools/objectvisualizer/vtkwidget.h b/tools/objectvisualizer/vtkwidget.h new file mode 100644 index 0000000..13c278e --- /dev/null +++ b/tools/objectvisualizer/vtkwidget.h @@ -0,0 +1,107 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_VTKWIDGET_H +#define GAMMARAY_VTKWIDGET_H + +#include + +#include + +#include +#include + +class vtkGraphLayoutStrategy; +class vtkVariantArray; +class vtkGraphLayoutView; +class vtkMutableDirectedGraph; + +class QMouseEvent; +class QTimer; + +namespace GammaRay { + +class VtkWidget : public QVTKWidget +{ + Q_OBJECT + + public: + explicit VtkWidget(QWidget *parent = 0); + virtual ~VtkWidget(); + + QObject *objectFilter() const + { + return m_objectFilter; + } + + vtkGraphLayoutView *layoutView() const + { + return m_view; + } + + public Q_SLOTS: + void resetCamera(); + + bool addObject(QObject *); + bool removeObject(QObject *); + + void setObjectFilter(QObject *object); + + void clear(); + void repopulate(); + + private Q_SLOTS: + bool addObjectInternal(QObject *object); + bool removeObjectInternal(QObject *object); + + void renderViewImpl(); + void renderView(); + + protected: + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + + bool filterAcceptsObject(QObject *object) const; + + private: + void setupGraph(); + void setupRenderer(); + + bool m_mousePressed; + QTimer *m_updateTimer; + QObject *m_objectFilter; + + // TODO: Instead of tracking all available objects, make Probe::m_validObjects public? + QSet m_availableObjects; + QMap m_objectIdMap; + + int m_colorIndex; + QMap m_typeColorMap; + + vtkSmartPointer m_vertexPropertyArr; + vtkGraphLayoutView *m_view; + vtkSmartPointer m_graph; +}; + +} + +#endif // GAMMARAY_VTKWIDGET_H diff --git a/tools/resourcebrowser/resourcefiltermodel.h b/tools/resourcebrowser/resourcefiltermodel.h index d52c248..d7ca770 100644 --- a/tools/resourcebrowser/resourcefiltermodel.h +++ b/tools/resourcebrowser/resourcefiltermodel.h @@ -21,8 +21,8 @@ along with this program. If not, see . */ -#ifndef RESOURCEFILTERMODEL_H -#define RESOURCEFILTERMODEL_H +#ifndef GAMMARAY_RESOURCEFILTERMODEL_H +#define GAMMARAY_RESOURCEFILTERMODEL_H #include diff --git a/tools/sceneinspector/sceneinspector.cpp b/tools/sceneinspector/sceneinspector.cpp index 3dd11cf..d711d1e 100644 --- a/tools/sceneinspector/sceneinspector.cpp +++ b/tools/sceneinspector/sceneinspector.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -82,7 +83,12 @@ void SceneInspector::sceneItemSelected(const QModelIndex &index) { if (index.isValid()) { QGraphicsItem *item = index.data(SceneModel::SceneItemRole).value(); - ui->scenePropertyWidget->setObject(item->toGraphicsObject()); + QGraphicsObject *obj = item->toGraphicsObject(); + if (obj) { + ui->scenePropertyWidget->setObject(obj); + } else { + ui->scenePropertyWidget->setObject(item, findBestType(item)); + } ui->graphicsSceneView->showGraphicsItem(item); } else { ui->scenePropertyWidget->setObject(0); @@ -121,4 +127,25 @@ void SceneInspector::sceneItemSelected(QGraphicsItem *item) sceneItemSelected(index); } +#define QGV_CHECK_TYPE(Class) \ + if (dynamic_cast(item) && MetaObjectRepository::instance()->hasMetaObject(#Class)) \ + return QLatin1String(#Class) + +QString SceneInspector::findBestType(QGraphicsItem *item) +{ + // keep this in reverse topological order of the class hierarchy! + // QObject-based types are covered elsewhere, so we don't need those here + QGV_CHECK_TYPE(QGraphicsEllipseItem); + QGV_CHECK_TYPE(QGraphicsPathItem); + QGV_CHECK_TYPE(QGraphicsPolygonItem); + QGV_CHECK_TYPE(QGraphicsSimpleTextItem); + QGV_CHECK_TYPE(QGraphicsRectItem); + QGV_CHECK_TYPE(QAbstractGraphicsShapeItem); + QGV_CHECK_TYPE(QGraphicsLineItem); + QGV_CHECK_TYPE(QGraphicsItemGroup); + QGV_CHECK_TYPE(QGraphicsPixmapItem); + + return QLatin1String("QGraphicsItem"); +} + #include "sceneinspector.moc" diff --git a/tools/sceneinspector/sceneinspector.h b/tools/sceneinspector/sceneinspector.h index 77a0762..5975b5e 100644 --- a/tools/sceneinspector/sceneinspector.h +++ b/tools/sceneinspector/sceneinspector.h @@ -48,6 +48,9 @@ class SceneInspector : public QWidget void widgetSelected(QWidget *item, const QPoint &pos); private: + QString findBestType(QGraphicsItem *item); + + private: QScopedPointer ui; SceneModel *m_sceneModel; }; diff --git a/tools/sceneinspector/scenemodel.cpp b/tools/sceneinspector/scenemodel.cpp index 8dfea12..1e5558b 100644 --- a/tools/sceneinspector/scenemodel.cpp +++ b/tools/sceneinspector/scenemodel.cpp @@ -23,16 +23,32 @@ #include "scenemodel.h" +#include #include #include +#include #include using namespace GammaRay; +#define QGV_ITEMTYPE(Type) \ +{ \ + Type t; \ + m_typeNames.insert(t.type(), QLatin1String(#Type)); \ +} + SceneModel::SceneModel(QObject *parent) : QAbstractItemModel(parent), m_scene(0) { + QGV_ITEMTYPE(QGraphicsLineItem) + QGV_ITEMTYPE(QGraphicsPixmapItem) + QGV_ITEMTYPE(QGraphicsRectItem) + QGV_ITEMTYPE(QGraphicsEllipseItem) + QGV_ITEMTYPE(QGraphicsPathItem) + QGV_ITEMTYPE(QGraphicsPolygonItem) + QGV_ITEMTYPE(QGraphicsSimpleTextItem) + QGV_ITEMTYPE(QGraphicsItemGroup) } void SceneModel::setScene(QGraphicsScene *scene) @@ -60,13 +76,13 @@ QVariant SceneModel::data(const QModelIndex &index, int role) const if (obj) { return obj->metaObject()->className(); } - return QString::number(item->type()); + return typeName(item->type()); } } else if (role == SceneItemRole) { return QVariant::fromValue(item); } else if (item && role == Qt::ForegroundRole) { if (!item->isVisible()) { - return Qt::gray; + return qApp->palette().color(QPalette::Disabled, QPalette::Text); } } return QVariant(); @@ -146,4 +162,21 @@ QVariant SceneModel::headerData(int section, Qt::Orientation orientation, int ro return QAbstractItemModel::headerData(section, orientation, role); } +QString SceneModel::typeName(int itemType) const +{ + const QHash::const_iterator it = m_typeNames.find(itemType); + if (it != m_typeNames.end()) { + return it.value(); + } + if (itemType == QGraphicsItem::UserType) { + return QLatin1String("UserType"); + } + if (itemType > QGraphicsItem::UserType) { + return + QString::fromLatin1("UserType + %1"). + arg(itemType - static_cast(QGraphicsItem::UserType)); + } + return QString::number(itemType); +} + #include "scenemodel.moc" diff --git a/tools/sceneinspector/scenemodel.h b/tools/sceneinspector/scenemodel.h index 9d74123..ded6830 100644 --- a/tools/sceneinspector/scenemodel.h +++ b/tools/sceneinspector/scenemodel.h @@ -49,7 +49,11 @@ class SceneModel : public QAbstractItemModel private: QList topLevelItems() const; + /// Returns a string type name for the given QGV item type id + QString typeName(int itemType) const; + QGraphicsScene *m_scene; + QHash m_typeNames; }; } diff --git a/tools/scriptenginedebugger/CMakeLists.txt b/tools/scriptenginedebugger/CMakeLists.txt new file mode 100644 index 0000000..7c02f3f --- /dev/null +++ b/tools/scriptenginedebugger/CMakeLists.txt @@ -0,0 +1,20 @@ +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} +) + +set(gammaray_scriptenginedebugger_plugin_srcs + scriptenginedebugger.cpp + ../../singlecolumnobjectproxymodel.cpp + ../../util.cpp + ../../3rdparty/kde/kidentityproxymodel.cpp +) +qt4_automoc(${gammaray_scriptenginedebugger_plugin_srcs}) +qt4_wrap_ui(gammaray_scriptenginedebugger_plugin_srcs scriptenginedebugger.ui) + +gammaray_add_plugin(gammaray_scriptenginedebugger_plugin gammaray_scriptenginedebugger.desktop ${gammaray_scriptenginedebugger_plugin_srcs}) +target_link_libraries(gammaray_scriptenginedebugger_plugin + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} + ${QT_QTSCRIPT_LIBRARIES} + ${QT_QTSCRIPTTOOLS_LIBRARIES} +) diff --git a/tools/scriptenginedebugger/gammaray_scriptenginedebugger.desktop b/tools/scriptenginedebugger/gammaray_scriptenginedebugger.desktop new file mode 100644 index 0000000..a20362f --- /dev/null +++ b/tools/scriptenginedebugger/gammaray_scriptenginedebugger.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Name=Script Engines +X-GammaRay-Types=QScriptEngine; +Exec=gammaray_scriptenginedebugger_plugin diff --git a/tools/scriptenginedebugger/scriptenginedebugger.cpp b/tools/scriptenginedebugger/scriptenginedebugger.cpp index f2d8787..67e0a91 100644 --- a/tools/scriptenginedebugger/scriptenginedebugger.cpp +++ b/tools/scriptenginedebugger/scriptenginedebugger.cpp @@ -32,6 +32,7 @@ #include #include #include +#include using namespace GammaRay; @@ -78,4 +79,6 @@ void ScriptEngineDebugger::scriptEngineSelected(int index) } } +Q_EXPORT_PLUGIN(ScriptEngineDebuggerFactory) + #include "scriptenginedebugger.moc" diff --git a/tools/scriptenginedebugger/scriptenginedebugger.h b/tools/scriptenginedebugger/scriptenginedebugger.h index ad6d28e..b0e330e 100644 --- a/tools/scriptenginedebugger/scriptenginedebugger.h +++ b/tools/scriptenginedebugger/scriptenginedebugger.h @@ -53,8 +53,9 @@ class ScriptEngineDebuggerFactory { Q_OBJECT Q_INTERFACES(GammaRay::ToolFactory) + public: - explicit ScriptEngineDebuggerFactory(QObject *parent) : QObject(parent) {} + explicit ScriptEngineDebuggerFactory(QObject *parent = 0) : QObject(parent) {} inline QString name() const { return tr("Script Engines"); } }; diff --git a/tools/statemachineinspector/statemachineinspector.cpp b/tools/statemachineinspector/statemachineinspector.cpp deleted file mode 100644 index 2fd046e..0000000 --- a/tools/statemachineinspector/statemachineinspector.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - statemachineinspector.cpp - - This file is part of GammaRay, the Qt application inspection and - manipulation tool. - - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Stephen Kelly - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "statemachineinspector.h" -#include "ui_statemachineinspector.h" - -#include "statemodel.h" -#include "transitionmodel.h" - -#include -#include - -using namespace GammaRay; - -StateMachineInspector::StateMachineInspector(ProbeInterface *probe, QWidget *parent) - : QWidget(parent), ui(new Ui::StateMachineInspector) -{ - ui->setupUi(this); - - ObjectTypeFilterProxyModel *stateMachineFilter = - new ObjectTypeFilterProxyModel(this); - stateMachineFilter->setSourceModel(probe->objectListModel()); - ui->stateMachinesView->setModel(stateMachineFilter); - connect(ui->stateMachinesView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - SLOT(stateMachineSelected(QItemSelection,QItemSelection))); - m_stateModel = 0; - - m_transitionModel = new TransitionModel(this); - ui->transitionView->setModel(m_transitionModel); -} - -void StateMachineInspector::stateMachineSelected(const QItemSelection &selected, - const QItemSelection &deselected) -{ - Q_UNUSED(deselected) - const QModelIndex selectedRow = selected.first().topLeft(); - QObject *machineObject = selectedRow.data(ObjectModel::ObjectRole).value(); - QStateMachine *machine = qobject_cast(machineObject); - if (machine) { - delete m_stateModel; - m_stateModel = new StateModel(machine, this); - ui->singleStateMachineView->setModel(m_stateModel); - ui->singleStateMachineView->expandAll(); - connect(ui->singleStateMachineView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - SLOT(stateSelected(QItemSelection,QItemSelection))); - } -} - -void StateMachineInspector::stateSelected(const QItemSelection &selected, - const QItemSelection &deselected) -{ - Q_UNUSED(deselected); - const QModelIndex selectedRow = selected.first().topLeft(); - QObject *stateObject = selectedRow.data(StateModel::StateObjectRole).value(); - QState *state = qobject_cast(stateObject); - if (state) { - m_transitionModel->setState(state); - } -} - -#include "statemachineinspector.moc" diff --git a/tools/statemachineinspector/statemachineinspector.h b/tools/statemachineinspector/statemachineinspector.h deleted file mode 100644 index 6335057..0000000 --- a/tools/statemachineinspector/statemachineinspector.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - statemachineinspector.h - - This file is part of GammaRay, the Qt application inspection and - manipulation tool. - - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef GAMMARAY_STATEMACHINEINSPECTOR_H -#define GAMMARAY_STATEMACHINEINSPECTOR_H - -#include -#include - -#include - -class QItemSelection; - -namespace GammaRay { - -class StateModel; -class TransitionModel; -namespace Ui { class StateMachineInspector; } - -class StateMachineInspector : public QWidget -{ - Q_OBJECT - public: - explicit StateMachineInspector(ProbeInterface *probe, QWidget *parent = 0); - - private slots: - void stateMachineSelected(const QItemSelection &selected, const QItemSelection &deselected); - void stateSelected(const QItemSelection &selected, const QItemSelection &deselected); - - private: - QScopedPointer ui; - StateModel *m_stateModel; - TransitionModel *m_transitionModel; -}; - -class StateMachineInspectorFactory : - public QObject, public StandardToolFactory -{ - Q_OBJECT - Q_INTERFACES(GammaRay::ToolFactory) - public: - explicit StateMachineInspectorFactory(QObject *parent) : QObject(parent) {} - inline QString name() const { return tr("State Machines"); } -}; - -} - -#endif // GAMMARAY_STATEMACHINEINSPECTOR_H diff --git a/tools/statemachineinspector/statemachineinspector.ui b/tools/statemachineinspector/statemachineinspector.ui deleted file mode 100644 index 536d06a..0000000 --- a/tools/statemachineinspector/statemachineinspector.ui +++ /dev/null @@ -1,31 +0,0 @@ - - - GammaRay::StateMachineInspector - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - Qt::Horizontal - - - - - - - - - - - diff --git a/tools/statemachineviewer/CMakeLists.txt b/tools/statemachineviewer/CMakeLists.txt new file mode 100644 index 0000000..1837709 --- /dev/null +++ b/tools/statemachineviewer/CMakeLists.txt @@ -0,0 +1,45 @@ +if(GRAPHVIZ_FOUND) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${GRAPHVIZ_INCLUDE_DIR} +) + +set(gammaray_statemachineviewer_plugin_srcs + # this part depends on graphviz + gvgraph/gvgraph.cpp + gvgraph/gvgraphitems.cpp + + statemachineview.cpp + statemachineviewer.cpp + statemachinewatcher.cpp + + transitionmodel.cpp + statemodel.cpp + + ${CMAKE_SOURCE_DIR}/util.cpp +) +qt4_automoc(${gammaray_statemachineviewer_plugin_srcs}) +qt4_wrap_ui(gammaray_statemachineviewer_plugin_srcs statemachineviewer.ui) + +set(gammaray_statemachineviewer_plugin_libs + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} + + ${GRAPHVIZ_GRAPH_LIBRARY} + ${GRAPHVIZ_GVC_LIBRARY} +) + +gammaray_add_plugin(gammaray_statemachineviewer_plugin gammaray_statemachineviewer.desktop ${gammaray_statemachineviewer_plugin_srcs}) +target_link_libraries(gammaray_statemachineviewer_plugin ${gammaray_statemachineviewer_plugin_libs}) + +add_executable(statemachineviewer_test + gvgraph/gvgraph.cpp + gvgraph/gvgraphitems.cpp + + test_main.cpp +) +target_link_libraries(statemachineviewer_test ${gammaray_statemachineviewer_plugin_libs}) + +endif() diff --git a/tools/statemachineviewer/gammaray_statemachineviewer.desktop b/tools/statemachineviewer/gammaray_statemachineviewer.desktop new file mode 100644 index 0000000..4c7a199 --- /dev/null +++ b/tools/statemachineviewer/gammaray_statemachineviewer.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Name=State Machines +X-GammaRay-Types=QStateMachine; +Exec=gammaray_statemachineviewer_plugin diff --git a/tools/statemachineviewer/gvgraph/gvgraph.cpp b/tools/statemachineviewer/gvgraph/gvgraph.cpp new file mode 100644 index 0000000..a7a6805 --- /dev/null +++ b/tools/statemachineviewer/gvgraph/gvgraph.cpp @@ -0,0 +1,464 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "gvgraph.h" + +#include "gvutils.h" + +#include +#include +#include + +#include +#include +#include + +#include + +using namespace GammaRay; +using namespace std; + +/*! Dot uses a 72 + * DPI value for converting it's position coordinates from points to pixels + while we display at 96 DPI on most operating systems. */ +const qreal DotDefaultDPI = 72.0; + +GVGraph::GVGraph(const QString &name) + : _context(gvContext()), + _graph(0), + _name(name) +{ + createGraph(); +} + +void GVGraph::createGraph() +{ + _graph = _agopen(_name, AGDIGRAPHSTRICT); // Strict directed graph, see libgraph doc + _graphMap.insert(_graph, GVSubGraph("ROOT")); + + Q_ASSERT(_context); + Q_ASSERT(_graph); + + _agset(_graph, "overlap", "prism"); + _agset(_graph, "splines", "true"); + _agset(_graph, "pad", "0,2"); + _agset(_graph, "dpi", "96,0"); + _agset(_graph, "nodesep", "0,4"); + + setFont(_font); +} + +void GVGraph::closeGraph() +{ + gvFreeLayout(_context, _graph); + + agclose(_graph); + _graph = 0; +} + +void GVGraph::clear() +{ + closeGraph(); + + _graphMap.clear(); + _nodeMap.clear(); + _edgeMap.clear(); + + createGraph(); +} + +GVGraph::~GVGraph() +{ + closeGraph(); +} + +GraphId GVGraph::addGraph(const QString &name) +{ + return addGraph(name, _graph); +} + +GraphId GVGraph::addGraph(const QString &name, GraphId subGraphId) +{ + Agraph_t *graph = agGraph(subGraphId); + return addGraph(name, graph); +} + +GraphId GVGraph::addGraph(const QString &name, Agraph_t *graph) +{ + if (!graph) { + qWarning() << "Subgraph does not exist:" << graph; + return 0; + } + + const QString realName = "cluster" + name; + + Agraph_t *subGraph = _agsubg(graph, realName); + Q_ASSERT(subGraph); + _graphMap.insert(subGraph, GVSubGraph(realName)); + return (GraphId)subGraph; +} + +void GVGraph::removeGraph(GraphId graphId) +{ + Agraph_t *graph = agGraph(graphId); + if (!graph) { + return; + } + + Agnode_t *node = agfstnode(graph); + while (node) { + removeNode(id(node)); + node = agnxtnode(_graph, node); + } + + agdelete(_graph, graph); + _graphMap.remove(graph); +} + +NodeId GVGraph::addNode(const QString &name, GraphId subGraphId) +{ + Agraph_t *graph = agGraph(subGraphId); + return addNode(name, graph); +} + +NodeId GVGraph::addNode(const QString &name, Agraph_t *graph) +{ + if (!graph) { + qWarning() << Q_FUNC_INFO << "Node not added, graph is NULL:" << name; + return 0; + } + + // TODO: Check for duplicates? + Agnode_t *node = _agnode(graph, name); + Q_ASSERT(node); + _agset(node, "label", name); + _nodeMap.insert(node, GVNode(name)); + return (NodeId)node; +} + +NodeId GVGraph::addNode(const QString &name) +{ + return addNode(name, _graph); +} + +QList< NodeId > GVGraph::addNodes(const QStringList &names) +{ + QList ids; + for (int i=0; iu.bb.LL.x * (dpi / DotDefaultDPI); + const qreal top = (_graph->u.bb.UR.y - graph->u.bb.LL.y) * (dpi / DotDefaultDPI); + const qreal right = graph->u.bb.UR.x * (dpi / DotDefaultDPI); + const qreal bottom = (_graph->u.bb.UR.y - graph->u.bb.UR.y) * (dpi / DotDefaultDPI); + return QRectF(left, top, right - left, bottom - top); +} + +void GVGraph::setGraphAttr(const QString &attr, const QString &value, GraphId graphId) +{ + if (!graphId) { + graphId = id(_graph); + } + + Agraph_t *graph = agGraph(graphId); + if (!graph) { + return; + } + + _agset(graph, attr, value); +} + +void GVGraph::setNodeAttribute(NodeId id, const QString &attr, const QString &value) +{ + _agset(agNode(id), attr, value); +} + +void GVGraph::setEdgeAttribute(EdgeId id, const QString &attr, const QString &value) +{ + _agset(agEdge(id), attr, value); +} + +QRectF GVGraph::boundingRect() const +{ + return boundingRectForAgraph(_graph); +} + +QList GVGraph::gvNodes() const +{ + QList list; + const qreal dpi = dpiForGraph(_graph); + + Q_FOREACH (Agnode_t *node, _nodeMap.keys()) { //krazy:exclude=foreach + GVNode object = _nodeMap[node]; + + //Set the name of the node + object.m_name = agget(node, const_cast("label")); + + //Fetch the X coordinate, apply the DPI conversion rate (actual DPI / 72, used by dot) + qreal x = node->u.coord.x * (dpi / DotDefaultDPI); + + //Translate the Y coordinate from bottom-left to top-left corner + qreal y = (_graph->u.bb.UR.y - node->u.coord.y) * (dpi / DotDefaultDPI); + object.m_centerPos=QPoint(x, y); + + //Transform the width and height from inches to pixels + object.m_height=node->u.height * dpi; + object.m_width=node->u.width * dpi; + + if (qstricmp(node->u.shape->name, "rectangle") == 0) { + if (qstricmp(agget(node, const_cast("style")), "rounded") == 0) { + object.m_shape = GVNode::RoundedRect; + } else { + object.m_shape = GVNode::Rect; + } + } else if (qstricmp(node->u.shape->name, "doublecircle") == 0) { + object.m_shape = GVNode::DoubleEllipse; + } + + if (qstricmp(agget(node, const_cast("style")), "filled") == 0) { + object.m_fillColor = QColor(agget(node, const_cast("fillcolor"))); + } + + list.append(GVNodePair(id(node), object)); + } + + return list; +} + +QList GVGraph::gvEdges() const +{ + QList list; + const qreal dpi = dpiForGraph(_graph); + + Q_FOREACH (Agedge_t *edge, _edgeMap.keys()) { //krazy:exclude=foreach + GVEdge object = _edgeMap[edge]; + + //Fill the source and target node names + object.m_source=edge->tail->name; + object.m_target=edge->head->name; + + if (edge->u.label) { + object.m_label = QString::fromUtf8(edge->u.label->text); + + // note that the position attributes in graphviz point to the *center* of this element. + // we need to subtract half of the width/height to get the top-left position + object.m_labelBoundingRect = QRectF( + (edge->u.label->pos.x - edge->u.label->dimen.x / 2.0) * (dpi / DotDefaultDPI), + ((_graph->u.bb.UR.y - edge->u.label->pos.y) - edge->u.label->dimen.y / 2.0) * (dpi / DotDefaultDPI), + edge->u.label->dimen.x * (dpi / DotDefaultDPI), + edge->u.label->dimen.y * (dpi / DotDefaultDPI)); + } + + //Calculate the path from the spline (only one spline, as the graph is strict. + //If it wasn't, we would have to iterate over the first list too) + //Calculate the path from the spline (only one as the graph is strict) + if ((edge->u.spl->list != 0) && (edge->u.spl->list->size%3 == 1)) { + //If there is a starting point, draw a line from it to the first curve point + if (edge->u.spl->list->sflag) { + object.m_path.moveTo(edge->u.spl->list->sp.x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->sp.y) * (dpi / DotDefaultDPI)); + object.m_path.lineTo(edge->u.spl->list->list[0].x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->list[0].y) * + (dpi / DotDefaultDPI)); + } else { + object.m_path.moveTo(edge->u.spl->list->list[0].x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->list[0].y) * + (dpi / DotDefaultDPI)); + } + + //Loop over the curve points + for (int i=1; iu.spl->list->size; i+=3) { + object.m_path.cubicTo(edge->u.spl->list->list[i].x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->list[i].y) * + (dpi / DotDefaultDPI), + edge->u.spl->list->list[i+1].x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->list[i+1].y) * + (dpi / DotDefaultDPI), + edge->u.spl->list->list[i+2].x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->list[i+2].y) * + (dpi / DotDefaultDPI)); + } + + //If there is an ending point, draw a line to it + if(edge->u.spl->list->eflag) { + object.m_path.lineTo(edge->u.spl->list->ep.x * (dpi / DotDefaultDPI), + (_graph->u.bb.UR.y - edge->u.spl->list->ep.y) * (dpi / DotDefaultDPI)); + } + } + + Q_ASSERT(!object.m_path.isEmpty()); + list.append(GVEdgePair(id(edge), object)); + } + + return list; +} + +QList GVGraph::gvSubGraphs() const +{ + QList list; + + Q_FOREACH (Agraph_t *subGraph, _graphMap.keys()) { //krazy:exclude=foreach + if (subGraph == _graph) { + continue; + } + const QRectF rect = boundingRectForAgraph(subGraph); + + QPainterPath path; + path.addRect(rect); + + GVSubGraph object = _graphMap[subGraph]; + object.m_path = path; + object.m_name = subGraph->name; + + list.append(GVSubGraphPair(id(subGraph), object)); + } + + return list; +} diff --git a/tools/statemachineviewer/gvgraph/gvgraph.h b/tools/statemachineviewer/gvgraph/gvgraph.h new file mode 100644 index 0000000..1f75cc5 --- /dev/null +++ b/tools/statemachineviewer/gvgraph/gvgraph.h @@ -0,0 +1,130 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_GVGRAPH_H +#define GAMMARAY_GVGRAPH_H + +#include "gvgraphelements.h" +#include "gvtypes.h" + +#include +#include +#include + +class Agedge_t; +class Agnode_t; +class Agraph_t; +typedef struct GVC_s GVC_t; + +namespace GammaRay { + +typedef QPair GVNodePair; +typedef QPair GVEdgePair; +typedef QPair GVSubGraphPair; + +/// An object containing a libgraph graph and its associated nodes and edges +class GVGraph +{ + public: + /*! + * \brief Construct a Graphviz graph object + * \param name The name of the graph, must be unique in the application + */ + GVGraph(const QString &name); + ~GVGraph(); + + GraphId addGraph(const QString &name); + GraphId addGraph(const QString &name, GraphId subGraphId); + void removeGraph(GraphId graphId); + QList gvSubGraphs() const; + + void setGraphAttr(const QString &attr, const QString &value, GraphId id = 0); + + /// Add and remove nodes + NodeId addNode(const QString &name); + NodeId addNode(const QString &name, GraphId subGraphId); + QList addNodes(const QStringList &names); + void removeNode(NodeId nodeId); + void clearNodes(); + QList gvNodes() const; + + void setNodeAttribute(NodeId id, const QString &attr, const QString &value); + + /// Add and remove edges + EdgeId addEdge(NodeId source, NodeId target, const QString &name); + void removeEdge(EdgeId id); + QList gvEdges() const; + + void setEdgeAttribute(EdgeId id, const QString &attr, const QString &value); + + /// Set the font to use in all the labels + void setFont(const QFont &font); + + QRectF boundingRect() const; + + void clear(); + + void applyLayout(); + + private: + GraphId addGraph(const QString &name, Agraph_t *graph); + NodeId addNode(const QString &name, Agraph_t *graph); + + void createGraph(); + void closeGraph(); + + NodeId id(Agnode_t *node) const + { + return (NodeId)node; + } + + EdgeId id(Agedge_t *edge) const + { + return (EdgeId)edge; + } + + GraphId id(Agraph_t *graph) const + { + return (GraphId)graph; + } + + Agnode_t *agNode(NodeId nodeId) const; + Agedge_t *agEdge(EdgeId edgeId) const; + Agraph_t *agGraph(GraphId graphId) const; + + QRectF boundingRectForAgraph(Agraph_t *graph) const; + + GVC_t *_context; + Agraph_t *_graph; + QFont _font; + qreal _dpi; + + QString _name; + + // data + QHash _graphMap; + QHash _edgeMap; + QHash _nodeMap; +}; + +} + +#endif // GAMMARAY_GVGRAPH_H diff --git a/tools/statemachineviewer/gvgraph/gvgraphelements.h b/tools/statemachineviewer/gvgraph/gvgraphelements.h new file mode 100644 index 0000000..c94d4f1 --- /dev/null +++ b/tools/statemachineviewer/gvgraph/gvgraphelements.h @@ -0,0 +1,140 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_GVGRAPHELEMENTS_H +#define GAMMARAY_GVGRAPHELEMENTS_H + +#include +#include + +namespace GammaRay { + +class GVGraph; + +class GVElement +{ + public: + friend class GVGraph; + + GVElement(const QString &name) : m_name(name) {} + GVElement() {} + + QString name() const + { + return m_name; + } + + private: + /// The unique identifier of the element in the graph + QString m_name; +}; + +class GVSubGraph : public GVElement +{ + friend class GVGraph; + + public: + GVSubGraph(const QString &name) : GVElement(name) {} + GVSubGraph() {} + + QPainterPath path() const + { + return m_path; + } + + private: + QPainterPath m_path; +}; + + /// A struct containing the information for a GVGraph's node +class GVNode : public GVElement +{ + friend class GVGraph; + + public: + enum Shape { + Ellipse, + DoubleEllipse, + Rect, + RoundedRect + }; + + GVNode(const QString &name) : GVElement(name), m_height(0), m_width(0), m_shape(Ellipse) {} + GVNode() : m_height(0), m_width(0), m_shape(Ellipse) {} + + QPoint centerPos() const + { + return m_centerPos; + } + + QSize size() const + { + return QSize(m_width, m_height); + } + + Shape shape() const + { + return m_shape; + } + + QColor fillColor() const + { + return m_fillColor; + } + + private: + /// The position of the center point of the node from the top-left corner + QPoint m_centerPos; + + /// The size of the node in pixels + qreal m_height, m_width; + + /// The shape of this node + Shape m_shape; + + /// Color to fill this node, invalid for non-filled nodes. + QColor m_fillColor; +}; + +/// A struct containing the information for a GVGraph's edge +class GVEdge : public GVElement +{ + public: + GVEdge(const QString &name) : GVElement(name) {} + GVEdge() {} + + /// The source and target nodes of the edge + QString m_source; + QString m_target; + + /// Path of the edge's line + QPainterPath m_path; + + /// The label of the edge + QString m_label; + + /// Position of the label + QRectF m_labelBoundingRect; +}; + +} + +#endif diff --git a/tools/statemachineviewer/gvgraph/gvgraphitems.cpp b/tools/statemachineviewer/gvgraph/gvgraphitems.cpp new file mode 100644 index 0000000..0ed6cea --- /dev/null +++ b/tools/statemachineviewer/gvgraph/gvgraphitems.cpp @@ -0,0 +1,173 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "gvgraphitems.h" + +#include +#include + +using namespace GammaRay; + +GVNodeItem::GVNodeItem(const GVNode &node, QGraphicsItem *parent, QGraphicsScene *scene) + : QGraphicsItemGroup(parent, scene), + m_node(node) +{ + const QSizeF size = node.size(); + const QRectF rect(-size.width() / 2, -size.height() / 2, + size.width(), size.height()); + switch (node.shape()) { + case GVNode::Rect: + { + QGraphicsRectItem *item = new QGraphicsRectItem(this); + item->setRect(rect); + m_shapeItem = item; + break; + } + case GVNode::RoundedRect: + { + QPainterPath path; + path.addRoundedRect(rect, 10, 10); + QGraphicsPathItem *item = new QGraphicsPathItem(this); + item->setPath(path); + m_shapeItem = item; + break; + } + case GVNode::Ellipse: + case GVNode::DoubleEllipse: + { + QGraphicsEllipseItem *item = new QGraphicsEllipseItem(this); + item->setRect(rect); + if (node.shape() == GVNode::DoubleEllipse) { + QGraphicsEllipseItem *doubleItem = new QGraphicsEllipseItem(item); + doubleItem->setRect(rect.adjusted(4, 4, -4, -4)); + m_shapeItem = doubleItem; + } else { + m_shapeItem = item; + } + break; + } + default: + Q_ASSERT(false); + } + + m_textItem = new QGraphicsTextItem(node.name(), this); + m_textItem->setFont(QFont("Helvetica [Cronxy]", 6)); + + setPos(m_node.centerPos()); + setToolTip(QObject::tr("State: %1").arg(node.name())); + setFlags(ItemIsSelectable); + + // init text item child + { + QGraphicsTextItem *item = m_textItem; + QRectF textRect = item->boundingRect(); + while (size.width() < textRect.size().width() && item->font().pointSize() > 1) { + QFont font = item->font(); + font.setPointSize(font.pointSize() - 1); + item->setFont(font); + textRect = item->boundingRect(); + } + const QSizeF size = textRect.size(); + item->setPos(QPointF(-size.width() / 2, -size.height() / 2)); + } + + if (node.fillColor().isValid()) { + setBrush(node.fillColor()); + } +} + +void GVNodeItem::setPen(const QPen &pen) +{ + m_shapeItem->setPen(pen); +} + +QBrush GVNodeItem::brush() const +{ + return m_shapeItem->brush(); +} + +void GVNodeItem::setBrush(const QBrush &brush) +{ + m_shapeItem->setBrush(brush); +} + +GVEdgeItem::GVEdgeItem(const GVEdge &edge, QGraphicsItem *parent, QGraphicsScene *scene) + : QGraphicsItemGroup(parent, scene), + m_edge(edge) +{ + m_pathItem = new QGraphicsPathItem(this); + m_pathItem->setPath(edge.m_path); + setToolTip(QObject::tr("Transition: %1 -> %2").arg(edge.m_source).arg(edge.m_target)); + + // arrow head quick-fix + QVector points = QVector() << QPointF(0, 0) + << QPointF(-8, 4) + << QPointF(-8, -4); + m_arrowItem = new QGraphicsPolygonItem(this); + m_arrowItem->setPolygon(QPolygonF(points)); + m_arrowItem->setPos(edge.m_path.pointAtPercent(1.0)); + m_arrowItem->setRotation(-edge.m_path.angleAtPercent(1.0)); + + setPen(m_pathItem->pen()); + + m_textItem = new QGraphicsTextItem(edge.m_label, this); + m_textItem->setFont(QFont("Helvetica [Cronxy]", 6)); + // init text item child + { + QGraphicsTextItem *item = m_textItem; + const QRectF boundingRect = item->mapRectFromScene(edge.m_labelBoundingRect); + const QSizeF size = boundingRect.size(); + QRectF textRect = item->boundingRect(); + while (size.width() < textRect.size().width() && item->font().pointSize() > 1) { + QFont font = item->font(); + font.setPointSize(font.pointSize() - 1); + item->setFont(font); + textRect = item->boundingRect(); + } + item->setPos(boundingRect.x(), boundingRect.y()); + } +} + +void GVEdgeItem::setPen(const QPen &pen) +{ + m_pathItem->setPen(pen); + QPen arrowPen(pen); + arrowPen.setStyle(Qt::SolidLine); + m_arrowItem->setPen(arrowPen); + m_arrowItem->setBrush(arrowPen.color()); +} + +GVGraphItem::GVGraphItem(const GVSubGraph &graph, QGraphicsItem *parent, QGraphicsScene *scene) + : QGraphicsPathItem(parent, scene), + m_graph(graph), + m_textItem(0) +{ + setZValue(-1); + + setPath(graph.path()); + setPen(QColor(Qt::gray)); + setBrush(QColor(100, 100, 100, 20)); + setToolTip(QObject::tr("Graph: %1").arg(graph.name())); + + { + // TODO: Implement text item + } +} diff --git a/tools/statemachineviewer/gvgraph/gvgraphitems.h b/tools/statemachineviewer/gvgraph/gvgraphitems.h new file mode 100644 index 0000000..91a62d1 --- /dev/null +++ b/tools/statemachineviewer/gvgraph/gvgraphitems.h @@ -0,0 +1,117 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_GVGRAPHITEMS_H +#define GAMMARAY_GVGRAPHITEMS_H + +#include +#include + +#include "gvgraph.h" + +namespace GammaRay { + +class GVNodeItem : public QGraphicsItemGroup +{ + public: + explicit GVNodeItem(const GVNode &node, QGraphicsItem *parent = 0, + QGraphicsScene *scene = 0); + + enum { + Type = UserType + 1 + }; + + inline int type() const + { + return Type; + } + + QGraphicsTextItem *textItem() const + { + return m_textItem; + } + + void setPen(const QPen &pen); + QBrush brush() const; + void setBrush(const QBrush &brush); + + private: + GVNode m_node; + QGraphicsTextItem *m_textItem; + QAbstractGraphicsShapeItem *m_shapeItem; +}; + +class GVEdgeItem : public QGraphicsItemGroup +{ + public: + explicit GVEdgeItem(const GVEdge &edge, QGraphicsItem *parent = 0, + QGraphicsScene *scene = 0); + + enum { + Type = UserType + 2 + }; + + inline int type() const { + return Type; + } + + QGraphicsTextItem *textItem() const + { + return m_textItem; + } + + void setPen(const QPen &pen); + + private: + GVEdge m_edge; + QGraphicsPathItem *m_pathItem; + QGraphicsPolygonItem *m_arrowItem; + QGraphicsTextItem *m_textItem; +}; + +class GVGraphItem : public QGraphicsPathItem +{ + public: + explicit GVGraphItem(const GVSubGraph &edge, QGraphicsItem *parent = 0, + QGraphicsScene *scene = 0); + + enum { + Type = UserType + 3 + }; + + inline int type() const + { + return Type; + } + + QGraphicsTextItem *textItem() const + { + return m_textItem; + } + + private: + GVSubGraph m_graph; + QGraphicsTextItem *m_textItem; +}; + +} + +#endif // GAMMARAY_GVGRAPHITEMS_H diff --git a/splashscreen.h b/tools/statemachineviewer/gvgraph/gvtypes.h similarity index 78% rename from splashscreen.h rename to tools/statemachineviewer/gvgraph/gvtypes.h index 1181348..2342737 100644 --- a/splashscreen.h +++ b/tools/statemachineviewer/gvgraph/gvtypes.h @@ -1,11 +1,9 @@ /* - attachdialog.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Milian Wolff + Author: Kevin Funk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,14 +19,17 @@ along with this program. If not, see . */ -#ifndef SPLASHSCREEN_H -#define SPLASHSCREEN_H +#ifndef GAMMARAY_GVTYPES_H +#define GAMMARAY_GVTYPES_H -namespace GammaRay { +namespace GammaRay +{ -void showSplashScreen(); -void hideSplashScreen(); +typedef quintptr ElementId; +typedef quintptr EdgeId; +typedef quintptr NodeId; +typedef quintptr GraphId; } -#endif // SPLASHSCREEN_H +#endif diff --git a/tools/statemachineviewer/gvgraph/gvutils.h b/tools/statemachineviewer/gvgraph/gvutils.h new file mode 100644 index 0000000..e7d0613 --- /dev/null +++ b/tools/statemachineviewer/gvgraph/gvutils.h @@ -0,0 +1,89 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_GVUTILS_H +#define GAMMARAY_GVUTILS_H + +#include +#include +#include + +#include +#include + +namespace GammaRay { + +/// The agopen method for opening a graph +static inline Agraph_t *_agopen(QString name, int kind) +{ + return agopen(const_cast(qPrintable(name)), kind); +} + +/// Add an alternative value parameter to the method for getting an object's attribute +static inline QString _agget(void *object, QString attr, QString alt=QString()) +{ + const QString str = agget(object, const_cast(qPrintable(attr))); + if(str.isEmpty()) { + return alt; + } else { + return str; + } +} + +static inline Agsym_t *_agnodeattr(Agraph_t *object, QString attr, QString alt=QString()) +{ + return agnodeattr(object, + const_cast(qPrintable(attr)), + const_cast(qPrintable(alt))); +} + +static inline Agsym_t *_agedgeattr(Agraph_t *object, QString attr, QString alt=QString()) +{ + return agedgeattr(object, + const_cast(qPrintable(attr)), + const_cast(qPrintable(alt))); +} + +static inline int _gvLayout(GVC_t *gvc, graph_t *g, const char *engine) +{ + return gvLayout(gvc, g, engine); +} + +static inline Agnode_t *_agnode(Agraph_t *graph, const QString &attr) +{ + return agnode(graph, const_cast(qPrintable(attr))); +} + +static inline Agraph_t *_agsubg(Agraph_t *graph, const QString &attr) +{ + return agsubg(graph, const_cast(qPrintable(attr))); +} + +/// Directly use agsafeset which always works, contrarily to agset +static inline int _agset(void *object, QString attr, QString value) +{ + return agsafeset(object, const_cast(qPrintable(attr)), + const_cast(qPrintable(value)), const_cast("")); +} + +} + +#endif diff --git a/sidepane.h b/tools/statemachineviewer/statemachineview.cpp similarity index 58% copy from sidepane.h copy to tools/statemachineviewer/statemachineview.cpp index 09b0183..ee4e38b 100644 --- a/sidepane.h +++ b/tools/statemachineviewer/statemachineview.cpp @@ -1,6 +1,4 @@ /* - sidepane.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +19,33 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H +#include "statemachineview.h" -#include +#include -namespace GammaRay { +using namespace GammaRay; -class SidePane : public QListView +StateMachineView::StateMachineView(QWidget *parent) + : QGraphicsView(parent) { - Q_OBJECT - -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); +} - virtual QSize sizeHint() const; +StateMachineView::StateMachineView(QGraphicsScene *scene, QWidget *parent) + : QGraphicsView(scene, parent) +{ +} -protected: - virtual void resizeEvent(QResizeEvent *e); -}; +void StateMachineView::zoomBy(qreal scaleFactor) +{ + scale(scaleFactor, scaleFactor); +} +void StateMachineView::wheelEvent(QWheelEvent *event) +{ + const qreal step = qAbs(event->delta() / 100.0); + const qreal zoomFactor = event->delta() >= 0 ? step : 1.0f / step ; + zoomBy(zoomFactor); + event->accept(); } -#endif // GAMMARAY_SIDEPANE_H +#include "statemachineview.moc" diff --git a/sidepane.h b/tools/statemachineviewer/statemachineview.h similarity index 67% copy from sidepane.h copy to tools/statemachineviewer/statemachineview.h index 09b0183..489f750 100644 --- a/sidepane.h +++ b/tools/statemachineviewer/statemachineview.h @@ -1,6 +1,4 @@ /* - sidepane.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +19,27 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H +#ifndef GAMMARAY_STATEMACHINEVIEW_H +#define GAMMARAY_STATEMACHINEVIEW_H -#include +#include namespace GammaRay { -class SidePane : public QListView +class StateMachineView : public QGraphicsView { Q_OBJECT + public: + explicit StateMachineView(QWidget *parent = 0); + explicit StateMachineView(QGraphicsScene *scene, QWidget *parent = 0); -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); - - virtual QSize sizeHint() const; + public Q_SLOTS: + void zoomBy(qreal scaleFactor); -protected: - virtual void resizeEvent(QResizeEvent *e); + protected: + virtual void wheelEvent(QWheelEvent *event); }; } -#endif // GAMMARAY_SIDEPANE_H +#endif // GAMMARAY_STATEMACHINEVIEW_H diff --git a/tools/statemachineviewer/statemachineviewer.cpp b/tools/statemachineviewer/statemachineviewer.cpp new file mode 100644 index 0000000..72d5d4f --- /dev/null +++ b/tools/statemachineviewer/statemachineviewer.cpp @@ -0,0 +1,552 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "statemachineviewer.h" +#include "ui_statemachineviewer.h" + +#include "statemachineview.h" +#include "statemachinewatcher.h" +#include "gvgraph/gvgraph.h" +#include "gvgraph/gvgraphitems.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace GammaRay; + +template +static qreal relativePosition(QList list, T t) { + const int index = list.indexOf(t); + Q_ASSERT(index != -1); + return (index+1.0) / list.size(); +} + +static QString uniqueIdentifier(QObject *object) +{ + return Util::addressToUid(object); +} + +StateMachineViewer::StateMachineViewer(ProbeInterface *probe, QWidget *parent) + : QWidget(parent), + m_ui(new Ui::StateMachineViewer), + m_graph(new GVGraph("State Machine")), + m_stateModel(new StateModel(this)), + m_transitionModel(new TransitionModel(this)), + m_filteredState(0), + m_maximumDepth(0), + m_font(QFont("Helvetica [Cronxy]", 6)), + m_stateMachineWatcher(new StateMachineWatcher(this)) +{ + m_ui->setupUi(this); + + m_graph->setFont(m_font); + + m_lastConfigurations.resize(5); + + m_ui->graphicsView->setDragMode(QGraphicsView::ScrollHandDrag); + m_ui->graphicsView->setScene(new QGraphicsScene(this)); + m_ui->graphicsView->setRenderHint(QPainter::Antialiasing); + + ObjectTypeFilterProxyModel *stateMachineFilter = + new ObjectTypeFilterProxyModel(this); + stateMachineFilter->setSourceModel(probe->objectListModel()); + m_stateMachineModel = stateMachineFilter; + m_ui->stateMachinesView->setModel(m_stateMachineModel); + m_ui->stateMachinesView->header()->setResizeMode(0, QHeaderView::Stretch); + m_ui->stateMachinesView->header()->setResizeMode(1, QHeaderView::ResizeToContents); + connect(m_ui->stateMachinesView, SIGNAL(clicked(QModelIndex)), + SLOT(handleMachineClicked(QModelIndex))); + + m_ui->singleStateMachineView->setModel(m_stateModel); + connect(m_ui->singleStateMachineView, SIGNAL(clicked(QModelIndex)), + SLOT(handleStateClicked(QModelIndex))); + m_ui->singleStateMachineView->header()->setResizeMode(0, QHeaderView::Stretch); + m_ui->singleStateMachineView->header()->setResizeMode(1, QHeaderView::ResizeToContents); + + connect(m_ui->depthSpinBox, SIGNAL(valueChanged(int)), SLOT(handleDepthChanged(int))); + connect(m_ui->startStopButton, SIGNAL(clicked()), SLOT(startStopClicked())); + connect(m_ui->exportButton, SIGNAL(clicked()), SLOT(exportAsImage())); + + connect(m_stateMachineWatcher, SIGNAL(stateEntered(QAbstractState*)), + SLOT(handleStatesChanged())); + connect(m_stateMachineWatcher, SIGNAL(stateExited(QAbstractState*)), + SLOT(handleStatesChanged())); + connect(m_stateMachineWatcher, SIGNAL(transitionTriggered(QAbstractTransition*)), + SLOT(handleTransitionTriggered(QAbstractTransition*))); + + setMaximumDepth(3); + updateStartStop(); + + // pre-select the first state machine for convenience + if (m_stateMachineModel->rowCount() > 0) { + const QModelIndex firstRow = m_stateMachineModel->index(0, 0); + m_ui->stateMachinesView->selectionModel()->select( + firstRow, QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent); + handleMachineClicked(firstRow); + } +} + +void StateMachineViewer::clearGraph() +{ + m_graph->clear(); + + m_graphItemMap.clear(); + m_nodeItemMap.clear(); + m_edgeItemMap.clear(); + + m_stateGraphIdMap.clear(); + m_stateNodeIdMap.clear(); + m_transitionEdgeIdMap.clear(); +} + +void StateMachineViewer::repopulateGraph() +{ + clearGraph(); + + for (int i = 0; i < m_stateModel->rowCount(); ++i) { + const QModelIndex index = m_stateModel->index(i, 0); + QObject* stateObject = index.data(StateModel::StateObjectRole).value(); + QAbstractState *state = qobject_cast(stateObject); + if (!state) { + continue; + } + + addState(state); + } +} + +QStateMachine *StateMachineViewer::selectedStateMachine() const +{ + return m_stateModel->stateMachine(); +} + +void StateMachineViewer::selectStateMachine(QStateMachine *machine) +{ + if (!machine) { + qWarning() << Q_FUNC_INFO << "Warning: Null parameter"; + return; + } + + m_stateModel->setStateMachine(machine); + m_ui->singleStateMachineView->expandAll(); + + m_lastConfigurations.clear(); + m_lastTransitions.clear(); + + setFilteredState(machine); + m_stateMachineWatcher->setWatchedStateMachine(machine); + + connect(machine, SIGNAL(started()), SLOT(updateStartStop()), Qt::UniqueConnection); + connect(machine, SIGNAL(stopped()), SLOT(updateStartStop()), Qt::UniqueConnection); + connect(machine, SIGNAL(finished()),SLOT(updateStartStop()), Qt::UniqueConnection); + updateStartStop(); +} + +int treeDepth(QAbstractState *ascendant, QAbstractState *obj) +{ + if (!Util::descendantOf(ascendant, obj)) { + return -1; + } + + int depth = 0; + QAbstractState *parent = obj->parentState(); + while (parent) { + ++depth; + parent = parent->parentState(); + } + return depth; +} + +bool StateMachineViewer::mayAddState(QAbstractState *state) +{ + if (!state) { + return false; + } + + if (m_stateNodeIdMap.contains(state)) { + return false; + } + + if (m_filteredState) { + if (m_filteredState != state && !Util::descendantOf(m_filteredState, state)) { + return false; + } + } + + if (m_maximumDepth > 0) { + if (::treeDepth(m_filteredState, state) > m_maximumDepth) { + return false; + } + } + + return true; +} + +void StateMachineViewer::setFilteredState(QAbstractState *state) +{ + if (m_filteredState == state) { + return; + } + + showMessage(QString("Setting filter on: %1").arg(Util::displayString(state))); + m_filteredState = state; + repopulateGraph(); + repopulateView(); +} + +void StateMachineViewer::setMaximumDepth(int depth) +{ + if (m_maximumDepth == depth) { + return; + } + + showMessage(QString("Showing states until a depth of %1").arg(depth)); + m_maximumDepth = depth; + repopulateGraph(); + repopulateView(); + m_ui->depthSpinBox->setValue(depth); +} + +void StateMachineViewer::handleMachineClicked(const QModelIndex &index) +{ + QObject *stateMachineObject = index.data(ObjectModel::ObjectRole).value(); + QStateMachine *stateMachine = qobject_cast(stateMachineObject); + Q_ASSERT(stateMachine); + + selectStateMachine(stateMachine); +} + +void StateMachineViewer::handleStateClicked(const QModelIndex &index) +{ + QObject *stateObject = index.data(ObjectModel::ObjectRole).value(); + Q_ASSERT(stateObject); + QAbstractState *state = qobject_cast(stateObject); + Q_ASSERT(state); + setFilteredState(state); +} + +void StateMachineViewer::handleDepthChanged(int depth) +{ + setMaximumDepth(depth); +} + +void StateMachineViewer::showMessage(const QString &message) +{ + // update log + QPlainTextEdit *plainTextEdit = m_ui->plainTextEdit; + plainTextEdit->appendPlainText(message); + + // auto-scroll hack + QScrollBar *sb = plainTextEdit->verticalScrollBar(); + sb->setValue(sb->maximum()); +} + +void StateMachineViewer::handleTransitionTriggered(QAbstractTransition *transition) +{ + showMessage(tr("Transition triggered: %1").arg(Util::displayString(transition))); + + m_lastTransitions.enqueue(transition); + updateTransitionItems(); +} + +void StateMachineViewer::updateTransitionItems() +{ + // restore default color + Q_FOREACH (QGraphicsItem *item, m_ui->graphicsView->scene()->items()) { + GVEdgeItem *edgeItem = qgraphicsitem_cast(item); + if (edgeItem) { + edgeItem->setPen(QPen()); + } + } + + // set color based on recent usage + Q_FOREACH (QAbstractTransition *t, m_lastTransitions.entries()) { + EdgeId id = m_transitionEdgeIdMap.value(t); + GVEdgeItem *edgeItem = m_edgeItemMap[id]; + if (!edgeItem) { + continue; + } + + QColor color(Qt::red); + color.setRedF(relativePosition(m_lastTransitions.entries(), t)); + QPen pen(Qt::DashLine); + pen.setWidth(2); + pen.setColor(color); + edgeItem->setPen(pen); + } +} + +void StateMachineViewer::handleStatesChanged() +{ + StateMachineConfiguration config = m_stateModel->stateMachine()->configuration(); + if (m_lastConfigurations.size() > 0 && m_lastConfigurations.tail() == config) { + return; + } + + Q_FOREACH (QAbstractState *state, config) { + showMessage(tr("State entered: %1").arg(Util::displayString(state))); + } + + m_lastConfigurations.enqueue(config); + updateStateItems(); +} + +void StateMachineViewer::updateStateItems() +{ + // initialize + Q_FOREACH (QAbstractState *state, m_stateNodeIdMap.keys()) { + NodeId id = m_stateNodeIdMap.value(state); + GVNodeItem *nodeItem = m_nodeItemMap[id]; + if (qobject_cast(state)) { + nodeItem->setBrush(Qt::black); + } else if (qobject_cast(state)) { + nodeItem->setBrush(Qt::gray); + } else { + nodeItem->setBrush(Qt::white); + } + } + + // color recent configurations based on last usage + // note that each configuration has the same color saturation atm + Q_FOREACH (const StateMachineConfiguration &config, m_lastConfigurations.entries()) { + const qreal alpha = relativePosition(m_lastConfigurations.entries(), config); + Q_FOREACH (QAbstractState *state, config) { + NodeId id = m_stateNodeIdMap.value(state); + GVNodeItem *nodeItem = m_nodeItemMap[id]; + if (!nodeItem) { + continue; + } + + QColor color(Qt::red); + color.setAlphaF(alpha); + QBrush brush = nodeItem->brush(); + brush.setColor(color); + nodeItem->setBrush(brush); + } + } +} + +void StateMachineViewer::addState(QAbstractState *state) +{ + if (!mayAddState(state)) { + return; + } + + QState *parentState = state->parentState(); + if (parentState) { + addState(parentState); // be sure that parent is added first + } + + GraphId parentGraphId = m_stateGraphIdMap.value(parentState); + GraphId graphId = parentGraphId; + if (parentState && parentGraphId) { + if (state->findChild()) { + // only create sub-graphs if we have child states + graphId = m_graph->addGraph(uniqueIdentifier(state), parentGraphId); + m_graph->setGraphAttr(QLatin1String("label"), Util::displayString(state), graphId); + } + } else { + graphId = m_graph->addGraph(uniqueIdentifier(state)); + m_graph->setGraphAttr(QLatin1String("label"), Util::displayString(state), graphId); + } + const NodeId nodeId = m_graph->addNode(uniqueIdentifier(state), graphId); + m_graph->setNodeAttribute(nodeId, QLatin1String("label"), Util::displayString(state)); + Q_ASSERT(graphId); + Q_ASSERT(nodeId); + + if (qobject_cast(state)) { + m_graph->setNodeAttribute(nodeId, "shape", "doublecircle"); + m_graph->setNodeAttribute(nodeId, "label", ""); + m_graph->setNodeAttribute(nodeId, "style", "filled"); + m_graph->setNodeAttribute(nodeId, "fillcolor", "black"); + m_graph->setNodeAttribute(nodeId, "fixedsize", "true"); + m_graph->setNodeAttribute(nodeId, "heigh", "0.15"); + m_graph->setNodeAttribute(nodeId, "width", "0.15"); + } else if (qobject_cast(state)) { + m_graph->setNodeAttribute(nodeId, "label", "H"); + m_graph->setNodeAttribute(nodeId, "shape", "circle"); + } else { + m_graph->setNodeAttribute(nodeId, "shape", "rectangle"); + m_graph->setNodeAttribute(nodeId, "style", "rounded"); + } + + // add a connection from parent state to initial state iff + // parent state is valid and parent state has an initial state + if (parentGraphId && parentState->initialState() == state) { + NodeId initialNode = + m_graph->addNode(QString("initial-%1").arg(uniqueIdentifier(parentState)), parentGraphId); + m_graph->addEdge(initialNode, nodeId, QString()); + m_graph->setNodeAttribute(initialNode, "shape", "circle"); + m_graph->setNodeAttribute(initialNode, "style", "filled"); + m_graph->setNodeAttribute(initialNode, "fillcolor", "black"); + m_graph->setNodeAttribute(initialNode, "fixedsize", "true"); + m_graph->setNodeAttribute(initialNode, "heigh", "0.1"); + m_graph->setNodeAttribute(initialNode, "width", "0.1"); + m_graph->setNodeAttribute(initialNode, "label", ""); + } + + m_stateGraphIdMap.insert(state, graphId); + m_stateNodeIdMap.insert(state, nodeId); + + // add transitions + Q_FOREACH (QAbstractTransition *transition, state->findChildren()) { + addTransition(transition); + } + + // recursive call to add children + Q_FOREACH (QAbstractState* child, state->findChildren()) { + addState(child); + } +} + +void StateMachineViewer::addTransition(QAbstractTransition *transition) +{ + QState *sourceState = transition->sourceState(); + QAbstractState *targetState = transition->targetState(); + addState(sourceState); + addState(targetState); + + NodeId sourceStateId = m_stateNodeIdMap.value(sourceState); + NodeId targetStateId = m_stateNodeIdMap.value(targetState); + if (!sourceStateId || !targetStateId) { + return; + } + + EdgeId id = m_graph->addEdge(sourceStateId, targetStateId, Util::displayString(transition)); + Q_ASSERT(id); + + QSignalTransition *signalTransition = qobject_cast(transition); + if (signalTransition) { + const QString label = + QString::fromLatin1("%1::%2"). + arg(Util::displayString(signalTransition->senderObject())). + arg(QString::fromLatin1(signalTransition->signal().mid(1))); + m_graph->setEdgeAttribute(id, QLatin1String("label"), label); + } + + m_transitionEdgeIdMap.insert(transition, id); +} + +void StateMachineViewer::clearView() +{ + m_ui->graphicsView->scene()->clear(); +} + +void StateMachineViewer::repopulateView() +{ + clearView(); + + m_graph->applyLayout(); + + QGraphicsScene *scene = m_ui->graphicsView->scene(); + Q_FOREACH (const GVNodePair &nodePair, m_graph->gvNodes()) { + const NodeId &id = nodePair.first; + const GVNode &node = nodePair.second; + GVNodeItem *item = new GVNodeItem(node); + scene->addItem(item); + m_nodeItemMap.insert(id, item); + } + + Q_FOREACH (const GVEdgePair &edgePair, m_graph->gvEdges()) { + const EdgeId &id = edgePair.first; + const GVEdge &edge = edgePair.second; + GVEdgeItem *item = new GVEdgeItem(edge); + scene->addItem(item); + m_edgeItemMap.insert(id, item); + } + + Q_FOREACH (const GVSubGraphPair &graphPair, m_graph->gvSubGraphs()) { + const GraphId &id = graphPair.first; + const GVSubGraph &graph = graphPair.second; + GVGraphItem *item = new GVGraphItem(graph); + scene->addItem(item); + m_graphItemMap.insert(id, item); + } + + updateStateItems(); + updateTransitionItems(); + + // correctly set the scene rect + scene->setSceneRect(scene->itemsBoundingRect()); +} + +void StateMachineViewer::updateStartStop() +{ + if (!selectedStateMachine() || !selectedStateMachine()->isRunning()) { + m_ui->startStopButton->setChecked(false); + m_ui->startStopButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + } else { + m_ui->startStopButton->setChecked(true); + m_ui->startStopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); + } + m_ui->startStopButton->setEnabled(selectedStateMachine()); +} + +void StateMachineViewer::startStopClicked() +{ + if (!selectedStateMachine()) { + return; + } + if (selectedStateMachine()->isRunning()) { + selectedStateMachine()->stop(); + } else { + selectedStateMachine()->start(); + } +} + +void StateMachineViewer::exportAsImage() +{ + const QString fileName = QFileDialog::getSaveFileName(this, tr("Save As Image")); + if (fileName.isEmpty()) { + return; + } + + QGraphicsScene *scene = m_ui->graphicsView->scene(); + + QImage image(scene->sceneRect().width(), scene->sceneRect().height(), + QImage::Format_ARGB32_Premultiplied); + image.fill(QColor(Qt::white).rgb()); + + QPainter painter(&image); + painter.setRenderHint(QPainter::Antialiasing); + scene->render(&painter); + + image.save(fileName, "PNG"); +} + +Q_EXPORT_PLUGIN(StateMachineViewerFactory) + +#include "statemachineviewer.moc" diff --git a/tools/statemachineviewer/statemachineviewer.h b/tools/statemachineviewer/statemachineviewer.h new file mode 100644 index 0000000..f30d8e4 --- /dev/null +++ b/tools/statemachineviewer/statemachineviewer.h @@ -0,0 +1,142 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_STATEMACHINEVIEWER_H +#define GAMMARAY_STATEMACHINEVIEWER_H + +#include + +#include "gvgraph/gvtypes.h" +#include "statemachineviewerutil.h" + +#include +#include +#include +#include + +class QAbstractTransition; +class QStateMachine; +class QAbstractState; +class QAbstractItemModel; +class QModelIndex; + +typedef QSet StateMachineConfiguration; + +namespace GammaRay { + +namespace Ui { + class StateMachineViewer; +} + +class GVNodeItem; +class GVEdgeItem; +class GVGraphItem; +class StateModel; +class StateMachineWatcher; +class TransitionModel; + +class GVGraph; + +class StateMachineViewer : public QWidget +{ + Q_OBJECT + public: + explicit StateMachineViewer(ProbeInterface *probe, QWidget *parent = 0); + + void addState(QAbstractState *state); + void addTransition(QAbstractTransition *transition); + + QStateMachine *selectedStateMachine() const; + + private slots: + void handleStatesChanged(); + void handleTransitionTriggered(QAbstractTransition *); + + void handleMachineClicked(const QModelIndex &); + void handleStateClicked(const QModelIndex &); + void handleDepthChanged(int depth); + + void selectStateMachine(QStateMachine *stateMachine); + void setFilteredState(QAbstractState *state); + void setMaximumDepth(int depth); + + void clearView(); + void repopulateView(); + + void showMessage(const QString &message); + + void updateStartStop(); + void startStopClicked(); + void exportAsImage(); + + private: + void clearGraph(); + void repopulateGraph(); + + void updateStateItems(); + void updateTransitionItems(); + + bool mayAddState(QAbstractState *state); + + QScopedPointer m_ui; + + GVGraph *m_graph; + QFont m_font; + + QAbstractItemModel *m_stateMachineModel; + StateModel *m_stateModel; + TransitionModel *m_transitionModel; + + // filters + QAbstractState *m_filteredState; + int m_maximumDepth; + + QHash m_transitionEdgeIdMap; + QHash m_stateGraphIdMap; + QHash m_stateNodeIdMap; + + QHash m_edgeItemMap; + QHash m_graphItemMap; + QHash m_nodeItemMap; + + RingBuffer m_lastConfigurations; + RingBuffer m_lastTransitions; + + StateMachineWatcher *m_stateMachineWatcher; +}; + +class StateMachineViewerFactory : + public QObject, public StandardToolFactory +{ + Q_OBJECT + Q_INTERFACES(GammaRay::ToolFactory) + + public: + explicit StateMachineViewerFactory(QObject *parent = 0) : QObject(parent) {} + inline QString name() const + { + return tr("State Machine Viewer"); + } +}; + +} + +#endif // GAMMARAY_STATEMACHINEVIEWER_H diff --git a/tools/statemachineviewer/statemachineviewer.ui b/tools/statemachineviewer/statemachineviewer.ui new file mode 100644 index 0000000..f0b058f --- /dev/null +++ b/tools/statemachineviewer/statemachineviewer.ui @@ -0,0 +1,137 @@ + + + GammaRay::StateMachineViewer + + + + 0 + 0 + 809 + 594 + + + + Form + + + + + + Qt::Horizontal + + + + Qt::Vertical + + + + + + + Settings + + + + + + Maximum depth of state hierarchy shown: + + + + + + + 0 + + + + + + + + + + false + + + true + + + false + + + + + + + Save As Image... + + + + + + + + + + + Start/Stop State Machine: + + + + + + + + + + true + + + + + + + true + + + false + + + + + + + + true + + + 100 + + + false + + + + + + + 1 + 0 + + + + + + + + + + StateMachineView + QGraphicsView +
statemachineview.h
+
+
+ + +
diff --git a/sidepane.h b/tools/statemachineviewer/statemachineviewerutil.h similarity index 53% copy from sidepane.h copy to tools/statemachineviewer/statemachineviewerutil.h index 09b0183..94b4cbc 100644 --- a/sidepane.h +++ b/tools/statemachineviewer/statemachineviewerutil.h @@ -1,6 +1,4 @@ /* - sidepane.h - This file is part of GammaRay, the Qt application inspection and manipulation tool. @@ -21,27 +19,60 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_SIDEPANE_H -#define GAMMARAY_SIDEPANE_H - -#include +#ifndef GAMMARAY_STATEMACHINEVIEWER_UTIL_H +#define GAMMARAY_STATEMACHINEVIEWER_UTIL_H -namespace GammaRay { +#include -class SidePane : public QListView +template +class RingBuffer { - Q_OBJECT + public: + RingBuffer() : m_size(5) {} -public: - explicit SidePane(QWidget *parent = 0); - virtual ~SidePane(); + void resize(int size) + { + Q_ASSERT(size > 0); + m_size = size; + cleanup(); + } - virtual QSize sizeHint() const; + void enqueue(T t) + { + m_entries.enqueue(t); + cleanup(); + } -protected: - virtual void resizeEvent(QResizeEvent *e); -}; + void clear() + { + m_entries.clear(); + } + + int size() const + { + return m_entries.size(); + } -} + T tail() const + { + return m_entries.last(); + } + + QList entries() const + { + return m_entries; + } + + private: + void cleanup() + { + while (m_entries.size() > m_size) { + m_entries.dequeue(); + } + } + + QQueue m_entries; + int m_size; +}; -#endif // GAMMARAY_SIDEPANE_H +#endif diff --git a/tools/statemachineviewer/statemachinewatcher.cpp b/tools/statemachineviewer/statemachinewatcher.cpp new file mode 100644 index 0000000..dd3c060 --- /dev/null +++ b/tools/statemachineviewer/statemachinewatcher.cpp @@ -0,0 +1,139 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "statemachinewatcher.h" + +#include +#include +#include +#include + +#include + +using namespace GammaRay; + +StateMachineWatcher::StateMachineWatcher(QObject *parent) + : QObject(parent), + m_watchedStateMachine(0), + m_lastEnteredState(0), + m_lastExitedState(0) +{ +} + +StateMachineWatcher::~StateMachineWatcher() +{ +} + +void StateMachineWatcher::setWatchedStateMachine(QStateMachine *machine) +{ + if (m_watchedStateMachine == machine) { + return; + } + + m_watchedStateMachine = machine; + + clearWatchedStates(); + Q_FOREACH (QAbstractState* state, machine->findChildren()) { + watchState(state); + } + + emit watchedStateMachineChanged(machine); +} + +QStateMachine *StateMachineWatcher::watchedStateMachine() const +{ + return m_watchedStateMachine; +} + +void StateMachineWatcher::watchState(QAbstractState *state) +{ + if (state->machine() != m_watchedStateMachine) { + return; + } + + connect(state, SIGNAL(entered()), + this, SLOT(handleStateEntered()), Qt::UniqueConnection); + connect(state, SIGNAL(exited()), + this, SLOT(handleStateExited()), Qt::UniqueConnection); + + Q_FOREACH (QAbstractTransition *transition, state->findChildren()) { + connect(transition, SIGNAL(triggered()), + this, SLOT(handleTransitionTriggered()), Qt::UniqueConnection); + } + m_watchedStates << state; +} + +void StateMachineWatcher::clearWatchedStates() +{ + Q_FOREACH (QAbstractState *state, m_watchedStates) { + disconnect(state, SIGNAL(entered()), this, SLOT(handleStateEntered())); + disconnect(state, SIGNAL(exited()), this, SLOT(handleStateExited())); + + Q_FOREACH (QAbstractTransition *transition, state->findChildren()) { + disconnect(transition, SIGNAL(triggered()), this, SLOT(handleTransitionTriggered())); + } + } + m_watchedStates.clear(); +} + +void StateMachineWatcher::handleTransitionTriggered() +{ + QAbstractTransition *transition = qobject_cast(QObject::sender()); + Q_ASSERT(transition); + + emit transitionTriggered(transition); +} + +void StateMachineWatcher::handleStateEntered() +{ + QAbstractState* state = qobject_cast(QObject::sender()); + Q_ASSERT(state); + + if (state->machine() != m_watchedStateMachine) { + return; + } + + if (state == m_lastEnteredState) { + return; + } + + m_lastEnteredState = state; + emit stateEntered(state); +} + +void StateMachineWatcher::handleStateExited() +{ + QAbstractState* state = qobject_cast(QObject::sender()); + Q_ASSERT(state); + + if (state->machine() != m_watchedStateMachine) { + return; + } + + if (state == m_lastExitedState) { + return; + } + + m_lastExitedState = state; + emit stateExited(state); +} + +#include "statemachinewatcher.moc" diff --git a/tools/statemachineviewer/statemachinewatcher.h b/tools/statemachineviewer/statemachinewatcher.h new file mode 100644 index 0000000..dae6ca1 --- /dev/null +++ b/tools/statemachineviewer/statemachinewatcher.h @@ -0,0 +1,74 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef GAMMARAY_STATEMACHINEWATCHER_H +#define GAMMARAY_STATEMACHINEWATCHER_H + +#include +#include + +class QAbstractState; +class QAbstractState; +class QAbstractTransition; +class QState; +class QStateMachine; + +namespace GammaRay { + +class ProbeInterface; + +class StateMachineWatcher : public QObject +{ + Q_OBJECT + public: + explicit StateMachineWatcher(QObject *parent = 0); + virtual ~StateMachineWatcher(); + + void setWatchedStateMachine(QStateMachine *machine); + QStateMachine *watchedStateMachine() const; + + Q_SIGNALS: + void stateEntered(QAbstractState *state); + void stateExited(QAbstractState *state); + + void transitionTriggered(QAbstractTransition*); + + void watchedStateMachineChanged(QStateMachine *); + + private Q_SLOTS: + void watchState(QAbstractState *state); + void clearWatchedStates(); + + void handleStateEntered(); + void handleStateExited(); + void handleTransitionTriggered(); + + private: + QStateMachine *m_watchedStateMachine; + QVector m_watchedStates; + + QAbstractState *m_lastEnteredState; + QAbstractState *m_lastExitedState; +}; + +} + +#endif // GAMMARAY_STATEMACHINEWATCHER_H diff --git a/tools/statemachineinspector/statemodel.cpp b/tools/statemachineviewer/statemodel.cpp similarity index 76% rename from tools/statemachineinspector/statemodel.cpp rename to tools/statemachineviewer/statemodel.cpp index 16bab7b..b57d654 100644 --- a/tools/statemachineinspector/statemodel.cpp +++ b/tools/statemachineviewer/statemodel.cpp @@ -22,11 +22,13 @@ */ #include "statemodel.h" +#include "statemachinewatcher.h" +#include "util.h" + #include #include #include #include -#include "util.h" // #include @@ -37,19 +39,26 @@ namespace GammaRay class StateModelPrivate { - StateModelPrivate(QStateMachine *stateMachine, StateModel *qq) - : q_ptr(qq), m_stateMachine(stateMachine) + StateModelPrivate(StateModel *qq) + : q_ptr(qq), + m_stateMachine(0), + m_stateMachineWatcher(new StateMachineWatcher(qq)) { - + Q_ASSERT(qq->connect(m_stateMachineWatcher, SIGNAL(transitionTriggered(QAbstractTransition*)), + qq, SLOT(transitionTriggered(QAbstractTransition*)))); } Q_DECLARE_PUBLIC(StateModel) StateModel * const q_ptr; - QStateMachine * const m_stateMachine; + StateMachineWatcher * const m_stateMachineWatcher; + QStateMachine *m_stateMachine; QList children(QObject *parent) const; QObject *mapModelIndex2QObject(const QModelIndex &) const; + +// private slots: + void transitionTriggered(QAbstractTransition*); }; } @@ -61,6 +70,11 @@ QList StateModelPrivate::children(QObject *parent) const parent = m_stateMachine; } + // if the state machine is not yet set, return an empty list + if (!parent) { + return result; + } + foreach (QObject *o, parent->children()) { if (o->inherits("QState")) { result.append(o); @@ -80,8 +94,17 @@ QObject *StateModelPrivate::mapModelIndex2QObject(const QModelIndex &index) cons return m_stateMachine; } -StateModel::StateModel(QStateMachine *stateMachine, QObject *parent) - : ObjectModelBase(parent), d_ptr(new StateModelPrivate(stateMachine, this)) +void StateModelPrivate::transitionTriggered(QAbstractTransition *transition) +{ + Q_UNUSED(transition); + Q_Q(StateModel); + + // TODO: Make this more efficient? Find out the changed states and update just these indices + q->dataChanged(QModelIndex(), QModelIndex()); +} + +StateModel::StateModel(QObject *parent) + : ObjectModelBase(parent), d_ptr(new StateModelPrivate(this)) { QHash _roleNames = roleNames(); _roleNames.insert(TransitionsRole, "transitions"); @@ -89,6 +112,26 @@ StateModel::StateModel(QStateMachine *stateMachine, QObject *parent) setRoleNames(_roleNames); } +void StateModel::setStateMachine(QStateMachine *stateMachine) +{ + Q_D(StateModel); + if (d->m_stateMachine == stateMachine) { + return; + } + + beginResetModel(); + d->m_stateMachine = stateMachine; + endResetModel(); + + d->m_stateMachineWatcher->setWatchedStateMachine(stateMachine); +} + +QStateMachine *StateModel::stateMachine() const +{ + Q_D(const StateModel); + return d->m_stateMachine; +} + QVariant StateModel::data(const QModelIndex &index, int role) const { Q_D(const StateModel); @@ -130,7 +173,7 @@ QVariant StateModel::data(const QModelIndex &index, int role) const if (index.column() == 0 && role == Qt::CheckStateRole) { QState *s = qobject_cast(obj); if (s) { - return d->m_stateMachine->configuration().contains(s); + return d->m_stateMachine->configuration().contains(s) ? Qt::Checked : Qt::Unchecked; } } @@ -186,3 +229,5 @@ QModelIndex StateModel::parent(const QModelIndex &index) const int row = d->children(grandParent).indexOf(parent); return createIndex(row, 0, grandParent); } + +#include "statemodel.moc" diff --git a/tools/statemachineinspector/statemodel.h b/tools/statemachineviewer/statemodel.h similarity index 80% rename from tools/statemachineinspector/statemodel.h rename to tools/statemachineviewer/statemodel.h index f142b51..cb134b9 100644 --- a/tools/statemachineinspector/statemodel.h +++ b/tools/statemachineviewer/statemodel.h @@ -20,11 +20,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef STATEMODEL_H -#define STATEMODEL_H +#ifndef GAMMARAY_STATEMODEL_H +#define GAMMARAY_STATEMODEL_H #include "objectmodelbase.h" +class QAbstractTransition; class QStateMachine; namespace GammaRay @@ -34,13 +35,19 @@ class StateModelPrivate; class StateModel : public ObjectModelBase { + Q_OBJECT + public: enum Roles { - TransitionsRole = Qt::UserRole, + TransitionsRole = ObjectModel::UserRole + 1, IsInitialStateRole, StateObjectRole = Qt::UserRole + 11 }; - explicit StateModel(QStateMachine *stateMachine, QObject *parent = 0); + explicit StateModel(QObject *parent = 0); + + void setStateMachine(QStateMachine *stateMachine); + QStateMachine *stateMachine() const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; @@ -49,6 +56,9 @@ class StateModel : public ObjectModelBase protected: Q_DECLARE_PRIVATE(StateModel) StateModelPrivate * const d_ptr; + + private: + Q_PRIVATE_SLOT(d_func(), void transitionTriggered(QAbstractTransition*)) }; } diff --git a/tools/statemachineviewer/test_main.cpp b/tools/statemachineviewer/test_main.cpp new file mode 100644 index 0000000..2f979aa --- /dev/null +++ b/tools/statemachineviewer/test_main.cpp @@ -0,0 +1,79 @@ +/* + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Kevin Funk + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "gvgraph/gvgraph.h" +#include "gvgraph/gvgraphitems.h" + +#include +#include +#include + +using namespace GammaRay; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + // build data + GVGraph *graph = new GVGraph("Graph"); + NodeId nid1 = graph->addNode("Node1"); + + GraphId gid1 = graph->addGraph("SubGraph1"); + NodeId nid2 = graph->addNode("Node2", gid1); + NodeId nid3 = graph->addNode("Node3", gid1); + + EdgeId eid1 = graph->addEdge(nid1, nid2, "Edge1"); + graph->setEdgeAttribute(eid1, "label", "Edge1"); + EdgeId eid2 = graph->addEdge(nid2, nid3, "Edge2"); + graph->setEdgeAttribute(eid2, "label", "Edge2"); + EdgeId eid3 = graph->addEdge(nid1, nid3, "Edge3"); + graph->setEdgeAttribute(eid3, "label", "Edge3"); + graph->applyLayout(); + + if (argc > 1 && strcmp(argv[1], "--no-gui") == 0) { + return 0; + } + + // build ui + QGraphicsView *view = new QGraphicsView; + view->setRenderHint(QPainter::Antialiasing); + QGraphicsScene *scene = new QGraphicsScene; + view->setScene(scene); + + Q_FOREACH (const GVNodePair &pair, graph->gvNodes()) { + const GVNode node = pair.second; + new GVNodeItem(node, 0, scene); + } + Q_FOREACH (const GVEdgePair &pair, graph->gvEdges()) { + const GVEdge edge = pair.second; + new GVEdgeItem(edge, 0, scene); + } + Q_FOREACH (const GVSubGraphPair &pair, graph->gvSubGraphs()) { + const GVSubGraph graph = pair.second; + new GVGraphItem(graph, 0, scene); + } + delete graph; + graph = 0; + + view->show(); + + return app.exec(); +} diff --git a/tools/statemachineinspector/transitionmodel.cpp b/tools/statemachineviewer/transitionmodel.cpp similarity index 98% rename from tools/statemachineinspector/transitionmodel.cpp rename to tools/statemachineviewer/transitionmodel.cpp index 3351da4..ca2146c 100644 --- a/tools/statemachineinspector/transitionmodel.cpp +++ b/tools/statemachineviewer/transitionmodel.cpp @@ -23,11 +23,12 @@ #include "transitionmodel.h" +#include "util.h" + #include #include #include #include -#include "util.h" #include // #include @@ -46,7 +47,7 @@ class TransitionModelPrivate Q_DECLARE_PUBLIC(TransitionModel) TransitionModel * const q_ptr; - QState * m_state; + QAbstractState * m_state; QList children(QObject *parent) const; @@ -89,7 +90,7 @@ TransitionModel::TransitionModel(QObject *parent) setRoleNames(_roleNames); } -void TransitionModel::setState(QState *state) +void TransitionModel::setState(QAbstractState *state) { Q_D(TransitionModel); beginResetModel(); diff --git a/tools/statemachineinspector/transitionmodel.h b/tools/statemachineviewer/transitionmodel.h similarity index 92% rename from tools/statemachineinspector/transitionmodel.h rename to tools/statemachineviewer/transitionmodel.h index 55b104c..a2ca628 100644 --- a/tools/statemachineinspector/transitionmodel.h +++ b/tools/statemachineviewer/transitionmodel.h @@ -21,11 +21,12 @@ along with this program. If not, see . */ -#ifndef TRANSITIONMODEL_H -#define TRANSITIONMODEL_H +#ifndef GAMMARAY_TRANSITIONMODEL_H +#define GAMMARAY_TRANSITIONMODEL_H #include "objectmodelbase.h" +class QAbstractState; class QState; namespace GammaRay @@ -37,7 +38,7 @@ class TransitionModel : public ObjectModelBase { public: TransitionModel(QObject *parent = 0); - void setState(QState *state); + void setState(QAbstractState *state); int columnCount(const QModelIndex &parent = QModelIndex()) const; int rowCount (const QModelIndex &parent = QModelIndex()) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; diff --git a/tools/timertop/functioncalltimer.cpp b/tools/timertop/functioncalltimer.cpp new file mode 100644 index 0000000..bfb52fa --- /dev/null +++ b/tools/timertop/functioncalltimer.cpp @@ -0,0 +1,79 @@ +/* + functioncalltimer.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Thomas McGuire + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include "functioncalltimer.h" + +#ifdef Q_OS_WIN +#include +#endif + +using namespace GammaRay; + +FunctionCallTimer::FunctionCallTimer() + : m_active(false) +{ +} + +bool FunctionCallTimer::start() +{ + if (m_active) { + return false; + } + +#ifndef Q_OS_WIN + clock_gettime(CLOCK_REALTIME, &m_startTime); +#else + LARGE_INTEGER startTime; + bool ret = QueryPerformanceCounter(&startTime); + if (!ret) { + return false; + } + m_startTime = startTime.QuadPart; +#endif + m_active = true; + return true; +} + +bool FunctionCallTimer::active() const +{ + return m_active; +} + +int FunctionCallTimer::stop() +{ + Q_ASSERT(m_active); + m_active = false; +#ifndef Q_OS_WIN + timespec endTime; + clock_gettime(CLOCK_REALTIME, &endTime); + int elapsed = (endTime.tv_nsec - m_startTime.tv_nsec) / 1000; + elapsed += (endTime.tv_sec - m_startTime.tv_sec) * 1000000; + return elapsed; +#else + LARGE_INTEGER endTime; + LARGE_INTEGER frequency; + QueryPerformanceCounter(&endTime); + QueryPerformanceFrequency(&frequency); + int elapsed = ((endTime.QuadPart - m_startTime) * 1000000) / frequency.QuadPart; + return elapsed; +#endif +} diff --git a/mainwindow.h b/tools/timertop/functioncalltimer.h similarity index 66% copy from mainwindow.h copy to tools/timertop/functioncalltimer.h index 5b72d88..f4c323c 100644 --- a/mainwindow.h +++ b/tools/timertop/functioncalltimer.h @@ -1,11 +1,11 @@ /* - mainwindow.h + functioncalltimer.h This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause + Author: Thomas McGuire This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,36 +20,30 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef GAMMARAY_FUNCTIONCALLTIMER_H +#define GAMMARAY_FUNCTIONCALLTIMER_H -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -#include "ui_mainwindow.h" - -class QComboBox; +#include "time.h" +#include namespace GammaRay { -class MainWindow : public QMainWindow +class FunctionCallTimer { - Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); - - private slots: - void about(); - void aboutKDAB(); - - void toolSelected(); + FunctionCallTimer(); + bool start(); + bool active() const; + int stop(); private: - void selectInitialTool(); - - Ui::MainWindow ui; +#ifndef Q_OS_WIN + timespec m_startTime; +#else + qint64 m_startTime; +#endif + bool m_active; }; } - -#endif // MAINWINDOW_H +#endif // GAMMARAY_FUNCTIONCALLTIMER_H diff --git a/tools/timertop/timerinfo.cpp b/tools/timertop/timerinfo.cpp new file mode 100644 index 0000000..08aef0a --- /dev/null +++ b/tools/timertop/timerinfo.cpp @@ -0,0 +1,185 @@ +/* + timerinfo.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Thomas McGuire + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include "timerinfo.h" + +#include + +#include + +using namespace GammaRay; + +static const int maxTimeoutEvents = 1000; +static const int maxTimeSpan = 10000; + +TimerInfo::TimerInfo(QTimer *timer) + : m_type(QTimerType), + m_timer(timer), + m_timerId(timer->timerId()), + m_totalWakeups(0), + m_lastReceiver(0) +{ +} + +TimerInfo::TimerInfo(int timerId) + : m_type(QObjectType), + m_timerId(timerId), + m_totalWakeups(0) +{ +} + +void TimerInfo::addEvent(const TimeoutEvent &timeoutEvent) +{ + m_timeoutEvents.append(timeoutEvent); + removeOldEvents(); + m_totalWakeups++; +} + +int TimerInfo::numEvents() const +{ + return m_timeoutEvents.size(); +} + +QTimer *TimerInfo::timer() const +{ + return m_timer; +} + +int TimerInfo::timerId() const +{ + return m_timerId; +} + +FunctionCallTimer *TimerInfo::functionCallTimer() +{ + return &m_functionCallTimer; +} + +QString TimerInfo::wakeupsPerSec() const +{ + int totalWakeups = 0; + int start = 0; + int end = m_timeoutEvents.size() - 1; + for (int i = end; i >= 0; i--) { + const TimeoutEvent &event = m_timeoutEvents.at(i); + if (event.timeStamp.msecsTo(QTime::currentTime()) > maxTimeSpan) { + start = i; + break; + } + totalWakeups++; + } + + if (totalWakeups > 0 && end > start) { + const QTime startTime = m_timeoutEvents[start].timeStamp; + const QTime endTime = m_timeoutEvents[end].timeStamp; + const int timeSpan = startTime.msecsTo(endTime); + const float wakeupsPerSec = totalWakeups / (float)timeSpan * 1000.0f; + return QString::number(wakeupsPerSec, 'f', 1); + } + return "0"; +} + +QString TimerInfo::timePerWakeup() const +{ + if (m_type == QObjectType) { + return "N/A"; + } + + int totalWakeups = 0; + int totalTime = 0; + for (int i = m_timeoutEvents.size() - 1; i >= 0; i--) { + const TimeoutEvent &event = m_timeoutEvents.at(i); + if (event.timeStamp.msecsTo(QTime::currentTime()) > maxTimeSpan) { + break; + } + totalWakeups++; + totalTime += event.executionTime; + } + + if (totalWakeups > 0) { + return QString::number(totalTime / (float)totalWakeups, 'f', 1); + } + return "N/A"; +} + +QString TimerInfo::maxWakeupTime() const +{ + if (m_type == QObjectType) { + return "N/A"; + } + + int max = 0; + for (int i = 0; i < m_timeoutEvents.size(); i++) { + const TimeoutEvent &event = m_timeoutEvents.at(i); + if (event.executionTime > max) { + max = event.executionTime; + } + } + return QString::number(max); +} + +int TimerInfo::totalWakeups() const +{ + return m_totalWakeups; +} + +QString TimerInfo::state() const +{ + if (!m_timer){ + return QObject::tr("None"); + } + + if (!m_timer->isActive()) { + return QObject::tr("Inactive"); + } else { + if (m_timer->isSingleShot()) { + return QObject::tr("Singleshot (%1 ms)").arg(m_timer->interval()); + } else { + return QObject::tr("Repeating (%1 ms)").arg(m_timer->interval()); + } + } +} + +void TimerInfo::removeOldEvents() +{ + if (m_timeoutEvents.size() > maxTimeoutEvents) { + m_timeoutEvents.removeFirst(); + } +} + +void TimerInfo::setLastReceiver(QObject *receiver) +{ + m_lastReceiver = receiver; +} + +QString TimerInfo::displayName() const +{ + if (timer()) { + return Util::displayString(timer()); + } else { + if (m_lastReceiver) { + return Util::displayString(m_lastReceiver); + } else { + return QObject::tr("Unknown QObject"); + } + } +} diff --git a/tools/timertop/timerinfo.h b/tools/timertop/timerinfo.h new file mode 100644 index 0000000..6e58fcf --- /dev/null +++ b/tools/timertop/timerinfo.h @@ -0,0 +1,88 @@ +/* + timerinfo.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Thomas McGuire + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef GAMMARAY_TIMERINFO_H +#define GAMMARAY_TIMERINFO_H + +#include "functioncalltimer.h" + +#include +#include +#include +#include +#include + +namespace GammaRay { + +class TimerInfo +{ + public: + enum Type { + QTimerType, + QObjectType + }; + + struct TimeoutEvent + { + QTime timeStamp; + int executionTime; + }; + + explicit TimerInfo(QTimer *timer); + explicit TimerInfo(int timerId); + void addEvent(const TimeoutEvent &timeoutEvent); + void setLastReceiver(QObject *receiver); + int numEvents() const; + QTimer *timer() const; + int timerId() const; + FunctionCallTimer *functionCallTimer(); + QString wakeupsPerSec() const; + QString timePerWakeup() const; + QString maxWakeupTime() const; + int totalWakeups() const; + QString state() const; + QString displayName() const; + + private: + Type m_type; + int m_totalWakeups; + + // Only for QTimer timers + QPointer m_timer; + + int m_timerId; + FunctionCallTimer m_functionCallTimer; + QList m_timeoutEvents; + + // Only for free timers, QObject that received the timeout event + QPointer m_lastReceiver; + + void removeOldEvents(); +}; + +typedef QSharedPointer TimerInfoPtr; + +} + +Q_DECLARE_METATYPE(GammaRay::TimerInfoPtr) + +#endif // GAMMARAY_TIMERINFO_H diff --git a/tools/timertop/timermodel.cpp b/tools/timertop/timermodel.cpp new file mode 100644 index 0000000..825bfa2 --- /dev/null +++ b/tools/timertop/timermodel.cpp @@ -0,0 +1,345 @@ +/* + timermodel.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Thomas McGuire + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include "timermodel.h" + +#include +#include <3rdparty/qt/qobject_p_copy.h> + +#include +#include +#include + +#include + +static const char timerInfoPropertyName[] = "GammaRay TimerInfo"; + +using namespace GammaRay; +using namespace std; + +Q_GLOBAL_STATIC(TimerModel, s_timerModel) + +static QTimer *timer_from_callback(QObject *caller, int method_index) +{ + QTimer * const timer = dynamic_cast(caller); + if (timer) { + QMetaMethod method = timer->metaObject()->method(method_index); + if (method.signature() == QLatin1String("timeout()")) { + if (timer->objectName().toLower().startsWith("gammaray")) { + return 0; + } + return timer; + } + } + return 0; +} + +static void signal_begin_callback(QObject *caller, int method_index, void **argv) +{ + Q_UNUSED(argv); + QTimer * const timer = timer_from_callback(caller, method_index); + if (timer) { + TimerModel::instance()->preSignalActivate(timer); + } +} + +static void signal_end_callback(QObject *caller, int method_index) +{ + QTimer * const timer = timer_from_callback(caller, method_index); + if (timer) { + TimerModel::instance()->postSignalActivate(timer); + } +} + +TimerModel::TimerModel(QObject *parent) + : QAbstractTableModel(parent), + m_sourceModel(0) +{ +} + +TimerModel *TimerModel::instance() +{ + return s_timerModel(); +} + +TimerInfoPtr TimerModel::findOrCreateFreeTimerInfo(int timerId) +{ + // First, return the timer info if it already exists + foreach (const TimerInfoPtr &freeTimer, m_freeTimers) { + if (freeTimer->timerId() == timerId) { + return freeTimer; + } + } + + // Create a new free timer, and emit the correct update signals + TimerInfoPtr timerInfo(new TimerInfo(timerId)); + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + m_freeTimers.append(timerInfo); + endInsertRows(); + return timerInfo; +} + +TimerInfoPtr TimerModel::findOrCreateQTimerTimerInfo(QTimer *timer) +{ + if (!timer) { + return TimerInfoPtr(); + } + + QVariant timerInfoVariant = timer->property(timerInfoPropertyName); + if (!timerInfoVariant.isValid()) { + timerInfoVariant.setValue(TimerInfoPtr(new TimerInfo(timer))); + timer->setProperty(timerInfoPropertyName, timerInfoVariant); + } + + const TimerInfoPtr timerInfo = timerInfoVariant.value(); + Q_ASSERT(timerInfo->timer() == timer); + return timerInfo; +} + +TimerInfoPtr TimerModel::findOrCreateQTimerTimerInfo(int timerId) +{ + for (int row = 0; row < m_sourceModel->rowCount(); row++) { + const QModelIndex sourceIndex = m_sourceModel->index(row, 0); + QObject *const timerObject = sourceIndex.data(ObjectModel::ObjectRole).value(); + QTimer * const timer = qobject_cast(timerObject); + if (timer && timer->timerId() == timerId) { + return findOrCreateQTimerTimerInfo(timer); + } + } + + return TimerInfoPtr(); +} + +TimerInfoPtr TimerModel::findOrCreateTimerInfo(const QModelIndex &index) +{ + if (index.row() < m_sourceModel->rowCount()){ + const QModelIndex sourceIndex = m_sourceModel->index(index.row(), 0); + QObject *const timerObject = sourceIndex.data(ObjectModel::ObjectRole).value(); + return findOrCreateQTimerTimerInfo(qobject_cast(timerObject)); + } else { + const int freeListIndex = index.row() - m_sourceModel->rowCount(); + Q_ASSERT(freeListIndex >= 0); + if (freeListIndex < m_freeTimers.size()) { + return m_freeTimers.at(freeListIndex); + } + } + return TimerInfoPtr(); +} + +int TimerModel::rowFor(QTimer *timer) +{ + for (int i = 0; i < rowCount(); i++) { + const TimerInfoPtr timerInfo = findOrCreateTimerInfo(index(i, 0)); + if (timerInfo->timer() == timer) { + return i; + } + } + return -1; +} + +void TimerModel::preSignalActivate(QTimer *timer) +{ + const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer); + if (timerInfo) { + if (!timerInfo->functionCallTimer()->start()) { + cout << "TimerModel::preSignalActivate(): Recursive timeout for timer " + << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl; + } + } else { + // Ok, likely a GammaRay timer + //cout << "TimerModel::preSignalActivate(): Unable to find timer " + // << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl; + } +} + +void TimerModel::postSignalActivate(QTimer *timer) +{ + const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer); + if (timerInfo) { + if (!timerInfo->functionCallTimer()->active()) { + cout << "TimerModel::postSignalActivate(): Timer not active: " + << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl; + } else { + TimerInfo::TimeoutEvent event; + event.timeStamp = QTime::currentTime(); + event.executionTime = timerInfo->functionCallTimer()->stop(); + timerInfo->addEvent(event); + const int row = rowFor(timer); + if (row != -1) { + emit dataChanged(index(row, 0), index(row, columnCount() - 1)); + } + } + } else { + // Ok, likely a GammaRay timer + //cout << "TimerModel::postSignalActivate(): Unable to find timer " + // << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl; + } +} + +void TimerModel::setSourceModel(ObjectTypeFilterProxyModel *sourceModel) +{ + Q_ASSERT(!m_sourceModel); + m_sourceModel = sourceModel; + qApp->installEventFilter(this); + + QSignalSpyCallbackSet callbacks; + callbacks.slot_begin_callback = 0; + callbacks.slot_end_callback = 0; + callbacks.signal_begin_callback = signal_begin_callback; + callbacks.signal_end_callback = signal_end_callback; + + qt_register_signal_spy_callbacks(callbacks); + + connect(m_sourceModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(slotBeginInsertRows(QModelIndex,int,int))); + connect(m_sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(slotEndInsertRows())); + connect(m_sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(slotBeginRemoveRows(QModelIndex,int,int))); + connect(m_sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(slotEndRemoveRows())); + connect(m_sourceModel, SIGNAL(modelAboutToBeReset()), + this, SLOT(slotBeginReset())); + connect(m_sourceModel, SIGNAL(modelReset()), + this, SLOT(slotEndReset())); + connect(m_sourceModel, SIGNAL(layoutAboutToBeChanged()), + this, SLOT(slotBeginReset())); + connect(m_sourceModel, SIGNAL(layoutChanged()), + this, SLOT(slotEndReset())); + + reset(); +} + +int TimerModel::columnCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return LastRole - FirstRole - 1; +} + +int TimerModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + if (!m_sourceModel || parent.isValid()) { + return 0; + } + return m_sourceModel->rowCount() + m_freeTimers.count(); +} + +QVariant TimerModel::data(const QModelIndex &index, int role) const +{ + if (!m_sourceModel) { + return QVariant(); + } + + if (role == Qt::DisplayRole && index.isValid() && + index.column() >= 0 && index.column() < columnCount()) { + const TimerInfoPtr timerInfo = const_cast(this)->findOrCreateTimerInfo(index); + switch ((Roles)(index.column() + FirstRole + 1)) { + case ObjectNameRole: return timerInfo->displayName(); + case StateRole: return timerInfo->state(); + case TotalWakeupsRole: return timerInfo->totalWakeups(); + case WakeupsPerSecRole: return timerInfo->wakeupsPerSec(); + case TimePerWakeupRole: return timerInfo->timePerWakeup(); + case MaxTimePerWakeupRole: return timerInfo->maxWakeupTime(); + case TimerIdRole: return timerInfo->timerId(); + } + } + return QVariant(); +} + +QVariant TimerModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { + switch ((Roles)(section + FirstRole + 1)) { + case ObjectNameRole: return tr("Object Name"); + case StateRole: return tr("State"); + case TotalWakeupsRole: return tr("Total Wakeups"); + case WakeupsPerSecRole: return tr("Wakeups/Sec"); + case TimePerWakeupRole: return tr("Time/Wakeup [uSecs]"); + case MaxTimePerWakeupRole: return tr("Max Wakeup Time [uSecs]"); + case TimerIdRole: return tr("Timer ID"); + } + } + return QAbstractTableModel::headerData(section, orientation, role); +} + +bool TimerModel::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() == QEvent::Timer) { + + QTimerEvent * const timerEvent = dynamic_cast(event); + Q_ASSERT(timerEvent); + + // If there is a QTimer associated with this timer ID, don't handle it here, it will be handled + // by the signal hooks for QTimer::timeout() + if (findOrCreateQTimerTimerInfo(timerEvent->timerId())) { + return false; + } + + if (Probe::instance()->filterObject(watched)) { + return false; + } + + const TimerInfoPtr timerInfo = findOrCreateFreeTimerInfo(timerEvent->timerId()); + TimerInfo::TimeoutEvent timeoutEvent; + timeoutEvent.timeStamp = QTime::currentTime(); + timeoutEvent.executionTime = -1; + timerInfo->addEvent(timeoutEvent); + + timerInfo->setLastReceiver(watched); + } + return false; +} + +void TimerModel::slotBeginRemoveRows(const QModelIndex &parent, int start, int end) +{ + Q_UNUSED(parent); + beginRemoveRows(QModelIndex(), start, end); +} + +void TimerModel::slotEndRemoveRows() +{ + endRemoveRows(); +} + +void TimerModel::slotBeginInsertRows(const QModelIndex &parent, int start, int end) +{ + Q_UNUSED(parent); + beginInsertRows(QModelIndex(), start, end); +} + +void TimerModel::slotEndInsertRows() +{ + endInsertRows(); +} + +void TimerModel::slotBeginReset() +{ + beginResetModel(); +} + +void TimerModel::slotEndReset() +{ + endResetModel(); +} + +#include "timermodel.moc" diff --git a/tools/timertop/timermodel.h b/tools/timertop/timermodel.h new file mode 100644 index 0000000..d6680b8 --- /dev/null +++ b/tools/timertop/timermodel.h @@ -0,0 +1,104 @@ +/* + timermodel.h + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Thomas McGuire + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef GAMMARAY_TIMEMODEL_H +#define GAMMARAY_TIMEMODEL_H + +#include "timerinfo.h" +#include +#include + +class QTimer; + +namespace GammaRay { + +class TimerModel : public QAbstractTableModel +{ + Q_OBJECT + public: + TimerModel(QObject *parent = 0); + static TimerModel *instance(); + + // For the spy callbacks + void preSignalActivate(QTimer *timer); + void postSignalActivate(QTimer *timer); + + enum Roles { + FirstRole = Qt::UserRole + 1, + ObjectNameRole, + StateRole, + TotalWakeupsRole, + WakeupsPerSecRole, + TimePerWakeupRole, + MaxTimePerWakeupRole, + TimerIdRole, + LastRole + }; + + void setSourceModel(ObjectTypeFilterProxyModel *sourceModel); + + /* reimp */ + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + /* reimp */ + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + /* reimp */ + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + /* reimp */ + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + + /* reimp */ + bool eventFilter(QObject * watched, QEvent * event); + + private slots: + void slotBeginRemoveRows(const QModelIndex &parent, int start, int end); + void slotEndRemoveRows(); + void slotBeginInsertRows(const QModelIndex &parent, int start, int end); + void slotEndInsertRows(); + void slotBeginReset(); + void slotEndReset(); + + private: + + // Finds only QTimers based on the timer ID, not free timers. + TimerInfoPtr findOrCreateQTimerTimerInfo(int timerId); + + // Finds both QTimer and free timers + TimerInfoPtr findOrCreateTimerInfo(const QModelIndex &index); + + // Finds QTimer timers + TimerInfoPtr findOrCreateQTimerTimerInfo(QTimer *timer); + + // Finds QObject timers + TimerInfoPtr findOrCreateFreeTimerInfo(int timerId); + + int rowFor(QTimer *timer) ; + + ObjectTypeFilterProxyModel *m_sourceModel; + QList m_freeTimers; +}; + +} + +#endif diff --git a/tools/timertop/timertop.cpp b/tools/timertop/timertop.cpp new file mode 100644 index 0000000..de67ff4 --- /dev/null +++ b/tools/timertop/timertop.cpp @@ -0,0 +1,94 @@ +/* + timertop.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Thomas McGuire + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include "timertop.h" + +#include "ui_timertop.h" +#include "timermodel.h" +#include + +using namespace GammaRay; + +// +// TODO list for timer plugin +// + +// BUG: Some QTimers appear as free timers +// BUG: QTimeLine class name not shown +// BUG: No thread safety yet +// Related: Protect against timer deletion +// BUG: Sorting in the view doesn't work well +// BUG: Only top-level timers are shown (bug in probe) + +// ! Delete old free timers +// ! Wakeup time for QTimers +// ! Add button to view object info +// ! Test timer added/removed at runtime +// Automatic column resizing +// Filter line edit +// Buttons to kill or slow down timer and start timer +// Add clear button that removes all free timers and resets statistics for normal timers +// Add big fat "total wakeups / sec" label to the status bar +// Retrieve receiver name from connection model +// Add to view as column: receivers: slotXYZ and 3 others (shown in tooltip) +// Move signal hook to probe interface +// Then maybe add general signal profiler plugin, or even visualization +// Flash delegate when timer triggered +// Color cell in view redish, depending on how active the timer is + +TimerTop::TimerTop(ProbeInterface *probe, QWidget *parent) + : QWidget(parent), + ui(new Ui::TimerTop), + m_updateTimer(new QTimer(this)) +{ + Q_UNUSED(probe); + ui->setupUi(this); + ObjectTypeFilterProxyModel * const filterModel = + new ObjectTypeFilterProxyModel(this); + filterModel->setDynamicSortFilter(true); + filterModel->setSourceModel(probe->objectListModel()); + TimerModel::instance()->setSourceModel(filterModel); + QSortFilterProxyModel * const sortModel = new QSortFilterProxyModel(this); + sortModel->setSourceModel(TimerModel::instance()); + sortModel->setDynamicSortFilter(true); + ui->timerView->setModel(sortModel); + ui->timerView->sortByColumn(TimerModel::WakeupsPerSecRole - TimerModel::FirstRole - 1, + Qt::DescendingOrder); + + m_updateTimer->setObjectName("GammaRay update timer"); + m_updateTimer->setSingleShot(false); + m_updateTimer->setInterval(500); + m_updateTimer->start(); + connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateView())); +} + +void TimerTop::slotUpdateView() +{ + ui->timerView->viewport()->update(); +} + +QStringList TimerTopFactory::supportedTypes() const +{ + return QStringList() << "QObject" << "QTimer"; +} + +#include "timertop.moc" diff --git a/tools/webinspector/webinspector.h b/tools/timertop/timertop.h similarity index 59% copy from tools/webinspector/webinspector.h copy to tools/timertop/timertop.h index 3bf4c8f..eb20082 100644 --- a/tools/webinspector/webinspector.h +++ b/tools/timertop/timertop.h @@ -1,11 +1,11 @@ /* - webinspector.h + timertop.h This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Author: Volker Krause + Author: Thomas McGuire This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,41 +20,45 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - -#ifndef GAMMARAY_WEBINSPECTOR_H -#define GAMMARAY_WEBINSPECTOR_H +#ifndef GAMMARAY_TIMERTOP_H +#define GAMMARAY_TIMERTOP_H #include + #include -#include +#include namespace GammaRay { -namespace Ui { class WebInspector; } +namespace Ui { class TimerTop; } -class WebInspector : public QWidget +class TimerTop : public QWidget { Q_OBJECT public: - explicit WebInspector(GammaRay::ProbeInterface *probe, QWidget *parent = 0); + explicit TimerTop(ProbeInterface *probe, QWidget *parent = 0); private slots: - void webPageSelected(int index); + void slotUpdateView(); private: - QScopedPointer ui; + QScopedPointer ui; + QTimer *m_updateTimer; }; -class WebInspectorFactory - : public QObject, public StandardToolFactory +class TimerTopFactory : public QObject, + public StandardToolFactory { Q_OBJECT Q_INTERFACES(GammaRay::ToolFactory) public: - explicit WebInspectorFactory(QObject *parent) : QObject(parent) {} - inline QString name() const { return tr("Web Pages"); } + explicit TimerTopFactory(QObject *parent) : QObject(parent) {} + inline QString name() const { return tr("Timers"); } + + /* reimp */ + QStringList supportedTypes() const; }; } -#endif // GAMMARAY_WEBINSPECTOR_H +#endif // GAMMARAY_SCENEINSPECTOR_H diff --git a/tools/timertop/timertop.ui b/tools/timertop/timertop.ui new file mode 100644 index 0000000..6b0fae6 --- /dev/null +++ b/tools/timertop/timertop.ui @@ -0,0 +1,40 @@ + + + GammaRay::TimerTop + + + + 0 + 0 + 400 + 300 + + + + + + + + 0 + + + + + true + + + false + + + true + + + true + + + + + + + + diff --git a/tools/webinspector/CMakeLists.txt b/tools/webinspector/CMakeLists.txt new file mode 100644 index 0000000..d6a8121 --- /dev/null +++ b/tools/webinspector/CMakeLists.txt @@ -0,0 +1,19 @@ +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} +) + +set(gammaray_webinspector_plugin_srcs + webinspector.cpp + ../../singlecolumnobjectproxymodel.cpp + ../../util.cpp + ../../3rdparty/kde/kidentityproxymodel.cpp +) +qt4_automoc(${gammaray_webinspector_plugin_srcs}) +qt4_wrap_ui(gammaray_webinspector_plugin_srcs webinspector.ui) + +gammaray_add_plugin(gammaray_webinspector_plugin gammaray_webinspector.desktop ${gammaray_webinspector_plugin_srcs}) +target_link_libraries(gammaray_webinspector_plugin + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} + ${QT_QTWEBKIT_LIBRARIES} +) diff --git a/tools/webinspector/gammaray_webinspector.desktop b/tools/webinspector/gammaray_webinspector.desktop new file mode 100644 index 0000000..8339bd4 --- /dev/null +++ b/tools/webinspector/gammaray_webinspector.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Name=Web Inspector +X-GammaRay-Types=QWebPage; +Exec=gammaray_webinspector_plugin diff --git a/tools/webinspector/webinspector.cpp b/tools/webinspector/webinspector.cpp index 03e4aa7..bee63b4 100644 --- a/tools/webinspector/webinspector.cpp +++ b/tools/webinspector/webinspector.cpp @@ -28,6 +28,8 @@ #include #include +#include + using namespace GammaRay; WebInspector::WebInspector(ProbeInterface *probe, QWidget *parent) @@ -55,4 +57,6 @@ void WebInspector::webPageSelected(int index) } } +Q_EXPORT_PLUGIN(WebInspectorFactory) + #include "webinspector.moc" diff --git a/tools/webinspector/webinspector.h b/tools/webinspector/webinspector.h index 3bf4c8f..adfb418 100644 --- a/tools/webinspector/webinspector.h +++ b/tools/webinspector/webinspector.h @@ -50,8 +50,9 @@ class WebInspectorFactory { Q_OBJECT Q_INTERFACES(GammaRay::ToolFactory) + public: - explicit WebInspectorFactory(QObject *parent) : QObject(parent) {} + explicit WebInspectorFactory(QObject *parent = 0) : QObject(parent) {} inline QString name() const { return tr("Web Pages"); } }; diff --git a/tools/widgetinspector/CMakeLists.txt b/tools/widgetinspector/CMakeLists.txt new file mode 100644 index 0000000..eefa624 --- /dev/null +++ b/tools/widgetinspector/CMakeLists.txt @@ -0,0 +1,13 @@ +add_library(gammaray_widget_export_actions SHARED + widgetinspector_export_actions.cpp + uiextractor.cpp +) + +target_link_libraries(gammaray_widget_export_actions + ${QT_QTCORE_LIBRARIES} + ${QT_QTGUI_LIBRARIES} + ${QT_QTSVG_LIBRARIES} + ${QT_QTDESIGNER_LIBRARIES} +) + +install(TARGETS gammaray_widget_export_actions ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/tools/widgetinspector/overlaywidget.cpp b/tools/widgetinspector/overlaywidget.cpp index 1b71ba8..cc3a967 100644 --- a/tools/widgetinspector/overlaywidget.cpp +++ b/tools/widgetinspector/overlaywidget.cpp @@ -25,9 +25,9 @@ #include #include -#include -#include -#include +#include +#include +#include using namespace GammaRay; diff --git a/tools/widgetinspector/overlaywidget.h b/tools/widgetinspector/overlaywidget.h index 53da744..810fb99 100644 --- a/tools/widgetinspector/overlaywidget.h +++ b/tools/widgetinspector/overlaywidget.h @@ -24,7 +24,7 @@ #ifndef GAMMARAY_OVERLAYWIDGET_H #define GAMMARAY_OVERLAYWIDGET_H -#include +#include namespace GammaRay { diff --git a/tools/widgetinspector/uiextractor.cpp b/tools/widgetinspector/uiextractor.cpp new file mode 100644 index 0000000..c4953c6 --- /dev/null +++ b/tools/widgetinspector/uiextractor.cpp @@ -0,0 +1,67 @@ +/* + uiextractor.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "uiextractor.h" + +#include +#include +#include +#include + +using namespace GammaRay; + +bool UiExtractor::checkProperty(QObject *obj, const QString &prop) const +{ + const QMetaObject *mo = obj->metaObject(); + const QMetaProperty mp = mo->property(mo->indexOfProperty(prop.toLatin1())); + + // TODO come up with some more aggressive filtering + if (mp.isValid() && mp.isDesignable(obj) && mp.isStored(obj) && mp.isWritable()) { + const QVariant value = mp.read(obj); + + // try to figure out the default by resetting to it + if (mp.isResettable()) { + mp.reset(obj); + if (mp.read(obj) == value) { + return false; + } + mp.write(obj, value); + return true; + } + + // some guessing for non-resettable properties + if (value.isNull() || !value.isValid()) { + return false; + } + + if (value.type() == QVariant::String) { + return !value.toString().isEmpty(); + } else if (value.type() == QVariant::Locale) { + return value.value() != QLocale::system(); + } + + return true; + } + + return false; +} diff --git a/probefinder.h b/tools/widgetinspector/uiextractor.h similarity index 69% rename from probefinder.h rename to tools/widgetinspector/uiextractor.h index 6ebcc21..453f621 100644 --- a/probefinder.h +++ b/tools/widgetinspector/uiextractor.h @@ -1,10 +1,10 @@ /* - probefinder.h + uiextractor.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,21 +21,19 @@ along with this program. If not, see . */ -#ifndef GAMMARAY_PROBEFINDER_H -#define GAMMARAY_PROBEFINDER_H +#ifndef GAMMARAY_UIEXTRACTOR_H +#define GAMMARAY_UIEXTRACTOR_H -class QString; +#include namespace GammaRay { -namespace ProbeFinder +class UiExtractor : public QFormBuilder { - /** - * Attempts to find the full path of the probe DLL. - */ - QString findProbe(const QString &baseName); -} + protected: + virtual bool checkProperty(QObject *obj, const QString &prop) const; +}; } -#endif // GAMMARAY_PROBEFINDER_H +#endif // GAMMARAY_UIEXTRACTOR_H diff --git a/tools/widgetinspector/widgetinspector.cpp b/tools/widgetinspector/widgetinspector.cpp index f44f032..384a1da 100644 --- a/tools/widgetinspector/widgetinspector.cpp +++ b/tools/widgetinspector/widgetinspector.cpp @@ -25,13 +25,19 @@ #include "ui_widgetinspector.h" #include "overlaywidget.h" +#include "widgettreemodel.h" #include #include #include #include +#include #include +#include +#include +#include +#include using namespace GammaRay; @@ -44,8 +50,7 @@ WidgetInspector::WidgetInspector(ProbeInterface *probe, QWidget *parent) connect(probe->probe(), SIGNAL(widgetSelected(QWidget*,QPoint)), SLOT(widgetSelected(QWidget*))); - ObjectTypeFilterProxyModel *widgetFilterProxy = - new ObjectTypeFilterProxyModel(this); + WidgetTreeModel *widgetFilterProxy = new WidgetTreeModel(this); widgetFilterProxy->setSourceModel(probe->objectTreeModel()); KRecursiveFilterProxyModel *widgetSearchProxy = new KRecursiveFilterProxyModel(this); widgetSearchProxy->setSourceModel(widgetFilterProxy); @@ -56,16 +61,34 @@ WidgetInspector::WidgetInspector(ProbeInterface *probe, QWidget *parent) connect(ui->widgetTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(widgetSelected(QModelIndex))); + + connect(ui->actionSaveAsImage, SIGNAL(triggered()), SLOT(saveAsImage())); + connect(ui->actionSaveAsSvg, SIGNAL(triggered()), SLOT(saveAsSvg())); + connect(ui->actionSaveAsPdf, SIGNAL(triggered()), SLOT(saveAsPdf())); + connect(ui->actionSaveAsUiFile, SIGNAL(triggered()), SLOT(saveAsUiFile())); + + addAction(ui->actionSaveAsImage); + addAction(ui->actionSaveAsSvg); + addAction(ui->actionSaveAsPdf); + addAction(ui->actionSaveAsUiFile); + + setActionsEnabled(false); } void WidgetInspector::widgetSelected(const QModelIndex &index) { if (index.isValid()) { QObject *obj = index.data(ObjectModel::ObjectRole).value(); + QWidget *widget = qobject_cast(obj); + QLayout* layout = qobject_cast(obj); + if (!widget && layout) { + widget = layout->parentWidget(); + } + ui->widgetPropertyWidget->setObject(obj); - ui->widgetPreviewWidget->setWidget(qobject_cast(obj)); + ui->widgetPreviewWidget->setWidget(widget); + setActionsEnabled(widget != 0); - QWidget *widget = qobject_cast(obj); if (widget && qobject_cast(widget) == 0) { m_overlayWidget->placeOn(widget); } else { @@ -75,6 +98,7 @@ void WidgetInspector::widgetSelected(const QModelIndex &index) ui->widgetPropertyWidget->setObject(0); ui->widgetPreviewWidget->setWidget(0); m_overlayWidget->placeOn(0); + setActionsEnabled(false); } } @@ -98,4 +122,135 @@ void WidgetInspector::widgetSelected(QWidget *widget) widgetSelected(index); } +void WidgetInspector::setActionsEnabled(bool enabled) +{ + foreach (QAction *action, actions()) + action->setEnabled(enabled); +} + +QWidget *WidgetInspector::selectedWidget() const +{ + const QModelIndexList indexes = ui->widgetTreeView->selectionModel()->selectedRows(); + if (indexes.isEmpty()) { + return 0; + } + const QModelIndex index = indexes.first(); + if (index.isValid()) { + QObject *obj = index.data(ObjectModel::ObjectRole).value(); + QWidget *widget = qobject_cast(obj); + QLayout* layout = qobject_cast(obj); + if (!widget && layout) { + widget = layout->parentWidget(); + } + return widget; + } + return 0; +} + +void WidgetInspector::saveAsImage() +{ + const QString fileName = + QFileDialog::getSaveFileName( + this, + tr("Save As Image"), + QString(), + tr("Image Files (*.png *.jpg)")); + + QWidget *widget = selectedWidget(); + if (fileName.isEmpty() || !widget) { + return; + } + + QPixmap pixmap(widget->size()); + m_overlayWidget->hide(); + widget->render(&pixmap); + m_overlayWidget->show(); + pixmap.save(fileName); +} + +void WidgetInspector::saveAsSvg() +{ + const QString fileName = + QFileDialog::getSaveFileName( + this, + tr("Save As SVG"), + QString(), + tr("Scalable Vector Graphics (*.svg)")); + + QWidget *widget = selectedWidget(); + if (fileName.isEmpty() || !widget) { + return; + } + + m_overlayWidget->hide(); + callExternalExportAction("gammaray_save_widget_to_svg", widget, fileName); + m_overlayWidget->show(); +} + +void WidgetInspector::saveAsPdf() +{ + const QString fileName = + QFileDialog::getSaveFileName( + this, + tr("Save As PDF"), + QString(), + tr("PDF (*.pdf)")); + + QWidget *widget = selectedWidget(); + if (fileName.isEmpty() || !widget) { + return; + } + + QPrinter printer(QPrinter::ScreenResolution); + printer.setOutputFileName(fileName); + printer.setOutputFormat(QPrinter::PdfFormat); + printer.setPageMargins(0, 0, 0, 0, QPrinter::DevicePixel); + printer.setPaperSize(widget->size(), QPrinter::DevicePixel); + + m_overlayWidget->hide(); + widget->render(&printer); + m_overlayWidget->show(); +} + +void WidgetInspector::saveAsUiFile() +{ + const QString fileName = + QFileDialog::getSaveFileName( + this, + tr("Save As Qt Designer UI File"), + QString(), + tr("Qt Designer UI File (*.ui)")); + + QWidget *widget = selectedWidget(); + if (fileName.isEmpty() || !widget) { + return; + } + + callExternalExportAction("gammaray_save_widget_to_ui", widget, fileName); +} + +void WidgetInspector::callExternalExportAction(const char *name, + QWidget *widget, + const QString &fileName) +{ + if (!m_externalExportActions.isLoaded()) { + const QString probePath = + QString::fromLocal8Bit(qgetenv("GAMMARAY_PROBE_PATH")); + + m_externalExportActions.setFileName( + probePath + QLatin1String("/libgammaray_widget_export_actions")); + + m_externalExportActions.load(); + } + + void(*function)(QWidget*, const QString&) = + reinterpret_cast(m_externalExportActions.resolve(name)); + + if (!function) { + qWarning() << m_externalExportActions.errorString(); + return; + } + function(widget, fileName); +} + #include "widgetinspector.moc" diff --git a/tools/widgetinspector/widgetinspector.h b/tools/widgetinspector/widgetinspector.h index 52c9f42..e44fb94 100644 --- a/tools/widgetinspector/widgetinspector.h +++ b/tools/widgetinspector/widgetinspector.h @@ -24,6 +24,7 @@ #ifndef GAMMARAY_WIDGETINSPECTOR_H #define GAMMARAY_WIDGETINSPECTOR_H +#include #include #include @@ -41,13 +42,24 @@ class WidgetInspector : public QWidget public: explicit WidgetInspector(ProbeInterface *probe, QWidget *parent = 0); + private: + void setActionsEnabled(bool enabled); + QWidget *selectedWidget() const; + void callExternalExportAction(const char *name, QWidget *widget, const QString &fileName); + private slots: void widgetSelected(const QModelIndex &index); void widgetSelected(QWidget *widget); + void saveAsImage(); + void saveAsSvg(); + void saveAsPdf(); + void saveAsUiFile(); + private: OverlayWidget *m_overlayWidget; QScopedPointer ui; + QLibrary m_externalExportActions; }; class WidgetInspectorFactory diff --git a/tools/widgetinspector/widgetinspector.ui b/tools/widgetinspector/widgetinspector.ui index f36993b..d18911f 100644 --- a/tools/widgetinspector/widgetinspector.ui +++ b/tools/widgetinspector/widgetinspector.ui @@ -48,6 +48,38 @@
+ + + Save as &Image... + + + Save currently selected widget as image. + + + + + Save as &SVG... + + + Renders the currently selected image as SVG vector graphic. + + + + + Save as &PDF... + + + Renders the currently selected widget in to a PDF file. + + + + + Save as &UI file... + + + Saves the currently selected widget as a Qt designer UI file. + +
diff --git a/tools/widgetinspector/widgetinspector_export_actions.cpp b/tools/widgetinspector/widgetinspector_export_actions.cpp new file mode 100644 index 0000000..60b63e2 --- /dev/null +++ b/tools/widgetinspector/widgetinspector_export_actions.cpp @@ -0,0 +1,58 @@ +/* + widgetinspector_export_actions.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file widgetinspector_export_actions.cpp + * dlopen hack to avoid dependencies on QtSvg and QtDesigner in the main probe. + */ + +#include "uiextractor.h" + +#include +#include +#include +#include + +extern "C" { + +Q_DECL_EXPORT void gammaray_save_widget_to_svg(QWidget *widget, const QString &fileName) +{ + QSvgGenerator svg; + svg.setFileName(fileName); + svg.setSize(widget->size()); + svg.setViewBox(QRect(QPoint(0, 0), widget->size())); + QPainter painter(&svg); + widget->render(&painter); + painter.end(); +} + +Q_DECL_EXPORT void gammaray_save_widget_to_ui(QWidget *widget, const QString &fileName) +{ + QFile file(fileName); + if (file.open(QFile::WriteOnly)) { + GammaRay::UiExtractor formBuilder; + formBuilder.save(&file, widget); + } +} + +} diff --git a/tools/widgetinspector/widgettreemodel.cpp b/tools/widgetinspector/widgettreemodel.cpp new file mode 100644 index 0000000..66c323b --- /dev/null +++ b/tools/widgetinspector/widgettreemodel.cpp @@ -0,0 +1,59 @@ +/* + widgettreemodel.cpp + + This file is part of GammaRay, the Qt application inspection and + manipulation tool. + + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Author: Volker Krause + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "widgettreemodel.h" + +#include +#include +#include +#include + +using namespace GammaRay; + +WidgetTreeModel::WidgetTreeModel(QObject *parent) + : ObjectFilterProxyModelBase(parent) +{ +} + +QVariant WidgetTreeModel::data(const QModelIndex &index, int role) const +{ + if (index.isValid() && role == Qt::ForegroundRole) { + QObject *obj = index.data(ObjectModel::ObjectRole).value(); + QWidget *widget = qobject_cast(obj); + if (!widget) { + QLayout *layout = qobject_cast(obj); + widget = layout->parentWidget(); + } + if (widget && !widget->isVisible()) { + return qApp->palette().color(QPalette::Disabled, QPalette::Text); + } + } + return QSortFilterProxyModel::data(index, role); +} + +bool WidgetTreeModel::filterAcceptsObject(QObject *object) const +{ + return object->isWidgetType() || qobject_cast(object); +} + +#include "widgettreemodel.moc" diff --git a/mainwindow.h b/tools/widgetinspector/widgettreemodel.h similarity index 57% copy from mainwindow.h copy to tools/widgetinspector/widgettreemodel.h index 5b72d88..b2a8e3f 100644 --- a/mainwindow.h +++ b/tools/widgetinspector/widgettreemodel.h @@ -1,10 +1,10 @@ /* - mainwindow.h + widgettreemodel.h This file is part of GammaRay, the Qt application inspection and manipulation tool. - Copyright (C) 2010-2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com + Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause This program is free software; you can redistribute it and/or modify @@ -21,35 +21,27 @@ along with this program. If not, see . */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef GAMMARAY_WIDGETTREEMODEL_H +#define GAMMARAY_WIDGETTREEMODEL_H -#include - -#include "ui_mainwindow.h" - -class QComboBox; +#include namespace GammaRay { -class MainWindow : public QMainWindow +/** Widget tree model. + * @todo Show layout hierarchy instead of object hierarchy. + */ +class WidgetTreeModel : public ObjectFilterProxyModelBase { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); - - private slots: - void about(); - void aboutKDAB(); - - void toolSelected(); - - private: - void selectInitialTool(); + explicit WidgetTreeModel(QObject *parent = 0); + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - Ui::MainWindow ui; + protected: + virtual bool filterAcceptsObject(QObject *object) const; }; } -#endif // MAINWINDOW_H +#endif // GAMMARAY_WIDGETTREEMODEL_H diff --git a/util.cpp b/util.cpp index ffca50a..f857df6 100644 --- a/util.cpp +++ b/util.cpp @@ -22,6 +22,7 @@ */ #include "util.h" +#include "metatypedeclarations.h" #include #include @@ -30,10 +31,25 @@ #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace GammaRay; +namespace GammaRay { +class ProtectedExposer : public QObject +{ +public: + using QObject::staticQtMetaObject; +}; +} + QString Util::displayString(const QObject *object) { if (!object) { @@ -47,6 +63,11 @@ QString Util::displayString(const QObject *object) return object->objectName(); } +QString Util::addressToUid(const void *p) +{ + return QString::number(reinterpret_cast(p), 16); +} + static QString sizePolicyToString(QSizePolicy::Policy policy) { const int index = QSizePolicy::staticMetaObject.indexOfEnumerator("Policy"); @@ -57,6 +78,16 @@ static QString sizePolicyToString(QSizePolicy::Policy policy) QString GammaRay::Util::variantToString(const QVariant &value) { switch (value.type()) { + case QVariant::Line: + return QString::fromUtf8("%1 x %2 → %3 x %4") + .arg(value.toLine().x1()).arg(value.toLine().y1()) + .arg(value.toLine().x2()).arg(value.toLine().y2()); + + case QVariant::LineF: + return QString::fromUtf8("%1 x %2 → %3 x %4") + .arg(value.toLineF().x1()).arg(value.toLineF().y1()) + .arg(value.toLineF().x2()).arg(value.toLineF().y2()); + case QVariant::Point: return QString::fromLatin1("%1x%2"). arg(value.toPoint().x()). @@ -81,6 +112,19 @@ QString GammaRay::Util::variantToString(const QVariant &value) arg(value.toRectF().width()). arg(value.toRectF().height()); + case QVariant::Region: + { + const QRegion region = value.value(); + if (region.isEmpty()) { + return QLatin1String(""); + } + if (region.rectCount() == 1) { + return variantToString(region.rects().first()); + } else { + return QString::fromLatin1("<%1 rects>").arg(region.rectCount()); + } + } + case QVariant::Size: return QString::fromLatin1("%1x%2"). arg(value.toSize().width()). @@ -95,8 +139,18 @@ QString GammaRay::Util::variantToString(const QVariant &value) return QString::fromLatin1("%1 x %2"). arg(sizePolicyToString(value.value().horizontalPolicy())). arg(sizePolicyToString(value.value().verticalPolicy())); + case QVariant::StringList: return value.toStringList().join(", "); + + case QVariant::Transform: + { + const QTransform t = value.value(); + return QString::fromLatin1("[%1 %2 %3, %4 %5 %6, %7 %8 %9]"). + arg(t.m11()).arg(t.m12()).arg(t.m13()). + arg(t.m21()).arg(t.m22()).arg(t.m23()). + arg(t.m31()).arg(t.m32()).arg(t.m33()); + } default: break; } @@ -119,14 +173,142 @@ QString GammaRay::Util::variantToString(const QVariant &value) return QString::fromLatin1("%1 (%2)").arg(l.rawValue()).arg(typeStr); } + if (value.userType() == qMetaTypeId()) { + const QPainterPath path = value.value(); + if (path.isEmpty()) { + return QObject::tr(""); + } + return QObject::tr("<%1 elements>").arg(path.elementCount()); + } + + if (value.type() == qMetaTypeId()) { + return displayString(value.value()); + } + + if (value.userType() == qMetaTypeId()) { + return addressToString(value.value()); + } + if (value.userType() == qMetaTypeId()) { + return addressToString(value.value()); + } + if (value.userType() == qMetaTypeId()) { + return addressToString(value.value()); + } + if (value.userType() == qMetaTypeId()) { + return displayString(value.value()); + } + if (value.userType() == qMetaTypeId()) { + return displayString(value.value()); + } + if (value.userType() == qMetaTypeId()) { + return displayString(value.value()); + } + + // enums + const QString enumStr = enumToString(value); + if (!enumStr.isEmpty()) { + return enumStr; + } + return value.toString(); } +QVariant Util::decorationForVariant(const QVariant &value) +{ + switch (value.type()) { + case QVariant::Brush: + { + const QBrush b = value.value(); + if (b.style() != Qt::NoBrush) { + QPixmap p(16, 16); + p.fill(QColor(0, 0, 0, 0)); + QPainter painter(&p); + painter.setBrush(b); + painter.drawRect(0, 0, p.width() - 1, p.height() - 1); + return p; + } + } + case QVariant::Color: + { + const QColor c = value.value(); + if (c.isValid()) { + QPixmap p(16, 16); + QPainter painter(&p); + painter.setBrush(QBrush(c)); + painter.drawRect(0, 0, p.width() - 1, p.height() - 1); + return p; + } + } + case QVariant::Cursor: + { + const QCursor c = value.value(); + if (!c.pixmap().isNull()) { + return c.pixmap().scaled(16, 16, Qt::KeepAspectRatio, Qt::FastTransformation); + } + } + case QVariant::Icon: + { + return value; + } + case QVariant::Pen: + { + const QPen pen = value.value(); + if (pen.style() != Qt::NoPen) { + QPixmap p(16, 16); + p.fill(QColor(0, 0, 0, 0)); + QPainter painter(&p); + painter.setPen(pen); + painter.translate(0, 8 - pen.width() / 2); + painter.drawLine(0, 0, p.width(), 0); + return p; + } + } + case QVariant::Pixmap: + { + const QPixmap p = value.value(); + return QVariant::fromValue(p.scaled(16, 16, Qt::KeepAspectRatio, Qt::FastTransformation)); + } + default: break; + } + + return QVariant(); +} + QString Util::addressToString(const void *p) { return (QLatin1String("0x") + QString::number(reinterpret_cast(p), 16)); } +QString Util::enumToString(const QVariant &value, const char *typeName, QObject *object) +{ + QByteArray enumTypeName(typeName); + if (enumTypeName.isEmpty()) { + enumTypeName = value.typeName(); + } + + // strip of class name and namespace + const int pos = enumTypeName.lastIndexOf("::"); + if (pos >= 0) { + enumTypeName = enumTypeName.mid(pos + 2); + } + + const QMetaObject *mo = &ProtectedExposer::staticQtMetaObject; + int enumIndex = mo->indexOfEnumerator(enumTypeName); + if (enumIndex < 0 && object) { + mo = object->metaObject(); + enumIndex = mo->indexOfEnumerator(enumTypeName); + } + if (enumIndex < 0) { + return QString(); + } + + const QMetaEnum me = mo->enumerator(enumIndex); + if (!me.isValid()) { + return QString(); + } + return me.valueToKeys(value.toInt()); +} + bool Util::descendantOf(QObject *ascendant, QObject *obj) { QObject *parent = obj->parent(); @@ -138,3 +320,68 @@ bool Util::descendantOf(QObject *ascendant, QObject *obj) } return descendantOf(ascendant, parent); } + +namespace GammaRay { +static QString stringifyProperty(QObject *obj, const QString &propName) +{ + const QVariant value = obj->property(propName.toLatin1()); + const QMetaProperty mp = + obj->metaObject()->property( + obj->metaObject()->indexOfProperty(propName.toLatin1())); + if (mp.isValid()) { + const QString enumStr = Util::enumToString(value, mp.typeName(), obj); + if (!enumStr.isEmpty()) { + return enumStr; + } + } + return Util::variantToString(value); +} + +static QVariant iconForObject(const QMetaObject *mo, QObject *obj) +{ + const QString basePath = QString::fromLatin1(":/gammaray/classes/%1/").arg(mo->className()); + const QDir dir(basePath); + if (dir.exists()) { + // see if we find one with exactly matching properties + foreach (const QString &entry, + dir.entryList(QStringList() << QLatin1String("*.png"), QDir::Files)) { + if (entry == QLatin1String("default.png")) { + continue; + } + QString propString(entry); + propString.chop(4); + const QStringList props = propString.split(QLatin1String(";")); + if (props.isEmpty()) { + continue; + } + bool allMatch = true; + foreach (const QString &prop, props) { + const QStringList keyValue = prop.split(QLatin1Char('=')); + if (keyValue.size() != 2) { + continue; + } + if (stringifyProperty(obj, keyValue.first()) != keyValue.last()) { + allMatch = false; + break; + } + } + if (allMatch) { + return QIcon(basePath + entry); + } + } + return QIcon(basePath + QLatin1String("default.png")); + } else if (mo->superClass()) { + return iconForObject(mo->superClass(), obj); + } + return QVariant(); +} +} + +QVariant Util::iconForObject(QObject *obj) +{ + if (obj) { + return GammaRay::iconForObject(obj->metaObject(), obj); + } + return QVariant(); +} + diff --git a/util.h b/util.h index ea7a105..e60b857 100644 --- a/util.h +++ b/util.h @@ -35,7 +35,20 @@ namespace Util { QString displayString(const QObject *object); QString variantToString(const QVariant &value); + /// Returns a value representing @p value in a itemview decoration role + QVariant decorationForVariant(const QVariant &value); QString addressToString(const void *p); + QString addressToUid(const void *p); + + /** + * Translates an enum or flag value into a human readable text. + * @param value The numerical value. Type information from the QVariant + * are used to find the corresponding QMetaEnum. + * @param typeName Use this if the @p value has type int + * (e.g. the case for QMetaProperty::read). + * @param object Additional QObject to search for QMetaEnums. + */ + QString enumToString(const QVariant &value, const char *typeName = 0, QObject *object = 0); bool descendantOf(QObject *ascendant, QObject *obj); @@ -49,6 +62,9 @@ namespace Util } return findParentOfType(object->parent()); } + + /// Returns an icon for the given object. + QVariant iconForObject(QObject *obj); } } -- 2.11.4.GIT