[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the QtSCriptTools module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
[561] | 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #include "qscriptdebuggerconsoleglobalobject_p.h"
|
---|
| 43 | #include "qscriptdebuggercommandschedulerinterface_p.h"
|
---|
| 44 | #include "qscriptdebuggercommandschedulerfrontend_p.h"
|
---|
| 45 | #include "qscriptmessagehandlerinterface_p.h"
|
---|
| 46 | #include "qscriptdebuggerconsole_p.h"
|
---|
| 47 | #include "qscriptdebuggerconsolecommandmanager_p.h"
|
---|
| 48 |
|
---|
| 49 | #include <private/qobject_p.h>
|
---|
| 50 |
|
---|
| 51 | #include <QtScript/qscriptengine.h>
|
---|
| 52 |
|
---|
| 53 | QT_BEGIN_NAMESPACE
|
---|
| 54 |
|
---|
| 55 | class QScriptDebuggerConsoleGlobalObjectPrivate : public QObjectPrivate
|
---|
| 56 | {
|
---|
| 57 | Q_DECLARE_PUBLIC(QScriptDebuggerConsoleGlobalObject)
|
---|
| 58 | public:
|
---|
| 59 | QScriptDebuggerConsoleGlobalObjectPrivate();
|
---|
| 60 | ~QScriptDebuggerConsoleGlobalObjectPrivate();
|
---|
| 61 |
|
---|
| 62 | QScriptDebuggerCommandSchedulerInterface *scheduler;
|
---|
| 63 | QScriptDebuggerResponseHandlerInterface *responseHandler;
|
---|
| 64 | QScriptMessageHandlerInterface *messageHandler;
|
---|
| 65 | QScriptDebuggerConsole *console;
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | QScriptDebuggerConsoleGlobalObjectPrivate::QScriptDebuggerConsoleGlobalObjectPrivate()
|
---|
| 69 | {
|
---|
| 70 | scheduler = 0;
|
---|
| 71 | responseHandler = 0;
|
---|
| 72 | messageHandler = 0;
|
---|
| 73 | console = 0;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | QScriptDebuggerConsoleGlobalObjectPrivate::~QScriptDebuggerConsoleGlobalObjectPrivate()
|
---|
| 77 | {
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | QScriptDebuggerConsoleGlobalObject::QScriptDebuggerConsoleGlobalObject(QObject *parent)
|
---|
| 81 | : QObject(*new QScriptDebuggerConsoleGlobalObjectPrivate, parent)
|
---|
| 82 | {
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | QScriptDebuggerConsoleGlobalObject::~QScriptDebuggerConsoleGlobalObject()
|
---|
| 86 | {
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | QScriptDebuggerCommandSchedulerInterface *QScriptDebuggerConsoleGlobalObject::scheduler() const
|
---|
| 90 | {
|
---|
| 91 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 92 | return d->scheduler;
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | void QScriptDebuggerConsoleGlobalObject::setScheduler(QScriptDebuggerCommandSchedulerInterface *scheduler)
|
---|
| 96 | {
|
---|
| 97 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 98 | d->scheduler = scheduler;
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | QScriptDebuggerResponseHandlerInterface *QScriptDebuggerConsoleGlobalObject::responseHandler() const
|
---|
| 102 | {
|
---|
| 103 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 104 | return d->responseHandler;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | void QScriptDebuggerConsoleGlobalObject::setResponseHandler(
|
---|
| 108 | QScriptDebuggerResponseHandlerInterface *responseHandler)
|
---|
| 109 | {
|
---|
| 110 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 111 | d->responseHandler = responseHandler;
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | QScriptMessageHandlerInterface *QScriptDebuggerConsoleGlobalObject::messageHandler() const
|
---|
| 115 | {
|
---|
| 116 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 117 | return d->messageHandler;
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | void QScriptDebuggerConsoleGlobalObject::setMessageHandler(QScriptMessageHandlerInterface *messageHandler)
|
---|
| 121 | {
|
---|
| 122 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 123 | d->messageHandler = messageHandler;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | QScriptDebuggerConsole *QScriptDebuggerConsoleGlobalObject::console() const
|
---|
| 127 | {
|
---|
| 128 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 129 | return d->console;
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | void QScriptDebuggerConsoleGlobalObject::setConsole(QScriptDebuggerConsole *console)
|
---|
| 133 | {
|
---|
| 134 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 135 | d->console = console;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | // ### the scheduleXXX functions could take a callback function as argument (rather than using the
|
---|
| 139 | // global handleResponse() function)
|
---|
| 140 |
|
---|
| 141 | int QScriptDebuggerConsoleGlobalObject::scheduleInterrupt()
|
---|
| 142 | {
|
---|
| 143 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 144 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 145 | return frontend.scheduleInterrupt();
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | int QScriptDebuggerConsoleGlobalObject::scheduleContinue()
|
---|
| 149 | {
|
---|
| 150 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 151 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 152 | return frontend.scheduleContinue();
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | int QScriptDebuggerConsoleGlobalObject::scheduleStepInto(int count)
|
---|
| 156 | {
|
---|
| 157 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 158 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 159 | return frontend.scheduleStepInto(count);
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | int QScriptDebuggerConsoleGlobalObject::scheduleStepOver(int count)
|
---|
| 163 | {
|
---|
| 164 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 165 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 166 | return frontend.scheduleStepOver(count);
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | int QScriptDebuggerConsoleGlobalObject::scheduleStepOut()
|
---|
| 170 | {
|
---|
| 171 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 172 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 173 | return frontend.scheduleStepOut();
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | int QScriptDebuggerConsoleGlobalObject::scheduleRunToLocation(const QString &fileName, int lineNumber)
|
---|
| 177 | {
|
---|
| 178 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 179 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 180 | return frontend.scheduleRunToLocation(fileName, lineNumber);
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | int QScriptDebuggerConsoleGlobalObject::scheduleRunToLocation(qint64 scriptId, int lineNumber)
|
---|
| 184 | {
|
---|
| 185 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 186 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 187 | return frontend.scheduleRunToLocation(scriptId, lineNumber);
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | int QScriptDebuggerConsoleGlobalObject::scheduleForceReturn(int contextIndex, const QScriptDebuggerValue &value)
|
---|
| 191 | {
|
---|
| 192 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 193 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 194 | return frontend.scheduleForceReturn(contextIndex, value);
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | int QScriptDebuggerConsoleGlobalObject::scheduleSetBreakpoint(const QScriptBreakpointData &data)
|
---|
| 198 | {
|
---|
| 199 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 200 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 201 | return frontend.scheduleSetBreakpoint(data);
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 | int QScriptDebuggerConsoleGlobalObject::scheduleDeleteBreakpoint(int id)
|
---|
| 205 | {
|
---|
| 206 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 207 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 208 | return frontend.scheduleDeleteBreakpoint(id);
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | int QScriptDebuggerConsoleGlobalObject::scheduleDeleteAllBreakpoints()
|
---|
| 212 | {
|
---|
| 213 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 214 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 215 | return frontend.scheduleDeleteAllBreakpoints();
|
---|
| 216 | }
|
---|
| 217 |
|
---|
| 218 | int QScriptDebuggerConsoleGlobalObject::scheduleGetBreakpoints()
|
---|
| 219 | {
|
---|
| 220 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 221 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 222 | return frontend.scheduleGetBreakpoints();
|
---|
| 223 | }
|
---|
| 224 |
|
---|
| 225 | int QScriptDebuggerConsoleGlobalObject::scheduleGetBreakpointData(int id)
|
---|
| 226 | {
|
---|
| 227 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 228 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 229 | return frontend.scheduleGetBreakpointData(id);
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | int QScriptDebuggerConsoleGlobalObject::scheduleSetBreakpointData(int id, const QScriptBreakpointData &data)
|
---|
| 233 | {
|
---|
| 234 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 235 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 236 | return frontend.scheduleSetBreakpointData(id, data);
|
---|
| 237 | }
|
---|
| 238 |
|
---|
| 239 | int QScriptDebuggerConsoleGlobalObject::scheduleGetScripts()
|
---|
| 240 | {
|
---|
| 241 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 242 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 243 | return frontend.scheduleGetScripts();
|
---|
| 244 | }
|
---|
| 245 |
|
---|
| 246 | int QScriptDebuggerConsoleGlobalObject::scheduleGetScriptData(qint64 id)
|
---|
| 247 | {
|
---|
| 248 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 249 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 250 | return frontend.scheduleGetScriptData(id);
|
---|
| 251 | }
|
---|
| 252 |
|
---|
| 253 | int QScriptDebuggerConsoleGlobalObject::scheduleScriptsCheckpoint()
|
---|
| 254 | {
|
---|
| 255 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 256 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 257 | return frontend.scheduleScriptsCheckpoint();
|
---|
| 258 | }
|
---|
| 259 |
|
---|
| 260 | int QScriptDebuggerConsoleGlobalObject::scheduleGetScriptsDelta()
|
---|
| 261 | {
|
---|
| 262 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 263 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 264 | return frontend.scheduleGetScriptsDelta();
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 | int QScriptDebuggerConsoleGlobalObject::scheduleResolveScript(const QString &fileName)
|
---|
| 268 | {
|
---|
| 269 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 270 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 271 | return frontend.scheduleResolveScript(fileName);
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | int QScriptDebuggerConsoleGlobalObject::scheduleGetBacktrace()
|
---|
| 275 | {
|
---|
| 276 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 277 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 278 | return frontend.scheduleGetBacktrace();
|
---|
| 279 | }
|
---|
| 280 |
|
---|
| 281 | int QScriptDebuggerConsoleGlobalObject::scheduleGetThisObject(int contextIndex)
|
---|
| 282 | {
|
---|
| 283 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 284 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 285 | return frontend.scheduleGetThisObject(contextIndex);
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 | int QScriptDebuggerConsoleGlobalObject::scheduleGetActivationObject(int contextIndex)
|
---|
| 289 | {
|
---|
| 290 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 291 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 292 | return frontend.scheduleGetActivationObject(contextIndex);
|
---|
| 293 | }
|
---|
| 294 |
|
---|
| 295 | int QScriptDebuggerConsoleGlobalObject::scheduleGetContextCount()
|
---|
| 296 | {
|
---|
| 297 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 298 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 299 | return frontend.scheduleGetContextCount();
|
---|
| 300 | }
|
---|
| 301 |
|
---|
| 302 | int QScriptDebuggerConsoleGlobalObject::scheduleGetContextInfo(int contextIndex)
|
---|
| 303 | {
|
---|
| 304 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 305 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 306 | return frontend.scheduleGetContextInfo(contextIndex);
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 | int QScriptDebuggerConsoleGlobalObject::scheduleNewScriptValueIterator(const QScriptDebuggerValue &object)
|
---|
| 310 | {
|
---|
| 311 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 312 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 313 | return frontend.scheduleNewScriptValueIterator(object);
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | int QScriptDebuggerConsoleGlobalObject::scheduleGetPropertiesByIterator(int id, int count)
|
---|
| 317 | {
|
---|
| 318 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 319 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 320 | return frontend.scheduleGetPropertiesByIterator(id, count);
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | int QScriptDebuggerConsoleGlobalObject::scheduleDeleteScriptValueIterator(int id)
|
---|
| 324 | {
|
---|
| 325 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 326 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 327 | return frontend.scheduleDeleteScriptValueIterator(id);
|
---|
| 328 | }
|
---|
| 329 |
|
---|
| 330 | int QScriptDebuggerConsoleGlobalObject::scheduleEvaluate(int contextIndex, const QString &program,
|
---|
| 331 | const QString &fileName,
|
---|
| 332 | int lineNumber)
|
---|
| 333 | {
|
---|
| 334 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 335 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 336 | return frontend.scheduleEvaluate(contextIndex, program, fileName, lineNumber);
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | int QScriptDebuggerConsoleGlobalObject::scheduleScriptValueToString(const QScriptDebuggerValue &value)
|
---|
| 340 | {
|
---|
| 341 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 342 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 343 | return frontend.scheduleScriptValueToString(value);
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | int QScriptDebuggerConsoleGlobalObject::scheduleClearExceptions()
|
---|
| 347 | {
|
---|
| 348 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 349 | QScriptDebuggerCommandSchedulerFrontend frontend(d->scheduler, d->responseHandler);
|
---|
| 350 | return frontend.scheduleClearExceptions();
|
---|
| 351 | }
|
---|
| 352 |
|
---|
| 353 | int QScriptDebuggerConsoleGlobalObject::scheduleCommand(const QScriptDebuggerCommand &command)
|
---|
| 354 | {
|
---|
| 355 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 356 | return d->scheduler->scheduleCommand(command, d->responseHandler);
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | void QScriptDebuggerConsoleGlobalObject::warning(const QString &text,
|
---|
| 360 | const QString &fileName,
|
---|
| 361 | int lineNumber, int columnNumber)
|
---|
| 362 | {
|
---|
| 363 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
[561] | 364 | Q_ASSERT(d->messageHandler != 0);
|
---|
[2] | 365 | d->messageHandler->message(QtWarningMsg, text, fileName, lineNumber, columnNumber);
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | void QScriptDebuggerConsoleGlobalObject::message(const QString &text,
|
---|
| 369 | const QString &fileName,
|
---|
| 370 | int lineNumber, int columnNumber)
|
---|
| 371 | {
|
---|
| 372 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
[561] | 373 | Q_ASSERT(d->messageHandler != 0);
|
---|
[2] | 374 | d->messageHandler->message(QtDebugMsg, text, fileName, lineNumber, columnNumber);
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 | void QScriptDebuggerConsoleGlobalObject::error(const QString &text,
|
---|
| 378 | const QString &fileName,
|
---|
| 379 | int lineNumber, int columnNumber)
|
---|
| 380 | {
|
---|
| 381 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
[561] | 382 | Q_ASSERT(d->messageHandler != 0);
|
---|
[2] | 383 | d->messageHandler->message(QtCriticalMsg, text, fileName, lineNumber, columnNumber);
|
---|
| 384 | }
|
---|
| 385 |
|
---|
| 386 | int QScriptDebuggerConsoleGlobalObject::getCurrentFrameIndex() const
|
---|
| 387 | {
|
---|
| 388 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 389 | return d->console->currentFrameIndex();
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | void QScriptDebuggerConsoleGlobalObject::setCurrentFrameIndex(int index)
|
---|
| 393 | {
|
---|
| 394 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 395 | d->console->setCurrentFrameIndex(index);
|
---|
| 396 | }
|
---|
| 397 |
|
---|
| 398 | int QScriptDebuggerConsoleGlobalObject::getCurrentLineNumber() const
|
---|
| 399 | {
|
---|
| 400 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 401 | return d->console->currentLineNumber();
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | void QScriptDebuggerConsoleGlobalObject::setCurrentLineNumber(int lineNumber)
|
---|
| 405 | {
|
---|
| 406 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 407 | d->console->setCurrentLineNumber(lineNumber);
|
---|
| 408 | }
|
---|
| 409 |
|
---|
| 410 | qint64 QScriptDebuggerConsoleGlobalObject::getCurrentScriptId() const
|
---|
| 411 | {
|
---|
| 412 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 413 | return d->console->currentScriptId();
|
---|
| 414 | }
|
---|
| 415 |
|
---|
| 416 | void QScriptDebuggerConsoleGlobalObject::setCurrentScriptId(qint64 id)
|
---|
| 417 | {
|
---|
| 418 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 419 | d->console->setCurrentScriptId(id);
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | qint64 QScriptDebuggerConsoleGlobalObject::getSessionId() const
|
---|
| 423 | {
|
---|
| 424 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 425 | return d->console->sessionId();
|
---|
| 426 | }
|
---|
| 427 |
|
---|
| 428 | QScriptDebuggerConsoleCommandGroupMap QScriptDebuggerConsoleGlobalObject::getCommandGroups() const
|
---|
| 429 | {
|
---|
| 430 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 431 | return d->console->commandManager()->commandGroups();
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 | QScriptDebuggerConsoleCommand *QScriptDebuggerConsoleGlobalObject::findCommand(const QString &name) const
|
---|
| 435 | {
|
---|
| 436 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 437 | return d->console->commandManager()->findCommand(name);
|
---|
| 438 | }
|
---|
| 439 |
|
---|
| 440 | QScriptDebuggerConsoleCommandList QScriptDebuggerConsoleGlobalObject::getCommandsInGroup(const QString &name) const
|
---|
| 441 | {
|
---|
| 442 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 443 | return d->console->commandManager()->commandsInGroup(name);
|
---|
| 444 | }
|
---|
| 445 |
|
---|
| 446 | QStringList QScriptDebuggerConsoleGlobalObject::getCommandCompletions(const QString &prefix) const
|
---|
| 447 | {
|
---|
| 448 | Q_D(const QScriptDebuggerConsoleGlobalObject);
|
---|
| 449 | return d->console->commandManager()->completions(prefix);
|
---|
| 450 | }
|
---|
| 451 |
|
---|
| 452 | bool QScriptDebuggerConsoleGlobalObject::checkSyntax(const QString &program)
|
---|
| 453 | {
|
---|
| 454 | return (QScriptEngine::checkSyntax(program).state() == QScriptSyntaxCheckResult::Valid);
|
---|
| 455 | }
|
---|
| 456 |
|
---|
| 457 | void QScriptDebuggerConsoleGlobalObject::setEvaluateAction(int action)
|
---|
| 458 | {
|
---|
| 459 | Q_D(QScriptDebuggerConsoleGlobalObject);
|
---|
| 460 | d->console->setEvaluateAction(action);
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 | QT_END_NAMESPACE
|
---|