summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripttools/debugging')
-rw-r--r--src/scripttools/debugging/qscriptdebugger.cpp41
-rw-r--r--src/scripttools/debugging/qscriptdebugger_p.h5
-rw-r--r--src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp16
-rw-r--r--src/scripttools/debugging/qscriptenginedebugger.cpp43
4 files changed, 63 insertions, 42 deletions
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp
index 454d051..181f4ae 100644
--- a/src/scripttools/debugging/qscriptdebugger.cpp
+++ b/src/scripttools/debugging/qscriptdebugger.cpp
@@ -94,6 +94,8 @@
#include <QtGui/qevent.h>
#include <QtGui/qicon.h>
#include <QtGui/qinputdialog.h>
+#include <QtGui/qmenu.h>
+#include <QtGui/qtoolbar.h>
#include <QtGui/qtooltip.h>
QT_BEGIN_NAMESPACE
@@ -1905,6 +1907,45 @@ QAction *QScriptDebugger::goToLineAction(QObject *parent) const
return d->goToLineAction;
}
+QMenu *QScriptDebugger::createStandardMenu(QWidget *widgetParent, QObject *actionParent)
+{
+ QMenu *menu = new QMenu(widgetParent);
+ menu->setTitle(QObject::tr("Debug"));
+ menu->addAction(action(ContinueAction, actionParent));
+ menu->addAction(action(InterruptAction, actionParent));
+ menu->addAction(action(StepIntoAction, actionParent));
+ menu->addAction(action(StepOverAction, actionParent));
+ menu->addAction(action(StepOutAction, actionParent));
+ menu->addAction(action(RunToCursorAction, actionParent));
+ menu->addAction(action(RunToNewScriptAction, actionParent));
+
+ menu->addSeparator();
+ menu->addAction(action(ToggleBreakpointAction, actionParent));
+
+ menu->addSeparator();
+ menu->addAction(action(ClearDebugOutputAction, actionParent));
+ menu->addAction(action(ClearErrorLogAction, actionParent));
+ menu->addAction(action(ClearConsoleAction, actionParent));
+
+ return menu;
+}
+
+QToolBar *QScriptDebugger::createStandardToolBar(QWidget *widgetParent, QObject *actionParent)
+{
+ QToolBar *tb = new QToolBar(widgetParent);
+ tb->setObjectName(QLatin1String("qtscriptdebugger_standardToolBar"));
+ tb->addAction(action(ContinueAction, actionParent));
+ tb->addAction(action(InterruptAction, actionParent));
+ tb->addAction(action(StepIntoAction, actionParent));
+ tb->addAction(action(StepOverAction, actionParent));
+ tb->addAction(action(StepOutAction, actionParent));
+ tb->addAction(action(RunToCursorAction, actionParent));
+ tb->addAction(action(RunToNewScriptAction, actionParent));
+ tb->addSeparator();
+ tb->addAction(action(FindInScriptAction, actionParent));
+ return tb;
+}
+
/*!
\reimp
*/
diff --git a/src/scripttools/debugging/qscriptdebugger_p.h b/src/scripttools/debugging/qscriptdebugger_p.h
index 6d8fcab..e8fcf21 100644
--- a/src/scripttools/debugging/qscriptdebugger_p.h
+++ b/src/scripttools/debugging/qscriptdebugger_p.h
@@ -70,6 +70,8 @@ class QScriptErrorLogWidgetInterface;
class QScriptDebuggerWidgetFactoryInterface;
class QAction;
class QEvent;
+class QMenu;
+class QToolBar;
class QScriptDebuggerPrivate;
class Q_AUTOTEST_EXPORT QScriptDebugger : public QObject
@@ -165,6 +167,9 @@ public:
QAction *clearConsoleAction(QObject *parent) const;
QAction *clearErrorLogAction(QObject *parent) const;
+ QMenu *createStandardMenu(QWidget *widgetParent, QObject *actionParent);
+ QToolBar *createStandardToolBar(QWidget *widgetParent, QObject *actionParent);
+
bool eventFilter(QObject *, QEvent *e);
Q_SIGNALS:
diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
index e096ba8..94b085d 100644
--- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
@@ -136,6 +136,7 @@ public:
const QScriptDebuggerValuePropertyList &props);
void deleteObjectSnapshots(const QList<qint64> &snapshotIds);
+ void deleteAllObjectSnapshots();
QScriptDebuggerJobSchedulerInterface *jobScheduler;
QScriptDebuggerCommandSchedulerInterface *commandScheduler;
@@ -240,6 +241,14 @@ void QScriptDebuggerLocalsModelPrivate::deleteObjectSnapshots(const QList<qint64
frontend.scheduleDeleteScriptObjectSnapshot(snapshotIds.at(i));
}
+void QScriptDebuggerLocalsModelPrivate::deleteAllObjectSnapshots()
+{
+ QList<qint64> snapshotIds;
+ for (int i = 0; i < invisibleRootNode->children.count(); ++i)
+ snapshotIds += findSnapshotIdsRecursively(invisibleRootNode->children.at(i));
+ deleteObjectSnapshots(snapshotIds);
+}
+
QScriptDebuggerLocalsModelPrivate *QScriptDebuggerLocalsModelPrivate::get(QScriptDebuggerLocalsModel *q)
{
return q->d_func();
@@ -442,13 +451,6 @@ QScriptDebuggerLocalsModel::QScriptDebuggerLocalsModel(
QScriptDebuggerLocalsModel::~QScriptDebuggerLocalsModel()
{
- Q_D(QScriptDebuggerLocalsModel);
- QList<qint64> snapshotIds;
- for (int i = 0; i < d->invisibleRootNode->children.count(); ++i)
- snapshotIds += findSnapshotIdsRecursively(d->invisibleRootNode->children.at(i));
- QScriptDebuggerCommandSchedulerFrontend frontend(d->commandScheduler, 0);
- for (int j = 0; j < snapshotIds.size(); ++j)
- frontend.scheduleDeleteScriptObjectSnapshot(snapshotIds.at(j));
}
QModelIndex QScriptDebuggerLocalsModelPrivate::addTopLevelObject(const QString &name, const QScriptDebuggerValue &object)
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp
index a278e14..b09c79a 100644
--- a/src/scripttools/debugging/qscriptenginedebugger.cpp
+++ b/src/scripttools/debugging/qscriptenginedebugger.cpp
@@ -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
@@ -412,7 +410,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 +434,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 +587,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 +600,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);
}
/*!