Debian Codegraph @

src/scripttools/debugging/qscriptdebuggercodeview.cpp

raw symbols SCIP
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 #include "qscriptdebuggercodeview_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptdebuggercodeview_p.h`/
41 #include "qscriptdebuggercodeviewinterface_p_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptdebuggercodeviewinterface_p_p.h`/
42
43 #include "qscriptedit_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptedit_p.h`/
44
45 #include <QtWidgets/qboxlayout.h>
46 #include <QtGui/qtextobject.h>
47 #include <QtCore/qdebug.h>
48
49 QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`!
50
51 class QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#
52 : public QScriptDebuggerCodeViewInterfacePrivatecxx . . $ QScriptDebuggerCodeViewInterfacePrivate#
53 {
54 Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(QScriptDebuggerCodeView)
55 public:
56 QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#QScriptDebuggerCodeViewPrivate(49f6e7a06ebc5aa8).();
57 ~cxx . . $ QScriptDebuggerCodeViewPrivate#`~QScriptDebuggerCodeViewPrivate`(ced63f7c635d850d).QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#();
58
59 QScriptEditcxx . . $ QScriptEdit# *editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.;
60 };
61
62 QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#::QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#QScriptDebuggerCodeViewPrivate(49f6e7a06ebc5aa8).()
63 {
64 }
65
66 QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#::~cxx . . $ QScriptDebuggerCodeViewPrivate#`~QScriptDebuggerCodeViewPrivate`(ced63f7c635d850d).QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#()
67 {
68 }
69
70 QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#QScriptDebuggerCodeView(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent)
71 : QScriptDebuggerCodeViewInterfacecxx . . $ QScriptDebuggerCodeViewInterface#(*new QScriptDebuggerCodeViewPrivatecxx . . $ QScriptDebuggerCodeViewPrivate#QScriptDebuggerCodeViewPrivate(49f6e7a06ebc5aa8)., parent, {})
72 {
73 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
74 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor. = new QScriptEditcxx . . $ QScriptEdit#();
75 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setReadOnlycxx . . $ QPlainTextEdit#setReadOnly(b45ddcbc8423892c).(true);
76 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setBackgroundVisiblecxx . . $ QPlainTextEdit#setBackgroundVisible(b45ddcbc8423892c).(false);
77 QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(835f87066c895669).(d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(breakpointToggleRequest(int,bool)),
78 this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(breakpointToggleRequest(int,bool)));
79 QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(835f87066c895669).(d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(breakpointEnableRequest(int,bool)),
80 this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(breakpointEnableRequest(int,bool)));
81 QVBoxLayoutcxx . . $ QVBoxLayout# *vbox = new QVBoxLayout(this);
82 vbox->setContentsMarginscxx . . $ QLayout#setContentsMargins(79c4c8645766fc71).(0, 0, 0, 0);
83 vbox->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.);
84 }
85
86 QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::~cxx . . $ QScriptDebuggerCodeView#`~QScriptDebuggerCodeView`(ced63f7c635d850d).QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#()
87 {
88 }
89
90 QStringcxx . . $ QString# QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::textcxx . . $ QScriptDebuggerCodeView#text(6ef7b6c27b00b43d).() const
91 {
92 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptDebuggerCodeView);
93 return d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->toPlainTextcxx . . $ QPlainTextEdit#toPlainText(6ef7b6c27b00b43d).();
94 }
95
96 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::setTextcxx . . $ QScriptDebuggerCodeView#setText(3520e46b33348bf6).(const QStringcxx . . $ QString# &text)
97 {
98 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
99 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setPlainTextcxx . . $ QPlainTextEdit#setPlainText(3520e46b33348bf6).(text);
100 }
101
102 int QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::cursorLineNumbercxx . . $ QScriptDebuggerCodeView#cursorLineNumber(455f465bc33b4cdf).() const
103 {
104 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptDebuggerCodeView);
105 return d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->currentLineNumbercxx . . $ QScriptEdit#currentLineNumber(455f465bc33b4cdf).();
106 }
107
108 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::gotoLinecxx . . $ QScriptDebuggerCodeView#gotoLine(d4f767463ce0a6b3).(int lineNumber)
109 {
110 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
111 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->gotoLinecxx . . $ QScriptEdit#gotoLine(d4f767463ce0a6b3).(lineNumber);
112 }
113
114 int QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::findcxx . . $ QScriptDebuggerCodeView#find(a664fe1f05d5cb93).(const QStringcxx . . $ QString# &exp, int options)
115 {
116 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
117 QPlainTextEditcxx . . $ QPlainTextEdit# *ed = (QPlainTextEditcxx . . $ QPlainTextEdit#*)d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.;
118 QTextCursorcxx . . $ QTextCursor# cursor = ed->textCursorcxx . . $ QPlainTextEdit#textCursor(878247cba2fd3c00).();
119 if (options & 0x100) {
120 // start searching from the beginning of selection
121 if (cursor.hasSelectioncxx . . $ QTextCursor#hasSelection(50ce9a9e25b4a850).()) {
122 int len = cursor.selectedTextcxx . . $ QTextCursor#selectedText(6ef7b6c27b00b43d).().lengthcxx . . $ QString#length(455f465bc33b4cdf).();
123 cursor.clearSelectioncxx . . $ QTextCursor#clearSelection(49f6e7a06ebc5aa8).();
124 cursor.setPositioncxx . . $ QTextCursor#setPosition(f2a23d9eedd3abdd).(cursor.positioncxx . . $ QTextCursor#position(455f465bc33b4cdf).() - len);
125 ed->setTextCursorcxx . . $ QPlainTextEdit#setTextCursor(a408cee6726ac3d5).(cursor);
126 }
127 options &= ~0x100;
128 }
129 int ret = 0;
130 if (ed->findcxx . . $ QPlainTextEdit#find(a6e397b8ae6adea7).(exp, QTextDocument::FindFlags(options))) {
131 ret |= 0x1;
132 } else {
133 QTextCursorcxx . . $ QTextCursor# curse = cursorcxx . . $ QTextCursor#QTextCursor(a408cee6726ac3d5).;
134 curse.movePositioncxx . . $ QTextCursor#movePosition(e5e992d8a5d1c17e).(QTextCursorcxx . . $ QTextCursor#::Startcxx . . $ QTextCursor#Start.);
135 ed->setTextCursorcxx . . $ QPlainTextEdit#setTextCursor(a408cee6726ac3d5).(curse);
136 if (ed->findcxx . . $ QPlainTextEdit#find(a6e397b8ae6adea7).(exp, QTextDocument::FindFlags(options)))
137 ret |= 0x1 | 0x2;
138 else
139 ed->setTextCursorcxx . . $ QPlainTextEdit#setTextCursor(a408cee6726ac3d5).(cursor);
140 }
141 return ret;
142 }
143
144 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::setExecutionLineNumbercxx . . $ QScriptDebuggerCodeView#setExecutionLineNumber(918ebd27a9ddbad3).(int lineNumber, bool error)
145 {
146 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
147 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setExecutionLineNumbercxx . . $ QScriptEdit#setExecutionLineNumber(918ebd27a9ddbad3).(lineNumber, error);
148 }
149
150 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::setExecutableLineNumberscxx . . $ QScriptDebuggerCodeView#setExecutableLineNumbers(5f64d7721fa801f3).(const QSetcxx . . $ QSet#<int> &lineNumbers)
151 {
152 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
153 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setExecutableLineNumberscxx . . $ QScriptEdit#setExecutableLineNumbers(5f64d7721fa801f3).(lineNumbers);
154 }
155
156 int QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::baseLineNumbercxx . . $ QScriptDebuggerCodeView#baseLineNumber(455f465bc33b4cdf).() const
157 {
158 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptDebuggerCodeView);
159 return d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->baseLineNumbercxx . . $ QScriptEdit#baseLineNumber(455f465bc33b4cdf).();
160 }
161
162 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::setBaseLineNumbercxx . . $ QScriptDebuggerCodeView#setBaseLineNumber(d4f767463ce0a6b3).(int lineNumber)
163 {
164 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
165 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setBaseLineNumbercxx . . $ QScriptEdit#setBaseLineNumber(d4f767463ce0a6b3).(lineNumber);
166 }
167
168 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::setBreakpointcxx . . $ QScriptDebuggerCodeView#setBreakpoint(d4f767463ce0a6b3).(int lineNumber)
169 {
170 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
171 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setBreakpointcxx . . $ QScriptEdit#setBreakpoint(d4f767463ce0a6b3).(lineNumber);
172 }
173
174 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::deleteBreakpointcxx . . $ QScriptDebuggerCodeView#deleteBreakpoint(d4f767463ce0a6b3).(int lineNumber)
175 {
176 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
177 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->deleteBreakpointcxx . . $ QScriptEdit#deleteBreakpoint(d4f767463ce0a6b3).(lineNumber);
178 }
179
180 void QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::setBreakpointEnabledcxx . . $ QScriptDebuggerCodeView#setBreakpointEnabled(918ebd27a9ddbad3).(int lineNumber, bool enable)
181 {
182 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
183 d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->setBreakpointEnabledcxx . . $ QScriptEdit#setBreakpointEnabled(918ebd27a9ddbad3).(lineNumber, enable);
184 }
185
186 namespacecxx . . $ `$anonymous_namespace_src/scripttools/debugging/qscriptdebuggercodeview.cpp`/ {
187
188 static bool isIdentCharcxx . . $ `$anonymous_namespace_src/scripttools/debugging/qscriptdebuggercodeview.cpp`/isIdentChar(ab742ecf0fa16847).(const QCharcxx . . $ QChar# &ch)
189 {
190 static QCharcxx . . $ QChar# underscore = QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('_');
191 return ch.isLettercxx . . $ QChar#isLetter(3482b152b9333168).() || (ch ==cxx . . $ `operator==`(a468b2f18a3afe8). underscore);
192 }
193
194 } // namespace
195
196 /*!
197 \reimp
198 */
199 bool QScriptDebuggerCodeViewcxx . . $ QScriptDebuggerCodeView#::eventcxx . . $ QScriptDebuggerCodeView#event(f123fa2ce489f0bd).(QEventcxx . . $ QEvent# *e)
200 {
201 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerCodeView);
202 if (e->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::ToolTipcxx . . $ QEvent#ToolTip.) {
203 if (d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->executionLineNumbercxx . . $ QScriptEdit#executionLineNumber(455f465bc33b4cdf).() == -1)
204 return false;
205 QHelpEventcxx . . $ QHelpEvent# *he = static_cast<QHelpEventcxx . . $ QHelpEvent#*>(e);
206 QPointcxx . . $ QPoint# pt = he->poscxx . . $ QHelpEvent#pos(6de9f7a200ca710c).();
207 pt.rxcxx . . $ QPoint#rx(ffa05e89dbf2c50f).() -= d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).();
208 pt.rycxx . . $ QPoint#ry(ffa05e89dbf2c50f).() -= 8;
209 QTextCursorcxx . . $ QTextCursor# cursor = d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->cursorForPositioncxx . . $ QPlainTextEdit#cursorForPosition(4a0e9685946a717d).(pt);
210 QTextBlockcxx . . $ QTextBlock# block = cursor.blockcxx . . $ QTextCursor#block(fcb2c37f271a2a41).();
211 QStringcxx . . $ QString# contents = block.textcxx . . $ QTextBlock#text(6ef7b6c27b00b43d).();
212 if (contents.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).())
213 return false;
214 int linePosition = cursor.positioncxx . . $ QTextCursor#position(455f465bc33b4cdf).() - block.positioncxx . . $ QTextBlock#position(455f465bc33b4cdf).();
215 if (linePosition < 0)
216 linePosition = 0;
217
218 // ### generalize -- same as in completiontask
219
220 int pos = linePosition;
221 if ((pos > 0) && contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos-1).isNumbercxx . . $ QChar#isNumber(3482b152b9333168).()) {
222 // tooltips for numbers is pointless
223 return false;
224 }
225
226 while ((pos > 0) && isIdentCharcxx . . $ `$anonymous_namespace_src/scripttools/debugging/qscriptdebuggercodeview.cpp`/isIdentChar(ab742ecf0fa16847).(contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos-1)))
227 --pos;
228 if ((pos > 0) && ((contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('\''))
229 || (contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('\"')))) {
230 // ignore string literals
231 return false;
232 }
233 int pos2 = linePosition - 1;
234 while ((pos2+1 < contents.sizecxx . . $ QString#size(455f465bc33b4cdf).()) && isIdentCharcxx . . $ `$anonymous_namespace_src/scripttools/debugging/qscriptdebuggercodeview.cpp`/isIdentChar(ab742ecf0fa16847).(contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos2+1)))
235 ++pos2;
236 QStringcxx . . $ QString# ident = contents.midcxx . . $ QString#mid(44b7563da18aea72).(pos, pos2 - pos + 1);
237
238 QStringListcxx . . $ QStringList# pathcxx . . $ QStringList#QStringList(ced63f7c635d850d).;
239 path.append(ident);
240 while ((pos > 0) && (contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('.'))) {
241 --pos;
242 pos2 = pos;
243 while ((pos > 0) && isIdentCharcxx . . $ `$anonymous_namespace_src/scripttools/debugging/qscriptdebuggercodeview.cpp`/isIdentChar(ab742ecf0fa16847).(contents.atcxx . . $ QString#at(13af7ae5a875439e).(pos-1)))
244 --pos;
245 path.prepend(contents.midcxx . . $ QString#mid(44b7563da18aea72).(pos, pos2 - pos));
246 }
247
248 if (!path.isEmpty()) {
249 int lineNumber = cursor.blockNumbercxx . . $ QTextCursor#blockNumber(455f465bc33b4cdf).() + d->editorcxx . . $ QScriptDebuggerCodeViewPrivate#editor.->baseLineNumbercxx . . $ QScriptEdit#baseLineNumber(455f465bc33b4cdf).();
250 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! toolTipRequestcxx . . $ QScriptDebuggerCodeViewInterface#toolTipRequest(79748ab40653c518).(he->globalPoscxx . . $ QHelpEvent#globalPos(6de9f7a200ca710c).(), lineNumber, path);
251 }
252 }
253 return false;
254 }
255
256 QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`!
257
258 #include "moc_qscriptdebuggercodeview_p.cpp"cxx . . $ `<file>/src/scripttools/.moc/moc_qscriptdebuggercodeview_p.cpp`/