diff options
Diffstat (limited to 'src/scripttools/debugging/qscriptenginedebugger.cpp')
-rw-r--r-- | src/scripttools/debugging/qscriptenginedebugger.cpp | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index a278e14..f2245cc 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtSCriptTools module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,9 +49,7 @@ #include <QtGui/qapplication.h> #include <QtGui/qdockwidget.h> #include <QtGui/qmainwindow.h> -#include <QtGui/qmenu.h> #include <QtGui/qmenubar.h> -#include <QtGui/qtoolbar.h> #include <QtGui/qboxlayout.h> // this has to be outside the namespace @@ -128,7 +126,7 @@ public: mode in which it accepts input from the user. The evaluationResumed() signal is emitted when script evaluation is resumed, i.e, when execution control is given back to the script - engine. + engine. The state() function returns the debugger's current state. When calling QScriptEngine::evaluate() it is useful to pass a descriptive script name (file name) as second argument, as this is @@ -228,6 +226,16 @@ public: \value GoToLineAction Shows the "Go to Line" dialog. */ +/*! + \enum QScriptEngineDebugger::DebuggerState + \since 4.6 + + This enum specifies the current state of the debugger. + + \value RunningState The debugger is running. (Script evaluation is allowed.) + \value SuspendedState The debugger has suspended script evaluation. +*/ + class QScriptEngineDebuggerPrivate : public QObjectPrivate { @@ -389,6 +397,20 @@ void QScriptEngineDebugger::detach() } /*! + \since 4.6 + + Returns the current state of the debugger. + + \sa evaluationResumed() + \sa evaluationSuspended() +*/ +QScriptEngineDebugger::DebuggerState QScriptEngineDebugger::state() const +{ + Q_D(const QScriptEngineDebugger); + return !d->debugger || !d->debugger->isInteractive() ? SuspendedState : RunningState; +} + +/*! Returns a pointer to the instance of the specified standard \a widget. The widgets available are defined by the DebuggerWidget @@ -412,7 +434,7 @@ QWidget *QScriptEngineDebugger::widget(DebuggerWidget widget) const { Q_D(const QScriptEngineDebugger); const_cast<QScriptEngineDebuggerPrivate*>(d)->createDebugger(); - return d->debugger->widget(static_cast<QScriptDebugger::DebuggerWidget>(widget)); + return d->debugger->widget(static_cast<QScriptDebugger::DebuggerWidget>(static_cast<int>(widget))); } /*! @@ -436,7 +458,7 @@ QAction *QScriptEngineDebugger::action(DebuggerAction action) const Q_D(const QScriptEngineDebugger); QScriptEngineDebugger *that = const_cast<QScriptEngineDebugger*>(this); that->d_func()->createDebugger(); - return d->debugger->action(static_cast<QScriptDebugger::DebuggerAction>(action), that); + return d->debugger->action(static_cast<QScriptDebugger::DebuggerAction>(static_cast<int>(action)), that); } /*! @@ -589,25 +611,9 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const */ QMenu *QScriptEngineDebugger::createStandardMenu(QWidget *parent) { - QMenu *menu = new QMenu(parent); - menu->setTitle(QObject::tr("Debug")); - menu->addAction(action(ContinueAction)); - menu->addAction(action(InterruptAction)); - menu->addAction(action(StepIntoAction)); - menu->addAction(action(StepOverAction)); - menu->addAction(action(StepOutAction)); - menu->addAction(action(RunToCursorAction)); - menu->addAction(action(RunToNewScriptAction)); - - menu->addSeparator(); - menu->addAction(action(ToggleBreakpointAction)); - - menu->addSeparator(); - menu->addAction(action(ClearDebugOutputAction)); - menu->addAction(action(ClearErrorLogAction)); - menu->addAction(action(ClearConsoleAction)); - - return menu; + Q_D(QScriptEngineDebugger); + d->createDebugger(); + return d->debugger->createStandardMenu(parent, this); } /*! @@ -618,18 +624,9 @@ QMenu *QScriptEngineDebugger::createStandardMenu(QWidget *parent) */ QToolBar *QScriptEngineDebugger::createStandardToolBar(QWidget *parent) { - QToolBar *tb = new QToolBar(parent); - tb->setObjectName(QLatin1String("qtscriptdebugger_standardToolBar")); - tb->addAction(action(ContinueAction)); - tb->addAction(action(InterruptAction)); - tb->addAction(action(StepIntoAction)); - tb->addAction(action(StepOverAction)); - tb->addAction(action(StepOutAction)); - tb->addAction(action(RunToCursorAction)); - tb->addAction(action(RunToNewScriptAction)); - tb->addSeparator(); - tb->addAction(action(FindInScriptAction)); - return tb; + Q_D(QScriptEngineDebugger); + d->createDebugger(); + return d->debugger->createStandardToolBar(parent, this); } /*! |