diff options
author | Jerome Pasion <jerome.pasion@digia.com> | 2013-01-22 18:00:26 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-24 11:26:54 +0100 |
commit | 8759cf3fcb3b78a7b62e7f4feedee8e6822bde32 (patch) | |
tree | a5e26f9a3c0d6cd8673204a587f3bbf1f5696569 /src/scripttools | |
parent | 848ddbe91b5219214f43892d325d7e5e9ddc0489 (diff) | |
download | qtscript-8759cf3fcb3b78a7b62e7f4feedee8e6822bde32.tar.gz |
Doc: Modularized Qt Script Tools documentation.
-moved content from qtdoc
-moved snippets to src/scripttools
-enabled 'make docs'
-edited QScriptEngineDebugger with the proper module identifier
-created two way links from Qt Script to Qt Script Tools
Change-Id: I83a76278969528dcb1ecbca4acc8563fe9390978
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Geir Vattekar <geir.vattekar@digia.com>
Diffstat (limited to 'src/scripttools')
-rw-r--r-- | src/scripttools/debugging/qscriptenginedebugger.cpp | 14 | ||||
-rw-r--r-- | src/scripttools/doc/qtscripttools.qdocconf | 47 | ||||
-rw-r--r-- | src/scripttools/doc/snippets/doc_src_qtscripttools.cpp | 43 | ||||
-rw-r--r-- | src/scripttools/doc/snippets/doc_src_qtscripttools.pro | 43 | ||||
-rw-r--r-- | src/scripttools/doc/snippets/scriptdebugger.cpp | 103 | ||||
-rw-r--r-- | src/scripttools/doc/snippets/src.scripttools.qscriptenginedebugger.cpp | 49 | ||||
-rw-r--r-- | src/scripttools/doc/src/qtscripttools-index.qdoc | 60 | ||||
-rw-r--r-- | src/scripttools/doc/src/qtscripttools-module.qdoc | 49 | ||||
-rw-r--r-- | src/scripttools/scripttools.pro | 2 |
9 files changed, 403 insertions, 7 deletions
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index b6df016..6a6bd14 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -70,12 +70,12 @@ public: }; /*! - \since 4.5 - \class QScriptEngineDebugger + \since 4.5 + \class QScriptEngineDebugger + \inmodule QtScriptTools + \brief The QScriptEngineDebugger class provides a QScriptEngine debugger. - \brief The QScriptEngineDebugger class provides a QScriptEngine debugger. - - \ingroup script + \ingroup script The QScriptEngineDebugger class provides a debugger that can be @@ -86,7 +86,7 @@ public: To attach the debugger to a script engine, call the attachTo() function. - \snippet code/src.scripttools.qscriptenginedebugger.cpp 0 + \snippet src.scripttools.qscriptenginedebugger.cpp 0 Once the debugger has been attached to a script engine, you can proceed to evaluate scripts as usual, e.g. by calling @@ -140,7 +140,7 @@ public: the function call does not return until the user has finished interacting with the debugger. - \snippet code/src.scripttools.qscriptenginedebugger.cpp 1 + \snippet src.scripttools.qscriptenginedebugger.cpp 1 When the Qt Script debugger is running, the C++ application itself is not "frozen". This means that it is possible that more scripts diff --git a/src/scripttools/doc/qtscripttools.qdocconf b/src/scripttools/doc/qtscripttools.qdocconf new file mode 100644 index 0000000..362fc61 --- /dev/null +++ b/src/scripttools/doc/qtscripttools.qdocconf @@ -0,0 +1,47 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +# Name of the project which must match the outputdir. Determines the .index file +project = qtscripttools + +# Directories in which to search for files to document and images. +# By default set to the root directory of the project for sources +# and headers and qdoc will therefore generate output for each file. +# Images should be placed in <rootdir>/dic/images and examples in +# <rootdir>/examples. +# Paths are relative to the location of this file. +exampledirs += ../../../examples \ + snippets + +headerdirs += .. +imagedirs += images +sourcedirs += .. + +depends += qtcore qtlinguist qtscript + +# The following parameters are for creating a qhp file, the qhelpgenerator +# program can convert the qhp file into a qch file which can be opened in +# Qt Assistant and/or Qt Creator. + +# Defines the name of the project. You cannot use operators (+, =, -) in +# the name. Properties for this project are set using a qhp.<projectname>.property +# format. +qhp.projects = qtscripttools + +# Sets the name of the output qhp file. +qhp.qtscripttools.file = qtscripttools.qhp + +# Namespace for the output file. This namespace is used to distinguish between +# different documentation files in Creator/Assistant. +qhp.qtscripttools.namespace = org.qt-project.qtscripttools.501 + +# Title for the package, will be the main title for the package in +# Assistant/Creator. +qhp.qtscripttools.indexTitle = Qt Script + +# Only update the name of the project for the next variables. +qhp.qtscripttools.virtualFolder = qtscripttools +qhp.qtscripttools.subprojects = classes +qhp.qtscripttools.subprojects.classes.title = C++ Classes +qhp.qtscripttools.subprojects.classes.indexTitle = Qt Script Tools C++ Classes +qhp.qtscripttools.subprojects.classes.selectors = class fake:headerfile +qhp.qtscripttools.subprojects.classes.sortPages = true diff --git a/src/scripttools/doc/snippets/doc_src_qtscripttools.cpp b/src/scripttools/doc/snippets/doc_src_qtscripttools.cpp new file mode 100644 index 0000000..d385f69 --- /dev/null +++ b/src/scripttools/doc/snippets/doc_src_qtscripttools.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include <QtScriptTools> +//! [0] diff --git a/src/scripttools/doc/snippets/doc_src_qtscripttools.pro b/src/scripttools/doc/snippets/doc_src_qtscripttools.pro new file mode 100644 index 0000000..6680f5f --- /dev/null +++ b/src/scripttools/doc/snippets/doc_src_qtscripttools.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#! [1] +QT += scripttools +#! [1] diff --git a/src/scripttools/doc/snippets/scriptdebugger.cpp b/src/scripttools/doc/snippets/scriptdebugger.cpp new file mode 100644 index 0000000..a59ed89 --- /dev/null +++ b/src/scripttools/doc/snippets/scriptdebugger.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtWidgets> +#include <QtScript> +#include <QtScriptTools> + +// Perhaps shpw entire example for getting debugger up with script +int main(int argv, char **args) +{ + QApplication app(argv, args); + + QString fileName("helloscript.qs"); + QFile scriptFile(fileName); + scriptFile.open(QIODevice::ReadOnly); + QTextStream stream(&scriptFile); + QString contents = stream.readAll(); + scriptFile.close(); + + QScriptEngine *engine = new QScriptEngine(); + + QScriptEngineDebugger *debugger = new QScriptEngineDebugger(); + debugger->attachTo(engine); + + // Set up configuration with only stack and code + QWidget *widget = new QWidget; +//![0] + QWidget *codeWindow = debugger->widget(QScriptEngineDebugger::CodeWidget); + QWidget *stackWidget = debugger->widget(QScriptEngineDebugger::StackWidget); + + QLayout *layout = new QHBoxLayout; + layout->addWidget(codeWindow); + layout->addWidget(stackWidget); +//![0] + +//![1] + QAction *continueAction = debugger->action(QScriptEngineDebugger::ContinueAction); + QAction *stepOverAction = debugger->action(QScriptEngineDebugger::StepOverAction); + QAction *stepIntoAction = debugger->action(QScriptEngineDebugger::StepIntoAction); + + QToolBar *toolBar = new QToolBar; + toolBar->addAction(continueAction); +//![1] + toolBar->addAction(stepOverAction); + toolBar->addAction(stepIntoAction); + + layout->addWidget(toolBar); + continueAction->setIcon(QIcon("copy.png")); + + debugger->setAutoShowStandardWindow(false); + + widget->setLayout(layout); + widget->show(); + + QPushButton button; + QScriptValue scriptButton = engine->newQObject(&button); + engine->globalObject().setProperty("button", scriptButton); + +//![2] + debugger->action(QScriptEngineDebugger::InterruptAction)->trigger(); + engine->evaluate(contents, fileName); +//![2] + + return app.exec(); +} + diff --git a/src/scripttools/doc/snippets/src.scripttools.qscriptenginedebugger.cpp b/src/scripttools/doc/snippets/src.scripttools.qscriptenginedebugger.cpp new file mode 100644 index 0000000..cff33bb --- /dev/null +++ b/src/scripttools/doc/snippets/src.scripttools.qscriptenginedebugger.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] + QScriptEngine engine; + QScriptEngineDebugger debugger; + debugger.attachTo(&engine); +//! [0] + +//! [1] + engine.evaluate("debugger"); +//! [1] diff --git a/src/scripttools/doc/src/qtscripttools-index.qdoc b/src/scripttools/doc/src/qtscripttools-index.qdoc new file mode 100644 index 0000000..1817753 --- /dev/null +++ b/src/scripttools/doc/src/qtscripttools-index.qdoc @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtscripttools-index.html + \title Qt Script Tools + \brief Provides a debugger for applications that use Qt Script + + The Qt Script Tools module provides a debugger that can be embedded into Qt + applications that use \l{Qt Script}. The debugger enables the application + user to inspect the state of the script environment and control script + execution. + + \section1 Configuring the Build Process + + To include the definitions of the module's classes, use the + following directive: + + \snippet doc_src_qtscripttools.cpp 0 + + To link against the module, add this line to your \l qmake \c .pro file: + + \snippet doc_src_qtscripttools.pro 1 + + \section1 Related Information + + \section2 Guides + \list + \li \l {Qt Script Debugger Manual} + \endlist + \section2 Reference + \list + \li \l{Qt Script Tools C++ Classes}{C++ Classes} + \endlist + +*/ diff --git a/src/scripttools/doc/src/qtscripttools-module.qdoc b/src/scripttools/doc/src/qtscripttools-module.qdoc new file mode 100644 index 0000000..bc89994 --- /dev/null +++ b/src/scripttools/doc/src/qtscripttools-module.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \module QtScriptTools + \title Qt Script Tools C++ Classes + \since 4.5 + \ingroup modules + + \brief Provides additional components for applications that use Qt Script. + + The \l{Qt Script Tools} module provides a debugger for applications that + use Qt Script. + + \section1 Configuring the Build Process + + To include the definitions of the module's classes, use the + following directive: + + \snippet doc_src_qtscripttools.cpp 0 + + To link against the module, add this line to your \l qmake \c .pro file: + + \snippet doc_src_qtscripttools.pro 1 +*/ diff --git a/src/scripttools/scripttools.pro b/src/scripttools/scripttools.pro index 0cb8381..12d26a4 100644 --- a/src/scripttools/scripttools.pro +++ b/src/scripttools/scripttools.pro @@ -5,6 +5,8 @@ QT_PRIVATE = gui widgets-private script DEFINES += QT_NO_USING_NAMESPACE #win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 +QMAKE_DOCS = $$PWD/doc/qtscripttools.qdocconf + load(qt_module) include(debugging/debugging.pri) |