summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-12 18:27:24 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-12 18:29:13 (GMT)
commit10c093e56c82254d545e9d698934a2cfb9121a59 (patch)
tree4c7a5c27fab93bc6a5962ed032db5c4461d61c25 /src/scripttools/debugging
parent2f4ca8e06be0477503acf2a4bf38a1c76f52e5b1 (diff)
downloadQt-10c093e56c82254d545e9d698934a2cfb9121a59.zip
Qt-10c093e56c82254d545e9d698934a2cfb9121a59.tar.gz
Qt-10c093e56c82254d545e9d698934a2cfb9121a59.tar.bz2
refactor some script debugger internals
Make it possible to reuse more code in remote debugger.
Diffstat (limited to 'src/scripttools/debugging')
-rw-r--r--src/scripttools/debugging/debugging.pri6
-rw-r--r--src/scripttools/debugging/qscriptdebugger.cpp116
-rw-r--r--src/scripttools/debugging/qscriptdebugger_p.h34
-rw-r--r--src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory.cpp109
-rw-r--r--src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory_p.h85
-rw-r--r--src/scripttools/debugging/qscriptdebuggerwidgetfactoryinterface_p.h10
-rw-r--r--src/scripttools/debugging/qscriptenginedebugger.cpp151
7 files changed, 363 insertions, 148 deletions
diff --git a/src/scripttools/debugging/debugging.pri b/src/scripttools/debugging/debugging.pri
index fa39e83..2082fd0 100644
--- a/src/scripttools/debugging/debugging.pri
+++ b/src/scripttools/debugging/debugging.pri
@@ -111,7 +111,8 @@ SOURCES += \
$$PWD/qscriptbreakpointswidget.cpp \
$$PWD/qscriptbreakpointsmodel.cpp \
$$PWD/qscripterrorlogwidgetinterface.cpp \
- $$PWD/qscripterrorlogwidget.cpp
+ $$PWD/qscripterrorlogwidget.cpp \
+ $$PWD/qscriptdebuggerstandardwidgetfactory.cpp
HEADERS += \
$$PWD/qscriptdebuggerconsolewidgetinterface_p_p.h \
@@ -148,7 +149,8 @@ HEADERS += \
$$PWD/qscripterrorlogwidgetinterface_p_p.h \
$$PWD/qscripterrorlogwidgetinterface_p.h \
$$PWD/qscripterrorlogwidget_p.h \
- $$PWD/qscriptdebuggerwidgetfactoryinterface_p.h
+ $$PWD/qscriptdebuggerwidgetfactoryinterface_p.h \
+ $$PWD/qscriptdebuggerstandardwidgetfactory_p.h
SOURCES += \
$$PWD/qscriptenginedebugger.cpp
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp
index 5626a4b..454d051 100644
--- a/src/scripttools/debugging/qscriptdebugger.cpp
+++ b/src/scripttools/debugging/qscriptdebugger.cpp
@@ -1337,6 +1337,122 @@ void QScriptDebugger::setFrontend(QScriptDebuggerFrontend *frontend)
}
}
+QAction *QScriptDebugger::action(DebuggerAction action, QObject *parent)
+{
+ switch (action) {
+ case InterruptAction:
+ return interruptAction(parent);
+ case ContinueAction:
+ return continueAction(parent);
+ case StepIntoAction:
+ return stepIntoAction(parent);
+ case StepOverAction:
+ return stepOverAction(parent);
+ case StepOutAction:
+ return stepOutAction(parent);
+ case RunToCursorAction:
+ return runToCursorAction(parent);
+ case RunToNewScriptAction:
+ return runToNewScriptAction(parent);
+ case ToggleBreakpointAction:
+ return toggleBreakpointAction(parent);
+ case ClearDebugOutputAction:
+ return clearDebugOutputAction(parent);
+ case ClearErrorLogAction:
+ return clearErrorLogAction(parent);
+ case ClearConsoleAction:
+ return clearConsoleAction(parent);
+ case FindInScriptAction:
+ return findInScriptAction(parent);
+ case FindNextInScriptAction:
+ return findNextInScriptAction(parent);
+ case FindPreviousInScriptAction:
+ return findPreviousInScriptAction(parent);
+ case GoToLineAction:
+ return goToLineAction(parent);
+ }
+ return 0;
+}
+
+QWidget *QScriptDebugger::widget(DebuggerWidget widget)
+{
+ switch (widget) {
+ case ConsoleWidget: {
+ QScriptDebuggerConsoleWidgetInterface *w = consoleWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createConsoleWidget();
+ setConsoleWidget(w);
+ }
+ return w;
+ }
+ case StackWidget: {
+ QScriptDebuggerStackWidgetInterface *w = stackWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createStackWidget();
+ setStackWidget(w);
+ }
+ return w;
+ }
+ case ScriptsWidget: {
+ QScriptDebuggerScriptsWidgetInterface *w = scriptsWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createScriptsWidget();
+ setScriptsWidget(w);
+ }
+ return w;
+ }
+ case LocalsWidget: {
+ QScriptDebuggerLocalsWidgetInterface *w = localsWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createLocalsWidget();
+ setLocalsWidget(w);
+ }
+ return w;
+ }
+ case CodeWidget: {
+ QScriptDebuggerCodeWidgetInterface *w = codeWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createCodeWidget();
+ setCodeWidget(w);
+ }
+ return w;
+ }
+ case CodeFinderWidget: {
+ QScriptDebuggerCodeFinderWidgetInterface *w = codeFinderWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createCodeFinderWidget();
+ setCodeFinderWidget(w);
+ }
+ return w;
+ }
+ case BreakpointsWidget: {
+ QScriptBreakpointsWidgetInterface *w = breakpointsWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createBreakpointsWidget();
+ setBreakpointsWidget(w);
+ }
+ return w;
+ }
+ case DebugOutputWidget: {
+ QScriptDebugOutputWidgetInterface *w = debugOutputWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createDebugOutputWidget();
+ setDebugOutputWidget(w);
+ }
+ return w;
+ }
+ case ErrorLogWidget: {
+ QScriptErrorLogWidgetInterface *w = errorLogWidget();
+ if (!w && widgetFactory()) {
+ w = widgetFactory()->createErrorLogWidget();
+ setErrorLogWidget(w);
+ }
+ return w;
+ }
+ }
+ return 0;
+}
+
QScriptDebuggerConsoleWidgetInterface *QScriptDebugger::consoleWidget() const
{
Q_D(const QScriptDebugger);
diff --git a/src/scripttools/debugging/qscriptdebugger_p.h b/src/scripttools/debugging/qscriptdebugger_p.h
index 8f14f4d..6d8fcab 100644
--- a/src/scripttools/debugging/qscriptdebugger_p.h
+++ b/src/scripttools/debugging/qscriptdebugger_p.h
@@ -76,12 +76,46 @@ class Q_AUTOTEST_EXPORT QScriptDebugger : public QObject
{
Q_OBJECT
public:
+ // mirrors QScriptEngineDebugger::DebuggerWidget
+ enum DebuggerWidget {
+ ConsoleWidget,
+ StackWidget,
+ ScriptsWidget,
+ LocalsWidget,
+ CodeWidget,
+ CodeFinderWidget,
+ BreakpointsWidget,
+ DebugOutputWidget,
+ ErrorLogWidget
+ };
+ // mirrors QScriptEngineDebugger::DebuggerAction
+ enum DebuggerAction {
+ InterruptAction,
+ ContinueAction,
+ StepIntoAction,
+ StepOverAction,
+ StepOutAction,
+ RunToCursorAction,
+ RunToNewScriptAction,
+ ToggleBreakpointAction,
+ ClearDebugOutputAction,
+ ClearErrorLogAction,
+ ClearConsoleAction,
+ FindInScriptAction,
+ FindNextInScriptAction,
+ FindPreviousInScriptAction,
+ GoToLineAction
+ };
+
QScriptDebugger(QObject *parent = 0);
~QScriptDebugger();
QScriptDebuggerFrontend *frontend() const;
void setFrontend(QScriptDebuggerFrontend *frontend);
+ QWidget *widget(DebuggerWidget widget);
+ QAction *action(DebuggerAction action, QObject *parent);
+
QScriptDebuggerConsoleWidgetInterface *consoleWidget() const;
void setConsoleWidget(QScriptDebuggerConsoleWidgetInterface *consoleWidget);
diff --git a/src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory.cpp b/src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory.cpp
new file mode 100644
index 0000000..09d6f2f
--- /dev/null
+++ b/src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtSCriptTools 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscriptdebuggerstandardwidgetfactory_p.h"
+#include "qscriptdebuggerconsolewidget_p.h"
+#include "qscriptdebuggerstackwidget_p.h"
+#include "qscriptdebuggerscriptswidget_p.h"
+#include "qscriptdebuggerlocalswidget_p.h"
+#include "qscriptdebuggercodewidget_p.h"
+#include "qscriptdebuggercodefinderwidget_p.h"
+#include "qscriptbreakpointswidget_p.h"
+#include "qscriptdebugoutputwidget_p.h"
+#include "qscripterrorlogwidget_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QScriptDebuggerStandardWidgetFactory::QScriptDebuggerStandardWidgetFactory(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QScriptDebuggerStandardWidgetFactory::~QScriptDebuggerStandardWidgetFactory()
+{
+}
+
+QScriptDebugOutputWidgetInterface *QScriptDebuggerStandardWidgetFactory::createDebugOutputWidget()
+{
+ return new QScriptDebugOutputWidget();
+}
+
+QScriptDebuggerConsoleWidgetInterface *QScriptDebuggerStandardWidgetFactory::createConsoleWidget()
+{
+ return new QScriptDebuggerConsoleWidget();
+}
+
+QScriptErrorLogWidgetInterface *QScriptDebuggerStandardWidgetFactory::createErrorLogWidget()
+{
+ return new QScriptErrorLogWidget();
+}
+
+QScriptDebuggerCodeFinderWidgetInterface *QScriptDebuggerStandardWidgetFactory::createCodeFinderWidget()
+{
+ return new QScriptDebuggerCodeFinderWidget();
+}
+
+QScriptDebuggerStackWidgetInterface *QScriptDebuggerStandardWidgetFactory::createStackWidget()
+{
+ return new QScriptDebuggerStackWidget();
+}
+
+QScriptDebuggerScriptsWidgetInterface *QScriptDebuggerStandardWidgetFactory::createScriptsWidget()
+{
+ return new QScriptDebuggerScriptsWidget();
+}
+
+QScriptDebuggerLocalsWidgetInterface *QScriptDebuggerStandardWidgetFactory::createLocalsWidget()
+{
+ return new QScriptDebuggerLocalsWidget();
+}
+
+QScriptDebuggerCodeWidgetInterface *QScriptDebuggerStandardWidgetFactory::createCodeWidget()
+{
+ return new QScriptDebuggerCodeWidget();
+}
+
+QScriptBreakpointsWidgetInterface *QScriptDebuggerStandardWidgetFactory::createBreakpointsWidget()
+{
+ return new QScriptBreakpointsWidget();
+}
+
+QT_END_NAMESPACE
diff --git a/src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory_p.h b/src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory_p.h
new file mode 100644
index 0000000..bfce66e
--- /dev/null
+++ b/src/scripttools/debugging/qscriptdebuggerstandardwidgetfactory_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtSCriptTools 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTDEBUGGERSTANDARDWIDGETFACTORY_P_H
+#define QSCRIPTDEBUGGERSTANDARDWIDGETFACTORY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+
+#include "qscriptdebuggerwidgetfactoryinterface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_AUTOTEST_EXPORT QScriptDebuggerStandardWidgetFactory
+ : public QObject, public QScriptDebuggerWidgetFactoryInterface
+{
+public:
+ QScriptDebuggerStandardWidgetFactory(QObject *parent = 0);
+ virtual ~QScriptDebuggerStandardWidgetFactory();
+
+ QScriptDebugOutputWidgetInterface *createDebugOutputWidget();
+ QScriptDebuggerConsoleWidgetInterface *createConsoleWidget();
+ QScriptErrorLogWidgetInterface *createErrorLogWidget();
+ QScriptDebuggerCodeFinderWidgetInterface *createCodeFinderWidget();
+ QScriptDebuggerStackWidgetInterface *createStackWidget();
+ QScriptDebuggerScriptsWidgetInterface *createScriptsWidget();
+ QScriptDebuggerLocalsWidgetInterface *createLocalsWidget();
+ QScriptDebuggerCodeWidgetInterface *createCodeWidget();
+ QScriptBreakpointsWidgetInterface *createBreakpointsWidget();
+
+private:
+ Q_DISABLE_COPY(QScriptDebuggerStandardWidgetFactory)
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/scripttools/debugging/qscriptdebuggerwidgetfactoryinterface_p.h b/src/scripttools/debugging/qscriptdebuggerwidgetfactoryinterface_p.h
index 9ad1eeb..ea22793 100644
--- a/src/scripttools/debugging/qscriptdebuggerwidgetfactoryinterface_p.h
+++ b/src/scripttools/debugging/qscriptdebuggerwidgetfactoryinterface_p.h
@@ -61,6 +61,11 @@ class QScriptDebugOutputWidgetInterface;
class QScriptDebuggerConsoleWidgetInterface;
class QScriptErrorLogWidgetInterface;
class QScriptDebuggerCodeFinderWidgetInterface;
+class QScriptDebuggerStackWidgetInterface;
+class QScriptDebuggerScriptsWidgetInterface;
+class QScriptDebuggerLocalsWidgetInterface;
+class QScriptDebuggerCodeWidgetInterface;
+class QScriptBreakpointsWidgetInterface;
class Q_AUTOTEST_EXPORT QScriptDebuggerWidgetFactoryInterface
{
@@ -71,6 +76,11 @@ public:
virtual QScriptDebuggerConsoleWidgetInterface *createConsoleWidget() = 0;
virtual QScriptErrorLogWidgetInterface *createErrorLogWidget() = 0;
virtual QScriptDebuggerCodeFinderWidgetInterface *createCodeFinderWidget() = 0;
+ virtual QScriptDebuggerStackWidgetInterface *createStackWidget() = 0;
+ virtual QScriptDebuggerScriptsWidgetInterface *createScriptsWidget() = 0;
+ virtual QScriptDebuggerLocalsWidgetInterface *createLocalsWidget() = 0;
+ virtual QScriptDebuggerCodeWidgetInterface *createCodeWidget() = 0;
+ virtual QScriptBreakpointsWidgetInterface *createBreakpointsWidget() = 0;
};
QT_END_NAMESPACE
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp
index 0f8b600..a278e14 100644
--- a/src/scripttools/debugging/qscriptenginedebugger.cpp
+++ b/src/scripttools/debugging/qscriptenginedebugger.cpp
@@ -42,16 +42,7 @@
#include "qscriptenginedebugger.h"
#include "qscriptdebugger_p.h"
#include "qscriptenginedebuggerfrontend_p.h"
-#include "qscriptdebuggerconsolewidget_p.h"
-#include "qscriptdebuggerstackwidget_p.h"
-#include "qscriptdebuggerscriptswidget_p.h"
-#include "qscriptdebuggerlocalswidget_p.h"
-#include "qscriptdebuggercodewidget_p.h"
-#include "qscriptdebuggercodefinderwidget_p.h"
-#include "qscriptbreakpointswidget_p.h"
-#include "qscriptdebugoutputwidget_p.h"
-#include "qscripterrorlogwidget_p.h"
-#include "qscriptdebuggerwidgetfactoryinterface_p.h"
+#include "qscriptdebuggerstandardwidgetfactory_p.h"
#include <private/qobject_p.h>
#include <QtCore/qsettings.h>
@@ -238,19 +229,13 @@ public:
*/
class QScriptEngineDebuggerPrivate
- : public QObjectPrivate,
- public QScriptDebuggerWidgetFactoryInterface
+ : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QScriptEngineDebugger)
public:
QScriptEngineDebuggerPrivate();
~QScriptEngineDebuggerPrivate();
- QScriptDebugOutputWidgetInterface *createDebugOutputWidget();
- QScriptDebuggerConsoleWidgetInterface *createConsoleWidget();
- QScriptErrorLogWidgetInterface *createErrorLogWidget();
- QScriptDebuggerCodeFinderWidgetInterface *createCodeFinderWidget();
-
// private slots
void _q_showStandardWindow();
@@ -320,26 +305,6 @@ QScriptEngineDebuggerPrivate::~QScriptEngineDebuggerPrivate()
}
}
-QScriptDebugOutputWidgetInterface *QScriptEngineDebuggerPrivate::createDebugOutputWidget()
-{
- return new QScriptDebugOutputWidget();
-}
-
-QScriptDebuggerConsoleWidgetInterface *QScriptEngineDebuggerPrivate::createConsoleWidget()
-{
- return new QScriptDebuggerConsoleWidget();
-}
-
-QScriptErrorLogWidgetInterface *QScriptEngineDebuggerPrivate::createErrorLogWidget()
-{
- return new QScriptErrorLogWidget();
-}
-
-QScriptDebuggerCodeFinderWidgetInterface *QScriptEngineDebuggerPrivate::createCodeFinderWidget()
-{
- return new QScriptDebuggerCodeFinderWidget();
-}
-
void QScriptEngineDebuggerPrivate::_q_showStandardWindow()
{
Q_Q(QScriptEngineDebugger);
@@ -352,7 +317,7 @@ void QScriptEngineDebuggerPrivate::createDebugger()
Q_Q(QScriptEngineDebugger);
if (!debugger) {
debugger = new QScriptDebugger();
- debugger->setWidgetFactory(this);
+ debugger->setWidgetFactory(new QScriptDebuggerStandardWidgetFactory(q));
QObject::connect(debugger, SIGNAL(started()),
q, SIGNAL(evaluationResumed()));
QObject::connect(debugger, SIGNAL(stopped()),
@@ -447,81 +412,7 @@ QWidget *QScriptEngineDebugger::widget(DebuggerWidget widget) const
{
Q_D(const QScriptEngineDebugger);
const_cast<QScriptEngineDebuggerPrivate*>(d)->createDebugger();
- switch (widget) {
- case ConsoleWidget: {
- QScriptDebuggerConsoleWidgetInterface *w = d->debugger->consoleWidget();
- if (!w) {
- w = new QScriptDebuggerConsoleWidget();
- d->debugger->setConsoleWidget(w);
- }
- return w;
- }
- case StackWidget: {
- QScriptDebuggerStackWidgetInterface *w = d->debugger->stackWidget();
- if (!w) {
- w = new QScriptDebuggerStackWidget();
- d->debugger->setStackWidget(w);
- }
- return w;
- }
- case ScriptsWidget: {
- QScriptDebuggerScriptsWidgetInterface *w = d->debugger->scriptsWidget();
- if (!w) {
- w = new QScriptDebuggerScriptsWidget();
- d->debugger->setScriptsWidget(w);
- }
- return w;
- }
- case LocalsWidget: {
- QScriptDebuggerLocalsWidgetInterface *w = d->debugger->localsWidget();
- if (!w) {
- w = new QScriptDebuggerLocalsWidget();
- d->debugger->setLocalsWidget(w);
- }
- return w;
- }
- case CodeWidget: {
- QScriptDebuggerCodeWidgetInterface *w = d->debugger->codeWidget();
- if (!w) {
- w = new QScriptDebuggerCodeWidget();
- d->debugger->setCodeWidget(w);
- }
- return w;
- }
- case CodeFinderWidget: {
- QScriptDebuggerCodeFinderWidgetInterface *w = d->debugger->codeFinderWidget();
- if (!w) {
- w = new QScriptDebuggerCodeFinderWidget();
- d->debugger->setCodeFinderWidget(w);
- }
- return w;
- }
- case BreakpointsWidget: {
- QScriptBreakpointsWidgetInterface *w = d->debugger->breakpointsWidget();
- if (!w) {
- w = new QScriptBreakpointsWidget();
- d->debugger->setBreakpointsWidget(w);
- }
- return w;
- }
- case DebugOutputWidget: {
- QScriptDebugOutputWidgetInterface *w = d->debugger->debugOutputWidget();
- if (!w) {
- w = new QScriptDebugOutputWidget();
- d->debugger->setDebugOutputWidget(w);
- }
- return w;
- }
- case ErrorLogWidget: {
- QScriptErrorLogWidgetInterface *w = d->debugger->errorLogWidget();
- if (!w) {
- w = new QScriptErrorLogWidget();
- d->debugger->setErrorLogWidget(w);
- }
- return w;
- }
- }
- return 0;
+ return d->debugger->widget(static_cast<QScriptDebugger::DebuggerWidget>(widget));
}
/*!
@@ -545,39 +436,7 @@ QAction *QScriptEngineDebugger::action(DebuggerAction action) const
Q_D(const QScriptEngineDebugger);
QScriptEngineDebugger *that = const_cast<QScriptEngineDebugger*>(this);
that->d_func()->createDebugger();
- switch (action) {
- case InterruptAction:
- return d->debugger->interruptAction(that);
- case ContinueAction:
- return d->debugger->continueAction(that);
- case StepIntoAction:
- return d->debugger->stepIntoAction(that);
- case StepOverAction:
- return d->debugger->stepOverAction(that);
- case StepOutAction:
- return d->debugger->stepOutAction(that);
- case RunToCursorAction:
- return d->debugger->runToCursorAction(that);
- case RunToNewScriptAction:
- return d->debugger->runToNewScriptAction(that);
- case ToggleBreakpointAction:
- return d->debugger->toggleBreakpointAction(that);
- case ClearDebugOutputAction:
- return d->debugger->clearDebugOutputAction(that);
- case ClearErrorLogAction:
- return d->debugger->clearErrorLogAction(that);
- case ClearConsoleAction:
- return d->debugger->clearConsoleAction(that);
- case FindInScriptAction:
- return d->debugger->findInScriptAction(that);
- case FindNextInScriptAction:
- return d->debugger->findNextInScriptAction(that);
- case FindPreviousInScriptAction:
- return d->debugger->findPreviousInScriptAction(that);
- case GoToLineAction:
- return d->debugger->goToLineAction(that);
- }
- return 0;
+ return d->debugger->action(static_cast<QScriptDebugger::DebuggerAction>(action), that);
}
/*!