1/****************************************************************************
2**
3** Copyright (C) 2018 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtSCriptTools module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QSCRIPTDEBUGGER_P_H
41#define QSCRIPTDEBUGGER_P_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <QtCore/qobject.h>
55
56QT_BEGIN_NAMESPACE
57
58class QScriptDebuggerFrontend;
59class QScriptDebuggerConsoleWidgetInterface;
60class QScriptDebuggerScriptsWidgetInterface;
61class QScriptDebuggerCodeWidgetInterface;
62class QScriptDebuggerCodeFinderWidgetInterface;
63class QScriptBreakpointsWidgetInterface;
64class QScriptDebuggerStackWidgetInterface;
65class QScriptDebuggerLocalsWidgetInterface;
66class QScriptDebugOutputWidgetInterface;
67class QScriptErrorLogWidgetInterface;
68class QScriptDebuggerWidgetFactoryInterface;
69class QAction;
70class QEvent;
71class QMenu;
72#ifndef QT_NO_TOOLBAR
73class QToolBar;
74#endif
75
76class QScriptDebuggerPrivate;
77class Q_AUTOTEST_EXPORT QScriptDebugger : public QObject
78{
79 Q_OBJECT
80public:
81 // mirrors QScriptEngineDebugger::DebuggerWidget
82 enum DebuggerWidget {
83 ConsoleWidget,
84 StackWidget,
85 ScriptsWidget,
86 LocalsWidget,
87 CodeWidget,
88 CodeFinderWidget,
89 BreakpointsWidget,
90 DebugOutputWidget,
91 ErrorLogWidget
92 };
93 // mirrors QScriptEngineDebugger::DebuggerAction
94 enum DebuggerAction {
95 InterruptAction,
96 ContinueAction,
97 StepIntoAction,
98 StepOverAction,
99 StepOutAction,
100 RunToCursorAction,
101 RunToNewScriptAction,
102 ToggleBreakpointAction,
103 ClearDebugOutputAction,
104 ClearErrorLogAction,
105 ClearConsoleAction,
106 FindInScriptAction,
107 FindNextInScriptAction,
108 FindPreviousInScriptAction,
109 GoToLineAction
110 };
111
112 QScriptDebugger(QObject *parent = 0);
113 ~QScriptDebugger();
114
115 QScriptDebuggerFrontend *frontend() const;
116 void setFrontend(QScriptDebuggerFrontend *frontend);
117
118 QWidget *widget(DebuggerWidget widget);
119 QAction *action(DebuggerAction action, QObject *parent);
120
121 QScriptDebuggerConsoleWidgetInterface *consoleWidget() const;
122 void setConsoleWidget(QScriptDebuggerConsoleWidgetInterface *consoleWidget);
123
124 QScriptDebuggerScriptsWidgetInterface *scriptsWidget() const;
125 void setScriptsWidget(QScriptDebuggerScriptsWidgetInterface *scriptsWidget);
126
127 QScriptDebuggerCodeWidgetInterface *codeWidget() const;
128 void setCodeWidget(QScriptDebuggerCodeWidgetInterface *codeWidget);
129
130 QScriptDebuggerCodeFinderWidgetInterface *codeFinderWidget() const;
131 void setCodeFinderWidget(QScriptDebuggerCodeFinderWidgetInterface *codeFinderWidget);
132
133 QScriptDebuggerStackWidgetInterface *stackWidget() const;
134 void setStackWidget(QScriptDebuggerStackWidgetInterface *stackWidget);
135
136 QScriptDebuggerLocalsWidgetInterface *localsWidget() const;
137 void setLocalsWidget(QScriptDebuggerLocalsWidgetInterface *localsWidget);
138
139 QScriptBreakpointsWidgetInterface *breakpointsWidget() const;
140 void setBreakpointsWidget(QScriptBreakpointsWidgetInterface *breakpointsWidget);
141
142 QScriptDebugOutputWidgetInterface *debugOutputWidget() const;
143 void setDebugOutputWidget(QScriptDebugOutputWidgetInterface *debugOutputWidget);
144
145 QScriptErrorLogWidgetInterface *errorLogWidget() const;
146 void setErrorLogWidget(QScriptErrorLogWidgetInterface *errorLogWidget);
147
148 QScriptDebuggerWidgetFactoryInterface *widgetFactory() const;
149 void setWidgetFactory(QScriptDebuggerWidgetFactoryInterface *factory);
150
151 QAction *interruptAction(QObject *parent) const;
152 QAction *continueAction(QObject *parent) const;
153 QAction *stepIntoAction(QObject *parent) const;
154 QAction *stepOverAction(QObject *parent) const;
155 QAction *stepOutAction(QObject *parent) const;
156 QAction *runToCursorAction(QObject *parent) const;
157 QAction *runToNewScriptAction(QObject *parent) const;
158
159 QAction *toggleBreakpointAction(QObject *parent) const;
160
161 QAction *findInScriptAction(QObject *parent) const;
162 QAction *findNextInScriptAction(QObject *parent) const;
163 QAction *findPreviousInScriptAction(QObject *parent) const;
164 QAction *goToLineAction(QObject *parent) const;
165
166 QAction *clearDebugOutputAction(QObject *parent) const;
167 QAction *clearConsoleAction(QObject *parent) const;
168 QAction *clearErrorLogAction(QObject *parent) const;
169
170 QMenu *createStandardMenu(QWidget *widgetParent, QObject *actionParent);
171#ifndef QT_NO_TOOLBAR
172 QToolBar *createStandardToolBar(QWidget *widgetParent, QObject *actionParent);
173#endif
174 bool eventFilter(QObject *, QEvent *e);
175
176 bool isInteractive() const;
177
178Q_SIGNALS:
179 void stopped() const;
180 void started() const;
181
182protected:
183 void timerEvent(QTimerEvent *e);
184
185protected:
186 QScriptDebugger(QScriptDebuggerPrivate &dd, QObject *parent);
187
188private:
189 Q_DECLARE_PRIVATE(QScriptDebugger)
190 Q_DISABLE_COPY(QScriptDebugger)
191
192 Q_PRIVATE_SLOT(d_func(), void _q_onLineEntered(const QString &))
193 Q_PRIVATE_SLOT(d_func(), void _q_onCurrentFrameChanged(int))
194 Q_PRIVATE_SLOT(d_func(), void _q_onCurrentScriptChanged(qint64))
195 Q_PRIVATE_SLOT(d_func(), void _q_onScriptLocationSelected(int))
196
197 Q_PRIVATE_SLOT(d_func(), void _q_interrupt())
198 Q_PRIVATE_SLOT(d_func(), void _q_continue())
199 Q_PRIVATE_SLOT(d_func(), void _q_stepInto())
200 Q_PRIVATE_SLOT(d_func(), void _q_stepOver())
201 Q_PRIVATE_SLOT(d_func(), void _q_stepOut())
202 Q_PRIVATE_SLOT(d_func(), void _q_runToCursor())
203 Q_PRIVATE_SLOT(d_func(), void _q_runToNewScript())
204
205 Q_PRIVATE_SLOT(d_func(), void _q_toggleBreakpoint())
206
207 Q_PRIVATE_SLOT(d_func(), void _q_clearDebugOutput())
208 Q_PRIVATE_SLOT(d_func(), void _q_clearErrorLog())
209 Q_PRIVATE_SLOT(d_func(), void _q_clearConsole())
210
211 Q_PRIVATE_SLOT(d_func(), void _q_findInScript())
212 Q_PRIVATE_SLOT(d_func(), void _q_findNextInScript())
213 Q_PRIVATE_SLOT(d_func(), void _q_findPreviousInScript())
214 Q_PRIVATE_SLOT(d_func(), void _q_onFindCodeRequest(const QString &, int))
215 Q_PRIVATE_SLOT(d_func(), void _q_goToLine())
216};
217
218QT_END_NAMESPACE
219
220#endif
221

source code of qtscript/src/scripttools/debugging/qscriptdebugger_p.h