Qt 4.8
qscriptdebugger.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qscriptdebugger_p.h"
69 #include "qscriptdebuggerevent_p.h"
70 #include "qscriptdebuggervalue_p.h"
75 #include "qscriptdebuggerjob_p_p.h"
76 #include "qscriptxmlparser_p.h"
77 
78 #include "private/qobject_p.h"
79 
80 #include <QtScript/qscriptcontext.h>
81 #include <QtScript/qscriptcontextinfo.h>
82 
83 #include <QtCore/qcoreapplication.h>
84 #include <QtCore/qdir.h>
85 #include <QtCore/qfileinfo.h>
86 #include <QtCore/qstringlist.h>
87 #include <QtCore/qdebug.h>
88 
89 #include <QtGui/qaction.h>
90 #include <QtGui/qevent.h>
91 #include <QtGui/qicon.h>
92 #include <QtGui/qinputdialog.h>
93 #include <QtGui/qmenu.h>
94 #include <QtGui/qtoolbar.h>
95 #include <QtGui/qtooltip.h>
96 
101 
103 
105 
106 Q_SCRIPT_EXPORT QString qt_scriptToXml(const QString &program, int lineNumber = 1);
107 
108 namespace {
109 
110 static int scriptDebuggerCount = 0;
111 static bool eventCallbackRegistered = false;
112 static bool widgetInPaintEvent = false;
113 
114 static bool scriptDebuggerEventCallback(void **data)
115 {
116  QEvent *event = reinterpret_cast<QEvent*>(data[1]);
117  if (event->type() == QEvent::Paint) {
118  QObject *receiver = reinterpret_cast<QObject*>(data[0]);
119  bool was = widgetInPaintEvent;
120  widgetInPaintEvent = true;
122  widgetInPaintEvent = was;
123  bool *result = reinterpret_cast<bool*>(data[2]);
124  *result = true;
125  return true;
126  }
127  return false;
128 }
129 
130 }
131 
147  : public QObjectPrivate,
154 {
156 public:
159 
161  void finishJob(QScriptDebuggerJob *job);
163 
164  void maybeStartNewJob();
165 
166  int scheduleCommand(const QScriptDebuggerCommand &command,
167  QScriptDebuggerResponseHandlerInterface *responseHandler);
168 
169  void handleResponse(
170  const QScriptDebuggerResponse &response, int commandId);
172 
174  const QString &contents, int cursorPosition, int frameIndex, int options);
175 
176  void showToolTip(const QPoint &pos, int frameIndex,
177  int lineNumber, const QStringList &path);
178 
179  static QPixmap pixmap(const QString &path);
180 
182  qint64 scriptId, int lineNumber);
183  void sync();
184  void loadLocals(int frameIndex);
186  void selectScriptForFrame(int frameIndex);
187  void emitStoppedSignal();
188 
189  void maybeDelete(QWidget *widget);
190 
191  // private slots
192  void _q_onLineEntered(const QString &contents);
193  void _q_onCurrentFrameChanged(int frameIndex);
194  void _q_onCurrentScriptChanged(qint64 scriptId);
195  void _q_onScriptLocationSelected(int lineNumber);
196  void _q_interrupt();
197  void _q_continue();
198  void _q_stepInto();
199  void _q_stepOver();
200  void _q_stepOut();
201  void _q_runToCursor();
202  void _q_runToNewScript();
203  void _q_toggleBreakpoint();
204  void _q_clearDebugOutput();
205  void _q_clearErrorLog();
206  void _q_clearConsole();
207  void _q_findInScript();
208  void _q_findNextInScript();
210  void _q_onFindCodeRequest(const QString &, int);
211  void _q_goToLine();
212 
213  void executeConsoleCommand(const QString &command);
214  void findCode(const QString &exp, int options);
215 
217 
220 
228 
243 
251 
253 
257 
262 
264 };
265 
267 {
268  frontend = 0;
269  activeJob = 0;
270  activeJobHibernating = false;
271  nextJobId = 0;
272  interactive = false;
273 
275  QString scriptsPath = QLatin1String(":/qt/scripttools/debugging/scripts/commands");
277  console->loadScriptedCommands(scriptsPath, &tmp);
278 
279  consoleWidget = 0;
280  stackWidget = 0;
281  stackModel = 0;
282  scriptsWidget = 0;
283  scriptsModel = 0;
284  localsWidget = 0;
285  codeWidget = 0;
286  codeFinderWidget = 0;
287  breakpointsWidget = 0;
288  breakpointsModel = 0;
289  debugOutputWidget = 0;
290  errorLogWidget = 0;
291  widgetFactory = 0;
292 
293  interruptAction = 0;
294  continueAction = 0;
295  stepIntoAction = 0;
296  stepOverAction = 0;
297  stepOutAction = 0;
298  runToCursorAction = 0;
300 
302 
305  clearConsoleAction = 0;
306 
307  findInScriptAction = 0;
310  goToLineAction = 0;
311 
313 }
314 
316 {
317  delete console;
319  delete activeJob;
329 }
330 
332 {
333  if (widget && !widget->parent())
334  delete widget;
335 }
336 
338 {
339  static QString prefix = QString::fromLatin1(":/qt/scripttools/debugging/images/");
340  return QPixmap(prefix + path);
341 }
342 
347 {
349  Q_ASSERT(priv->jobScheduler == 0);
350  priv->jobScheduler = this;
351  int id = nextJobId;
352  pendingJobs.append(job);
353  pendingJobIds.append(id);
355  return id;
356 }
357 
362 {
363  Q_UNUSED(job);
364  Q_ASSERT(activeJob == job);
365  delete activeJob;
366  activeJob = 0;
367  activeJobHibernating = false;
369 }
370 
375 {
376  Q_UNUSED(job);
377  Q_ASSERT(activeJob == job);
378  activeJobHibernating = true;
379 }
380 
385 {
386  if (activeJob || pendingJobs.isEmpty())
387  return;
389  activeJob->start();
390 }
391 
396  const QScriptDebuggerCommand &command,
398 {
399  if (!frontend)
400  return -1;
401  int id = frontend->scheduleCommand(command, this);
402  if (responseHandler && (responseHandler != this))
403  responseHandlers.insert(id, responseHandler);
407  // need to watch this command and update the breakpoints model afterwards
408  watchedCommands.insert(id, command);
409  }
410  return id;
411 }
412 
417  const QScriptDebuggerResponse &response, int commandId)
418 {
420  if (watchedCommands.contains(commandId)) {
421  QScriptDebuggerCommand command = watchedCommands.take(commandId);
422  if (response.error() == QScriptDebuggerResponse::NoError) {
423  if (!breakpointsModel)
424  breakpointsModel = new QScriptBreakpointsModel(this, this, q);
425  switch (command.type()) {
427  int breakpointId = response.resultAsInt();
428  QScriptBreakpointData data = command.breakpointData();
429  breakpointsModel->addBreakpoint(breakpointId, data);
430  } break;
432  int breakpointId = command.breakpointId();
433  QScriptBreakpointData data = command.breakpointData();
434  breakpointsModel->modifyBreakpoint(breakpointId, data);
435  } break;
437  int breakpointId = command.breakpointId();
438  breakpointsModel->removeBreakpoint(breakpointId);
439  } break;
440  default:
441  Q_ASSERT(false);
442  }
443  }
444  } else if (response.async()) {
445  interactive = false;
446  // disable/invalidate/enable stuff
447  if (continueAction)
448  continueAction->setEnabled(false);
449  if (stepIntoAction)
450  stepIntoAction->setEnabled(false);
451  if (stepOverAction)
452  stepOverAction->setEnabled(false);
453  if (stepOutAction)
454  stepOutAction->setEnabled(false);
455  if (runToCursorAction)
459  if (interruptAction)
461 
462  // the timer is to avoid flicker when stepping
463  if (stackWidget) {
465  stackWidget->setEnabled(false);
466  if (updatesEnabledTimerId == -1)
467  updatesEnabledTimerId = q->startTimer(75);
468  }
469  if (localsWidget) {
471  localsWidget->setEnabled(false);
472  if (updatesEnabledTimerId == -1)
473  updatesEnabledTimerId = q->startTimer(75);
474  }
475  if (codeWidget)
477 
478  emit q->started();
479  }
480 
482  if (realHandler)
483  realHandler->handleResponse(response, commandId);
484 }
485 
495 {
497  switch (event.type()) {
501  Q_ASSERT(false);
502  break;
503 
506  q->setDebugOutputWidget(widgetFactory->createDebugOutputWidget());
507  if (debugOutputWidget)
509  return true; // trace doesn't stall execution
510 
513  q->setConsoleWidget(widgetFactory->createConsoleWidget());
514  if (consoleWidget) {
515  QString msg = event.message();
516  if (!msg.isEmpty())
518  }
519  } break;
520 
523  break;
524 
526  int bpId = event.breakpointId();
528  q->setConsoleWidget(widgetFactory->createConsoleWidget());
529  if (consoleWidget) {
531  QString::fromLatin1("Breakpoint %0 at %1, line %2.")
532  .arg(bpId).arg(event.fileName())
533  .arg(event.lineNumber()));
534  }
537  } break;
538 
540  if (event.hasExceptionHandler()) {
541  // Let the exception be handled like normal.
542  // We may want to add a "Break on all exceptions" option
543  // to be able to customize this behavior.
544  return true;
545  }
547  q->setConsoleWidget(widgetFactory->createConsoleWidget());
549  q->setErrorLogWidget(widgetFactory->createErrorLogWidget());
550  if (consoleWidget || errorLogWidget) {
551  QString fn = event.fileName();
552  if (fn.isEmpty()) {
553  if (event.scriptId() != -1)
554  fn = QString::fromLatin1("<anonymous script, id=%0>").arg(event.scriptId());
555  else
556  fn = QString::fromLatin1("<native>");
557  }
558  QString msg = QString::fromLatin1("Uncaught exception at %0:%1: %2").arg(fn)
559  .arg(event.lineNumber()).arg(event.message());
560  if (consoleWidget)
562  if (errorLogWidget)
564  }
565  } break;
566 
568  QScriptDebuggerValue result = event.scriptValue();
569  Q_ASSERT(console != 0);
570  int action = console->evaluateAction();
572  switch (action) {
573  case 0: { // eval command
574  if (activeJob) {
575  if (activeJobHibernating) {
576  activeJobHibernating = false;
577  activeJob->evaluateFinished(result);
578  }
579  } else if (consoleWidget) {
580  // ### if the result is an object, need to do a tostring job on it
581 // messageHandler->message(QtDebugMsg, result.toString());
584  }
585  } break;
586  case 1: { // return command
588  frontend.scheduleForceReturn(console->currentFrameIndex(), result);
589  } return false;
590  }
591  if (!event.isNestedEvaluate()) {
592  // in the case when evaluate() was called while the
593  // engine was not running, we don't want to enter interactive mode
594  return true;
595  }
596  } break;
597 
600  q->setConsoleWidget(widgetFactory->createConsoleWidget());
601  if (consoleWidget) {
602  QString fn = event.fileName();
603  if (fn.isEmpty())
604  fn = QString::fromLatin1("<anonymous script, id=%0>").arg(event.scriptId());
606  QString::fromLatin1("Debugger invoked from %1, line %2.")
607  .arg(fn).arg(event.lineNumber()));
608  }
609  } break;
610 
612  } break;
613 
614  }
615 
616  if (widgetInPaintEvent) {
617  QString msg = QString::fromLatin1("Suspending evaluation in paintEvent() is not supported; resuming.");
619  q->setConsoleWidget(widgetFactory->createConsoleWidget());
621  q->setErrorLogWidget(widgetFactory->createErrorLogWidget());
622  if (consoleWidget)
624  if (errorLogWidget)
626  return true;
627  }
628 
629  if (activeJobHibernating) {
630  // evaluate() did not finish normally (e.g. due to a breakpoint),
631  // so cancel the job that's waiting for it
632  delete activeJob;
633  activeJob = 0;
634  activeJobHibernating = false;
635  }
636 
637  startInteraction(event.type(), event.scriptId(), event.lineNumber());
638  return !interactive;
639 }
640 
642 {
643 public:
644  QScriptToolTipJob(const QPoint &pos, int frameIndex,
645  int lineNumber, const QStringList &path,
647  : QScriptDebuggerCommandSchedulerJob(scheduler), m_pos(pos),
648  m_frameIndex(frameIndex), m_lineNumber(lineNumber), m_path(path)
649  {}
650 
651  void start()
652  {
653  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
654  frontend.scheduleGetPropertyExpressionValue(m_frameIndex, m_lineNumber, m_path);
655  }
656  void handleResponse(const QScriptDebuggerResponse &response, int /*commandId*/)
657  {
658  QString tip = response.result().toString();
659  if (tip.indexOf(QLatin1Char('\n')) != -1) {
660  QStringList lines = tip.split(QLatin1Char('\n'));
661  int lineCount = lines.size();
662  if (lineCount > 5) {
663  lines = lines.mid(0, 5);
664  lines.append(QString::fromLatin1("(... %0 more lines ...)").arg(lineCount - 5));
665  }
666  tip = lines.join(QLatin1String("\n"));
667  }
668  QToolTip::showText(m_pos, tip);
669  finish();
670  }
671 
672 private:
677 };
678 
682 void QScriptDebuggerPrivate::showToolTip(const QPoint &pos, int frameIndex,
683  int lineNumber, const QStringList &path)
684 {
685  if (frameIndex == -1) {
686  if (stackWidget)
687  frameIndex = stackWidget->currentFrameIndex();
688  else
689  frameIndex = console->currentFrameIndex();
690  }
691  QScriptDebuggerJob *job = new QScriptToolTipJob(pos, frameIndex, lineNumber, path, this);
692  scheduleJob(job);
693 }
694 
699  const QString &contents, int cursorPosition, int frameIndex, int options)
700 {
701  return new QScriptCompletionTask(
702  contents, cursorPosition, frameIndex, this, this,
704 }
705 
710 {
712  commandJob = console->consumeInput(contents, consoleWidget, this);
713  if (commandJob != 0) {
714  scheduleJob(commandJob);
716  } else if (console->hasIncompleteInput()) {
718  }
719 }
720 
725 {
726  loadLocals(frameIndex);
727  selectScriptForFrame(frameIndex);
728 }
729 
734 {
735  if (codeWidget && (codeWidget->currentScriptId() != scriptId)) {
736  codeWidget->setCurrentScript(scriptId);
738  if (view)
739  view->setExecutionLineNumber(-1, /*error=*/false);
740  }
741 }
742 
744 {
746  if (!view)
747  return;
748  view->gotoLine(lineNumber);
749 }
750 
752 {
754 }
755 
757 {
759 }
760 
762 {
764 }
765 
767 {
769 }
770 
772 {
774 }
775 
777 {
778  qint64 scriptId = codeWidget->currentScriptId();
779  int lineNumber = codeWidget->currentView()->cursorLineNumber();
781  frontend.scheduleRunToLocation(scriptId, lineNumber);
782 }
783 
785 {
787  frontend.scheduleRunToLocation(QString(), -1);
788 }
789 
791 {
792  Q_ASSERT(codeWidget != 0);
794  if (!view)
795  return;
796  qint64 scriptId = codeWidget->currentScriptId();
797  int lineNumber = view->cursorLineNumber();
799  int bpId = breakpointsModel->resolveBreakpoint(scriptId, lineNumber);
800  if (bpId != -1) {
802  } else {
803  QScriptBreakpointData data(scriptId, lineNumber);
804  if (scriptsModel)
805  data.setFileName(scriptsModel->scriptData(scriptId).fileName());
807  }
808 }
809 
811 {
812  if (debugOutputWidget)
814 }
815 
817 {
818  if (errorLogWidget)
820 }
821 
823 {
824  if (consoleWidget)
825  consoleWidget->clear();
826 }
827 
829 {
834  if (job != 0) {
835  scheduleJob(job);
836  // once to send the command...
838  // ... and once to receive the response
840  }
841 }
842 
844 {
846  q_func()->setCodeFinderWidget(widgetFactory->createCodeFinderWidget());
847  if (codeFinderWidget) {
850  }
851 }
852 
854 {
856 }
857 
859 {
860  int options = codeFinderWidget->findOptions();
861  options |= QTextDocument::FindBackward;
862  findCode(codeFinderWidget->text(), options);
863 }
864 
866  const QString &exp, int options)
867 {
868  findCode(exp, options);
873 }
874 
875 void QScriptDebuggerPrivate::findCode(const QString &exp, int options)
876 {
878  if (!view)
879  return;
880  int result = view->find(exp, options);
881  codeFinderWidget->setOK(((result & 0x1) != 0) || exp.isEmpty());
882  codeFinderWidget->setWrapped((result & 0x2) != 0);
883 }
884 
886 {
888  if (!view)
889  return;
890 #ifndef QT_NO_INPUTDIALOG
891  bool ok = false;
892  int lineNumber = QInputDialog::getInteger(0, QScriptDebugger::tr("Go to Line"),
893  QScriptDebugger::tr("Line:"),
894  view->cursorLineNumber(),
895  1, INT_MAX, 1, &ok);
896  if (ok)
897  view->gotoLine(lineNumber);
898 #endif
899 }
900 
902 {
903 public:
904  QScriptDebuggerShowLineJob(qint64 scriptId, int lineNumber,
908  m_scriptId(scriptId), m_lineNumber(lineNumber),
909  m_messageHandler(messageHandler) {}
910 
911  void start()
912  {
913  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
914  frontend.scheduleGetScriptData(m_scriptId);
915  }
916  void handleResponse(const QScriptDebuggerResponse &response, int /*commandId*/)
917  {
918  QScriptScriptData data = response.resultAsScriptData();
919  QString line = data.lines(m_lineNumber, 1).value(0);
920  m_messageHandler->message(QtDebugMsg, QString::fromLatin1("%0\t%1")
921  .arg(m_lineNumber).arg(line));
922  finish();
923  }
924 
925 private:
929 };
930 
931 namespace {
932 
933 class SyncStackJob : public QScriptDebuggerCommandSchedulerJob
934 {
935 public:
936  SyncStackJob(QScriptDebuggerPrivate *debugger)
938  m_debugger(debugger), m_index(0) {}
939  void start()
940  {
941  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
942  frontend.scheduleGetContextInfo(m_index); // ### getContextInfos()
943  }
944  void handleResponse(const QScriptDebuggerResponse &response,
945  int)
946  {
947  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
949  m_infos.append(response.resultAsContextInfo());
950  frontend.scheduleGetContextInfo(++m_index);
951  } else {
952  m_debugger->stackModel->setContextInfos(m_infos);
953  if (m_debugger->stackWidget->currentFrameIndex() == -1)
954  m_debugger->stackWidget->setCurrentFrameIndex(0);
955  m_debugger->stackWidget->setUpdatesEnabled(true);
956  m_debugger->stackWidget->setEnabled(true);
957  finish();
958  }
959  }
960 
961 private:
962  QScriptDebuggerPrivate *m_debugger;
963  int m_index;
965 };
966 
967 class SyncScriptsJob : public QScriptDebuggerCommandSchedulerJob
968 {
969 public:
970  SyncScriptsJob(QScriptDebuggerPrivate *debugger)
972  m_debugger(debugger), m_index(-1) {}
973 
974  void start()
975  {
976  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
977  frontend.scheduleScriptsCheckpoint();
978  }
979  void handleResponse(const QScriptDebuggerResponse &response,
980  int)
981  {
982  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
983  if (m_index == -1) {
984  QScriptScriptsDelta delta;
985  delta = qvariant_cast<QScriptScriptsDelta>(response.result());
986 
987  const QList<qint64> &removed = delta.second;
988  for (int i = 0; i < removed.size(); ++i)
989  m_debugger->scriptsModel->removeScript(removed.at(i));
990 
991  m_added = delta.first;
992  if (!m_added.isEmpty()) {
993  frontend.scheduleGetScriptData(m_added.at(++m_index));
994  } else {
995  m_debugger->scriptsModel->commit();
996  finish();
997  }
998  } else {
999  QScriptScriptData data = response.resultAsScriptData();
1000  qint64 scriptId = m_added.at(m_index);
1001  m_debugger->scriptsModel->addScript(scriptId, data);
1002 
1003  // ### could be slow, might want to do this in a separate thread
1004 // Q_ASSERT_X(false, Q_FUNC_INFO, "implement me");
1005  QString xml; // = qt_scriptToXml(data.contents(), data.baseLineNumber());
1007  m_debugger->scriptsModel->addExtraScriptInfo(
1008  scriptId, extraInfo.functionsInfo, extraInfo.executableLineNumbers);
1009 
1010  if (++m_index < m_added.size())
1011  frontend.scheduleGetScriptData(m_added.at(m_index));
1012  else {
1013  m_debugger->scriptsModel->commit();
1014  finish();
1015  }
1016  }
1017  }
1018 
1019 private:
1020  QScriptDebuggerPrivate *m_debugger;
1021  int m_index;
1022  QList<qint64> m_added;
1023 };
1024 
1025 class SyncBreakpointsJob : public QScriptDebuggerCommandSchedulerJob
1026 {
1027 public:
1028  SyncBreakpointsJob(QScriptDebuggerPrivate *debugger)
1030  m_debugger(debugger), m_index(-1) {}
1031  void start()
1032  {
1033  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
1034  frontend.scheduleGetBreakpoints();
1035  }
1036  void handleResponse(const QScriptDebuggerResponse &response,
1037  int)
1038  {
1039  QScriptBreakpointMap breakpoints = response.resultAsBreakpoints();
1041  for (it = breakpoints.constBegin(); it != breakpoints.constEnd(); ++it) {
1042  int id = it.key();
1043  QScriptBreakpointData newData = it.value();
1044  QScriptBreakpointData existingData = m_debugger->breakpointsModel->breakpointData(id);
1045  if (existingData.isValid() && (existingData != newData))
1046  m_debugger->breakpointsModel->modifyBreakpoint(id, newData);
1047  }
1048  finish();
1049  }
1050 
1051 private:
1052  QScriptDebuggerPrivate *m_debugger;
1053  int m_index;
1054  QList<QScriptContextInfo> m_infos;
1055 };
1056 
1057 class SyncLocalsJob : public QScriptDebuggerCommandSchedulerJob
1058 {
1059 public:
1060  SyncLocalsJob(QScriptDebuggerPrivate *debugger)
1062  m_debugger(debugger) {}
1063 
1064  void start()
1065  {
1066  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
1067  frontend.scheduleContextsCheckpoint();
1068  }
1069  void handleResponse(const QScriptDebuggerResponse &response,
1070  int)
1071  {
1073  for (int i = 0; i < delta.first.size(); ++i) {
1074  QScriptDebuggerLocalsModel *model = m_debugger->localsModels.take(delta.first.at(i));
1075  delete model;
1076  }
1077  finish();
1078  }
1079 
1080 private:
1081  QScriptDebuggerPrivate *m_debugger;
1082 };
1083 
1084 class LoadLocalsJob : public QScriptDebuggerCommandSchedulerJob
1085 {
1086 public:
1087  LoadLocalsJob(QScriptDebuggerPrivate *debugger, int frameIndex)
1089  m_debugger(debugger), m_frameIndex(frameIndex) {}
1090 
1091  void start()
1092  {
1093  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
1094  frontend.scheduleGetContextId(m_frameIndex);
1095  }
1096  void handleResponse(const QScriptDebuggerResponse &response,
1097  int)
1098  {
1099  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
1100  qint64 contextId = response.resultAsLongLong();
1101  QScriptDebuggerLocalsModel *model = m_debugger->localsModels.value(contextId);
1102  if (model) {
1103  model->sync(m_frameIndex);
1104  } else {
1105  model = m_debugger->createLocalsModel();
1106  m_debugger->localsModels.insert(contextId, model);
1107  model->init(m_frameIndex);
1108  }
1109  if (m_debugger->localsWidget) {
1110  if (m_debugger->localsWidget->localsModel() != model) // ### bug in qtreeview
1111  m_debugger->localsWidget->setLocalsModel(model);
1112  m_debugger->localsWidget->setUpdatesEnabled(true);
1113  m_debugger->localsWidget->setEnabled(true);
1114  }
1115  finish();
1116  }
1117 
1118 private:
1119  QScriptDebuggerPrivate *m_debugger;
1120  int m_frameIndex;
1121 };
1122 
1123 class EmitStoppedSignalJob : public QScriptDebuggerJob
1124 {
1125 public:
1126  EmitStoppedSignalJob(QScriptDebuggerPrivate *debugger)
1127  : m_debugger(debugger) {}
1128 
1129  void start()
1130  {
1131  m_debugger->emitStoppedSignal();
1132  finish();
1133  }
1134 
1135 private:
1136  QScriptDebuggerPrivate *m_debugger;
1137 };
1138 
1139 } // namespace
1140 
1142  qint64 scriptId, int lineNumber)
1143 {
1146  if (stackWidget)
1149  console->setCurrentScriptId(scriptId);
1150  console->setCurrentLineNumber(lineNumber);
1151  }
1152 
1153  if ((scriptId != -1) && consoleWidget) {
1154  QScriptDebuggerJob *job = new QScriptDebuggerShowLineJob(scriptId, lineNumber, consoleWidget, this);
1155  scheduleJob(job);
1156  }
1157 
1158  sync();
1159 
1160  if (!interactive) {
1161  interactive = true;
1162  if (updatesEnabledTimerId != -1) {
1163  q->killTimer(updatesEnabledTimerId);
1164  updatesEnabledTimerId = -1;
1165  }
1167  scheduleJob(new EmitStoppedSignalJob(this));
1168  }
1169 
1170  if (consoleWidget)
1172  else if (codeWidget)
1174 
1175  if (continueAction)
1176  continueAction->setEnabled(true);
1177  if (stepIntoAction)
1178  stepIntoAction->setEnabled(true);
1179  if (stepOverAction)
1180  stepOverAction->setEnabled(true);
1181  if (stepOutAction)
1182  stepOutAction->setEnabled(true);
1183  if (runToCursorAction)
1187  if (interruptAction)
1188  interruptAction->setEnabled(false);
1189 
1190  bool hasScript = (codeWidget != 0);
1191  if (findInScriptAction)
1192  findInScriptAction->setEnabled(hasScript);
1194  toggleBreakpointAction->setEnabled(hasScript);
1195  if (goToLineAction)
1196  goToLineAction->setEnabled(hasScript);
1197 }
1198 
1200 {
1201  if (localsWidget) {
1202  QScriptDebuggerJob *job = new SyncLocalsJob(this);
1203  scheduleJob(job);
1204  }
1205  if (scriptsModel) {
1206  QScriptDebuggerJob *job = new SyncScriptsJob(this);
1207  scheduleJob(job);
1208  }
1209  if (stackModel) {
1210  QScriptDebuggerJob *job = new SyncStackJob(this);
1211  scheduleJob(job);
1212  }
1213  if (breakpointsModel) {
1214  // need to sync because the ignore-count could have changed
1215  QScriptDebuggerJob *job = new SyncBreakpointsJob(this);
1216  scheduleJob(job);
1217  }
1218 
1219  if (stackWidget && (stackWidget->currentFrameIndex() != -1)) {
1221  loadLocals(index);
1222  selectScriptForFrame(index);
1223  } else if (codeWidget && (console->currentFrameIndex() != -1)) {
1225  }
1226 }
1227 
1229 {
1230  LoadLocalsJob *job = new LoadLocalsJob(this, frameIndex);
1231  scheduleJob(job);
1232 }
1233 
1235 {
1236  return new QScriptDebuggerLocalsModel(this, this, q_func());
1237 }
1238 
1239 namespace {
1240 
1241 class ShowFrameCodeJob : public QScriptDebuggerCommandSchedulerJob
1242 {
1243 public:
1244  ShowFrameCodeJob(QScriptDebuggerPrivate *debugger, int frameIndex)
1246  m_debugger(debugger), m_frameIndex(frameIndex) {}
1247 
1248  void start()
1249  {
1250  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
1251  frontend.scheduleGetContextInfo(m_frameIndex);
1252  }
1253  void handleResponse(const QScriptDebuggerResponse &response,
1254  int)
1255  {
1256  if (m_info.isNull()) {
1257  m_info = response.resultAsContextInfo();
1258  QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this);
1259  frontend.scheduleGetContextState(m_frameIndex);
1260  } else {
1261  int contextState = response.resultAsInt();
1262  bool error = (contextState == QScriptContext::ExceptionState);
1263  if (m_debugger->scriptsWidget) {
1264  m_debugger->scriptsWidget->setCurrentScript(m_info.scriptId());
1265  }
1266  if (m_debugger->codeWidget) {
1267  m_debugger->codeWidget->setCurrentScript(m_info.scriptId());
1268  QScriptDebuggerCodeViewInterface *view = m_debugger->codeWidget->currentView();
1269  if (view)
1270  view->setExecutionLineNumber(m_info.lineNumber(), error);
1271  }
1272  finish();
1273  }
1274  }
1275 
1276 private:
1277  QScriptDebuggerPrivate *m_debugger;
1278  int m_frameIndex;
1279  QScriptContextInfo m_info;
1280 };
1281 
1282 } // namespace
1283 
1285 {
1286  QScriptDebuggerJob *job = new ShowFrameCodeJob(this, frameIndex);
1287  scheduleJob(job);
1288 }
1289 
1291 {
1292  emit q_func()->stopped();
1293 }
1294 
1299  : QObject(*new QScriptDebuggerPrivate, parent)
1300 {
1301  ++scriptDebuggerCount;
1302 }
1303 
1308 {
1309  --scriptDebuggerCount;
1310  if ((scriptDebuggerCount == 0) && eventCallbackRegistered) {
1311  eventCallbackRegistered = false;
1313  scriptDebuggerEventCallback);
1314  }
1315 }
1316 
1321  : QObject(dd, parent)
1322 {
1323 }
1324 
1326 {
1327  Q_D(const QScriptDebugger);
1328  return d->frontend;
1329 }
1330 
1332 {
1334  if (d->frontend)
1335  d->frontend->setEventHandler(0);
1336  d->frontend = frontend;
1337  if (frontend) {
1338  frontend->setEventHandler(d);
1339  if (!eventCallbackRegistered) {
1340  eventCallbackRegistered = true;
1342  scriptDebuggerEventCallback);
1343  }
1344  }
1345 }
1346 
1348 {
1349  switch (action) {
1350  case InterruptAction:
1351  return interruptAction(parent);
1352  case ContinueAction:
1353  return continueAction(parent);
1354  case StepIntoAction:
1355  return stepIntoAction(parent);
1356  case StepOverAction:
1357  return stepOverAction(parent);
1358  case StepOutAction:
1359  return stepOutAction(parent);
1360  case RunToCursorAction:
1361  return runToCursorAction(parent);
1362  case RunToNewScriptAction:
1363  return runToNewScriptAction(parent);
1365  return toggleBreakpointAction(parent);
1367  return clearDebugOutputAction(parent);
1368  case ClearErrorLogAction:
1369  return clearErrorLogAction(parent);
1370  case ClearConsoleAction:
1371  return clearConsoleAction(parent);
1372  case FindInScriptAction:
1373  return findInScriptAction(parent);
1375  return findNextInScriptAction(parent);
1377  return findPreviousInScriptAction(parent);
1378  case GoToLineAction:
1379  return goToLineAction(parent);
1380  }
1381  return 0;
1382 }
1383 
1385 {
1386  switch (widget) {
1387  case ConsoleWidget: {
1389  if (!w && widgetFactory()) {
1391  setConsoleWidget(w);
1392  }
1393  return w;
1394  }
1395  case StackWidget: {
1397  if (!w && widgetFactory()) {
1399  setStackWidget(w);
1400  }
1401  return w;
1402  }
1403  case ScriptsWidget: {
1405  if (!w && widgetFactory()) {
1407  setScriptsWidget(w);
1408  }
1409  return w;
1410  }
1411  case LocalsWidget: {
1413  if (!w && widgetFactory()) {
1415  setLocalsWidget(w);
1416  }
1417  return w;
1418  }
1419  case CodeWidget: {
1421  if (!w && widgetFactory()) {
1423  setCodeWidget(w);
1424  }
1425  return w;
1426  }
1427  case CodeFinderWidget: {
1429  if (!w && widgetFactory()) {
1432  }
1433  return w;
1434  }
1435  case BreakpointsWidget: {
1437  if (!w && widgetFactory()) {
1440  }
1441  return w;
1442  }
1443  case DebugOutputWidget: {
1445  if (!w && widgetFactory()) {
1448  }
1449  return w;
1450  }
1451  case ErrorLogWidget: {
1453  if (!w && widgetFactory()) {
1455  setErrorLogWidget(w);
1456  }
1457  return w;
1458  }
1459  }
1460  return 0;
1461 }
1462 
1464 {
1465  Q_D(const QScriptDebugger);
1466  return d->consoleWidget;
1467 }
1468 
1470 {
1472  if (d->consoleWidget) {
1473  QObject::disconnect(d->consoleWidget, 0, this, 0);
1474  }
1475  d->consoleWidget = consoleWidget;
1476  if (consoleWidget) {
1477  consoleWidget->setCommandHistorian(d->console);
1478  consoleWidget->setCompletionProvider(d);
1479  QObject::connect(consoleWidget, SIGNAL(lineEntered(QString)),
1480  this, SLOT(_q_onLineEntered(QString)));
1481 
1482  d->console->showDebuggerInfoMessage(consoleWidget);
1483  }
1484 }
1485 
1487 {
1488  Q_D(const QScriptDebugger);
1489  return d->stackWidget;
1490 }
1491 
1493 {
1495  if (d->stackWidget) {
1496  QObject::disconnect(d->stackWidget, 0, this, 0);
1497  }
1498  d->stackWidget = stackWidget;
1499  if (stackWidget) {
1500  if (!d->stackModel) {
1501  d->stackModel = new QScriptDebuggerStackModel(this);
1502  if (d->interactive)
1503  d->scheduleJob(new SyncStackJob(d));
1504  }
1505  stackWidget->setStackModel(d->stackModel);
1506  QObject::connect(stackWidget, SIGNAL(currentFrameChanged(int)),
1507  this, SLOT(_q_onCurrentFrameChanged(int)));
1508  }
1509 }
1510 
1512 {
1513  Q_D(const QScriptDebugger);
1514  return d->scriptsWidget;
1515 }
1516 
1518 {
1520  if (d->scriptsWidget) {
1521  QObject::disconnect(d->scriptsWidget, 0, this, 0);
1522  }
1523  d->scriptsWidget = scriptsWidget;
1524  if (scriptsWidget) {
1525  if (!d->scriptsModel) {
1526  d->scriptsModel = new QScriptDebuggerScriptsModel(this);
1527  if (d->interactive)
1528  d->scheduleJob(new SyncScriptsJob(d));
1529  }
1530  scriptsWidget->setScriptsModel(d->scriptsModel);
1531  QObject::connect(scriptsWidget, SIGNAL(currentScriptChanged(qint64)),
1532  this, SLOT(_q_onCurrentScriptChanged(qint64)));
1533  QObject::connect(d->scriptsWidget, SIGNAL(scriptLocationSelected(int)),
1534  this, SLOT(_q_onScriptLocationSelected(int)));
1535  }
1536 }
1537 
1539 {
1540  Q_D(const QScriptDebugger);
1541  return d->localsWidget;
1542 }
1543 
1545 {
1547  if (d->localsWidget) {
1548  // ### d->localsWidget->setLocalsModel(0);
1549  }
1550  localsWidget->setCompletionProvider(d);
1551  d->localsWidget = localsWidget;
1552 }
1553 
1555 {
1556  Q_D(const QScriptDebugger);
1557  return d->codeWidget;
1558 }
1559 
1561 {
1563  if (d->codeWidget) {
1564  d->codeWidget->removeEventFilter(this);
1565  }
1566  d->codeWidget = codeWidget;
1567  if (codeWidget) {
1568  if (!d->scriptsModel) {
1569  d->scriptsModel = new QScriptDebuggerScriptsModel(this);
1570  if (d->interactive)
1571  d->scheduleJob(new SyncScriptsJob(d));
1572  }
1573  codeWidget->setScriptsModel(d->scriptsModel);
1574  if (!d->breakpointsModel) {
1575  d->breakpointsModel = new QScriptBreakpointsModel(d, d, this);
1576  if (d->interactive)
1577  d->scheduleJob(new SyncBreakpointsJob(d));
1578  }
1579  codeWidget->setBreakpointsModel(d->breakpointsModel);
1580  codeWidget->setToolTipProvider(d);
1581  codeWidget->installEventFilter(this);
1582  }
1583  bool hasScript = (codeWidget != 0) && (codeWidget->currentView() != 0);
1584  if (d->findInScriptAction)
1585  d->findInScriptAction->setEnabled(hasScript && (d->codeFinderWidget != 0));
1586  if (d->goToLineAction)
1587  d->goToLineAction->setEnabled(hasScript);
1588  if (d->toggleBreakpointAction)
1589  d->toggleBreakpointAction->setEnabled(hasScript);
1590 }
1591 
1593 {
1594  Q_D(const QScriptDebugger);
1595  return d->codeFinderWidget;
1596 }
1597 
1599 {
1601  if (d->codeFinderWidget) {
1602  QObject::disconnect(d->codeFinderWidget, 0, this, 0);
1603  }
1604  d->codeFinderWidget = codeFinderWidget;
1605  if (codeFinderWidget) {
1606  QObject::connect(codeFinderWidget, SIGNAL(findRequest(QString,int)),
1607  this, SLOT(_q_onFindCodeRequest(QString,int)));
1608  }
1609  if (d->findInScriptAction) {
1610  d->findInScriptAction->setEnabled(
1611  (codeFinderWidget != 0)
1612  && (d->codeWidget != 0)
1613  && (d->codeWidget->currentView() != 0));
1614  }
1615 }
1616 
1618 {
1619  Q_D(const QScriptDebugger);
1620  return d->debugOutputWidget;
1621 }
1622 
1624 {
1626  d->debugOutputWidget = debugOutputWidget;
1627 }
1628 
1630 {
1631  Q_D(const QScriptDebugger);
1632  return d->breakpointsWidget;
1633 }
1634 
1636 {
1638  if (d->breakpointsWidget) {
1639  // ### invalidate
1640  }
1641  d->breakpointsWidget = breakpointsWidget;
1642  if (breakpointsWidget) {
1643  if (!d->breakpointsModel) {
1644  d->breakpointsModel = new QScriptBreakpointsModel(d, d, this);
1645  if (d->interactive)
1646  d->scheduleJob(new SyncBreakpointsJob(d));
1647  }
1648  d->breakpointsWidget->setBreakpointsModel(d->breakpointsModel);
1649  d->breakpointsWidget->setScriptsModel(d->scriptsModel);
1650  }
1651 }
1652 
1654 {
1655  Q_D(const QScriptDebugger);
1656  return d->errorLogWidget;
1657 }
1658 
1660 {
1662  d->errorLogWidget = errorLogWidget;
1663 }
1664 
1666 {
1667  Q_D(const QScriptDebugger);
1668  return d->widgetFactory;
1669 }
1670 
1672 {
1674  d->widgetFactory = factory;
1675 }
1676 
1678 {
1679  Q_D(const QScriptDebugger);
1680  if (!d->interruptAction) {
1681  QIcon interruptIcon;
1682  interruptIcon.addPixmap(d->pixmap(QString::fromLatin1("interrupt.png")), QIcon::Normal);
1683  interruptIcon.addPixmap(d->pixmap(QString::fromLatin1("d_interrupt.png")), QIcon::Disabled);
1684  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1685  that->d_func()->interruptAction = new QAction(interruptIcon, QScriptDebugger::tr("Interrupt"), parent);
1686  d->interruptAction->setEnabled(!d->interactive);
1687  d->interruptAction->setShortcut(QScriptDebugger::tr("Shift+F5"));
1688  QObject::connect(d->interruptAction, SIGNAL(triggered()),
1689  that, SLOT(_q_interrupt()));
1690  }
1691  return d->interruptAction;
1692 }
1693 
1695 {
1696  Q_D(const QScriptDebugger);
1697  if (!d->continueAction) {
1698  QIcon continueIcon;
1699  continueIcon.addPixmap(d->pixmap(QString::fromLatin1("play.png")), QIcon::Normal);
1700  continueIcon.addPixmap(d->pixmap(QString::fromLatin1("d_play.png")), QIcon::Disabled);
1701  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1702  that->d_func()->continueAction = new QAction(continueIcon, QScriptDebugger::tr("Continue"), parent);
1703  d->continueAction->setEnabled(d->interactive);
1704  d->continueAction->setShortcut(QScriptDebugger::tr("F5"));
1705  QObject::connect(d->continueAction, SIGNAL(triggered()),
1706  that, SLOT(_q_continue()));
1707  }
1708  return d->continueAction;
1709 }
1710 
1712 {
1713  Q_D(const QScriptDebugger);
1714  if (!d->stepIntoAction) {
1715  QIcon stepIntoIcon;
1716  stepIntoIcon.addPixmap(d->pixmap(QString::fromLatin1("stepinto.png")), QIcon::Normal);
1717  stepIntoIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepinto.png")), QIcon::Disabled);
1718  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1719  that->d_func()->stepIntoAction = new QAction(stepIntoIcon, QScriptDebugger::tr("Step Into"), parent);
1720  d->stepIntoAction->setEnabled(d->interactive);
1721  d->stepIntoAction->setShortcut(QScriptDebugger::tr("F11"));
1722  QObject::connect(d->stepIntoAction, SIGNAL(triggered()),
1723  that, SLOT(_q_stepInto()));
1724  }
1725  return d->stepIntoAction;
1726 }
1727 
1729 {
1730  Q_D(const QScriptDebugger);
1731  if (!d->stepOverAction) {
1732  QIcon stepOverIcon;
1733  stepOverIcon.addPixmap(d->pixmap(QString::fromLatin1("stepover.png")), QIcon::Normal);
1734  stepOverIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepover.png")), QIcon::Disabled);
1735  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1736  that->d_func()->stepOverAction = new QAction(stepOverIcon, QScriptDebugger::tr("Step Over"), parent);
1737  d->stepOverAction->setEnabled(d->interactive);
1738  d->stepOverAction->setShortcut(QScriptDebugger::tr("F10"));
1739  QObject::connect(d->stepOverAction, SIGNAL(triggered()),
1740  that, SLOT(_q_stepOver()));
1741  }
1742  return d->stepOverAction;
1743 }
1744 
1746 {
1747  Q_D(const QScriptDebugger);
1748  if (!d->stepOutAction) {
1749  QIcon stepOutIcon;
1750  stepOutIcon.addPixmap(d->pixmap(QString::fromLatin1("stepout.png")), QIcon::Normal);
1751  stepOutIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepout.png")), QIcon::Disabled);
1752  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1753  that->d_func()->stepOutAction = new QAction(stepOutIcon, QScriptDebugger::tr("Step Out"), parent);
1754  d->stepOutAction->setEnabled(d->interactive);
1755  d->stepOutAction->setShortcut(QScriptDebugger::tr("Shift+F11"));
1756  QObject::connect(d->stepOutAction, SIGNAL(triggered()),
1757  that, SLOT(_q_stepOut()));
1758  }
1759  return d->stepOutAction;
1760 }
1761 
1763 {
1764  Q_D(const QScriptDebugger);
1765  if (!d->runToCursorAction) {
1766  QIcon runToCursorIcon;
1767  runToCursorIcon.addPixmap(d->pixmap(QString::fromLatin1("runtocursor.png")), QIcon::Normal);
1768  runToCursorIcon.addPixmap(d->pixmap(QString::fromLatin1("d_runtocursor.png")), QIcon::Disabled);
1769  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1770  that->d_func()->runToCursorAction = new QAction(runToCursorIcon, QScriptDebugger::tr("Run to Cursor"), parent);
1771  d->runToCursorAction->setEnabled(d->interactive);
1772  d->runToCursorAction->setShortcut(QScriptDebugger::tr("Ctrl+F10"));
1773  QObject::connect(d->runToCursorAction, SIGNAL(triggered()),
1774  that, SLOT(_q_runToCursor()));
1775  }
1776  return d->runToCursorAction;
1777 }
1778 
1780 {
1781  Q_D(const QScriptDebugger);
1782  if (!d->runToNewScriptAction) {
1783  QIcon runToNewScriptIcon;
1784  runToNewScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("runtonewscript.png")), QIcon::Normal);
1785  runToNewScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("d_breakonscriptload.png")), QIcon::Disabled);
1786  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1787  that->d_func()->runToNewScriptAction = new QAction(runToNewScriptIcon,
1788  QScriptDebugger::tr("Run to New Script"), parent);
1789  d->runToNewScriptAction->setEnabled(d->interactive);
1790  QObject::connect(d->runToNewScriptAction, SIGNAL(triggered()),
1791  that, SLOT(_q_runToNewScript()));
1792  }
1793  return d->runToNewScriptAction;
1794 }
1795 
1797 {
1798  Q_D(const QScriptDebugger);
1799  if (!d->toggleBreakpointAction) {
1800  QIcon toggleBreakpointIcon;
1801  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1802  that->d_func()->toggleBreakpointAction = new QAction(toggleBreakpointIcon,
1803  QScriptDebugger::tr("Toggle Breakpoint"), parent);
1804  d->toggleBreakpointAction->setShortcut(QScriptDebugger::tr("F9"));
1805  d->toggleBreakpointAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0));
1806  QObject::connect(d->toggleBreakpointAction, SIGNAL(triggered()),
1807  that, SLOT(_q_toggleBreakpoint()));
1808  }
1809  return d->toggleBreakpointAction;
1810 }
1811 
1813 {
1814  Q_D(const QScriptDebugger);
1815  if (!d->clearDebugOutputAction) {
1816  QIcon clearDebugOutputIcon;
1817  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1818  that->d_func()->clearDebugOutputAction = new QAction(clearDebugOutputIcon, QScriptDebugger::tr("Clear Debug Output"), parent);
1819  QObject::connect(d->clearDebugOutputAction, SIGNAL(triggered()),
1820  that, SLOT(_q_clearDebugOutput()));
1821  }
1822  return d->clearDebugOutputAction;
1823 }
1824 
1826 {
1827  Q_D(const QScriptDebugger);
1828  if (!d->clearErrorLogAction) {
1829  QIcon clearErrorLogIcon;
1830  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1831  that->d_func()->clearErrorLogAction = new QAction(clearErrorLogIcon, QScriptDebugger::tr("Clear Error Log"), parent);
1832  QObject::connect(d->clearErrorLogAction, SIGNAL(triggered()),
1833  that, SLOT(_q_clearErrorLog()));
1834  }
1835  return d->clearErrorLogAction;
1836 }
1837 
1839 {
1840  Q_D(const QScriptDebugger);
1841  if (!d->clearConsoleAction) {
1842  QIcon clearConsoleIcon;
1843  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1844  that->d_func()->clearConsoleAction = new QAction(clearConsoleIcon, QScriptDebugger::tr("Clear Console"), parent);
1845  QObject::connect(d->clearConsoleAction, SIGNAL(triggered()),
1846  that, SLOT(_q_clearConsole()));
1847  }
1848  return d->clearConsoleAction;
1849 }
1850 
1852 {
1853  Q_D(const QScriptDebugger);
1854  if (!d->findInScriptAction) {
1855  QIcon findInScriptIcon;
1856  findInScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("find.png")), QIcon::Normal);
1857  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1858  that->d_func()->findInScriptAction = new QAction(findInScriptIcon, QScriptDebugger::tr("&Find in Script..."), parent);
1859  d->findInScriptAction->setShortcut(QScriptDebugger::tr("Ctrl+F"));
1860  d->findInScriptAction->setEnabled(
1861  (d->codeFinderWidget != 0)
1862  && (d->codeWidget != 0)
1863  && (d->codeWidget->currentView() != 0));
1864  QObject::connect(d->findInScriptAction, SIGNAL(triggered()),
1865  that, SLOT(_q_findInScript()));
1866  }
1867  return d->findInScriptAction;
1868 }
1869 
1871 {
1872  Q_D(const QScriptDebugger);
1873  if (!d->findNextInScriptAction) {
1874  QIcon findNextInScriptIcon;
1875  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1876  that->d_func()->findNextInScriptAction = new QAction(findNextInScriptIcon, QScriptDebugger::tr("Find &Next"), parent);
1877  d->findNextInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty());
1878  d->findNextInScriptAction->setShortcut(QScriptDebugger::tr("F3"));
1879  QObject::connect(d->findNextInScriptAction, SIGNAL(triggered()),
1880  that, SLOT(_q_findNextInScript()));
1881  }
1882  return d->findNextInScriptAction;
1883 }
1884 
1886 {
1887  Q_D(const QScriptDebugger);
1888  if (!d->findPreviousInScriptAction) {
1889  QIcon findPreviousInScriptIcon;
1890  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1891  that->d_func()->findPreviousInScriptAction = new QAction(findPreviousInScriptIcon, QScriptDebugger::tr("Find &Previous"), parent);
1892  d->findPreviousInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty());
1893  d->findPreviousInScriptAction->setShortcut(QScriptDebugger::tr("Shift+F3"));
1894  QObject::connect(d->findPreviousInScriptAction, SIGNAL(triggered()),
1895  that, SLOT(_q_findPreviousInScript()));
1896  }
1897  return d->findPreviousInScriptAction;
1898 }
1899 
1901 {
1902  Q_D(const QScriptDebugger);
1903  if (!d->goToLineAction) {
1904  QIcon goToLineIcon;
1905  QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
1906  that->d_func()->goToLineAction = new QAction(goToLineIcon, QScriptDebugger::tr("Go to Line"), parent);
1907  d->goToLineAction->setShortcut(QScriptDebugger::tr("Ctrl+G"));
1908  d->goToLineAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0));
1909  QObject::connect(d->goToLineAction, SIGNAL(triggered()),
1910  that, SLOT(_q_goToLine()));
1911  }
1912  return d->goToLineAction;
1913 }
1914 
1916 {
1917  QMenu *menu = new QMenu(widgetParent);
1918  menu->setTitle(QScriptDebugger::tr("Debug"));
1919  menu->addAction(action(ContinueAction, actionParent));
1920  menu->addAction(action(InterruptAction, actionParent));
1921  menu->addAction(action(StepIntoAction, actionParent));
1922  menu->addAction(action(StepOverAction, actionParent));
1923  menu->addAction(action(StepOutAction, actionParent));
1924  menu->addAction(action(RunToCursorAction, actionParent));
1925  menu->addAction(action(RunToNewScriptAction, actionParent));
1926 
1927  menu->addSeparator();
1928  menu->addAction(action(ToggleBreakpointAction, actionParent));
1929 
1930  menu->addSeparator();
1931  menu->addAction(action(ClearDebugOutputAction, actionParent));
1932  menu->addAction(action(ClearErrorLogAction, actionParent));
1933  menu->addAction(action(ClearConsoleAction, actionParent));
1934 
1935  return menu;
1936 }
1937 
1938 #ifndef QT_NO_TOOLBAR
1940 {
1941  QToolBar *tb = new QToolBar(widgetParent);
1942  tb->setObjectName(QLatin1String("qtscriptdebugger_standardToolBar"));
1943  tb->addAction(action(ContinueAction, actionParent));
1944  tb->addAction(action(InterruptAction, actionParent));
1945  tb->addAction(action(StepIntoAction, actionParent));
1946  tb->addAction(action(StepOverAction, actionParent));
1947  tb->addAction(action(StepOutAction, actionParent));
1948  tb->addAction(action(RunToCursorAction, actionParent));
1949  tb->addAction(action(RunToNewScriptAction, actionParent));
1950  tb->addSeparator();
1951  tb->addAction(action(FindInScriptAction, actionParent));
1952  return tb;
1953 }
1954 #endif
1955 
1957 {
1958  Q_D(const QScriptDebugger);
1959  return d->interactive;
1960 }
1961 
1966 {
1968  if (watched == d->codeWidget) {
1969  if (e->type() == QEvent::KeyPress) {
1970  d->_q_findInScript();
1971  d->codeFinderWidget->setText(static_cast<QKeyEvent*>(e)->text());
1972  return true;
1973  }
1974  }
1975  return false;
1976 }
1977 
1982 {
1984  if (e->timerId() == d->updatesEnabledTimerId) {
1985  killTimer(d->updatesEnabledTimerId);
1986  d->updatesEnabledTimerId = -1;
1987  if (d->stackWidget)
1988  d->stackWidget->setUpdatesEnabled(true);
1989  if (d->localsWidget)
1990  d->localsWidget->setUpdatesEnabled(true);
1991  } else {
1993  }
1994 }
1995 
1997 
1998 #include "moc_qscriptdebugger_p.cpp"
QScriptDebuggerCodeFinderWidgetInterface * codeFinderWidget() const
virtual void setWrapped(bool wrapped)=0
double d
Definition: qnumeric_p.h:62
QScriptDebuggerWidgetFactoryInterface * widgetFactory() const
QScriptBreakpointMap resultAsBreakpoints() const
QAction * clearConsoleAction(QObject *parent) const
void setCommandHistorian(QScriptDebuggerConsoleHistorianInterface *historian)
virtual QScriptErrorLogWidgetInterface * createErrorLogWidget()=0
QScriptDebuggerLocalsWidgetInterface * localsWidget() const
virtual void setStackModel(QAbstractItemModel *model)=0
bool isSingleShot() const
Returns true if the breakpoint is single-shot, false otherwise.
QAction * action(DebuggerAction action, QObject *parent)
int type
Definition: qmetatype.cpp:239
bool isInteractive() const
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
Definition: qicon.cpp:814
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void loadLocals(int frameIndex)
Error error() const
Returns the error code of this response.
EventRef event
QPointer< QWidget > widget
QScriptScriptData resultAsScriptData() const
void setWidgetFactory(QScriptDebuggerWidgetFactoryInterface *factory)
void executeConsoleCommand(const QString &command)
QToolBar * createStandardToolBar(QWidget *widgetParent, QObject *actionParent)
void hibernateUntilEvaluateFinished(QScriptDebuggerJob *job)
Reimplemented Function
QScriptDebuggerJobSchedulerInterface * jobScheduler
virtual void start()=0
void deleteBreakpoint(int id)
Deletes the breakpoint with the given id.
#define it(className, varName)
QAction * continueAction(QObject *parent) const
void _q_onCurrentFrameChanged(int frameIndex)
Slot called when the current index has changed in the stack widget.
QScriptDebugOutputWidgetInterface * debugOutputWidget
The QScriptDebuggerFrontend class is the base class of debugger front-ends.
void setScriptsWidget(QScriptDebuggerScriptsWidgetInterface *scriptsWidget)
void setFileName(const QString &fileName)
QPair< QList< qint64 >, QList< qint64 > > QScriptContextsDelta
QScriptBreakpointsWidgetInterface * breakpointsWidget() const
QScriptDebuggerLocalsWidgetInterface * localsWidget
#define error(msg)
The QScriptDebuggerResponse class represents a front-end&#39;s response to a QScriptDebuggerCommand.
QAction * interruptAction(QObject *parent) const
QAction * stepOverAction(QObject *parent) const
#define SLOT(a)
Definition: qobjectdefs.h:226
QScriptDebuggerStackWidgetInterface * stackWidget
T1 first
Definition: qpair.h:65
bool eventFilter(QObject *, QEvent *e)
Reimplemented Function
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Definition: qobject.cpp:1294
QScriptDebuggerWidgetFactoryInterface * widgetFactory
virtual void gotoLine(int lineNumber)=0
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setFrontend(QScriptDebuggerFrontend *frontend)
T2 second
Definition: qpair.h:66
Q_SCRIPT_EXPORT QString qt_scriptToXml(const QString &program, int lineNumber=1)
void setCodeFinderWidget(QScriptDebuggerCodeFinderWidgetInterface *codeFinderWidget)
QScriptContextInfo resultAsContextInfo() const
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
static QScriptDebuggerJobPrivate * get(QScriptDebuggerJob *q)
void startInteraction(QScriptDebuggerEvent::Type type, qint64 scriptId, int lineNumber)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QScriptDebuggerLocalsModel * createLocalsModel()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setErrorLogWidget(QScriptErrorLogWidgetInterface *errorLogWidget)
QScriptBreakpointsWidgetInterface * breakpointsWidget
QScriptDebuggerFrontend * frontend() const
int scheduleCommand(const QScriptDebuggerCommand &command, QScriptDebuggerResponseHandlerInterface *responseHandler)
Reimplemented Function
The QString class provides a Unicode character string.
Definition: qstring.h:83
void timerEvent(QTimerEvent *e)
Reimplemented Function
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it...
Definition: qhash.h:807
void setCompletionProvider(QScriptCompletionProviderInterface *completionProvider)
QAction * addAction(const QString &text)
This convenience function creates a new action with text.
Definition: qmenu.cpp:1453
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
bool debuggerEvent(const QScriptDebuggerEvent &event)
Handles a debugger event from the frontend.
QScriptScriptData scriptData(qint64 id) const
void _q_onFindCodeRequest(const QString &, int)
QAction * runToCursorAction(QObject *parent) const
void setUpdatesEnabled(bool enable)
Definition: qwidget.cpp:7670
#define Q_D(Class)
Definition: qglobal.h:2482
QAction * clearDebugOutputAction(QObject *parent) const
QMenu * createStandardMenu(QWidget *widgetParent, QObject *actionParent)
QWidget * widget(DebuggerWidget widget)
static bool unregisterCallback(Callback, qInternalCallback)
Definition: qglobal.cpp:3644
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
QAction * goToLineAction(QObject *parent) const
Type type() const
Returns the type of this command.
QScriptDebuggerFrontend * frontend
void setEnabled(bool)
Definition: qaction.cpp:1192
virtual QScriptDebuggerCodeFinderWidgetInterface * createCodeFinderWidget()=0
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes all pending events for the calling thread according to the specified flags until there are ...
void handleResponse(const QScriptDebuggerResponse &response, int)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QHash< int, QScriptDebuggerResponseHandlerInterface * > responseHandlers
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
QList< T > mid(int pos, int length=-1) const
Returns a list whose elements are copied from this list, starting at position pos.
Definition: qlist.h:637
void setIncompleteInput(const QString &input)
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
QScriptErrorLogWidgetInterface * errorLogWidget() const
The QScriptScriptData class holds data associated with a script.
virtual QScriptDebuggerScriptsWidgetInterface * createScriptsWidget()=0
void findCode(const QString &exp, int options)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QScriptDebugOutputWidgetInterface * debugOutputWidget() const
The QScriptDebuggerConsole class provides the core functionality of a debugger console.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
virtual void invalidateExecutionLineNumbers()=0
virtual bool notify(QObject *, QEvent *)
Sends event to receiver: {receiver}->event(event).
virtual void setScriptsModel(QScriptDebuggerScriptsModel *model)=0
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QScriptDebuggerCodeFinderWidgetInterface * codeFinderWidget
QScriptDebuggerScriptsWidgetInterface * scriptsWidget() const
QAction * findPreviousInScriptAction(QObject *parent) const
QList< QScriptDebuggerJob * > pendingJobs
QScriptMessageHandlerInterface * m_messageHandler
virtual void handleResponse(const QScriptDebuggerResponse &response, int commandId)=0
void setTitle(const QString &title)
Definition: qmenu.cpp:732
void setStackWidget(QScriptDebuggerStackWidgetInterface *stackWidget)
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489
QAction * findInScriptAction(QObject *parent) const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void showToolTip(const QPoint &pos, int frameIndex, int lineNumber, const QStringList &path)
Reimplemented Function
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
virtual void evaluateFinished(const QScriptDebuggerValue &result)
QScriptDebuggerCodeWidgetInterface * codeWidget() const
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
void setConsoleWidget(QScriptDebuggerConsoleWidgetInterface *consoleWidget)
virtual void setScriptsModel(QScriptDebuggerScriptsModel *model)=0
void selectScriptForFrame(int frameIndex)
void modifyBreakpoint(int id, const QScriptBreakpointData &data)
Modify the data of breakpoint id.
#define emit
Definition: qobjectdefs.h:76
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QScriptDebuggerCodeWidgetInterface * codeWidget
virtual int cursorLineNumber() const =0
QMap< QString, int > functionsInfo
void _q_onCurrentScriptChanged(qint64 scriptId)
Slot called when the current script has changed in the scripts widget.
void setLocalsWidget(QScriptDebuggerLocalsWidgetInterface *localsWidget)
QAction * addSeparator()
This convenience function creates a new separator action, i.e.
Definition: qmenu.cpp:1583
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
void setCodeWidget(QScriptDebuggerCodeWidgetInterface *codeWidget)
~QScriptDebugger()
Destroys this QScriptDebugger.
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
QScriptDebuggerStackModel * stackModel
__int64 qint64
Definition: qglobal.h:942
QAction * runToNewScriptAction(QObject *parent) const
void loadScriptedCommands(const QString &scriptsPath, QScriptMessageHandlerInterface *messageHandler)
The QScriptBreakpointData class contains data associated with a breakpoint.
QScriptBreakpointData breakpointData(int id) const
void show()
Shows the widget and its child widgets.
QScriptDebuggerScriptsWidgetInterface * scriptsWidget
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
#define Q_SCRIPT_EXPORT
Definition: qglobal.h:1460
virtual QScriptDebugOutputWidgetInterface * createDebugOutputWidget()=0
virtual int find(const QString &exp, int options=0)=0
QScriptDebuggerConsoleCommandJob * consumeInput(const QString &input, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *commandScheduler)
Consumes the given line of input.
void setEnabled(bool)
Definition: qwidget.cpp:3447
#define Q_DECLARE_METATYPE(TYPE)
This macro makes the type Type known to QMetaType as long as it provides a public default constructor...
Definition: qmetatype.h:265
void handleResponse(const QScriptDebuggerResponse &response, int commandId)
Reimplemented Function
The QScriptStdMessageHandler class implements a message handler that writes to standard output...
virtual void setCurrentFrameIndex(int frameIndex)=0
QScriptDebuggerConsoleWidgetInterface * consoleWidget
The QScriptDebuggerCommand class represents a command issued to a QScriptDebuggerFrontend.
int scheduleForceReturn(int contextIndex, const QScriptDebuggerValue &value)
QAction * addSeparator()
Adds a separator to the end of the toolbar.
Definition: qtoolbar.cpp:936
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
QString join(const QString &sep) const
Joins all the string list&#39;s strings into a single string with each element separated by the given sep...
Definition: qstringlist.h:162
ValueType type() const
Returns the type of this value.
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
The QScriptDebuggerValue class represents a script value.
virtual QScriptDebuggerCodeWidgetInterface * createCodeWidget()=0
static int getInteger(QWidget *parent, const QString &title, const QString &label, int value=0, int minValue=-2147483647, int maxValue=2147483647, int step=1, bool *ok=0, Qt::WindowFlags flags=0)
Use getInt() instead.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
The QScriptContextInfo class provides additional information about a QScriptContext.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
void setBreakpoint(const QScriptBreakpointData &data)
Sets a breakpoint defined by the given data.
void handleResponse(const QScriptDebuggerResponse &response, int)
int scheduleJob(QScriptDebuggerJob *job)
Reimplemented Function
virtual void setToolTipProvider(QScriptToolTipProviderInterface *toolTipProvider)=0
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QAction * toggleBreakpointAction(QObject *parent) const
void addBreakpoint(int id, const QScriptBreakpointData &data)
Adds a breakpoint to the model.
virtual QString text() const =0
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
static QPixmap pixmap(const QString &path)
int scheduleCommand(const QScriptDebuggerCommand &command, QScriptDebuggerResponseHandlerInterface *responseHandler)
Schedules the given command for execution by this front-end, and returns a unique identifier associat...
QScriptDebugger(QObject *parent=0)
Constructs a new QScriptDebugger object.
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
static QCoreApplication * instance()
Returns a pointer to the application&#39;s QCoreApplication (or QApplication) instance.
QScriptDebuggerJob * activeJob
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
virtual void setLineContinuationMode(bool enabled)=0
static void messageHandler(QtMsgType type, const char *msg)
Definition: qtestlog.cpp:121
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
static Result parse(const QString &xml)
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QScriptDebuggerScriptsModel * scriptsModel
virtual QScriptDebuggerStackWidgetInterface * createStackWidget()=0
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
virtual QScriptDebuggerLocalsWidgetInterface * createLocalsWidget()=0
static const QMetaObjectPrivate * priv(const uint *data)
void removeBreakpoint(int id)
Remove the breakpoint identified by id from the model.
QScriptToolTipJob(const QPoint &pos, int frameIndex, int lineNumber, const QStringList &path, QScriptDebuggerCommandSchedulerInterface *scheduler)
void setCompletionProvider(QScriptCompletionProviderInterface *completionProvider)
void setDebugOutputWidget(QScriptDebugOutputWidgetInterface *debugOutputWidget)
virtual void setBreakpointsModel(QScriptBreakpointsModel *model)=0
The QScriptDebugger class provides a Qt Script debugger.
QHash< int, QScriptDebuggerLocalsModel * > localsModels
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
virtual void setExecutionLineNumber(int lineNumber, bool error)=0
virtual QScriptDebuggerConsoleWidgetInterface * createConsoleWidget()=0
void setCurrentLineNumber(int lineNumber)
void activateWindow()
Sets the top-level widget containing this widget to be the active window.
quint16 index
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QObject * parent
Definition: qobject.h:92
QScriptDebuggerConsole * console
void maybeDelete(QWidget *widget)
void _q_onLineEntered(const QString &contents)
Slot called when a line has been entered in the console widget.
QAction * stepIntoAction(QObject *parent) const
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
QScriptDebuggerStackWidgetInterface * stackWidget() const
void maybeStartNewJob()
Starts a new job if appropriate.
int resolveBreakpoint(qint64 scriptId, int lineNumber) const
Tries to find a breakpoint with the given scriptId and lineNumber.
int scheduleGetPropertyExpressionValue(int contextIndex, int lineNumber, const QStringList &path)
QStringList lines(int startLineNumber, int count) const
virtual void setCurrentScript(qint64 scriptId)=0
QAction * addAction(const QString &text)
Creates a new action with the given text.
Definition: qtoolbar.cpp:868
virtual QScriptBreakpointsWidgetInterface * createBreakpointsWidget()=0
QScriptErrorLogWidgetInterface * errorLogWidget
virtual void message(QtMsgType type, const QString &text, const QString &fileName=QString(), int lineNumber=-1, int columnNumber=-1, const QVariant &data=QVariant())=0
QScriptCompletionTaskInterface * createCompletionTask(const QString &contents, int cursorPosition, int frameIndex, int options)
Reimplemented Function
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
QScriptBreakpointData breakpointData() const
void setEventHandler(QScriptDebuggerEventHandlerInterface *eventHandler)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QVariant result() const
Returns the result of this response.
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319
virtual QScriptDebuggerCodeViewInterface * currentView() const =0
static bool registerCallback(Callback, qInternalCallback)
Definition: qglobal.cpp:3633
QPair< QList< qint64 >, QList< qint64 > > QScriptScriptsDelta
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QAction * clearErrorLogAction(QObject *parent) const
QScriptDebuggerShowLineJob(qint64 scriptId, int lineNumber, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *scheduler)
#define INT_MAX
QHash< int, QScriptDebuggerCommand > watchedCommands
virtual int currentFrameIndex() const =0
QString fileName() const
void _q_onScriptLocationSelected(int lineNumber)
int scheduleRunToLocation(const QString &fileName, int lineNumber)
Instructs the front-end to continue evaluation until the location specified by the given fileName and...
QScriptDebuggerConsoleWidgetInterface * consoleWidget() const
void setBreakpointsWidget(QScriptBreakpointsWidgetInterface *breakpointsWidget)
virtual qint64 currentScriptId() const =0
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
QAction * stepOutAction(QObject *parent) const
QAction * findNextInScriptAction(QObject *parent) const
#define text
Definition: qobjectdefs.h:80
QScriptBreakpointsModel * breakpointsModel
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650
static void showText(const QPoint &pos, const QString &text, QWidget *w=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qtooltip.cpp:497
void finishJob(QScriptDebuggerJob *job)
Reimplemented Function
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60