summaryrefslogtreecommitdiffstats
path: root/src/scripttools
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-15 17:08:16 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-15 17:08:16 (GMT)
commit2b529b77bc8caf0f4e56ea6dd1af4f0423fd74d6 (patch)
treeb33a95b8391ab95317c92d84bda8aed4b8981195 /src/scripttools
parent9134604eb34b7757b071bae725d57a880a8b62d6 (diff)
downloadQt-2b529b77bc8caf0f4e56ea6dd1af4f0423fd74d6.zip
Qt-2b529b77bc8caf0f4e56ea6dd1af4f0423fd74d6.tar.gz
Qt-2b529b77bc8caf0f4e56ea6dd1af4f0423fd74d6.tar.bz2
small refactoring so remote debugger can use the same code
Diffstat (limited to 'src/scripttools')
-rw-r--r--src/scripttools/debugging/qscriptdebugger.cpp41
-rw-r--r--src/scripttools/debugging/qscriptdebugger_p.h5
-rw-r--r--src/scripttools/debugging/qscriptenginedebugger.cpp39
3 files changed, 52 insertions, 33 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/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp
index a278e14..6ee6c98 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
@@ -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);
}
/*!