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 QSCRIPTENGINEDEBUGGER_H |
41 | #define QSCRIPTENGINEDEBUGGER_H |
42 | |
43 | #include <QtCore/qobject.h> |
44 | #include <QtScript/qtscriptglobal.h> |
45 | |
46 | QT_BEGIN_NAMESPACE |
47 | |
48 | |
49 | class QAction; |
50 | class QScriptEngine; |
51 | class QWidget; |
52 | #ifndef QT_NO_MAINWINDOW |
53 | class QMainWindow; |
54 | #endif |
55 | class ; |
56 | class QToolBar; |
57 | |
58 | class QScriptEngineDebuggerPrivate; |
59 | class Q_SCRIPTTOOLS_EXPORT QScriptEngineDebugger : public QObject |
60 | { |
61 | Q_OBJECT |
62 | public: |
63 | enum DebuggerWidget { |
64 | ConsoleWidget, |
65 | StackWidget, |
66 | ScriptsWidget, |
67 | LocalsWidget, |
68 | CodeWidget, |
69 | CodeFinderWidget, |
70 | BreakpointsWidget, |
71 | DebugOutputWidget, |
72 | ErrorLogWidget |
73 | }; |
74 | |
75 | enum DebuggerAction { |
76 | InterruptAction, |
77 | ContinueAction, |
78 | StepIntoAction, |
79 | StepOverAction, |
80 | StepOutAction, |
81 | RunToCursorAction, |
82 | RunToNewScriptAction, |
83 | ToggleBreakpointAction, |
84 | ClearDebugOutputAction, |
85 | ClearErrorLogAction, |
86 | ClearConsoleAction, |
87 | FindInScriptAction, |
88 | FindNextInScriptAction, |
89 | FindPreviousInScriptAction, |
90 | GoToLineAction |
91 | }; |
92 | |
93 | enum DebuggerState { |
94 | RunningState, |
95 | SuspendedState |
96 | }; |
97 | |
98 | explicit QScriptEngineDebugger(QObject *parent = nullptr); |
99 | ~QScriptEngineDebugger(); |
100 | |
101 | void attachTo(QScriptEngine *engine); |
102 | void detach(); |
103 | |
104 | bool autoShowStandardWindow() const; |
105 | void setAutoShowStandardWindow(bool autoShow); |
106 | |
107 | #ifndef QT_NO_MAINWINDOW |
108 | QMainWindow *standardWindow() const; |
109 | #endif |
110 | QToolBar *createStandardToolBar(QWidget *parent = nullptr); |
111 | QMenu *createStandardMenu(QWidget *parent = nullptr); |
112 | |
113 | QWidget *widget(DebuggerWidget widget) const; |
114 | QAction *action(DebuggerAction action) const; |
115 | |
116 | DebuggerState state() const; |
117 | |
118 | Q_SIGNALS: |
119 | void evaluationSuspended(); |
120 | void evaluationResumed(); |
121 | |
122 | private: |
123 | Q_DECLARE_PRIVATE(QScriptEngineDebugger) |
124 | Q_DISABLE_COPY(QScriptEngineDebugger) |
125 | |
126 | Q_PRIVATE_SLOT(d_func(), void _q_showStandardWindow()) |
127 | }; |
128 | |
129 | QT_END_NAMESPACE |
130 | |
131 | #endif |
132 | |