diff options
author | Lasse Holmstedt <lasse.holmstedt@nokia.com> | 2010-09-27 17:22:57 +0200 |
---|---|---|
committer | Lasse Holmstedt <lasse.holmstedt@nokia.com> | 2010-09-29 09:39:30 +0200 |
commit | 96d991bbdc34b00b4ba1c3b4f5690f04edfb4cf0 (patch) | |
tree | ba09125bc414c558ad54f1bc2ad391bb0d88779e /share | |
parent | 5d9858129aa9c11a9b708c3fb1701c3ed9ac9843 (diff) | |
download | qt-creator-96d991bbdc34b00b4ba1c3b4f5690f04edfb4cf0.tar.gz |
QML Observer: Build together on runtime with debugging tools
Moved qmljsdebugger to a dir under qml/, made qmlobserver compile
without creator dependencies and made it compile with debugging
helpers.
Reviewed-by: hjk
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp (renamed from share/qtcreator/qmljsdebugger/editor/abstractformeditortool.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.h (renamed from share/qtcreator/qmljsdebugger/editor/abstractformeditortool.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp (renamed from share/qtcreator/qmljsdebugger/editor/boundingrecthighlighter.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h (renamed from share/qtcreator/qmljsdebugger/editor/boundingrecthighlighter.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp (renamed from share/qtcreator/qmljsdebugger/editor/colorpickertool.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h (renamed from share/qtcreator/qmljsdebugger/editor/colorpickertool.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/editor.pri (renamed from share/qtcreator/qmljsdebugger/editor/editor.pri) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/editor.qrc (renamed from share/qtcreator/qmljsdebugger/editor/editor.qrc) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/color-picker-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/color-picker-24.png) | bin | 3440 -> 3440 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/color-picker-hicontrast.png (renamed from share/qtcreator/qmljsdebugger/editor/images/color-picker-hicontrast.png) | bin | 3192 -> 3192 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/color-picker.png (renamed from share/qtcreator/qmljsdebugger/editor/images/color-picker.png) | bin | 3173 -> 3173 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/from-qml-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/from-qml-24.png) | bin | 3395 -> 3395 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/from-qml.png (renamed from share/qtcreator/qmljsdebugger/editor/images/from-qml.png) | bin | 3205 -> 3205 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/observermode-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/observermode-24.png) | bin | 1283 -> 1283 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/observermode.png (renamed from share/qtcreator/qmljsdebugger/editor/images/observermode.png) | bin | 3539 -> 3539 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/pause-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/pause-24.png) | bin | 3307 -> 3307 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/pause.png (renamed from share/qtcreator/qmljsdebugger/editor/images/pause.png) | bin | 3097 -> 3097 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/play-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/play-24.png) | bin | 3655 -> 3655 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/play.png (renamed from share/qtcreator/qmljsdebugger/editor/images/play.png) | bin | 3363 -> 3363 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/reload.png (renamed from share/qtcreator/qmljsdebugger/editor/images/reload.png) | bin | 3418 -> 3418 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/resize_handle.png (renamed from share/qtcreator/qmljsdebugger/editor/images/resize_handle.png) | bin | 160 -> 160 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/select-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/select-24.png) | bin | 3510 -> 3510 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/select-marquee-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/select-marquee-24.png) | bin | 2891 -> 2891 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/select-marquee.png (renamed from share/qtcreator/qmljsdebugger/editor/images/select-marquee.png) | bin | 2871 -> 2871 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/select.png (renamed from share/qtcreator/qmljsdebugger/editor/images/select.png) | bin | 3308 -> 3308 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/to-qml-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/to-qml-24.png) | bin | 3407 -> 3407 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/to-qml.png (renamed from share/qtcreator/qmljsdebugger/editor/images/to-qml.png) | bin | 3227 -> 3227 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/zoom-24.png (renamed from share/qtcreator/qmljsdebugger/editor/images/zoom-24.png) | bin | 3566 -> 3566 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/images/zoom.png (renamed from share/qtcreator/qmljsdebugger/editor/images/zoom.png) | bin | 3347 -> 3347 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/layeritem.cpp (renamed from share/qtcreator/qmljsdebugger/editor/layeritem.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/layeritem.h (renamed from share/qtcreator/qmljsdebugger/editor/layeritem.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp (renamed from share/qtcreator/qmljsdebugger/editor/qmltoolbar.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h (renamed from share/qtcreator/qmljsdebugger/editor/qmltoolbar.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp (renamed from share/qtcreator/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.h (renamed from share/qtcreator/qmljsdebugger/editor/rubberbandselectionmanipulator.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp (renamed from share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.h (renamed from share/qtcreator/qmljsdebugger/editor/selectionindicator.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/selectionrectangle.cpp (renamed from share/qtcreator/qmljsdebugger/editor/selectionrectangle.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/selectionrectangle.h (renamed from share/qtcreator/qmljsdebugger/editor/selectionrectangle.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp (renamed from share/qtcreator/qmljsdebugger/editor/selectiontool.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/selectiontool.h (renamed from share/qtcreator/qmljsdebugger/editor/selectiontool.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp (renamed from share/qtcreator/qmljsdebugger/editor/singleselectionmanipulator.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.h (renamed from share/qtcreator/qmljsdebugger/editor/singleselectionmanipulator.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp (renamed from share/qtcreator/qmljsdebugger/editor/subcomponenteditortool.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.h (renamed from share/qtcreator/qmljsdebugger/editor/subcomponenteditortool.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp (renamed from share/qtcreator/qmljsdebugger/editor/subcomponentmasklayeritem.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h (renamed from share/qtcreator/qmljsdebugger/editor/subcomponentmasklayeritem.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp (renamed from share/qtcreator/qmljsdebugger/editor/toolbarcolorbox.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.h (renamed from share/qtcreator/qmljsdebugger/editor/toolbarcolorbox.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp (renamed from share/qtcreator/qmljsdebugger/editor/zoomtool.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h (renamed from share/qtcreator/qmljsdebugger/editor/zoomtool.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h (renamed from share/qtcreator/qmljsdebugger/include/jsdebuggeragent.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h (renamed from share/qtcreator/qmljsdebugger/include/qdeclarativeobserverservice.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h (renamed from share/qtcreator/qmljsdebugger/include/qdeclarativeviewobserver.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h (renamed from share/qtcreator/qmljsdebugger/include/qmljsdebugger_global.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/include/qmlobserverconstants.h (renamed from share/qtcreator/qmljsdebugger/include/qmlobserverconstants.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp (renamed from share/qtcreator/qmljsdebugger/jsdebuggeragent.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/private_headers.pri (renamed from share/qtcreator/qmljsdebugger/private_headers.pri) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/qdeclarativeobserverservice.cpp (renamed from share/qtcreator/qmljsdebugger/qdeclarativeobserverservice.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp (renamed from share/qtcreator/qmljsdebugger/qdeclarativeviewobserver.cpp) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h (renamed from share/qtcreator/qmljsdebugger/qdeclarativeviewobserver_p.h) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri | 35 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri (renamed from share/qtcreator/qmljsdebugger/qmljsdebugger.pri) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro (renamed from share/qtcreator/qmljsdebugger/qmljsdebugger.pro) | 0 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/Info_mac.plist | 18 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT | 3 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/LICENSE.LGPL | 504 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/content/Browser.qml | 284 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/content/images/folder.png | bin | 0 -> 1841 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/content/images/titlebar.png | bin | 0 -> 1436 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/content/images/titlebar.sci | 5 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/content/images/up.png | bin | 0 -> 662 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/deviceorientation.cpp | 75 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/deviceorientation.h | 81 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/deviceorientation_maemo5.cpp | 127 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/loggerwidget.cpp | 201 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/loggerwidget.h | 99 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/main.cpp | 471 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/proxysettings.cpp | 113 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/proxysettings.h | 75 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/proxysettings.ui | 115 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui | 177 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp | 407 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qdeclarativetester.h | 289 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qml.icns | bin | 0 -> 196156 bytes | |||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qml.pri | 38 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qmlobserver.pro | 24 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qmlruntime.cpp | 1581 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qmlruntime.h | 230 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/qmlruntime.qrc | 9 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/recopts.ui | 513 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/recopts_maemo5.ui | 254 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h | 113 | ||||
-rw-r--r-- | share/qtcreator/qmljsdebugger/qmljsdebugger-lib.pri | 35 |
94 files changed, 5841 insertions, 35 deletions
diff --git a/share/qtcreator/qmljsdebugger/editor/abstractformeditortool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp index 557a301112..557a301112 100644 --- a/share/qtcreator/qmljsdebugger/editor/abstractformeditortool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/abstractformeditortool.h b/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.h index 63f50c876f..63f50c876f 100644 --- a/share/qtcreator/qmljsdebugger/editor/abstractformeditortool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.h diff --git a/share/qtcreator/qmljsdebugger/editor/boundingrecthighlighter.cpp b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp index c1daee8b19..c1daee8b19 100644 --- a/share/qtcreator/qmljsdebugger/editor/boundingrecthighlighter.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/boundingrecthighlighter.h b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h index 2463d78d2c..2463d78d2c 100644 --- a/share/qtcreator/qmljsdebugger/editor/boundingrecthighlighter.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h diff --git a/share/qtcreator/qmljsdebugger/editor/colorpickertool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp index bf52075fc7..bf52075fc7 100644 --- a/share/qtcreator/qmljsdebugger/editor/colorpickertool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/colorpickertool.h b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h index 748ad581aa..748ad581aa 100644 --- a/share/qtcreator/qmljsdebugger/editor/colorpickertool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h diff --git a/share/qtcreator/qmljsdebugger/editor/editor.pri b/share/qtcreator/qml/qmljsdebugger/editor/editor.pri index 150ca7dd08..150ca7dd08 100644 --- a/share/qtcreator/qmljsdebugger/editor/editor.pri +++ b/share/qtcreator/qml/qmljsdebugger/editor/editor.pri diff --git a/share/qtcreator/qmljsdebugger/editor/editor.qrc b/share/qtcreator/qml/qmljsdebugger/editor/editor.qrc index 77744d57bb..77744d57bb 100644 --- a/share/qtcreator/qmljsdebugger/editor/editor.qrc +++ b/share/qtcreator/qml/qmljsdebugger/editor/editor.qrc diff --git a/share/qtcreator/qmljsdebugger/editor/images/color-picker-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/color-picker-24.png Binary files differindex cff47212a4..cff47212a4 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/color-picker-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/color-picker-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/color-picker-hicontrast.png b/share/qtcreator/qml/qmljsdebugger/editor/images/color-picker-hicontrast.png Binary files differindex b953d08a68..b953d08a68 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/color-picker-hicontrast.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/color-picker-hicontrast.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/color-picker.png b/share/qtcreator/qml/qmljsdebugger/editor/images/color-picker.png Binary files differindex 026c31b3e1..026c31b3e1 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/color-picker.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/color-picker.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/from-qml-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/from-qml-24.png Binary files differindex 0ad21f3dbb..0ad21f3dbb 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/from-qml-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/from-qml-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/from-qml.png b/share/qtcreator/qml/qmljsdebugger/editor/images/from-qml.png Binary files differindex 666382c06d..666382c06d 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/from-qml.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/from-qml.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/observermode-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/observermode-24.png Binary files differindex 5e74d867c0..5e74d867c0 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/observermode-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/observermode-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/observermode.png b/share/qtcreator/qml/qmljsdebugger/editor/images/observermode.png Binary files differindex daed21c944..daed21c944 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/observermode.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/observermode.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/pause-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/pause-24.png Binary files differindex d9a2f6f814..d9a2f6f814 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/pause-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/pause-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/pause.png b/share/qtcreator/qml/qmljsdebugger/editor/images/pause.png Binary files differindex 114d89b12b..114d89b12b 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/pause.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/pause.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/play-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/play-24.png Binary files differindex e2b9fbcf51..e2b9fbcf51 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/play-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/play-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/play.png b/share/qtcreator/qml/qmljsdebugger/editor/images/play.png Binary files differindex 011598a746..011598a746 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/play.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/play.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/reload.png b/share/qtcreator/qml/qmljsdebugger/editor/images/reload.png Binary files differindex 7042bec9ae..7042bec9ae 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/reload.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/reload.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/resize_handle.png b/share/qtcreator/qml/qmljsdebugger/editor/images/resize_handle.png Binary files differindex 2934f25b74..2934f25b74 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/resize_handle.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/resize_handle.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/select-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/select-24.png Binary files differindex 5388a9d16a..5388a9d16a 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/select-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/select-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/select-marquee-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/select-marquee-24.png Binary files differindex 0111ddae45..0111ddae45 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/select-marquee-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/select-marquee-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/select-marquee.png b/share/qtcreator/qml/qmljsdebugger/editor/images/select-marquee.png Binary files differindex 92fe40d1ad..92fe40d1ad 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/select-marquee.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/select-marquee.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/select.png b/share/qtcreator/qml/qmljsdebugger/editor/images/select.png Binary files differindex 672285582b..672285582b 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/select.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/select.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/to-qml-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/to-qml-24.png Binary files differindex b72450ddd4..b72450ddd4 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/to-qml-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/to-qml-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/to-qml.png b/share/qtcreator/qml/qmljsdebugger/editor/images/to-qml.png Binary files differindex 2ab951fd08..2ab951fd08 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/to-qml.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/to-qml.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/zoom-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/zoom-24.png Binary files differindex 03462001ec..03462001ec 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/zoom-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/zoom-24.png diff --git a/share/qtcreator/qmljsdebugger/editor/images/zoom.png b/share/qtcreator/qml/qmljsdebugger/editor/images/zoom.png Binary files differindex 17f0da6d64..17f0da6d64 100644 --- a/share/qtcreator/qmljsdebugger/editor/images/zoom.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/zoom.png diff --git a/share/qtcreator/qmljsdebugger/editor/layeritem.cpp b/share/qtcreator/qml/qmljsdebugger/editor/layeritem.cpp index 285b3e3074..285b3e3074 100644 --- a/share/qtcreator/qmljsdebugger/editor/layeritem.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/layeritem.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/layeritem.h b/share/qtcreator/qml/qmljsdebugger/editor/layeritem.h index c699cb8bc9..c699cb8bc9 100644 --- a/share/qtcreator/qmljsdebugger/editor/layeritem.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/layeritem.h diff --git a/share/qtcreator/qmljsdebugger/editor/qmltoolbar.cpp b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp index 355a13b6c3..355a13b6c3 100644 --- a/share/qtcreator/qmljsdebugger/editor/qmltoolbar.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/qmltoolbar.h b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h index 77685b9b4f..77685b9b4f 100644 --- a/share/qtcreator/qmljsdebugger/editor/qmltoolbar.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h diff --git a/share/qtcreator/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp index 379ba98c44..379ba98c44 100644 --- a/share/qtcreator/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/rubberbandselectionmanipulator.h b/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.h index e681569577..e681569577 100644 --- a/share/qtcreator/qmljsdebugger/editor/rubberbandselectionmanipulator.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.h diff --git a/share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp index 5782f2a5ee..5782f2a5ee 100644 --- a/share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/selectionindicator.h b/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.h index ecfeda86a0..ecfeda86a0 100644 --- a/share/qtcreator/qmljsdebugger/editor/selectionindicator.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.h diff --git a/share/qtcreator/qmljsdebugger/editor/selectionrectangle.cpp b/share/qtcreator/qml/qmljsdebugger/editor/selectionrectangle.cpp index dc8ee26cce..dc8ee26cce 100644 --- a/share/qtcreator/qmljsdebugger/editor/selectionrectangle.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectionrectangle.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/selectionrectangle.h b/share/qtcreator/qml/qmljsdebugger/editor/selectionrectangle.h index 03346d7bb9..03346d7bb9 100644 --- a/share/qtcreator/qmljsdebugger/editor/selectionrectangle.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectionrectangle.h diff --git a/share/qtcreator/qmljsdebugger/editor/selectiontool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp index b677a10577..b677a10577 100644 --- a/share/qtcreator/qmljsdebugger/editor/selectiontool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/selectiontool.h b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.h index 63461da296..63461da296 100644 --- a/share/qtcreator/qmljsdebugger/editor/selectiontool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.h diff --git a/share/qtcreator/qmljsdebugger/editor/singleselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp index d006481549..d006481549 100644 --- a/share/qtcreator/qmljsdebugger/editor/singleselectionmanipulator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/singleselectionmanipulator.h b/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.h index e4ff0f346a..e4ff0f346a 100644 --- a/share/qtcreator/qmljsdebugger/editor/singleselectionmanipulator.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.h diff --git a/share/qtcreator/qmljsdebugger/editor/subcomponenteditortool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp index 5089944ddb..5089944ddb 100644 --- a/share/qtcreator/qmljsdebugger/editor/subcomponenteditortool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/subcomponenteditortool.h b/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.h index c1652ddb24..c1652ddb24 100644 --- a/share/qtcreator/qmljsdebugger/editor/subcomponenteditortool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.h diff --git a/share/qtcreator/qmljsdebugger/editor/subcomponentmasklayeritem.cpp b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp index 1e8ff42466..1e8ff42466 100644 --- a/share/qtcreator/qmljsdebugger/editor/subcomponentmasklayeritem.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/subcomponentmasklayeritem.h b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h index 37759ebf71..37759ebf71 100644 --- a/share/qtcreator/qmljsdebugger/editor/subcomponentmasklayeritem.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h diff --git a/share/qtcreator/qmljsdebugger/editor/toolbarcolorbox.cpp b/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp index dd6eb7e4a7..dd6eb7e4a7 100644 --- a/share/qtcreator/qmljsdebugger/editor/toolbarcolorbox.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/toolbarcolorbox.h b/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.h index d4be7921bb..d4be7921bb 100644 --- a/share/qtcreator/qmljsdebugger/editor/toolbarcolorbox.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.h diff --git a/share/qtcreator/qmljsdebugger/editor/zoomtool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp index 2bb152e2d6..2bb152e2d6 100644 --- a/share/qtcreator/qmljsdebugger/editor/zoomtool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp diff --git a/share/qtcreator/qmljsdebugger/editor/zoomtool.h b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h index 299efee3ea..299efee3ea 100644 --- a/share/qtcreator/qmljsdebugger/editor/zoomtool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h diff --git a/share/qtcreator/qmljsdebugger/include/jsdebuggeragent.h b/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h index 39b559cabe..39b559cabe 100644 --- a/share/qtcreator/qmljsdebugger/include/jsdebuggeragent.h +++ b/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h diff --git a/share/qtcreator/qmljsdebugger/include/qdeclarativeobserverservice.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h index 121a847684..121a847684 100644 --- a/share/qtcreator/qmljsdebugger/include/qdeclarativeobserverservice.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h diff --git a/share/qtcreator/qmljsdebugger/include/qdeclarativeviewobserver.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h index 02aee970a2..02aee970a2 100644 --- a/share/qtcreator/qmljsdebugger/include/qdeclarativeviewobserver.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h diff --git a/share/qtcreator/qmljsdebugger/include/qmljsdebugger_global.h b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h index 6aba5be426..6aba5be426 100644 --- a/share/qtcreator/qmljsdebugger/include/qmljsdebugger_global.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h diff --git a/share/qtcreator/qmljsdebugger/include/qmlobserverconstants.h b/share/qtcreator/qml/qmljsdebugger/include/qmlobserverconstants.h index 8709cfef00..8709cfef00 100644 --- a/share/qtcreator/qmljsdebugger/include/qmlobserverconstants.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qmlobserverconstants.h diff --git a/share/qtcreator/qmljsdebugger/jsdebuggeragent.cpp b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp index 4258882e10..4258882e10 100644 --- a/share/qtcreator/qmljsdebugger/jsdebuggeragent.cpp +++ b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp diff --git a/share/qtcreator/qmljsdebugger/private_headers.pri b/share/qtcreator/qml/qmljsdebugger/private_headers.pri index fc35396178..fc35396178 100644 --- a/share/qtcreator/qmljsdebugger/private_headers.pri +++ b/share/qtcreator/qml/qmljsdebugger/private_headers.pri diff --git a/share/qtcreator/qmljsdebugger/qdeclarativeobserverservice.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeobserverservice.cpp index 16b5145e74..16b5145e74 100644 --- a/share/qtcreator/qmljsdebugger/qdeclarativeobserverservice.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeobserverservice.cpp diff --git a/share/qtcreator/qmljsdebugger/qdeclarativeviewobserver.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp index 81cd9b018b..81cd9b018b 100644 --- a/share/qtcreator/qmljsdebugger/qdeclarativeviewobserver.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp diff --git a/share/qtcreator/qmljsdebugger/qdeclarativeviewobserver_p.h b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h index a276c4350e..a276c4350e 100644 --- a/share/qtcreator/qmljsdebugger/qdeclarativeviewobserver_p.h +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri new file mode 100644 index 0000000000..f8e482e38c --- /dev/null +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri @@ -0,0 +1,35 @@ +QT += declarative script +INCLUDEPATH += $$PWD $$PWD/include editor +DEPENDPATH += $$PWD $$PWD/include editor + +contains(CONFIG, dll) { + DEFINES += BUILD_QMLJSDEBUGGER_LIB +} else { + DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB +} + +include($$PWD/private_headers.pri) + +## Input +HEADERS += \ + $$PWD/include/jsdebuggeragent.h \ + $$PWD/include/qmljsdebugger_global.h + +SOURCES += \ + $$PWD/jsdebuggeragent.cpp + +contains(DEFINES, QMLOBSERVER) { + include($$PWD/editor/editor.pri) + + HEADERS += \ + $$PWD/include/qdeclarativeviewobserver.h \ + $$PWD/include/qdeclarativeobserverservice.h \ + $$PWD/include/qmlobserverconstants.h \ + $$PWD/qdeclarativeviewobserver_p.h + + SOURCES += \ + $$PWD/qdeclarativeviewobserver.cpp \ + $$PWD/qdeclarativeobserverservice.cpp +} + +OTHER_FILES += $$PWD/qmljsdebugger.pri diff --git a/share/qtcreator/qmljsdebugger/qmljsdebugger.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri index a4abeb9cd5..a4abeb9cd5 100644 --- a/share/qtcreator/qmljsdebugger/qmljsdebugger.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pri diff --git a/share/qtcreator/qmljsdebugger/qmljsdebugger.pro b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro index 5f3eb50958..5f3eb50958 100644 --- a/share/qtcreator/qmljsdebugger/qmljsdebugger.pro +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro diff --git a/share/qtcreator/qml/qmlobserver/Info_mac.plist b/share/qtcreator/qml/qmlobserver/Info_mac.plist new file mode 100644 index 0000000000..80ca6a3526 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/Info_mac.plist @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.1"> +<dict> + <key>CFBundleIconFile</key> + <string>@ICON@</string> + <key>CFBundleIdentifier</key> + <string>com.nokia.qt.qml</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@EXECUTABLE@</string> +</dict> +</plist> diff --git a/share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT b/share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT new file mode 100644 index 0000000000..8d0f85eba4 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT @@ -0,0 +1,3 @@ +Nokia Qt LGPL Exception version 1.0 + +As a special exception to the GNU Lesser General Public License version 2.1, the object code form of a "work that uses the Library" may incorporate material from a header file that is part of the Library. You may distribute such object code under terms of your choice, provided that the incorporated material (i) does not exceed more than 5% of the total size of the Library; and (ii) is limited to numerical parameters, data structure layouts, accessors, macros, inline functions and templates.
\ No newline at end of file diff --git a/share/qtcreator/qml/qmlobserver/LICENSE.LGPL b/share/qtcreator/qml/qmlobserver/LICENSE.LGPL new file mode 100644 index 0000000000..602bfc9463 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/LICENSE.LGPL @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/share/qtcreator/qml/qmlobserver/content/Browser.qml b/share/qtcreator/qml/qmlobserver/content/Browser.qml new file mode 100644 index 0000000000..ff2bb47647 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/content/Browser.qml @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import Qt.labs.folderlistmodel 1.0 + +Rectangle { + id: root + property bool keyPressed: false + property variant folders: folders1 + property variant view: view1 + width: 320 + height: 480 + color: palette.window + + FolderListModel { + id: folders1 + nameFilters: [ "*.qml" ] + folder: qmlViewerFolder + } + FolderListModel { + id: folders2 + nameFilters: [ "*.qml" ] + folder: qmlViewerFolder + } + + SystemPalette { id: palette } + + function down(path) { + if (folders == folders1) { + view = view2 + folders = folders2; + view1.state = "exitLeft"; + } else { + view = view1 + folders = folders1; + view2.state = "exitLeft"; + } + view.x = root.width; + view.state = "current"; + view.focus = true; + folders.folder = path; + } + function up() { + var path = folders.parentFolder; + if (folders == folders1) { + view = view2 + folders = folders2; + view1.state = "exitRight"; + } else { + view = view1 + folders = folders1; + view2.state = "exitRight"; + } + view.x = -root.width; + view.state = "current"; + view.focus = true; + folders.folder = path; + } + + Component { + id: folderDelegate + Rectangle { + id: wrapper + function launch() { + if (folders.isFolder(index)) { + down(filePath); + } else { + qmlViewer.launch(filePath); + } + } + width: root.width + height: 52 + color: "transparent" + Rectangle { + id: highlight; visible: false + anchors.fill: parent + gradient: Gradient { + GradientStop { id: t1; position: 0.0; color: palette.highlight } + GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } + } + } + Item { + width: 48; height: 48 + Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} + } + Text { + id: nameText + anchors.fill: parent; verticalAlignment: Text.AlignVCenter + text: fileName + anchors.leftMargin: 54 + font.pixelSize: 32 + color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText + elide: Text.ElideRight + } + MouseArea { + id: mouseRegion + anchors.fill: parent + onClicked: { if (folders == wrapper.ListView.view.model) launch() } + } + states: [ + State { + name: "pressed" + when: mouseRegion.pressed + PropertyChanges { target: highlight; visible: true } + PropertyChanges { target: nameText; color: palette.highlightedText } + } + ] + } + } + + ListView { + id: view1 + anchors.top: titleBar.bottom + anchors.bottom: parent.bottom + x: 0 + width: parent.width + model: folders1 + delegate: folderDelegate + highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view1.count != 0 } + highlightMoveSpeed: 1000 + pressDelay: 100 + focus: true + state: "current" + states: [ + State { + name: "current" + PropertyChanges { target: view1; x: 0 } + }, + State { + name: "exitLeft" + PropertyChanges { target: view1; x: -root.width } + }, + State { + name: "exitRight" + PropertyChanges { target: view1; x: root.width } + } + ] + transitions: [ + Transition { + to: "current" + SequentialAnimation { + NumberAnimation { properties: "x"; duration: 250 } + } + }, + Transition { + NumberAnimation { properties: "x"; duration: 250 } + NumberAnimation { properties: "x"; duration: 250 } + } + ] + Keys.onPressed: { root.keyPressed = true; } + } + + ListView { + id: view2 + anchors.top: titleBar.bottom + anchors.bottom: parent.bottom + x: parent.width + width: parent.width + model: folders2 + delegate: folderDelegate + highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view2.count != 0 } + highlightMoveSpeed: 1000 + pressDelay: 100 + states: [ + State { + name: "current" + PropertyChanges { target: view2; x: 0 } + }, + State { + name: "exitLeft" + PropertyChanges { target: view2; x: -root.width } + }, + State { + name: "exitRight" + PropertyChanges { target: view2; x: root.width } + } + ] + transitions: [ + Transition { + to: "current" + SequentialAnimation { + NumberAnimation { properties: "x"; duration: 250 } + } + }, + Transition { + NumberAnimation { properties: "x"; duration: 250 } + } + ] + Keys.onPressed: { root.keyPressed = true; } + } + + Keys.onPressed: { + root.keyPressed = true; + if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) { + view.currentItem.launch(); + event.accepted = true; + } else if (event.key == Qt.Key_Left) { + up(); + } + } + + BorderImage { + source: "images/titlebar.sci"; + width: parent.width; + height: 52 + y: -7 + id: titleBar + + Rectangle { + id: upButton + width: 48 + height: titleBar.height - 7 + color: "transparent" + + Image { anchors.centerIn: parent; source: "images/up.png" } + MouseArea { id: upRegion; anchors.centerIn: parent + width: 56 + height: 56 + onClicked: if (folders.parentFolder != "") up() + } + states: [ + State { + name: "pressed" + when: upRegion.pressed + PropertyChanges { target: upButton; color: palette.highlight } + } + ] + } + Rectangle { + color: "gray" + x: 48 + width: 1 + height: 44 + } + + Text { + anchors.left: upButton.right; anchors.right: parent.right; height: parent.height + anchors.leftMargin: 4; anchors.rightMargin: 4 + text: folders.folder + color: "white" + elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter + font.pixelSize: 32 + } + } +} diff --git a/share/qtcreator/qml/qmlobserver/content/images/folder.png b/share/qtcreator/qml/qmlobserver/content/images/folder.png Binary files differnew file mode 100644 index 0000000000..e53e2ad464 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/content/images/folder.png diff --git a/share/qtcreator/qml/qmlobserver/content/images/titlebar.png b/share/qtcreator/qml/qmlobserver/content/images/titlebar.png Binary files differnew file mode 100644 index 0000000000..51c90082d0 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/content/images/titlebar.png diff --git a/share/qtcreator/qml/qmlobserver/content/images/titlebar.sci b/share/qtcreator/qml/qmlobserver/content/images/titlebar.sci new file mode 100644 index 0000000000..0418d94cd6 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/content/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/share/qtcreator/qml/qmlobserver/content/images/up.png b/share/qtcreator/qml/qmlobserver/content/images/up.png Binary files differnew file mode 100644 index 0000000000..b05f8025d0 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/content/images/up.png diff --git a/share/qtcreator/qml/qmlobserver/deviceorientation.cpp b/share/qtcreator/qml/qmlobserver/deviceorientation.cpp new file mode 100644 index 0000000000..e7c70d5fde --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/deviceorientation.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "deviceorientation.h" + +QT_USE_NAMESPACE + +class DefaultDeviceOrientation : public DeviceOrientation +{ + Q_OBJECT +public: + DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {} + + Orientation orientation() const { + return m_orientation; + } + + void setOrientation(Orientation o) { + if (o != m_orientation) { + m_orientation = o; + emit orientationChanged(); + } + } + + Orientation m_orientation; +}; + +DeviceOrientation* DeviceOrientation::instance() +{ + static DefaultDeviceOrientation *o = 0; + if (!o) + o = new DefaultDeviceOrientation; + return o; +} + +#include "deviceorientation.moc" + diff --git a/share/qtcreator/qml/qmlobserver/deviceorientation.h b/share/qtcreator/qml/qmlobserver/deviceorientation.h new file mode 100644 index 0000000000..3bad5bec01 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/deviceorientation.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ORIENTATION_H +#define ORIENTATION_H + +#include <QObject> + +QT_BEGIN_NAMESPACE + +class DeviceOrientationPrivate; +class DeviceOrientation : public QObject +{ + Q_OBJECT + Q_ENUMS(Orientation) +public: + enum Orientation { + UnknownOrientation, + Portrait, + Landscape, + PortraitInverted, + LandscapeInverted + }; + + virtual Orientation orientation() const = 0; + virtual void setOrientation(Orientation) = 0; + + static DeviceOrientation *instance(); + +signals: + void orientationChanged(); + +protected: + DeviceOrientation() {} + +private: + DeviceOrientationPrivate *d_ptr; + friend class DeviceOrientationPrivate; +}; + +QT_END_NAMESPACE + +#endif diff --git a/share/qtcreator/qml/qmlobserver/deviceorientation_maemo5.cpp b/share/qtcreator/qml/qmlobserver/deviceorientation_maemo5.cpp new file mode 100644 index 0000000000..e942579b70 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/deviceorientation_maemo5.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "deviceorientation.h" +#include <QtDBus> + +#include <mce/mode-names.h> +#include <mce/dbus-names.h> + +class MaemoOrientation : public DeviceOrientation +{ + Q_OBJECT +public: + MaemoOrientation() + : o(UnknownOrientation) + { + // enable the orientation sensor + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ)); + + // query the initial orientation + QDBusMessage reply = QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET)); + if (reply.type() == QDBusMessage::ErrorMessage) { + qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage())); + } else { + o = toOrientation(reply.arguments().value(0).toString()); + } + + // connect to the orientation change signal + QDBusConnection::systemBus().connect(QString(), MCE_SIGNAL_PATH, MCE_SIGNAL_IF, + MCE_DEVICE_ORIENTATION_SIG, + this, + SLOT(deviceOrientationChanged(QString))); + } + + ~MaemoOrientation() + { + // disable the orientation sensor + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(MCE_SERVICE, MCE_REQUEST_PATH, + MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ)); + } + + inline Orientation orientation() const + { + return o; + } + + void setOrientation(Orientation o) + { + } + +private Q_SLOTS: + void deviceOrientationChanged(const QString &newOrientation) + { + o = toOrientation(newOrientation); + + emit orientationChanged(); +// printf("%d\n", o); + } + +private: + static Orientation toOrientation(const QString &nativeOrientation) + { + if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE) + return Landscape; + else if (nativeOrientation == MCE_ORIENTATION_LANDSCAPE_INVERTED) + return LandscapeInverted; + else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT) + return Portrait; + else if (nativeOrientation == MCE_ORIENTATION_PORTRAIT_INVERTED) + return PortraitInverted; + return UnknownOrientation; + } + +private: + Orientation o; +}; + +DeviceOrientation* DeviceOrientation::instance() +{ + static MaemoOrientation *o = new MaemoOrientation; + return o; +} + +#include "deviceorientation_maemo5.moc" diff --git a/share/qtcreator/qml/qmlobserver/loggerwidget.cpp b/share/qtcreator/qml/qmlobserver/loggerwidget.cpp new file mode 100644 index 0000000000..8aa029f3d0 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/loggerwidget.cpp @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qglobal.h> +#include <QDebug> +#include <QSettings> +#include <QActionGroup> +#include <QMenu> +#include <QPlainTextEdit> +#ifdef Q_WS_MAEMO_5 +# include <QScrollArea> +# include <QVBoxLayout> +# include "texteditautoresizer_maemo5.h" +#endif + +#include "loggerwidget.h" + +QT_BEGIN_NAMESPACE + +LoggerWidget::LoggerWidget(QWidget *parent) : + QMainWindow(parent), + m_visibilityOrigin(SettingsOrigin) +{ + setAttribute(Qt::WA_QuitOnClose, false); + setWindowTitle(tr("Warnings")); + + m_plainTextEdit = new QPlainTextEdit(); + +#ifdef Q_WS_MAEMO_5 + new TextEditAutoResizer(m_plainTextEdit); + setAttribute(Qt::WA_Maemo5StackedWindow); + QScrollArea *area = new QScrollArea(); + area->setWidget(m_plainTextEdit); + area->setWidgetResizable(true); + setCentralWidget(area); +#else + setCentralWidget(m_plainTextEdit); +#endif + readSettings(); + setupPreferencesMenu(); +} + +void LoggerWidget::append(const QString &msg) +{ + m_plainTextEdit->appendPlainText(msg); + + if (!isVisible() && (defaultVisibility() == AutoShowWarnings)) + setVisible(true); +} + +LoggerWidget::Visibility LoggerWidget::defaultVisibility() const +{ + return m_visibility; +} + +void LoggerWidget::setDefaultVisibility(LoggerWidget::Visibility visibility) +{ + if (m_visibility == visibility) + return; + + m_visibility = visibility; + m_visibilityOrigin = CommandLineOrigin; + + m_preferencesMenu->setEnabled(m_visibilityOrigin == SettingsOrigin); +} + +QMenu *LoggerWidget::preferencesMenu() +{ + return m_preferencesMenu; +} + +QAction *LoggerWidget::showAction() +{ + return m_showWidgetAction; +} + +void LoggerWidget::readSettings() +{ + QSettings settings; + QString warningsPreferences = settings.value("warnings", "hide").toString(); + if (warningsPreferences == "show") { + m_visibility = ShowWarnings; + } else if (warningsPreferences == "hide") { + m_visibility = HideWarnings; + } else { + m_visibility = AutoShowWarnings; + } +} + +void LoggerWidget::saveSettings() +{ + if (m_visibilityOrigin != SettingsOrigin) + return; + + QString value = "autoShow"; + if (defaultVisibility() == ShowWarnings) { + value = "show"; + } else if (defaultVisibility() == HideWarnings) { + value = "hide"; + } + + QSettings settings; + settings.setValue("warnings", value); +} + +void LoggerWidget::warningsPreferenceChanged(QAction *action) +{ + Visibility newSetting = static_cast<Visibility>(action->data().toInt()); + m_visibility = newSetting; + saveSettings(); +} + +void LoggerWidget::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + emit opened(); +} + +void LoggerWidget::closeEvent(QCloseEvent *event) +{ + QWidget::closeEvent(event); + emit closed(); +} + +void LoggerWidget::setupPreferencesMenu() +{ + m_preferencesMenu = new QMenu(tr("Warnings")); + QActionGroup *warnings = new QActionGroup(m_preferencesMenu); + warnings->setExclusive(true); + + connect(warnings, SIGNAL(triggered(QAction*)), this, SLOT(warningsPreferenceChanged(QAction*))); + + QAction *showWarningsPreference = new QAction(tr("Show by default"), m_preferencesMenu); + showWarningsPreference->setCheckable(true); + showWarningsPreference->setData(LoggerWidget::ShowWarnings); + warnings->addAction(showWarningsPreference); + m_preferencesMenu->addAction(showWarningsPreference); + + QAction *hideWarningsPreference = new QAction(tr("Hide by default"), m_preferencesMenu); + hideWarningsPreference->setCheckable(true); + hideWarningsPreference->setData(LoggerWidget::HideWarnings); + warnings->addAction(hideWarningsPreference); + m_preferencesMenu->addAction(hideWarningsPreference); + + QAction *autoWarningsPreference = new QAction(tr("Show for first warning"), m_preferencesMenu); + autoWarningsPreference->setCheckable(true); + autoWarningsPreference->setData(LoggerWidget::AutoShowWarnings); + warnings->addAction(autoWarningsPreference); + m_preferencesMenu->addAction(autoWarningsPreference); + + switch (defaultVisibility()) { + case LoggerWidget::ShowWarnings: + showWarningsPreference->setChecked(true); + break; + case LoggerWidget::HideWarnings: + hideWarningsPreference->setChecked(true); + break; + default: + autoWarningsPreference->setChecked(true); + } +} + +QT_END_NAMESPACE diff --git a/share/qtcreator/qml/qmlobserver/loggerwidget.h b/share/qtcreator/qml/qmlobserver/loggerwidget.h new file mode 100644 index 0000000000..13c319f91a --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/loggerwidget.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LOGGERWIDGET_H +#define LOGGERWIDGET_H + +#include <QMainWindow> +#include <QMetaType> + +QT_BEGIN_NAMESPACE + +class QPlainTextEdit; +class QMenu; +class QAction; + +class LoggerWidget : public QMainWindow { + Q_OBJECT +public: + LoggerWidget(QWidget *parent=0); + + enum Visibility { ShowWarnings, HideWarnings, AutoShowWarnings }; + + Visibility defaultVisibility() const; + void setDefaultVisibility(Visibility visibility); + + QMenu *preferencesMenu(); + QAction *showAction(); + +public slots: + void append(const QString &msg); + +private slots: + void warningsPreferenceChanged(QAction *action); + void readSettings(); + void saveSettings(); + +protected: + void showEvent(QShowEvent *event); + void closeEvent(QCloseEvent *event); + +signals: + void opened(); + void closed(); + +private: + void setupPreferencesMenu(); + + QMenu *m_preferencesMenu; + QAction *m_showWidgetAction; + QPlainTextEdit *m_plainTextEdit; + + enum ConfigOrigin { CommandLineOrigin, SettingsOrigin }; + ConfigOrigin m_visibilityOrigin; + Visibility m_visibility; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(LoggerWidget::Visibility) + +#endif // LOGGERWIDGET_H diff --git a/share/qtcreator/qml/qmlobserver/main.cpp b/share/qtcreator/qml/qmlobserver/main.cpp new file mode 100644 index 0000000000..f04640d970 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/main.cpp @@ -0,0 +1,471 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarative.h" +#include "qmlruntime.h" +#include "qdeclarativeengine.h" +#include "loggerwidget.h" +#include <QWidget> +#include <QDir> +#include <QApplication> +#include <QTranslator> +#include <QDebug> +#include <QMessageBox> +#include "qdeclarativetester.h" + +QT_USE_NAMESPACE + +QtMsgHandler systemMsgOutput = 0; + +#if defined (Q_OS_SYMBIAN) +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +void myMessageOutput(QtMsgType type, const char *msg) +{ + static int fd = -1; + if (fd == -1) + fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); + + ::write(fd, msg, strlen(msg)); + ::write(fd, "\n", 1); + ::fsync(fd); + + switch (type) { + case QtFatalMsg: + abort(); + } +} + +#else // !defined (Q_OS_SYMBIAN) + +QWeakPointer<LoggerWidget> logger; + +QString warnings; +void showWarnings() +{ + if (!warnings.isEmpty()) { + int argc = 0; char **argv = 0; + QApplication application(argc, argv); // QApplication() in main has been destroyed already. + Q_UNUSED(application) + QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); + } +} + +void myMessageOutput(QtMsgType type, const char *msg) +{ + if (!logger.isNull()) { + QString strMsg = QString::fromAscii(msg); + QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); + } else { + warnings += msg; + warnings += QLatin1Char('\n'); + } + if (systemMsgOutput) { // Windows + systemMsgOutput(type, msg); + } else { // Unix + fprintf(stderr, "%s\n",msg); + fflush(stderr); + } +} + +#endif + +void usage() +{ + qWarning("Usage: qmlviewer [options] <filename>"); + qWarning(" "); + qWarning(" options:"); + qWarning(" -v, -version ............................. display version"); + qWarning(" -frameless ............................... run with no window frame"); + qWarning(" -maximized................................ run maximized"); + qWarning(" -fullscreen............................... run fullscreen"); + qWarning(" -stayontop................................ keep viewer window on top"); + qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); + qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view (default)"); + qWarning(" -qmlbrowser .............................. use a QML-based file browser"); + qWarning(" -warnings [show|hide]..................... show warnings in a separate log window"); + qWarning(" -recordfile <output> ..................... set video recording file"); + qWarning(" - ImageMagick 'convert' for GIF)"); + qWarning(" - png file for raw frames"); + qWarning(" - 'ffmpeg' for other formats"); + qWarning(" -recorddither ordered|threshold|floyd .... set GIF dither recording mode"); + qWarning(" -recordrate <fps> ........................ set recording frame rate"); + qWarning(" -record arg .............................. add a recording process argument"); + qWarning(" -autorecord [from-]<tomilliseconds> ...... set recording to start and stop"); + qWarning(" -devicekeys .............................. use numeric keys (see F1)"); + qWarning(" -dragthreshold <size> .................... set mouse drag threshold size"); + qWarning(" -netcache <size> ......................... set disk cache to size bytes"); + qWarning(" -translation <translationfile> ........... set the language to run in"); + qWarning(" -I <directory> ........................... prepend to the module import search path,"); + qWarning(" display path if <directory> is empty"); + qWarning(" -P <directory> ........................... prepend to the plugin search path"); + qWarning(" -opengl .................................. use a QGLWidget for the viewport"); + qWarning(" -script <path> ........................... set the script to use"); + qWarning(" -scriptopts <options>|help ............... set the script options to use"); + + qWarning(" "); + qWarning(" Press F1 for interactive help"); + exit(1); +} + +void scriptOptsUsage() +{ + qWarning("Usage: qmlviewer -scriptopts <option>[,<option>...] ..."); + qWarning(" options:"); + qWarning(" record ................................... record a new script"); + qWarning(" play ..................................... playback an existing script"); + qWarning(" testimages ............................... record images or compare images on playback"); + qWarning(" testerror ................................ test 'error' property of root item on playback"); + qWarning(" snapshot ................................. file being recorded is static,"); + qWarning(" only one frame will be recorded or tested"); + qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion"); + qWarning(" exitonfailure ............................ immediately exit the viewer on script failure"); + qWarning(" saveonexit ............................... save recording on viewer exit"); + qWarning(" "); + qWarning(" One of record, play or both must be specified."); + exit(1); +} + +enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings }; + +int main(int argc, char ** argv) +{ +#if defined (Q_OS_SYMBIAN) + qInstallMsgHandler(myMessageOutput); +#else + systemMsgOutput = qInstallMsgHandler(myMessageOutput); +#endif + +#if defined (Q_OS_WIN) + // Debugging output is not visible by default on Windows - + // therefore show modal dialog with errors instead. + atexit(showWarnings); +#endif + +#if defined (Q_WS_X11) || defined (Q_WS_MAC) + //### default to using raster graphics backend for now + bool gsSpecified = false; + for (int i = 0; i < argc; ++i) { + QString arg = argv[i]; + if (arg == "-graphicssystem") { + gsSpecified = true; + break; + } + } + + if (!gsSpecified) + QApplication::setGraphicsSystem("raster"); +#endif + + QApplication app(argc, argv); + app.setApplicationName("QtQmlViewer"); + app.setOrganizationName("Nokia"); + app.setOrganizationDomain("nokia.com"); + + QDeclarativeViewer::registerTypes(); + QDeclarativeTester::registerTypes(); + + bool frameless = false; + QString fileName; + double fps = 0; + int autorecord_from = 0; + int autorecord_to = 0; + QString dither = "none"; + QString recordfile; + QStringList recordargs; + QStringList imports; + QStringList plugins; + QString script; + QString scriptopts; + bool runScript = false; + bool devkeys = false; + int cache = 0; + QString translationFile; + bool useGL = false; + bool fullScreen = false; + bool stayOnTop = false; + bool maximized = false; + bool useNativeFileBrowser = true; + bool experimentalGestures = false; + bool designModeBehavior = false; + bool debuggerModeBehavior = false; + + WarningsConfig warningsConfig = DefaultWarnings; + bool sizeToView = true; + +#if defined(Q_OS_SYMBIAN) + maximized = true; + useNativeFileBrowser = false; +#endif + +#if defined(Q_WS_MAC) + useGL = true; +#endif + + for (int i = 1; i < argc; ++i) { + bool lastArg = (i == argc - 1); + QString arg = argv[i]; + if (arg == "-frameless") { + frameless = true; + } else if (arg == "-maximized") { + maximized = true; + } else if (arg == "-fullscreen") { + fullScreen = true; + } else if (arg == "-stayontop") { + stayOnTop = true; + } else if (arg == "-netcache") { + if (lastArg) usage(); + cache = QString(argv[++i]).toInt(); + } else if (arg == "-recordrate") { + if (lastArg) usage(); + fps = QString(argv[++i]).toDouble(); + } else if (arg == "-recordfile") { + if (lastArg) usage(); + recordfile = QString(argv[++i]); + } else if (arg == "-record") { + if (lastArg) usage(); + recordargs << QString(argv[++i]); + } else if (arg == "-recorddither") { + if (lastArg) usage(); + dither = QString(argv[++i]); + } else if (arg == "-autorecord") { + if (lastArg) usage(); + QString range = QString(argv[++i]); + int dash = range.indexOf('-'); + if (dash > 0) + autorecord_from = range.left(dash).toInt(); + autorecord_to = range.mid(dash+1).toInt(); + } else if (arg == "-devicekeys") { + devkeys = true; + } else if (arg == "-dragthreshold") { + if (lastArg) usage(); + app.setStartDragDistance(QString(argv[++i]).toInt()); + } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { + qWarning("Qt QML Viewer version %s", QT_VERSION_STR); + exit(0); + } else if (arg == "-translation") { + if (lastArg) usage(); + translationFile = argv[++i]; + } else if (arg == "-opengl") { + useGL = true; + } else if (arg == "-qmlbrowser") { + useNativeFileBrowser = false; + } else if (arg == "-warnings") { + if (lastArg) usage(); + QString warningsStr = QString(argv[++i]); + if (warningsStr == QLatin1String("show")) { + warningsConfig = ShowWarnings; + } else if (warningsStr == QLatin1String("hide")) { + warningsConfig = HideWarnings; + } else { + usage(); + } + } else if (arg == "-I" || arg == "-L") { + if (arg == "-L") + qWarning("-L option provided for compatibility only, use -I instead"); + if (lastArg) { + QDeclarativeEngine tmpEngine; + QString paths = tmpEngine.importPathList().join(QLatin1String(":")); + qWarning("Current search path: %s", paths.toLocal8Bit().constData()); + exit(0); + } + imports << QString(argv[++i]); + } else if (arg == "-P") { + if (lastArg) usage(); + plugins << QString(argv[++i]); + } else if (arg == "-script") { + if (lastArg) usage(); + script = QString(argv[++i]); + } else if (arg == "-scriptopts") { + if (lastArg) usage(); + scriptopts = QString(argv[++i]); + } else if (arg == "-savescript") { + if (lastArg) usage(); + script = QString(argv[++i]); + runScript = false; + } else if (arg == "-playscript") { + if (lastArg) usage(); + script = QString(argv[++i]); + runScript = true; + } else if (arg == "-sizeviewtorootobject") { + sizeToView = false; + } else if (arg == "-sizerootobjecttoview") { + sizeToView = true; + } else if (arg == "-experimentalgestures") { + experimentalGestures = true; + } else if (arg == "-designmode") { + designModeBehavior = true; + } else if (arg == "-debugger") { + debuggerModeBehavior = true; + } else if (arg[0] != '-') { + fileName = arg; + } else if (1 || arg == "-help") { + usage(); + } + } + + QTranslator qmlTranslator; + if (!translationFile.isEmpty()) { + qmlTranslator.load(translationFile); + app.installTranslator(&qmlTranslator); + } + + Qt::WFlags wflags = (frameless ? Qt::FramelessWindowHint : Qt::Widget); + if (stayOnTop) + wflags |= Qt::WindowStaysOnTopHint; + + QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags); + viewer->setAttribute(Qt::WA_DeleteOnClose, true); + if (!scriptopts.isEmpty()) { + QStringList options = + scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); + + QDeclarativeViewer::ScriptOptions scriptOptions = 0; + for (int i = 0; i < options.count(); ++i) { + const QString &option = options.at(i); + if (option == QLatin1String("help")) { + scriptOptsUsage(); + } else if (option == QLatin1String("play")) { + scriptOptions |= QDeclarativeViewer::Play; + } else if (option == QLatin1String("record")) { + scriptOptions |= QDeclarativeViewer::Record; + } else if (option == QLatin1String("testimages")) { + scriptOptions |= QDeclarativeViewer::TestImages; + } else if (option == QLatin1String("testerror")) { + scriptOptions |= QDeclarativeViewer::TestErrorProperty; + } else if (option == QLatin1String("exitoncomplete")) { + scriptOptions |= QDeclarativeViewer::ExitOnComplete; + } else if (option == QLatin1String("exitonfailure")) { + scriptOptions |= QDeclarativeViewer::ExitOnFailure; + } else if (option == QLatin1String("saveonexit")) { + scriptOptions |= QDeclarativeViewer::SaveOnExit; + } else if (option == QLatin1String("snapshot")) { + scriptOptions |= QDeclarativeViewer::Snapshot; + } else { + scriptOptsUsage(); + } + } + + if (script.isEmpty()) + usage(); + + if (!(scriptOptions & QDeclarativeViewer::Record) && !(scriptOptions & QDeclarativeViewer::Play)) + scriptOptsUsage(); + viewer->setScriptOptions(scriptOptions); + viewer->setScript(script); + } else if (!script.isEmpty()) { + usage(); + } + +#if !defined(Q_OS_SYMBIAN) + logger = viewer->warningsWidget(); + if (warningsConfig == ShowWarnings) { + logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings); + logger.data()->show(); + } else if (warningsConfig == HideWarnings){ + logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); + } +#endif + + if (experimentalGestures) + viewer->enableExperimentalGestures(); + + viewer->setDesignModeBehavior(designModeBehavior); + + // FIXME debug mode is always on for qml observer + debuggerModeBehavior = true; + viewer->setDebugMode(debuggerModeBehavior); + + foreach (QString lib, imports) + viewer->addLibraryPath(lib); + + foreach (QString plugin, plugins) + viewer->addPluginPath(plugin); + + viewer->setNetworkCacheSize(cache); + viewer->setRecordFile(recordfile); + viewer->setSizeToView(sizeToView); + if (fps>0) + viewer->setRecordRate(fps); + if (autorecord_to) + viewer->setAutoRecord(autorecord_from,autorecord_to); + if (devkeys) + viewer->setDeviceKeys(true); + viewer->setRecordDither(dither); + if (recordargs.count()) + viewer->setRecordArgs(recordargs); + + viewer->setUseNativeFileBrowser(useNativeFileBrowser); + if (fullScreen && maximized) + qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen."; + + if (fileName.isEmpty()) { + QFile qmlapp(QLatin1String("qmlapp")); + if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) { + QString content = QString::fromUtf8(qmlapp.readAll()); + qmlapp.close(); + + int newline = content.indexOf(QLatin1Char('\n')); + if (newline >= 0) + fileName = content.left(newline); + else + fileName = content; + } + } + + if (!fileName.isEmpty()) { + viewer->open(fileName); + fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); + } else { + if (!useNativeFileBrowser) + viewer->openFile(); + fullScreen ? viewer->showFullScreen() : maximized ? viewer->showMaximized() : viewer->show(); + if (useNativeFileBrowser) + viewer->openFile(); + } + viewer->setUseGL(useGL); + viewer->raise(); + + return app.exec(); +} diff --git a/share/qtcreator/qml/qmlobserver/proxysettings.cpp b/share/qtcreator/qml/qmlobserver/proxysettings.cpp new file mode 100644 index 0000000000..ffaa4c0a29 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/proxysettings.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QIntValidator> +#include <QSettings> + +#include "proxysettings.h" + +QT_BEGIN_NAMESPACE + +ProxySettings::ProxySettings (QWidget * parent) + : QDialog (parent), Ui::ProxySettings() +{ + setupUi (this); + +#if !defined Q_WS_MAEMO_5 + // the onscreen keyboard can't cope with masks + proxyServerEdit->setInputMask ("000.000.000.000;_"); +#endif + QIntValidator *validator = new QIntValidator (0, 9999, this); + proxyPortEdit->setValidator (validator); + + QSettings settings; + proxyCheckBox->setChecked (settings.value ("http_proxy/use", 0).toBool ()); + proxyServerEdit->insert (settings.value ("http_proxy/hostname", "").toString ()); + proxyPortEdit->insert (settings.value ("http_proxy/port", "80").toString ()); + usernameEdit->insert (settings.value ("http_proxy/username", "").toString ()); + passwordEdit->insert (settings.value ("http_proxy/password", "").toString ()); +} + +ProxySettings::~ProxySettings() +{ +} + +void ProxySettings::accept () +{ + QSettings settings; + + settings.setValue ("http_proxy/use", proxyCheckBox->isChecked ()); + settings.setValue ("http_proxy/hostname", proxyServerEdit->text ()); + settings.setValue ("http_proxy/port", proxyPortEdit->text ()); + settings.setValue ("http_proxy/username", usernameEdit->text ()); + settings.setValue ("http_proxy/password", passwordEdit->text ()); + + QDialog::accept (); +} + +QNetworkProxy ProxySettings::httpProxy () +{ + QSettings settings; + QNetworkProxy proxy; + + bool proxyInUse = settings.value ("http_proxy/use", 0).toBool (); + if (proxyInUse) { + proxy.setType (QNetworkProxy::HttpProxy); + proxy.setHostName (settings.value ("http_proxy/hostname", "").toString ());// "192.168.220.5" + proxy.setPort (settings.value ("http_proxy/port", 80).toInt ()); // 8080 + proxy.setUser (settings.value ("http_proxy/username", "").toString ()); + proxy.setPassword (settings.value ("http_proxy/password", "").toString ()); + //QNetworkProxy::setApplicationProxy (proxy); + } + else { + proxy.setType (QNetworkProxy::NoProxy); + } + return proxy; +} + +bool ProxySettings::httpProxyInUse() +{ + QSettings settings; + return settings.value ("http_proxy/use", 0).toBool (); +} + +QT_END_NAMESPACE diff --git a/share/qtcreator/qml/qmlobserver/proxysettings.h b/share/qtcreator/qml/qmlobserver/proxysettings.h new file mode 100644 index 0000000000..5d4d137a99 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/proxysettings.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PROXYSETTINGS_H +#define PROXYSETTINGS_H + +#include <QDialog> +#include <QNetworkProxy> +#ifdef Q_WS_MAEMO_5 +#include "ui_proxysettings_maemo5.h" +#else +#include "ui_proxysettings.h" +#endif + +QT_BEGIN_NAMESPACE +/** +*/ +class ProxySettings : public QDialog, public Ui::ProxySettings +{ + +Q_OBJECT + +public: + ProxySettings(QWidget * parent = 0); + + ~ProxySettings(); + + static QNetworkProxy httpProxy (); + static bool httpProxyInUse (); + +public slots: + virtual void accept (); +}; + +QT_END_NAMESPACE + +#endif // PROXYSETTINGS_H diff --git a/share/qtcreator/qml/qmlobserver/proxysettings.ui b/share/qtcreator/qml/qmlobserver/proxysettings.ui new file mode 100644 index 0000000000..84e39fe03d --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/proxysettings.ui @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ProxySettings</class> + <widget class="QDialog" name="ProxySettings"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>318</width> + <height>199</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QCheckBox" name="proxyCheckBox"> + <property name="text"> + <string>Use http proxy</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="serverAddressLabel"> + <property name="text"> + <string>Server Address:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="proxyServerEdit"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Port:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="proxyPortEdit"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="usernameLabel"> + <property name="text"> + <string>Username:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="usernameEdit"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="passwordLabel"> + <property name="text"> + <string>Password:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="passwordEdit"> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>ProxySettings</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>ProxySettings</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui b/share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui new file mode 100644 index 0000000000..83f0c2a9de --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ProxySettings</class> + <widget class="QDialog" name="ProxySettings"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>449</width> + <height>164</height> + </rect> + </property> + <property name="windowTitle"> + <string>HTTP Proxy</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>16</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>16</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="horizontalSpacing"> + <number>16</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QCheckBox" name="proxyCheckBox"> + <property name="text"> + <string>Use HTTP Proxy</string> + </property> + </widget> + </item> + <item row="0" column="1" rowspan="2"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" rowspan="2"> + <widget class="QWidget" name="widget" native="true"> + <layout class="QGridLayout" name="gridLayout"> + <property name="horizontalSpacing"> + <number>16</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="serverAddressLabel"> + <property name="text"> + <string>Server</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="proxyServerEdit"> + <property name="placeholderText"> + <string>Name or IP</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Port</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="proxyPortEdit"> + <property name="text"> + <string>8080</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="usernameLabel"> + <property name="text"> + <string>Username</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="usernameEdit"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="passwordLabel"> + <property name="text"> + <string>Password</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="passwordEdit"> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>proxyCheckBox</tabstop> + <tabstop>proxyServerEdit</tabstop> + <tabstop>proxyPortEdit</tabstop> + <tabstop>usernameEdit</tabstop> + <tabstop>passwordEdit</tabstop> + <tabstop>buttonBox</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>ProxySettings</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>318</x> + <y>100</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>116</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>ProxySettings</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>318</x> + <y>100</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>116</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp b/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp new file mode 100644 index 0000000000..14918b2380 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp @@ -0,0 +1,407 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qdeclarativetester.h> +#include <QDebug> +#include <QApplication> +#include <qdeclarativeview.h> +#include <QFile> +#include <QDeclarativeComponent> +#include <QDir> +#include <QCryptographicHash> +#include <private/qabstractanimation_p.h> +#include <private/qdeclarativeitem_p.h> + +QT_BEGIN_NAMESPACE + + +QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, + QDeclarativeView *parent) +: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), + testscript(0), hasCompleted(false), hasFailed(false) +{ + parent->viewport()->installEventFilter(this); + parent->installEventFilter(this); + QUnifiedTimer::instance()->setConsistentTiming(true); + if (options & QDeclarativeViewer::Play) + this->run(); + start(); +} + +QDeclarativeTester::~QDeclarativeTester() +{ + if (!hasFailed && + options & QDeclarativeViewer::Record && + options & QDeclarativeViewer::SaveOnExit) + save(); +} + +int QDeclarativeTester::duration() const +{ + return -1; +} + +void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me) +{ + MouseEvent e(me); + e.destination = dest; + m_mouseEvents << e; +} + +void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke) +{ + KeyEvent e(ke); + e.destination = dest; + m_keyEvents << e; +} + +bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e) +{ + if (!filterEvents) + return false; + + Destination destination; + if (o == m_view) { + destination = View; + } else if (o == m_view->viewport()) { + destination = ViewPort; + } else { + return false; + } + + switch (e->type()) { + case QEvent::KeyPress: + case QEvent::KeyRelease: + addKeyEvent(destination, (QKeyEvent *)e); + return true; + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + case QEvent::MouseButtonDblClick: + addMouseEvent(destination, (QMouseEvent *)e); + return true; + default: + break; + } + return false; +} + +void QDeclarativeTester::executefailure() +{ + hasFailed = true; + + if (options & QDeclarativeViewer::ExitOnFailure) + exit(-1); +} + +void QDeclarativeTester::imagefailure() +{ + hasFailed = true; + + if (options & QDeclarativeViewer::ExitOnFailure) + exit(-1); +} + +void QDeclarativeTester::complete() +{ + if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) { + QString e = m_view->rootObject()->property("error").toString(); + if (!e.isEmpty()) { + qWarning() << "Test failed:" << e; + hasFailed = true; + } + } + if (options & QDeclarativeViewer::ExitOnComplete) + QApplication::exit(hasFailed?-1:0); + + if (hasCompleted) + return; + hasCompleted = true; + + if (options & QDeclarativeViewer::Play) + qWarning("Script playback complete"); +} + +void QDeclarativeTester::run() +{ + QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml")); + + testscript = qobject_cast<QDeclarativeVisualTest *>(c.create()); + if (testscript) testscript->setParent(this); + else { executefailure(); exit(-1); } + testscriptidx = 0; +} + +void QDeclarativeTester::save() +{ + QString filename = m_script + QLatin1String(".qml"); + QFileInfo filenameInfo(filename); + QDir saveDir = filenameInfo.absoluteDir(); + saveDir.mkpath("."); + + QFile file(filename); + file.open(QIODevice::WriteOnly); + QTextStream ts(&file); + + ts << "import Qt.VisualTest 4.7\n\n"; + ts << "VisualTest {\n"; + + int imgCount = 0; + QList<KeyEvent> keyevents = m_savedKeyEvents; + QList<MouseEvent> mouseevents = m_savedMouseEvents; + for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) { + const FrameEvent &fe = m_savedFrameEvents.at(ii); + ts << " Frame {\n"; + ts << " msec: " << fe.msec << "\n"; + if (!fe.hash.isEmpty()) { + ts << " hash: \"" << fe.hash.toHex() << "\"\n"; + } else if (!fe.image.isNull()) { + QString filename = filenameInfo.baseName() + "." + QString::number(imgCount) + ".png"; + fe.image.save(m_script + "." + QString::number(imgCount) + ".png"); + imgCount++; + ts << " image: \"" << filename << "\"\n"; + } + ts << " }\n"; + + while (!mouseevents.isEmpty() && + mouseevents.first().msec == fe.msec) { + MouseEvent me = mouseevents.takeFirst(); + + ts << " Mouse {\n"; + ts << " type: " << me.type << "\n"; + ts << " button: " << me.button << "\n"; + ts << " buttons: " << me.buttons << "\n"; + ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n"; + ts << " modifiers: " << me.modifiers << "\n"; + if (me.destination == ViewPort) + ts << " sendToViewport: true\n"; + ts << " }\n"; + } + + while (!keyevents.isEmpty() && + keyevents.first().msec == fe.msec) { + KeyEvent ke = keyevents.takeFirst(); + + ts << " Key {\n"; + ts << " type: " << ke.type << "\n"; + ts << " key: " << ke.key << "\n"; + ts << " modifiers: " << ke.modifiers << "\n"; + ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n"; + ts << " autorep: " << (ke.autorep?"true":"false") << "\n"; + ts << " count: " << ke.count << "\n"; + if (ke.destination == ViewPort) + ts << " sendToViewport: true\n"; + ts << " }\n"; + } + } + + ts << "}\n"; + file.close(); +} + +void QDeclarativeTester::updateCurrentTime(int msec) +{ + QDeclarativeItemPrivate::setConsistentTime(msec); + if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot) + return; + + QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); + + if (options & QDeclarativeViewer::TestImages) { + img.fill(qRgb(255,255,255)); + QPainter p(&img); + m_view->render(&p); + } + + bool snapshot = msec == 16 && (options & QDeclarativeViewer::Snapshot + || (testscript && testscript->count() == 2)); + + FrameEvent fe; + fe.msec = msec; + if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { + // Skip first frame, skip if not doing images + } else if (0 == (m_savedFrameEvents.count() % 60) || snapshot) { + fe.image = img; + } else { + QCryptographicHash hash(QCryptographicHash::Md5); + hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height()); + fe.hash = hash.result(); + } + m_savedFrameEvents.append(fe); + + // Deliver mouse events + filterEvents = false; + + if (!testscript) { + for (int ii = 0; ii < m_mouseEvents.count(); ++ii) { + MouseEvent &me = m_mouseEvents[ii]; + me.msec = msec; + QMouseEvent event(me.type, me.pos, me.button, me.buttons, me.modifiers); + + if (me.destination == View) { + QCoreApplication::sendEvent(m_view, &event); + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + } + } + + for (int ii = 0; ii < m_keyEvents.count(); ++ii) { + KeyEvent &ke = m_keyEvents[ii]; + ke.msec = msec; + QKeyEvent event(ke.type, ke.key, ke.modifiers, ke.text, ke.autorep, ke.count); + + if (ke.destination == View) { + QCoreApplication::sendEvent(m_view, &event); + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + } + } + m_savedMouseEvents.append(m_mouseEvents); + m_savedKeyEvents.append(m_keyEvents); + } + + m_mouseEvents.clear(); + m_keyEvents.clear(); + + // Advance test script + while (testscript && testscript->count() > testscriptidx) { + + QObject *event = testscript->event(testscriptidx); + + if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) { + if (frame->msec() < msec) { + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Extra frame. Seen:" + << msec << "Expected:" << frame->msec(); + imagefailure(); + } + } else if (frame->msec() == msec) { + if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { + qWarning() << "QDeclarativeTester: Mismatched frame hash at" << msec + << ". Seen:" << fe.hash.toHex() + << "Expected:" << frame->hash().toUtf8(); + imagefailure(); + } + } + } else if (frame->msec() > msec) { + break; + } + + if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { + QImage goodImage(frame->image().toLocalFile()); + if (goodImage != img) { + QString reject(frame->image().toLocalFile() + ".reject.png"); + qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:" + << reject; + img.save(reject); + bool doDiff = (goodImage.size() == img.size()); + if (doDiff) { + QImage diffimg(m_view->width(), m_view->height(), QImage::Format_RGB32); + diffimg.fill(qRgb(255,255,255)); + QPainter p(&diffimg); + int diffCount = 0; + for (int x = 0; x < img.width(); ++x) { + for (int y = 0; y < img.height(); ++y) { + if (goodImage.pixel(x,y) != img.pixel(x,y)) { + ++diffCount; + p.drawPoint(x,y); + } + } + } + QString diff(frame->image().toLocalFile() + ".diff.png"); + diffimg.save(diff); + qWarning().nospace() << " Diff (" << diffCount << " pixels differed) saved to: " << diff; + } + imagefailure(); + } + } + } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast<QDeclarativeVisualTestMouse *>(event)) { + QPoint pos(mouse->x(), mouse->y()); + QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; + QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); + + MouseEvent me(&event); + me.msec = msec; + if (!mouse->sendToViewport()) { + QCoreApplication::sendEvent(m_view, &event); + me.destination = View; + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + me.destination = ViewPort; + } + m_savedMouseEvents.append(me); + } else if (QDeclarativeVisualTestKey *key = qobject_cast<QDeclarativeVisualTestKey *>(event)) { + + QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); + + KeyEvent ke(&event); + ke.msec = msec; + if (!key->sendToViewport()) { + QCoreApplication::sendEvent(m_view, &event); + ke.destination = View; + } else { + QCoreApplication::sendEvent(m_view->viewport(), &event); + ke.destination = ViewPort; + } + m_savedKeyEvents.append(ke); + } + testscriptidx++; + } + + filterEvents = true; + + if (testscript && testscript->count() <= testscriptidx) { + //if (msec == 16) //for a snapshot, leave it up long enough to see + // (void)::sleep(1); + complete(); + } +} + +void QDeclarativeTester::registerTypes() +{ + qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,7, "VisualTest"); + qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,7, "Frame"); + qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,7, "Mouse"); + qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,7, "Key"); +} + +QT_END_NAMESPACE diff --git a/share/qtcreator/qml/qmlobserver/qdeclarativetester.h b/share/qtcreator/qml/qmlobserver/qdeclarativetester.h new file mode 100644 index 0000000000..021869d93a --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qdeclarativetester.h @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVETESTER_H +#define QDECLARATIVETESTER_H + +#include <QEvent> +#include <QMouseEvent> +#include <QKeyEvent> +#include <QImage> +#include <QUrl> +#include <qmlruntime.h> +#include <qdeclarativelist.h> +#include <qdeclarative.h> +#include <QAbstractAnimation> + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTest : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<QObject> events READ events CONSTANT) + Q_CLASSINFO("DefaultProperty", "events") +public: + QDeclarativeVisualTest() {} + + QDeclarativeListProperty<QObject> events() { return QDeclarativeListProperty<QObject>(this, m_events); } + + int count() const { return m_events.count(); } + QObject *event(int idx) { return m_events.at(idx); } + +private: + QList<QObject *> m_events; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTest) + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTestFrame : public QObject +{ + Q_OBJECT + Q_PROPERTY(int msec READ msec WRITE setMsec) + Q_PROPERTY(QString hash READ hash WRITE setHash) + Q_PROPERTY(QUrl image READ image WRITE setImage) +public: + QDeclarativeVisualTestFrame() : m_msec(-1) {} + + int msec() const { return m_msec; } + void setMsec(int m) { m_msec = m; } + + QString hash() const { return m_hash; } + void setHash(const QString &hash) { m_hash = hash; } + + QUrl image() const { return m_image; } + void setImage(const QUrl &image) { m_image = image; } + +private: + int m_msec; + QString m_hash; + QUrl m_image; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTestFrame) + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTestMouse : public QObject +{ + Q_OBJECT + Q_PROPERTY(int type READ type WRITE setType) + Q_PROPERTY(int button READ button WRITE setButton) + Q_PROPERTY(int buttons READ buttons WRITE setButtons) + Q_PROPERTY(int x READ x WRITE setX) + Q_PROPERTY(int y READ y WRITE setY) + Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) + Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) +public: + QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} + + int type() const { return m_type; } + void setType(int t) { m_type = t; } + + int button() const { return m_button; } + void setButton(int b) { m_button = b; } + + int buttons() const { return m_buttons; } + void setButtons(int b) { m_buttons = b; } + + int x() const { return m_x; } + void setX(int x) { m_x = x; } + + int y() const { return m_y; } + void setY(int y) { m_y = y; } + + int modifiers() const { return m_modifiers; } + void setModifiers(int modifiers) { m_modifiers = modifiers; } + + bool sendToViewport() const { return m_viewport; } + void setSendToViewport(bool v) { m_viewport = v; } +private: + int m_type; + int m_button; + int m_buttons; + int m_x; + int m_y; + int m_modifiers; + bool m_viewport; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTestMouse) + +QT_BEGIN_NAMESPACE + +class QDeclarativeVisualTestKey : public QObject +{ + Q_OBJECT + Q_PROPERTY(int type READ type WRITE setType) + Q_PROPERTY(int key READ key WRITE setKey) + Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(bool autorep READ autorep WRITE setAutorep) + Q_PROPERTY(int count READ count WRITE setCount) + Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) +public: + QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} + + int type() const { return m_type; } + void setType(int t) { m_type = t; } + + int key() const { return m_key; } + void setKey(int k) { m_key = k; } + + int modifiers() const { return m_modifiers; } + void setModifiers(int m) { m_modifiers = m; } + + QString text() const { return m_text; } + void setText(const QString &t) { m_text = t; } + + bool autorep() const { return m_autorep; } + void setAutorep(bool a) { m_autorep = a; } + + int count() const { return m_count; } + void setCount(int c) { m_count = c; } + + bool sendToViewport() const { return m_viewport; } + void setSendToViewport(bool v) { m_viewport = v; } +private: + int m_type; + int m_key; + int m_modifiers; + QString m_text; + bool m_autorep; + int m_count; + bool m_viewport; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeVisualTestKey) + +QT_BEGIN_NAMESPACE + +class QDeclarativeTester : public QAbstractAnimation +{ +public: + QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent); + ~QDeclarativeTester(); + + static void registerTypes(); + + virtual int duration() const; + + void run(); + void save(); + + void executefailure(); +protected: + virtual void updateCurrentTime(int msecs); + virtual bool eventFilter(QObject *, QEvent *); + +private: + QString m_script; + + void imagefailure(); + void complete(); + + enum Destination { View, ViewPort }; + void addKeyEvent(Destination, QKeyEvent *); + void addMouseEvent(Destination, QMouseEvent *); + QDeclarativeView *m_view; + + struct MouseEvent { + MouseEvent(QMouseEvent *e) + : type(e->type()), button(e->button()), buttons(e->buttons()), + pos(e->pos()), modifiers(e->modifiers()), destination(View) {} + + QEvent::Type type; + Qt::MouseButton button; + Qt::MouseButtons buttons; + QPoint pos; + Qt::KeyboardModifiers modifiers; + Destination destination; + + int msec; + }; + struct KeyEvent { + KeyEvent(QKeyEvent *e) + : type(e->type()), key(e->key()), modifiers(e->modifiers()), text(e->text()), + autorep(e->isAutoRepeat()), count(e->count()), destination(View) {} + QEvent::Type type; + int key; + Qt::KeyboardModifiers modifiers; + QString text; + bool autorep; + ushort count; + Destination destination; + + int msec; + }; + struct FrameEvent { + QImage image; + QByteArray hash; + int msec; + }; + QList<MouseEvent> m_mouseEvents; + QList<KeyEvent> m_keyEvents; + + QList<MouseEvent> m_savedMouseEvents; + QList<KeyEvent> m_savedKeyEvents; + QList<FrameEvent> m_savedFrameEvents; + bool filterEvents; + + QDeclarativeViewer::ScriptOptions options; + int testscriptidx; + QDeclarativeVisualTest *testscript; + + bool hasCompleted; + bool hasFailed; +}; + + +QT_END_NAMESPACE + +#endif // QDECLARATIVETESTER_H diff --git a/share/qtcreator/qml/qmlobserver/qml.icns b/share/qtcreator/qml/qmlobserver/qml.icns Binary files differnew file mode 100644 index 0000000000..c76051626a --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qml.icns diff --git a/share/qtcreator/qml/qmlobserver/qml.pri b/share/qtcreator/qml/qmlobserver/qml.pri new file mode 100644 index 0000000000..2016513f4e --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qml.pri @@ -0,0 +1,38 @@ +QT += declarative script network sql + +contains(QT_CONFIG, opengl) { + QT += opengl + DEFINES += GL_SUPPORTED +} + +INCLUDEPATH += $$PWD + +HEADERS += $$PWD/qmlruntime.h \ + $$PWD/proxysettings.h \ + $$PWD/qdeclarativetester.h \ + $$PWD/deviceorientation.h \ + $$PWD/loggerwidget.h \ + $$PWD/crumblepath.h + + +SOURCES += $$PWD/qmlruntime.cpp \ + $$PWD/proxysettings.cpp \ + $$PWD/qdeclarativetester.cpp \ + $$PWD/loggerwidget.cpp \ + $$PWD/crumblepath.cpp + +RESOURCES += $$PWD/qmlruntime.qrc + +OTHER_FILES += toolbarstyle.css + +maemo5 { + QT += dbus + HEADERS += $$PWD/texteditautoresizer_maemo5.h + SOURCES += $$PWD/deviceorientation_maemo5.cpp + FORMS += $$PWD/recopts_maemo5.ui \ + $$PWD/proxysettings_maemo5.ui +} else { + SOURCES += $$PWD/deviceorientation.cpp + FORMS += $$PWD/recopts.ui \ + $$PWD/proxysettings.ui +} diff --git a/share/qtcreator/qml/qmlobserver/qmlobserver.pro b/share/qtcreator/qml/qmlobserver/qmlobserver.pro new file mode 100644 index 0000000000..e4f765c21d --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qmlobserver.pro @@ -0,0 +1,24 @@ +TEMPLATE = app +DEFINES += QMLOBSERVER + +include(qml.pri) + +SOURCES += main.cpp + +exists($$PWD/qmljsdebugger/qmljsdebugger-lib.pri) { +# for building helpers within QT_INSTALL_DATA, we deploy the lib inside the observer directory. + include($$PWD/qmljsdebugger/qmljsdebugger-lib.pri) +} else { + include($$PWD/../qmljsdebugger/qmljsdebugger-lib.pri) +} + +DESTDIR = $$IDE_BIN_PATH + +mac { + QMAKE_INFO_PLIST=Info_mac.plist + TARGET=QMLObserver + ICON=qml.icns +} else { + TARGET=qmlobserver +} + diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp new file mode 100644 index 0000000000..140aee7084 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp @@ -0,0 +1,1581 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qdeclarativeview.h> + +#ifdef hz +#undef hz +#endif +#ifdef Q_WS_MAEMO_5 +# include <QMaemo5ValueButton> +# include <QMaemo5ListPickSelector> +# include <QWidgetAction> +# include <QStringListModel> +# include "ui_recopts_maemo5.h" +#else +# include "ui_recopts.h" +#endif + +#include <qdeclarativeviewobserver.h> +#include <qdeclarativeobserverservice.h> + +#include "crumblepath.h" +#include "qmlruntime.h" +#include <qdeclarativecontext.h> +#include <qdeclarativeengine.h> +#include <qdeclarativenetworkaccessmanagerfactory.h> +#include "qdeclarative.h" +#include <QAbstractAnimation> +#include <private/qabstractanimation_p.h> + +#include <QSettings> +#include <QXmlStreamReader> +#include <QBuffer> +#include <QNetworkReply> +#include <QNetworkCookieJar> +#include <QNetworkDiskCache> +#include <QNetworkAccessManager> +#include <QSignalMapper> +#include <QDeclarativeComponent> +#include <QWidget> +#include <QApplication> +#include <QTranslator> +#include <QDir> +#include <QTextBrowser> +#include <QFile> +#include <QFileInfo> +#include <QVBoxLayout> +#include <QProgressDialog> +#include <QProcess> +#include <QMenuBar> +#include <QMenu> +#include <QAction> +#include <QFileDialog> +#include <QTimer> +#include <QGraphicsObject> +#include <QNetworkProxyFactory> +#include <QKeyEvent> +#include <QToolBar> +#include <QMutex> +#include <QMutexLocker> +#include "proxysettings.h" +#include "deviceorientation.h" +#include <QInputDialog> + +#ifdef GL_SUPPORTED +#include <QGLWidget> +#endif + +#include <qdeclarativetester.h> +#include "jsdebuggeragent.h" + +QT_BEGIN_NAMESPACE + +class Runtime : public QObject +{ + Q_OBJECT + + Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged) + Q_PROPERTY(DeviceOrientation::Orientation orientation READ orientation NOTIFY orientationChanged) + +public: + static Runtime* instance() + { + static Runtime *instance = 0; + if (!instance) + instance = new Runtime; + return instance; + } + + bool isActiveWindow() const { return activeWindow; } + void setActiveWindow(bool active) + { + if (active == activeWindow) + return; + activeWindow = active; + emit isActiveWindowChanged(); + } + + DeviceOrientation::Orientation orientation() const { return DeviceOrientation::instance()->orientation(); } + +Q_SIGNALS: + void isActiveWindowChanged(); + void orientationChanged(); + +private: + Runtime(QObject *parent=0) : QObject(parent), activeWindow(false) + { + connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), + this, SIGNAL(orientationChanged())); + } + + bool activeWindow; +}; + + + +#if defined(Q_WS_MAEMO_5) + +class Maemo5PickerAction : public QWidgetAction { + Q_OBJECT +public: + Maemo5PickerAction(const QString &text, QActionGroup *actions, QObject *parent) + : QWidgetAction(parent), m_text(text), m_actions(actions) + { } + + QWidget *createWidget(QWidget *parent) + { + QMaemo5ValueButton *button = new QMaemo5ValueButton(m_text, parent); + button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered); + QMaemo5ListPickSelector *pick = new QMaemo5ListPickSelector(button); + button->setPickSelector(pick); + if (m_actions) { + QStringList sl; + int curIdx = -1, idx = 0; + foreach (QAction *a, m_actions->actions()) { + sl << a->text(); + if (a->isChecked()) + curIdx = idx; + idx++; + } + pick->setModel(new QStringListModel(sl)); + pick->setCurrentIndex(curIdx); + } else { + button->setEnabled(false); + } + connect(pick, SIGNAL(selected(QString)), this, SLOT(emitTriggered())); + return button; + } + +private slots: + void emitTriggered() + { + QMaemo5ListPickSelector *pick = qobject_cast<QMaemo5ListPickSelector *>(sender()); + if (!pick) + return; + int idx = pick->currentIndex(); + + if (m_actions && idx >= 0 && idx < m_actions->actions().count()) + m_actions->actions().at(idx)->trigger(); + } + +private: + QString m_text; + QPointer<QActionGroup> m_actions; +}; + +#endif // Q_WS_MAEMO_5 + +static struct { const char *name, *args; } ffmpegprofiles[] = { + {"Maximum Quality", "-sameq"}, + {"High Quality", "-qmax 2"}, + {"Medium Quality", "-qmax 6"}, + {"Low Quality", "-qmax 16"}, + {"Custom ffmpeg arguments", ""}, + {0,0} +}; + +class RecordingDialog : public QDialog, public Ui::RecordingOptions { + Q_OBJECT + +public: + RecordingDialog(QWidget *parent) : QDialog(parent) + { + setupUi(this); +#ifndef Q_WS_MAEMO_5 + hz->setValidator(new QDoubleValidator(hz)); +#endif + for (int i=0; ffmpegprofiles[i].name; ++i) { + profile->addItem(ffmpegprofiles[i].name); + } + } + + void setArguments(QString a) + { + int i; + for (i=0; ffmpegprofiles[i].args[0]; ++i) { + if (ffmpegprofiles[i].args == a) { + profile->setCurrentIndex(i); + args->setText(QLatin1String(ffmpegprofiles[i].args)); + return; + } + } + customargs = a; + args->setText(a); + profile->setCurrentIndex(i); + } + + QString arguments() const + { + int i = profile->currentIndex(); + return ffmpegprofiles[i].args[0] ? QLatin1String(ffmpegprofiles[i].args) : customargs; + } + + void setOriginalSize(const QSize &s) + { + QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height()); + +#ifdef Q_WS_MAEMO_5 + sizeCombo->setItemText(0, str); +#else + sizeOriginal->setText(str); + if (sizeWidth->value()<=1) { + sizeWidth->setValue(s.width()); + sizeHeight->setValue(s.height()); + } +#endif + } + + void showffmpegOptions(bool b) + { +#ifdef Q_WS_MAEMO_5 + profileLabel->setVisible(b); + profile->setVisible(b); + ffmpegHelp->setVisible(b); + args->setVisible(b); +#else + ffmpegOptions->setVisible(b); +#endif + } + + void showRateOptions(bool b) + { +#ifdef Q_WS_MAEMO_5 + rateLabel->setVisible(b); + rateCombo->setVisible(b); +#else + rateOptions->setVisible(b); +#endif + } + + void setVideoRate(int rate) + { +#ifdef Q_WS_MAEMO_5 + int idx; + if (rate >= 60) + idx = 0; + else if (rate >= 50) + idx = 2; + else if (rate >= 25) + idx = 3; + else if (rate >= 24) + idx = 4; + else if (rate >= 20) + idx = 5; + else if (rate >= 15) + idx = 6; + else + idx = 7; + rateCombo->setCurrentIndex(idx); +#else + if (rate == 24) + hz24->setChecked(true); + else if (rate == 25) + hz25->setChecked(true); + else if (rate == 50) + hz50->setChecked(true); + else if (rate == 60) + hz60->setChecked(true); + else { + hzCustom->setChecked(true); + hz->setText(QString::number(rate)); + } +#endif + } + + int videoRate() const + { +#ifdef Q_WS_MAEMO_5 + switch (rateCombo->currentIndex()) { + case 0: return 60; + case 1: return 50; + case 2: return 25; + case 3: return 24; + case 4: return 20; + case 5: return 15; + case 7: return 10; + default: return 60; + } +#else + if (hz24->isChecked()) + return 24; + else if (hz25->isChecked()) + return 25; + else if (hz50->isChecked()) + return 50; + else if (hz60->isChecked()) + return 60; + else { + return hz->text().toInt(); + } +#endif + } + + QSize videoSize() const + { +#ifdef Q_WS_MAEMO_5 + switch (sizeCombo->currentIndex()) { + case 0: return QSize(); + case 1: return QSize(640,480); + case 2: return QSize(320,240); + case 3: return QSize(1280,720); + default: return QSize(); + } +#else + if (sizeOriginal->isChecked()) + return QSize(); + else if (size720p->isChecked()) + return QSize(1280,720); + else if (sizeVGA->isChecked()) + return QSize(640,480); + else if (sizeQVGA->isChecked()) + return QSize(320,240); + else + return QSize(sizeWidth->value(), sizeHeight->value()); +#endif + } + + + +private slots: + void pickProfile(int i) + { + if (ffmpegprofiles[i].args[0]) { + args->setText(QLatin1String(ffmpegprofiles[i].args)); + } else { + args->setText(customargs); + } + } + + void storeCustomArgs(QString s) + { + setArguments(s); + } + +private: + QString customargs; +}; + +class PersistentCookieJar : public QNetworkCookieJar { +public: + PersistentCookieJar(QObject *parent) : QNetworkCookieJar(parent) { load(); } + ~PersistentCookieJar() { save(); } + + virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const + { + QMutexLocker lock(&mutex); + return QNetworkCookieJar::cookiesForUrl(url); + } + + virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) + { + QMutexLocker lock(&mutex); + return QNetworkCookieJar::setCookiesFromUrl(cookieList, url); + } + +private: + void save() + { + QMutexLocker lock(&mutex); + QList<QNetworkCookie> list = allCookies(); + QByteArray data; + foreach (QNetworkCookie cookie, list) { + if (!cookie.isSessionCookie()) { + data.append(cookie.toRawForm()); + data.append("\n"); + } + } + QSettings settings; + settings.setValue("Cookies",data); + } + + void load() + { + QMutexLocker lock(&mutex); + QSettings settings; + QByteArray data = settings.value("Cookies").toByteArray(); + setAllCookies(QNetworkCookie::parseCookies(data)); + } + + mutable QMutex mutex; +}; + +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +{ +public: + NetworkAccessManagerFactory() : cacheSize(0) {} + ~NetworkAccessManagerFactory() {} + + QNetworkAccessManager *create(QObject *parent); + + void setupProxy(QNetworkAccessManager *nam) + { + class SystemProxyFactory : public QNetworkProxyFactory + { + public: + virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) + { + QString protocolTag = query.protocolTag(); + if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) { + QList<QNetworkProxy> ret; + ret << httpProxy; + return ret; + } +#ifdef Q_OS_WIN + // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) + return QNetworkProxyFactory::proxyForQuery(query); +#else + return QNetworkProxyFactory::systemProxyForQuery(query); +#endif + } + void setHttpProxy (QNetworkProxy proxy) + { + httpProxy = proxy; + httpProxyInUse = true; + } + void unsetHttpProxy () + { + httpProxyInUse = false; + } + private: + bool httpProxyInUse; + QNetworkProxy httpProxy; + }; + + SystemProxyFactory *proxyFactory = new SystemProxyFactory; + if (ProxySettings::httpProxyInUse()) + proxyFactory->setHttpProxy(ProxySettings::httpProxy()); + else + proxyFactory->unsetHttpProxy(); + nam->setProxyFactory(proxyFactory); + } + + void setCacheSize(int size) { + if (size != cacheSize) { + cacheSize = size; + } + } + + static PersistentCookieJar *cookieJar; + QMutex mutex; + int cacheSize; +}; + +PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0; + +static void cleanup_cookieJar() +{ + delete NetworkAccessManagerFactory::cookieJar; + NetworkAccessManagerFactory::cookieJar = 0; +} + +QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) +{ + QMutexLocker lock(&mutex); + QNetworkAccessManager *manager = new QNetworkAccessManager(parent); + if (!cookieJar) { + qAddPostRoutine(cleanup_cookieJar); + cookieJar = new PersistentCookieJar(0); + } + manager->setCookieJar(cookieJar); + cookieJar->setParent(0); + setupProxy(manager); + if (cacheSize > 0) { + QNetworkDiskCache *cache = new QNetworkDiskCache; + cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache")); + cache->setMaximumCacheSize(cacheSize); + manager->setCache(cache); + } else { + manager->setCache(0); + } + qDebug() << "created new network access manager for" << parent; + return manager; +} + +// +// Event filter that ensures the crumble path width is always the canvas width +// +class CrumblePathResizer : public QObject +{ + Q_OBJECT +public: + CrumblePathResizer(CrumblePath *crumblePathWidget, QObject *parent = 0) : + QObject(parent), + m_crumblePathWidget(crumblePathWidget) + { + } + + bool eventFilter(QObject *obj, QEvent *event) + { + if (event->type() == QEvent::Resize) { + QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event); + m_crumblePathWidget->resize(resizeEvent->size().width(), m_crumblePathWidget->height()); + } + return QObject::eventFilter(obj, event); + } + +private: + QWidget *m_crumblePathWidget; +}; + +QString QDeclarativeViewer::getVideoFileName() +{ + QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames"); + QStringList types; + if (ffmpegAvailable) types += tr("Common Video files")+QLatin1String(" (*.avi *.mpeg *.mov)"); + if (convertAvailable) types += tr("GIF Animation")+QLatin1String(" (*.gif)"); + types += tr("Individual PNG frames")+QLatin1String(" (*.png)"); + if (ffmpegAvailable) types += tr("All ffmpeg formats (*.*)"); + return QFileDialog::getSaveFileName(this, title, "", types.join(";; ")); +} + +QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) + : QMainWindow(parent, flags) + , loggerWindow(new LoggerWidget(this)) + , frame_stream(0) + , orientation(0) + , showWarningsWindow(0) + , designModeBehaviorAction(0) + , m_scriptOptions(0) + , tester(0) + , useQmlFileBrowser(true) + , m_centralWidget(0) + , m_crumblePathWidget(0) + , translator(0) +{ + QDeclarativeViewer::registerTypes(); + setWindowTitle(tr("Qt QML Viewer")); +#ifdef Q_WS_MAEMO_5 + setAttribute(Qt::WA_Maemo5StackedWindow); +// setPalette(QApplication::palette("QLabel")); +#endif + + devicemode = false; + canvas = 0; + record_autotime = 0; + record_rate = 50; + record_args += QLatin1String("-sameq"); + + recdlg = new RecordingDialog(this); + connect(recdlg->pickfile, SIGNAL(clicked()), this, SLOT(pickRecordingFile())); + senseFfmpeg(); + senseImageMagick(); + if (!ffmpegAvailable) + recdlg->showffmpegOptions(false); + if (!ffmpegAvailable && !convertAvailable) + recdlg->showRateOptions(false); + QString warn; + if (!ffmpegAvailable) { + if (!convertAvailable) + warn = tr("ffmpeg and ImageMagick not available - no video output"); + else + warn = tr("ffmpeg not available - GIF and PNG outputs only"); + recdlg->warning->setText(warn); + } else { + recdlg->warning->hide(); + } + + canvas = new QDeclarativeView(this); + observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this); + if (!(flags & Qt::FramelessWindowHint)) { + m_crumblePathWidget = new CrumblePath(canvas); +#ifndef Q_WS_MAC + m_crumblePathWidget->setStyleSheet("QWidget { border-bottom: 1px solid black; }"); +#endif + m_crumblePathWidget->setVisible(observer->designModeBehavior()); + + // CrumblePath is not in a layout, so that it overlays the central widget + // The event filter ensures that its width stays in sync nevertheless + CrumblePathResizer *resizer = new CrumblePathResizer(m_crumblePathWidget, m_crumblePathWidget); + canvas->installEventFilter(resizer); + } + + m_centralWidget = new QWidget(this); + QVBoxLayout *layout = new QVBoxLayout(m_centralWidget); + layout->setMargin(0); + layout->setSpacing(0); + + + layout->addWidget(canvas); + m_centralWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + + canvas->setAttribute(Qt::WA_OpaquePaintEvent); + canvas->setAttribute(Qt::WA_NoSystemBackground); + + canvas->setFocus(); + + QObject::connect(observer, SIGNAL(reloadRequested()), this, SLOT(reload())); + QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); + QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); + if (m_crumblePathWidget) { + QObject::connect(observer, SIGNAL(inspectorContextCleared()), m_crumblePathWidget, SLOT(clear())); + QObject::connect(observer, SIGNAL(inspectorContextPushed(QString)), m_crumblePathWidget, SLOT(pushElement(QString))); + QObject::connect(observer, SIGNAL(inspectorContextPopped()), m_crumblePathWidget, SLOT(popElement())); + QObject::connect(m_crumblePathWidget, SIGNAL(elementClicked(int)), observer, SLOT(setObserverContext(int))); + QObject::connect(observer, SIGNAL(designModeBehaviorChanged(bool)), m_crumblePathWidget, SLOT(setVisible(bool))); + } + QObject::connect(canvas->engine(), SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit())); + + QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened())); + QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed())); + + if (!(flags & Qt::FramelessWindowHint)) { + createMenu(); + changeOrientation(orientation->actions().value(0)); + } else { + setMenuBar(0); + } + + setCentralWidget(m_centralWidget); + + namFactory = new NetworkAccessManagerFactory; + canvas->engine()->setNetworkAccessManagerFactory(namFactory); + + connect(&autoStartTimer, SIGNAL(timeout()), this, SLOT(autoStartRecording())); + connect(&autoStopTimer, SIGNAL(timeout()), this, SLOT(autoStopRecording())); + connect(&recordTimer, SIGNAL(timeout()), this, SLOT(recordFrame())); + connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), + this, SLOT(orientationChanged()), Qt::QueuedConnection); + autoStartTimer.setSingleShot(true); + autoStopTimer.setSingleShot(true); + recordTimer.setSingleShot(false); + + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(appAboutToQuit())); +} + +QDeclarativeViewer::~QDeclarativeViewer() +{ + delete loggerWindow; + canvas->engine()->setNetworkAccessManagerFactory(0); + delete namFactory; +} + +void QDeclarativeViewer::setDesignModeBehavior(bool value) +{ + if (designModeBehaviorAction) + designModeBehaviorAction->setChecked(value); + observer->setDesignModeBehavior(value); +} + +void QDeclarativeViewer::setDebugMode(bool on) +{ + observer->setDebugMode(on); +} + +void QDeclarativeViewer::enableExperimentalGestures() +{ + canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); +} + +QDeclarativeView *QDeclarativeViewer::view() const +{ + return canvas; +} + +LoggerWidget *QDeclarativeViewer::warningsWidget() const +{ + return loggerWindow; +} + +void QDeclarativeViewer::createMenu() +{ + QAction *openAction = new QAction(tr("&Open..."), this); + openAction->setShortcut(QKeySequence("Ctrl+O")); + connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); + + QAction *reloadAction = new QAction(tr("&Reload"), this); + reloadAction->setShortcut(QKeySequence("Ctrl+R")); + connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); + + QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this); + snapshotAction->setShortcut(QKeySequence("F3")); + connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot())); + + recordAction = new QAction(tr("Start Recording &Video"), this); + recordAction->setShortcut(QKeySequence("F9")); + connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection())); + + QAction *recordOptions = new QAction(tr("Video &Options..."), this); + connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions())); + + QMenu *playSpeedMenu = new QMenu(tr("Animation Speed"), this); + QActionGroup *playSpeedMenuActions = new QActionGroup(this); + playSpeedMenuActions->setExclusive(true); + + QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setChecked(true); + animationSpeed = 1.0f; + speedAction->setData(1.0f); + playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(2.0f); + playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(4.0f); + playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(8.0f); + playSpeedMenuActions->addAction(speedAction); + + speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); + speedAction->setCheckable(true); + speedAction->setData(10.0f); + playSpeedMenuActions->addAction(speedAction); + + pauseAnimationsAction = playSpeedMenu->addAction(tr("Pause"), this, SLOT(setAnimationsPaused(bool))); + pauseAnimationsAction->setCheckable(true); + pauseAnimationsAction->setShortcut(QKeySequence("Ctrl+.")); + + animationStepAction = playSpeedMenu->addAction(tr("Pause and step"), this, SLOT(stepAnimations())); + animationStepAction->setShortcut(QKeySequence("Ctrl+,")); + + animationSetStepAction = playSpeedMenu->addAction(tr("Set step"), this, SLOT(setAnimationStep())); + m_stepSize = 40; + + QAction *playSpeedAction = new QAction(tr("Animations"), this); + playSpeedAction->setMenu(playSpeedMenu); + + showWarningsWindow = new QAction(tr("Show Warnings"), this); + showWarningsWindow->setCheckable((true)); + showWarningsWindow->setChecked(loggerWindow->isVisible()); + connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool))); + + designModeBehaviorAction = new QAction(tr("&Observer Mode"), this); + designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D")); + designModeBehaviorAction->setCheckable(true); + designModeBehaviorAction->setChecked(observer->designModeBehavior()); + designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeObserverService::hasDebuggingClient()); + connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool))); + connect(observer, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool))); + connect(QmlJSDebugger::QDeclarativeObserverService::instance(), SIGNAL(debuggingClientChanged(bool)), designModeBehaviorAction, SLOT(setEnabled(bool))); + + QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this); + connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings())); + + QAction *fullscreenAction = new QAction(tr("Full Screen"), this); + fullscreenAction->setCheckable(true); + connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); + + QAction *rotateOrientation = new QAction(tr("Rotate orientation"), this); + rotateOrientation->setShortcut(QKeySequence("Ctrl+T")); + connect(rotateOrientation, SIGNAL(triggered()), this, SLOT(rotateOrientation())); + + orientation = new QActionGroup(this); + orientation->setExclusive(true); + connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*))); + + QAction *portraitAction = new QAction(tr("Portrait"), this); + portraitAction->setCheckable(true); + QAction *landscapeAction = new QAction(tr("Landscape"), this); + landscapeAction->setCheckable(true); + QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this); + portraitInvAction->setCheckable(true); + QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this); + landscapeInvAction->setCheckable(true); + + QAction *aboutAction = new QAction(tr("&About Qt..."), this); + connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + + QAction *quitAction = new QAction(tr("&Quit"), this); + quitAction->setShortcut(QKeySequence("Ctrl+Q")); + connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + + QMenuBar *menu = menuBar(); + if (!menu) + return; + +#if defined(Q_WS_MAEMO_5) + menu->addAction(openAction); + menu->addAction(reloadAction); + + menu->addAction(snapshotAction); + menu->addAction(recordAction); + + menu->addAction(recordOptions); + menu->addAction(proxyAction); + + menu->addAction(playSpeedMenu); + menu->addAction(showWarningsWindow); + + orientation->addAction(landscapeAction); + orientation->addAction(portraitAction); + menu->addAction(new Maemo5PickerAction(tr("Set orientation"), orientation, this)); + menu->addAction(fullscreenAction); + return; +#endif // Q_WS_MAEMO_5 + + QMenu *fileMenu = menu->addMenu(tr("&File")); + fileMenu->addAction(openAction); + fileMenu->addAction(reloadAction); + fileMenu->addSeparator(); + fileMenu->addAction(quitAction); + +#if !defined(Q_OS_SYMBIAN) + QMenu *recordMenu = menu->addMenu(tr("&Recording")); + recordMenu->addAction(snapshotAction); + recordMenu->addAction(recordAction); + + QMenu *debugMenu = menu->addMenu(tr("&Debugging")); + debugMenu->addAction(playSpeedAction); + debugMenu->addAction(showWarningsWindow); + debugMenu->addAction(designModeBehaviorAction); +#endif // ! Q_OS_SYMBIAN + + QMenu *settingsMenu = menu->addMenu(tr("S&ettings")); + settingsMenu->addAction(proxyAction); +#if !defined(Q_OS_SYMBIAN) + settingsMenu->addAction(recordOptions); + settingsMenu->addMenu(loggerWindow->preferencesMenu()); +#else // ! Q_OS_SYMBIAN + settingsMenu->addAction(fullscreenAction); +#endif // Q_OS_SYMBIAN + settingsMenu->addAction(rotateOrientation); + + QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties")); + + orientation->addAction(portraitAction); + orientation->addAction(landscapeAction); + orientation->addAction(portraitInvAction); + orientation->addAction(landscapeInvAction); + propertiesMenu->addActions(orientation->actions()); + + QMenu *helpMenu = menu->addMenu(tr("&Help")); + helpMenu->addAction(aboutAction); +} + +void QDeclarativeViewer::showProxySettings() +{ + ProxySettings settingsDlg (this); + + connect (&settingsDlg, SIGNAL (accepted()), this, SLOT (proxySettingsChanged ())); + + settingsDlg.exec(); +} + +void QDeclarativeViewer::proxySettingsChanged() +{ + reload (); +} + +void QDeclarativeViewer::rotateOrientation() +{ + QAction *current = orientation->checkedAction(); + QList<QAction *> actions = orientation->actions(); + int index = actions.indexOf(current); + if (index < 0) + return; + + QAction *newOrientation = actions[(index + 1) % actions.count()]; + changeOrientation(newOrientation); +} + +void QDeclarativeViewer::toggleFullScreen() +{ + if (isFullScreen()) + showMaximized(); + else + showFullScreen(); +} + +void QDeclarativeViewer::showWarnings(bool show) +{ + loggerWindow->setVisible(show); +} + +void QDeclarativeViewer::warningsWidgetOpened() +{ + showWarningsWindow->setChecked(true); +} + +void QDeclarativeViewer::warningsWidgetClosed() +{ + showWarningsWindow->setChecked(false); +} + +void QDeclarativeViewer::takeSnapShot() +{ + static int snapshotcount = 1; + QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount); + QPixmap::grabWidget(canvas).save(snapFileName); + qDebug() << "Wrote" << snapFileName; + ++snapshotcount; +} + +void QDeclarativeViewer::pickRecordingFile() +{ + QString fileName = getVideoFileName(); + if (!fileName.isEmpty()) + recdlg->file->setText(fileName); +} + +void QDeclarativeViewer::chooseRecordingOptions() +{ + // File + recdlg->file->setText(record_file); + + // Size + recdlg->setOriginalSize(canvas->size()); + + // Rate + recdlg->setVideoRate(record_rate); + + + // Profile + recdlg->setArguments(record_args.join(" ")); + if (recdlg->exec()) { + // File + record_file = recdlg->file->text(); + // Size + record_outsize = recdlg->videoSize(); + // Rate + record_rate = recdlg->videoRate(); + // Profile + record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts); + } +} + +void QDeclarativeViewer::toggleRecordingWithSelection() +{ + if (!recordTimer.isActive()) { + if (record_file.isEmpty()) { + QString fileName = getVideoFileName(); + if (fileName.isEmpty()) + return; + if (!fileName.contains(QRegExp(".[^\\/]*$"))) + fileName += ".avi"; + setRecordFile(fileName); + } + } + toggleRecording(); +} + +void QDeclarativeViewer::toggleRecording() +{ + if (record_file.isEmpty()) { + toggleRecordingWithSelection(); + return; + } + bool recording = !recordTimer.isActive(); + recordAction->setText(recording ? tr("&Stop Recording Video\tF9") : tr("&Start Recording Video\tF9")); + setRecording(recording); +} + +void QDeclarativeViewer::setAnimationsPaused(bool enable) +{ + if (enable) { + setAnimationSpeed(0.0); + } else { + setAnimationSpeed(animationSpeed); + } +} + +void QDeclarativeViewer::pauseAnimations() { + pauseAnimationsAction->setChecked(true); + setAnimationsPaused(true); +} + +void QDeclarativeViewer::stepAnimations() +{ + setAnimationSpeed(1.0); + QTimer::singleShot(m_stepSize, this, SLOT(pauseAnimations())); +} + +void QDeclarativeViewer::setAnimationStep() +{ + bool ok; + int stepSize = QInputDialog::getInt(this, tr("Set animation step duration"), + tr("Step duration (ms):"), m_stepSize, 20, 10000, 1, &ok); + if (ok) m_stepSize = stepSize; +} + +void QDeclarativeViewer::changeAnimationSpeed() +{ + QAction *action = qobject_cast<QAction*>(sender()); + if (action) { + float f = action->data().toFloat(); + animationSpeed = f; + if (!pauseAnimationsAction->isChecked()) + setAnimationSpeed(animationSpeed); + } +} + +void QDeclarativeViewer::addLibraryPath(const QString& lib) +{ + canvas->engine()->addImportPath(lib); +} + +void QDeclarativeViewer::addPluginPath(const QString& plugin) +{ + canvas->engine()->addPluginPath(plugin); +} + +void QDeclarativeViewer::reload() +{ + observer->setDesignModeBehavior(false); + open(currentFileOrUrl); +} + +void QDeclarativeViewer::openFile() +{ + QString cur = canvas->source().toLocalFile(); + if (useQmlFileBrowser) { + open("qrc:/content/Browser.qml"); + } else { + QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)")); + if (!fileName.isEmpty()) { + QFileInfo fi(fileName); + open(fi.absoluteFilePath()); + } + } +} + +void QDeclarativeViewer::statusChanged() +{ + if (canvas->status() == QDeclarativeView::Error && tester) + tester->executefailure(); + + if (canvas->status() == QDeclarativeView::Ready) { + initialSize = canvas->initialSize(); + updateSizeHints(true); + } +} + +void QDeclarativeViewer::launch(const QString& file_or_url) +{ + QMetaObject::invokeMethod(this, "open", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); +} + +void QDeclarativeViewer::loadTranslationFile(const QString& directory) +{ + if (!translator) { + translator = new QTranslator(this); + QApplication::installTranslator(translator); + } + + translator->load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n")); +} + +void QDeclarativeViewer::loadDummyDataFiles(const QString& directory) +{ + QDir dir(directory+"/dummydata", "*.qml"); + QStringList list = dir.entryList(); + for (int i = 0; i < list.size(); ++i) { + QString qml = list.at(i); + QFile f(dir.filePath(qml)); + f.open(QIODevice::ReadOnly); + QByteArray data = f.readAll(); + QDeclarativeComponent comp(canvas->engine()); + comp.setData(data, QUrl()); + QObject *dummyData = comp.create(); + + if(comp.isError()) { + QList<QDeclarativeError> errors = comp.errors(); + foreach (const QDeclarativeError &error, errors) { + qWarning() << error; + } + if (tester) tester->executefailure(); + } + + if (dummyData) { + qWarning() << "Loaded dummy data:" << dir.filePath(qml); + qml.truncate(qml.length()-4); + canvas->rootContext()->setContextProperty(qml, dummyData); + dummyData->setParent(this); + } + } +} + +bool QDeclarativeViewer::open(const QString& file_or_url) +{ + currentFileOrUrl = file_or_url; + + QUrl url; + QFileInfo fi(file_or_url); + if (fi.exists()) + url = QUrl::fromLocalFile(fi.absoluteFilePath()); + else + url = QUrl(file_or_url); + setWindowTitle(tr("%1 - Qt QML Viewer").arg(file_or_url)); + + if (!m_script.isEmpty()) + tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); + + delete canvas->rootObject(); + canvas->engine()->clearComponentCache(); + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("qmlViewer", this); +#ifdef Q_OS_SYMBIAN + ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone +#else + ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath()); +#endif + + ctxt->setContextProperty("runtime", Runtime::instance()); + + QString fileName = url.toLocalFile(); + if (!fileName.isEmpty()) { + fi.setFile(fileName); + if (fi.exists()) { + if (fi.suffix().toLower() != QLatin1String("qml")) { + qWarning() << "qml cannot open non-QML file" << fileName; + return false; + } + + QFileInfo fi(fileName); + loadTranslationFile(fi.path()); + loadDummyDataFiles(fi.path()); + } else { + qWarning() << "qml cannot find file:" << fileName; + return false; + } + } + + QTime t; + t.start(); + + canvas->setSource(url); + + return true; +} + +void QDeclarativeViewer::setAutoRecord(int from, int to) +{ + if (from==0) from=1; // ensure resized + record_autotime = to-from; + autoStartTimer.setInterval(from); + autoStartTimer.start(); +} + +void QDeclarativeViewer::setRecordArgs(const QStringList& a) +{ + record_args = a; +} + +void QDeclarativeViewer::setRecordFile(const QString& f) +{ + record_file = f; +} + +void QDeclarativeViewer::setRecordRate(int fps) +{ + record_rate = fps; +} + +void QDeclarativeViewer::sceneResized(QSize) +{ + updateSizeHints(); +} + +void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) +{ + if (event->key() == Qt::Key_0 && devicemode) + exit(0); + else if (event->key() == Qt::Key_F1 || (event->key() == Qt::Key_1 && devicemode)) { + qDebug() << "F1 - help\n" + << "F2 - save test script\n" + << "F3 - take PNG snapshot\n" + << "F4 - show items and state\n" + << "F5 - reload QML\n" + << "F6 - show object tree\n" + << "F7 - show timing\n" + << "F9 - toggle video recording\n" + << "F10 - toggle orientation\n" + << "device keys: 0=quit, 1..8=F1..F8" + ; + } else if (event->key() == Qt::Key_F2 || (event->key() == Qt::Key_2 && devicemode)) { + if (tester && m_scriptOptions & Record) + tester->save(); + } else if (event->key() == Qt::Key_F3 || (event->key() == Qt::Key_3 && devicemode)) { + takeSnapShot(); + } else if (event->key() == Qt::Key_F5 || (event->key() == Qt::Key_5 && devicemode)) { + reload(); + } else if (event->key() == Qt::Key_F9 || (event->key() == Qt::Key_9 && devicemode)) { + toggleRecording(); + } else if (event->key() == Qt::Key_F10) { + rotateOrientation(); + } + + QWidget::keyPressEvent(event); +} + +bool QDeclarativeViewer::event(QEvent *event) +{ + if (event->type() == QEvent::WindowActivate) { + Runtime::instance()->setActiveWindow(true); + } else if (event->type() == QEvent::WindowDeactivate) { + Runtime::instance()->setActiveWindow(false); + } + return QWidget::event(event); +} + +void QDeclarativeViewer::senseImageMagick() +{ + QProcess proc; + proc.start("convert", QStringList() << "-h"); + proc.waitForFinished(2000); + QString help = proc.readAllStandardOutput(); + convertAvailable = help.contains("ImageMagick"); +} + +void QDeclarativeViewer::senseFfmpeg() +{ + QProcess proc; + proc.start("ffmpeg", QStringList() << "-h"); + proc.waitForFinished(2000); + QString ffmpegHelp = proc.readAllStandardOutput(); + ffmpegAvailable = ffmpegHelp.contains("-s "); + ffmpegHelp = tr("Video recording uses ffmpeg:")+"\n\n"+ffmpegHelp; + + QDialog *d = new QDialog(recdlg); + QVBoxLayout *l = new QVBoxLayout(d); + QTextBrowser *b = new QTextBrowser(d); + QFont f = b->font(); + f.setFamily("courier"); + b->setFont(f); + b->setText(ffmpegHelp); + l->addWidget(b); + d->setLayout(l); + ffmpegHelpWindow = d; + connect(recdlg->ffmpegHelp,SIGNAL(clicked()), ffmpegHelpWindow, SLOT(show())); +} + +void QDeclarativeViewer::setRecording(bool on) +{ + if (on == recordTimer.isActive()) + return; + + int period = int(1000/record_rate+0.5); + QUnifiedTimer::instance()->setTimingInterval(on ? period:16); + QUnifiedTimer::instance()->setConsistentTiming(on); + if (on) { + canvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + recordTimer.setInterval(period); + recordTimer.start(); + frame_fmt = record_file.right(4).toLower(); + frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32); + if (frame_fmt != ".png" && (!convertAvailable || frame_fmt != ".gif")) { + // Stream video to ffmpeg + + QProcess *proc = new QProcess(this); + connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int))); + frame_stream = proc; + + QStringList args; + args << "-y"; + args << "-r" << QString::number(record_rate); + args << "-f" << "rawvideo"; + args << "-pix_fmt" << (frame_fmt == ".gif" ? "rgb24" : "rgb32"); + args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height()); + args << "-i" << "-"; + if (record_outsize.isValid()) { + args << "-s" << QString("%1x%2").arg(record_outsize.width()).arg(record_outsize.height()); + args << "-aspect" << QString::number(double(canvas->width())/canvas->height()); + } + args += record_args; + args << record_file; + proc->start("ffmpeg",args); + + } else { + // Store frames, save to GIF/PNG + frame_stream = 0; + } + } else { + canvas->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); + recordTimer.stop(); + if (frame_stream) { + qDebug() << "Saving video..."; + frame_stream->close(); + qDebug() << "Wrote" << record_file; + } else { + QProgressDialog progress(tr("Saving frames..."), tr("Cancel"), 0, frames.count()+10, this); + progress.setWindowModality(Qt::WindowModal); + + int frame=0; + QStringList inputs; + qDebug() << "Saving frames..."; + + QString framename; + bool png_output = false; + if (record_file.right(4).toLower()==".png") { + if (record_file.contains('%')) + framename = record_file; + else + framename = record_file.left(record_file.length()-4)+"%04d"+record_file.right(4); + png_output = true; + } else { + framename = "tmp-frame%04d.png"; + png_output = false; + } + foreach (QImage* img, frames) { + progress.setValue(progress.value()+1); + if (progress.wasCanceled()) + break; + QString name; + name.sprintf(framename.toLocal8Bit(),frame++); + if (record_outsize.isValid()) + *img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); + if (record_dither=="ordered") + img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name); + else if (record_dither=="threshold") + img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::ThresholdDither).save(name); + else if (record_dither=="floyd") + img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither).save(name); + else + img->save(name); + inputs << name; + delete img; + } + + if (!progress.wasCanceled()) { + if (png_output) { + framename.replace(QRegExp("%\\d*."),"*"); + qDebug() << "Wrote frames" << framename; + inputs.clear(); // don't remove them + } else { + // ImageMagick and gifsicle for GIF encoding + progress.setLabelText(tr("Converting frames to GIF file...")); + QStringList args; + args << "-delay" << QString::number(period/10); + args << inputs; + args << record_file; + qDebug() << "Converting..." << record_file << "(this may take a while)"; + if (0!=QProcess::execute("convert", args)) { + qWarning() << "Cannot run ImageMagick 'convert' - recorded frames not converted"; + inputs.clear(); // don't remove them + qDebug() << "Wrote frames tmp-frame*.png"; + } else { + if (record_file.right(4).toLower() == ".gif") { + qDebug() << "Compressing..." << record_file; + if (0!=QProcess::execute("gifsicle", QStringList() << "-O2" << "-o" << record_file << record_file)) + qWarning() << "Cannot run 'gifsicle' - not compressed"; + } + qDebug() << "Wrote" << record_file; + } + } + } + + progress.setValue(progress.maximum()-1); + foreach (QString name, inputs) + QFile::remove(name); + + frames.clear(); + } + } + qDebug() << "Recording: " << (recordTimer.isActive()?"ON":"OFF"); +} + +void QDeclarativeViewer::ffmpegFinished(int code) +{ + qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError(); +} + +void QDeclarativeViewer::appAboutToQuit() +{ + // avoid QGLContext errors about invalid contexts on exit + canvas->setViewport(0); + + // avoid crashes if messages are received after app has closed + delete loggerWindow; + loggerWindow = 0; +} + +void QDeclarativeViewer::autoStartRecording() +{ + setRecording(true); + autoStopTimer.setInterval(record_autotime); + autoStopTimer.start(); +} + +void QDeclarativeViewer::autoStopRecording() +{ + setRecording(false); +} + +void QDeclarativeViewer::recordFrame() +{ + canvas->QWidget::render(&frame); + if (frame_stream) { + if (frame_fmt == ".gif") { + // ffmpeg can't do 32bpp with gif + QImage rgb24 = frame.convertToFormat(QImage::Format_RGB888); + frame_stream->write((char*)rgb24.bits(),rgb24.numBytes()); + } else { + frame_stream->write((char*)frame.bits(),frame.numBytes()); + } + } else { + frames.append(new QImage(frame)); + } +} + +void QDeclarativeViewer::changeOrientation(QAction *action) +{ + if (!action) + return; + action->setChecked(true); + + QString o = action->text(); + if (o == QLatin1String("Portrait")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); + else if (o == QLatin1String("Landscape")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); + else if (o == QLatin1String("Portrait (inverted)")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted); + else if (o == QLatin1String("Landscape (inverted)")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted); +} + +void QDeclarativeViewer::orientationChanged() +{ + updateSizeHints(); +} + +void QDeclarativeViewer::setDeviceKeys(bool on) +{ + devicemode = on; +} + +void QDeclarativeViewer::setNetworkCacheSize(int size) +{ + namFactory->setCacheSize(size); +} + +void QDeclarativeViewer::setUseGL(bool useGL) +{ +#ifdef GL_SUPPORTED + if (useGL) { + QGLFormat format = QGLFormat::defaultFormat(); +#ifdef Q_WS_MAC + format.setSampleBuffers(true); +#else + format.setSampleBuffers(false); +#endif + + QGLWidget *glWidget = new QGLWidget(format); + //### potentially faster, but causes junk to appear if top-level is Item, not Rectangle + //glWidget->setAutoFillBackground(false); + + canvas->setViewport(glWidget); + } +#else + Q_UNUSED(useGL) +#endif +} + +void QDeclarativeViewer::setUseNativeFileBrowser(bool use) +{ + useQmlFileBrowser = !use; +} + +void QDeclarativeViewer::setSizeToView(bool sizeToView) +{ + QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject; + if (resizeMode != canvas->resizeMode()) { + canvas->setResizeMode(resizeMode); + updateSizeHints(); + } +} + +void QDeclarativeViewer::setAnimationSpeed(float f) +{ + QUnifiedTimer::instance()->setSlowdownFactor(f); + QUnifiedTimer::instance()->setSlowModeEnabled(f != 1.0); +} + +void QDeclarativeViewer::updateSizeHints(bool initial) +{ + static bool isRecursive = false; + + if (isRecursive) + return; + isRecursive = true; + + if (initial || (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject)) { + QSize newWindowSize = initial ? initialSize : canvas->sizeHint(); + //qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize; + if (!isFullScreen() && !isMaximized()) { + m_centralWidget->setFixedSize(newWindowSize.width(), newWindowSize.height() + 32); + canvas->setFixedSize(newWindowSize); + resize(1, 1); + layout()->setSizeConstraint(QLayout::SetFixedSize); + layout()->activate(); + } + } + //qWarning() << "USH: R2V: setting free size "; + layout()->setSizeConstraint(QLayout::SetNoConstraint); + layout()->activate(); + + setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); + canvas->setMinimumSize(QSize(0,0)); + canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); + + m_centralWidget->setMinimumSize(QSize(0,0)); + m_centralWidget->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); + + isRecursive = false; +} + + +void QDeclarativeViewer::registerTypes() +{ + static bool registered = false; + + if (!registered) { + // registering only for exposing the DeviceOrientation::Orientation enum + qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,7,"Orientation",""); + registered = true; + } +} + +QT_END_NAMESPACE + +#include "qmlruntime.moc" diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.h b/share/qtcreator/qml/qmlobserver/qmlruntime.h new file mode 100644 index 0000000000..eb43579659 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qmlruntime.h @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEVIEWER_H +#define QDECLARATIVEVIEWER_H + +#include <QMainWindow> +#include <QTimer> +#include <QTime> +#include <QList> + +#include "loggerwidget.h" + +namespace QmlJSDebugger { + class QDeclarativeViewObserver; +} + +class CrumblePath; + +QT_BEGIN_NAMESPACE + +class QDeclarativeView; +class PreviewDeviceSkin; +class QDeclarativeTestEngine; +class QProcess; +class RecordingDialog; +class QDeclarativeTester; +class QNetworkReply; +class QNetworkCookieJar; +class NetworkAccessManagerFactory; +class QTranslator; +class QActionGroup; +class QMenuBar; +class QSplitter; + +class QDeclarativeViewer + : public QMainWindow +{ + Q_OBJECT + +public: + explicit QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0); + ~QDeclarativeViewer(); + + static void registerTypes(); + + enum ScriptOption { + Play = 0x00000001, + Record = 0x00000002, + TestImages = 0x00000004, + TestErrorProperty = 0x00000008, + SaveOnExit = 0x00000010, + ExitOnComplete = 0x00000020, + ExitOnFailure = 0x00000040, + Snapshot = 0x00000080 + }; + Q_DECLARE_FLAGS(ScriptOptions, ScriptOption) + void setScript(const QString &s) { m_script = s; } + void setScriptOptions(ScriptOptions opt) { m_scriptOptions = opt; } + void setRecordDither(const QString& s) { record_dither = s; } + void setRecordRate(int fps); + void setRecordFile(const QString&); + void setRecordArgs(const QStringList&); + void setRecording(bool on); + bool isRecording() const { return recordTimer.isActive(); } + void setAutoRecord(int from, int to); + void setDeviceKeys(bool); + void setNetworkCacheSize(int size); + void addLibraryPath(const QString& lib); + void addPluginPath(const QString& plugin); + void setUseGL(bool use); + void setUseNativeFileBrowser(bool); + void setSizeToView(bool sizeToView); + + QDeclarativeView *view() const; + LoggerWidget *warningsWidget() const; + + void enableExperimentalGestures(); + +public slots: + void setDesignModeBehavior(bool value); + void setDebugMode(bool on); + void sceneResized(QSize size); + bool open(const QString&); + void openFile(); + void reload(); + void takeSnapShot(); + void toggleRecording(); + void toggleRecordingWithSelection(); + void ffmpegFinished(int code); + void showProxySettings (); + void proxySettingsChanged (); + void rotateOrientation(); + void statusChanged(); + void setAnimationsPaused(bool); + void pauseAnimations(); + void stepAnimations(); + void setAnimationStep(); + void changeAnimationSpeed(); + void launch(const QString &); + +protected: + virtual void keyPressEvent(QKeyEvent *); + virtual bool event(QEvent *); + void createMenu(); + +private slots: + void appAboutToQuit(); + + void autoStartRecording(); + void autoStopRecording(); + void recordFrame(); + void chooseRecordingOptions(); + void pickRecordingFile(); + void toggleFullScreen(); + void changeOrientation(QAction*); + void orientationChanged(); + + void showWarnings(bool show); + void warningsWidgetOpened(); + void warningsWidgetClosed(); + +private: + void setAnimationSpeed(float f); + void updateSizeHints(bool initial = false); + + QString getVideoFileName(); + + LoggerWidget *loggerWindow; + + QDeclarativeView *canvas; + QmlJSDebugger::QDeclarativeViewObserver *observer; + QSize initialSize; + QString currentFileOrUrl; + QTimer recordTimer; + QString frame_fmt; + QImage frame; + QList<QImage*> frames; + QProcess* frame_stream; + QTimer autoStartTimer; + QTimer autoStopTimer; + QString record_dither; + QString record_file; + QSize record_outsize; + QStringList record_args; + int record_rate; + int record_autotime; + bool devicemode; + QAction *recordAction; + QString currentSkin; + bool scaleSkin; + RecordingDialog *recdlg; + + void senseImageMagick(); + void senseFfmpeg(); + QWidget *ffmpegHelpWindow; + bool ffmpegAvailable; + bool convertAvailable; + + float animationSpeed; + int m_stepSize; + QAction *pauseAnimationsAction; + QAction *animationStepAction; + QAction *animationSetStepAction; + + QActionGroup *orientation; + QAction *showWarningsWindow; + QAction *designModeBehaviorAction; + + QString m_script; + ScriptOptions m_scriptOptions; + QDeclarativeTester *tester; + + QNetworkReply *wgtreply; + QString wgtdir; + NetworkAccessManagerFactory *namFactory; + + bool useQmlFileBrowser; + + QWidget *m_centralWidget; + CrumblePath *m_crumblePathWidget; + + QTranslator *translator; + void loadTranslationFile(const QString& directory); + + void loadDummyDataFiles(const QString& directory); +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions) + +QT_END_NAMESPACE + +#endif diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.qrc b/share/qtcreator/qml/qmlobserver/qmlruntime.qrc new file mode 100644 index 0000000000..4136eafa52 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/qmlruntime.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="/"> + <file>content/Browser.qml</file> + <file>content/images/up.png</file> + <file>content/images/folder.png</file> + <file>content/images/titlebar.sci</file> + <file>content/images/titlebar.png</file> + </qresource> +</RCC> diff --git a/share/qtcreator/qml/qmlobserver/recopts.ui b/share/qtcreator/qml/qmlobserver/recopts.ui new file mode 100644 index 0000000000..ce2da30767 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/recopts.ui @@ -0,0 +1,513 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>RecordingOptions</class> + <widget class="QDialog" name="RecordingOptions"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>316</width> + <height>436</height> + </rect> + </property> + <property name="windowTitle"> + <string>Video options</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>File:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="file"/> + </item> + <item> + <widget class="QToolButton" name="pickfile"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Size</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QRadioButton" name="sizeOriginal"> + <property name="text"> + <string/> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QRadioButton" name="sizeVGA"> + <property name="text"> + <string>VGA</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="size720p"> + <property name="text"> + <string>720p</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QRadioButton" name="sizeQVGA"> + <property name="text"> + <string>QVGA</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="3"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QRadioButton" name="sizeCustom"> + <property name="text"> + <string>Width:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sizeWidth"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>9999</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Height:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sizeHeight"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>9999</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="rateOptions"> + <property name="title"> + <string>Rate</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QRadioButton" name="hz60"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>60Hz</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="hz50"> + <property name="text"> + <string>50Hz</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QRadioButton" name="hz25"> + <property name="text"> + <string>25Hz</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="4"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QRadioButton" name="hzCustom"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="hz"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Hz</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="2"> + <widget class="QRadioButton" name="hz24"> + <property name="text"> + <string>24Hz</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="ffmpegOptions"> + <property name="title"> + <string>Profile</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0" colspan="3"> + <widget class="QComboBox" name="profile"/> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QLineEdit" name="args"/> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="ffmpegHelp"> + <property name="text"> + <string>Help</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="warning"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>file</tabstop> + <tabstop>pickfile</tabstop> + <tabstop>sizeOriginal</tabstop> + <tabstop>sizeVGA</tabstop> + <tabstop>size720p</tabstop> + <tabstop>sizeQVGA</tabstop> + <tabstop>sizeCustom</tabstop> + <tabstop>sizeWidth</tabstop> + <tabstop>sizeHeight</tabstop> + <tabstop>hz60</tabstop> + <tabstop>hz25</tabstop> + <tabstop>hz50</tabstop> + <tabstop>hz24</tabstop> + <tabstop>hzCustom</tabstop> + <tabstop>hz</tabstop> + <tabstop>profile</tabstop> + <tabstop>args</tabstop> + <tabstop>ffmpegHelp</tabstop> + <tabstop>buttonBox</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>hzCustom</sender> + <signal>clicked()</signal> + <receiver>hz</receiver> + <slot>setFocus()</slot> + <hints> + <hint type="sourcelabel"> + <x>43</x> + <y>257</y> + </hint> + <hint type="destinationlabel"> + <x>129</x> + <y>262</y> + </hint> + </hints> + </connection> + <connection> + <sender>hz</sender> + <signal>textChanged(QString)</signal> + <receiver>hzCustom</receiver> + <slot>toggle()</slot> + <hints> + <hint type="sourcelabel"> + <x>143</x> + <y>262</y> + </hint> + <hint type="destinationlabel"> + <x>43</x> + <y>257</y> + </hint> + </hints> + </connection> + <connection> + <sender>hz</sender> + <signal>selectionChanged()</signal> + <receiver>hzCustom</receiver> + <slot>toggle()</slot> + <hints> + <hint type="sourcelabel"> + <x>143</x> + <y>262</y> + </hint> + <hint type="destinationlabel"> + <x>43</x> + <y>257</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>RecordingOptions</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>258</x> + <y>424</y> + </hint> + <hint type="destinationlabel"> + <x>60</x> + <y>219</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>RecordingOptions</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>258</x> + <y>424</y> + </hint> + <hint type="destinationlabel"> + <x>92</x> + <y>219</y> + </hint> + </hints> + </connection> + <connection> + <sender>profile</sender> + <signal>activated(int)</signal> + <receiver>RecordingOptions</receiver> + <slot>pickProfile(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>92</x> + <y>329</y> + </hint> + <hint type="destinationlabel"> + <x>48</x> + <y>194</y> + </hint> + </hints> + </connection> + <connection> + <sender>args</sender> + <signal>textEdited(QString)</signal> + <receiver>RecordingOptions</receiver> + <slot>storeCustomArgs(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>128</x> + <y>357</y> + </hint> + <hint type="destinationlabel"> + <x>102</x> + <y>189</y> + </hint> + </hints> + </connection> + <connection> + <sender>sizeWidth</sender> + <signal>valueChanged(int)</signal> + <receiver>sizeCustom</receiver> + <slot>toggle()</slot> + <hints> + <hint type="sourcelabel"> + <x>108</x> + <y>133</y> + </hint> + <hint type="destinationlabel"> + <x>48</x> + <y>133</y> + </hint> + </hints> + </connection> + <connection> + <sender>sizeHeight</sender> + <signal>valueChanged(int)</signal> + <receiver>sizeCustom</receiver> + <slot>toggle()</slot> + <hints> + <hint type="sourcelabel"> + <x>212</x> + <y>133</y> + </hint> + <hint type="destinationlabel"> + <x>64</x> + <y>129</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <signal>filePicked(QString)</signal> + <signal>argumentsPicked(QString)</signal> + <slot>pickFile()</slot> + <slot>pickProfile(int)</slot> + <slot>storeCustomArgs(QString)</slot> + </slots> +</ui> diff --git a/share/qtcreator/qml/qmlobserver/recopts_maemo5.ui b/share/qtcreator/qml/qmlobserver/recopts_maemo5.ui new file mode 100644 index 0000000000..3bb5ecabd9 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/recopts_maemo5.ui @@ -0,0 +1,254 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>RecordingOptions</class> + <widget class="QDialog" name="RecordingOptions"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>469</width> + <height>142</height> + </rect> + </property> + <property name="windowTitle"> + <string>Video options</string> + </property> + <layout class="QGridLayout" name="gridLayout" columnstretch="0,2,0"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinAndMaxSize</enum> + </property> + <property name="leftMargin"> + <number>16</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>16</number> + </property> + <property name="bottomMargin"> + <number>8</number> + </property> + <property name="horizontalSpacing"> + <number>16</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="1"> + <widget class="QLineEdit" name="file"/> + </item> + <item row="0" column="2" rowspan="3"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>72</width> + <height>56</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Size</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="sizeCombo"> + <item> + <property name="text"> + <string/> + </property> + </item> + <item> + <property name="text"> + <string>VGA</string> + </property> + </item> + <item> + <property name="text"> + <string>QVGA</string> + </property> + </item> + <item> + <property name="text"> + <string>720p</string> + </property> + </item> + </widget> + </item> + <item row="2" column="0" rowspan="2"> + <widget class="QLabel" name="rateLabel"> + <property name="text"> + <string>Rate</string> + </property> + </widget> + </item> + <item row="2" column="1" rowspan="2"> + <widget class="QComboBox" name="rateCombo"> + <item> + <property name="text"> + <string>60 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>50 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>25 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>24 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>20 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>15 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>10 Hz</string> + </property> + </item> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLineEdit" name="args"/> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="profile"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="profileLabel"> + <property name="text"> + <string>Profile</string> + </property> + </widget> + </item> + <item row="6" column="0" colspan="2"> + <widget class="QLabel" name="warning"> + <property name="text"> + <string notr="true">warning</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="2" rowspan="3"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QPushButton" name="pickfile"> + <property name="text"> + <string>File</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QPushButton" name="ffmpegHelp"> + <property name="text"> + <string>Options</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>RecordingOptions</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>258</x> + <y>424</y> + </hint> + <hint type="destinationlabel"> + <x>60</x> + <y>219</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>RecordingOptions</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>258</x> + <y>424</y> + </hint> + <hint type="destinationlabel"> + <x>92</x> + <y>219</y> + </hint> + </hints> + </connection> + <connection> + <sender>profile</sender> + <signal>activated(int)</signal> + <receiver>RecordingOptions</receiver> + <slot>pickProfile(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>92</x> + <y>329</y> + </hint> + <hint type="destinationlabel"> + <x>48</x> + <y>194</y> + </hint> + </hints> + </connection> + <connection> + <sender>args</sender> + <signal>textEdited(QString)</signal> + <receiver>RecordingOptions</receiver> + <slot>storeCustomArgs(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>128</x> + <y>357</y> + </hint> + <hint type="destinationlabel"> + <x>102</x> + <y>189</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <signal>filePicked(QString)</signal> + <signal>argumentsPicked(QString)</signal> + <slot>pickFile()</slot> + <slot>pickProfile(int)</slot> + <slot>storeCustomArgs(QString)</slot> + </slots> +</ui> diff --git a/share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h b/share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h new file mode 100644 index 0000000000..bb5567a4c2 --- /dev/null +++ b/share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui/qplaintextedit.h> +#include <QtGui/qtextedit.h> +#include <QtGui/qabstractkineticscroller.h> +#include <QtGui/qscrollarea.h> +#include <QtDebug> + +#ifndef TEXTEDITAUTORESIZER_H +#define TEXTEDITAUTORESIZER_H + +class TextEditAutoResizer : public QObject +{ + Q_OBJECT +public: + TextEditAutoResizer(QWidget *parent) + : QObject(parent), plainTextEdit(qobject_cast<QPlainTextEdit *>(parent)), + textEdit(qobject_cast<QTextEdit *>(parent)), edit(qobject_cast<QFrame *>(parent)) + { + // parent must either inherit QPlainTextEdit or QTextEdit! + Q_ASSERT(plainTextEdit || textEdit); + + connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged())); + connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged())); + + textEditChanged(); + } + +private Q_SLOTS: + inline void textEditChanged(); + +private: + QPlainTextEdit *plainTextEdit; + QTextEdit *textEdit; + QFrame *edit; +}; + +void TextEditAutoResizer::textEditChanged() +{ + QTextDocument *doc = textEdit ? textEdit->document() : plainTextEdit->document(); + QRect cursor = textEdit ? textEdit->cursorRect() : plainTextEdit->cursorRect(); + + QSize s = doc->size().toSize(); + if (plainTextEdit) + s.setHeight((s.height() + 2) * edit->fontMetrics().lineSpacing()); + + const QRect fr = edit->frameRect(); + const QRect cr = edit->contentsRect(); + + edit->setMinimumHeight(qMax(70, s.height() + (fr.height() - cr.height() - 1))); + + // make sure the cursor is visible in case we have a QAbstractScrollArea parent + QPoint pos = edit->pos(); + QWidget *pw = edit->parentWidget(); + while (pw) { + if (qobject_cast<QScrollArea *>(pw)) + break; + pw = pw->parentWidget(); + } + + if (pw) { + QScrollArea *area = static_cast<QScrollArea *>(pw); + QPoint scrollto = area->widget()->mapFrom(edit, cursor.center()); + QPoint margin(10 + cursor.width(), 2 * cursor.height()); + + if (QAbstractKineticScroller *scroller = area->property("kineticScroller").value<QAbstractKineticScroller *>()) { + scroller->ensureVisible(scrollto, margin.x(), margin.y()); + } else { + area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y()); + } + } +} + +#endif diff --git a/share/qtcreator/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qmljsdebugger/qmljsdebugger-lib.pri deleted file mode 100644 index f491826378..0000000000 --- a/share/qtcreator/qmljsdebugger/qmljsdebugger-lib.pri +++ /dev/null @@ -1,35 +0,0 @@ -QT += declarative script -INCLUDEPATH += $$PWD $$PWD/include editor -DEPENDPATH += $$PWD $$PWD/include editor - -contains(CONFIG, dll) { - DEFINES += BUILD_QMLJSDEBUGGER_LIB -} else { - DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB -} - -include($$PWD/private_headers.pri) - -## Input -HEADERS += \ - include/jsdebuggeragent.h \ - include/qmljsdebugger_global.h - -SOURCES += \ - jsdebuggeragent.cpp - -contains(DEFINES, QMLOBSERVER) { - include($$PWD/editor/editor.pri) - - HEADERS += \ - include/qdeclarativeviewobserver.h \ - include/qdeclarativeobserverservice.h \ - include/qmlobserverconstants.h \ - qdeclarativeviewobserver_p.h - - SOURCES += \ - qdeclarativeviewobserver.cpp \ - qdeclarativeobserverservice.cpp -} - -OTHER_FILES += qmljsdebugger.pri |