diff options
Diffstat (limited to 'src/scripttools')
-rw-r--r-- | src/scripttools/debugging/qscriptdebugger.cpp | 3 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggeragent.cpp | 3 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggeragent_p.h | 1 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggeragent_p_p.h | 4 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp | 3 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggerstackmodel.cpp | 11 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptedit.cpp | 18 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptedit_p.h | 1 | ||||
-rw-r--r-- | src/scripttools/scripttools.pro | 1 |
9 files changed, 31 insertions, 14 deletions
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index 40f4d6c..c9bc650 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -993,7 +993,8 @@ public: m_debugger->scriptsModel->addScript(scriptId, data); // ### could be slow, might want to do this in a separate thread - QString xml = qt_scriptToXml(data.contents(), data.baseLineNumber()); +// Q_ASSERT_X(false, Q_FUNC_INFO, "implement me"); + QString xml; // = qt_scriptToXml(data.contents(), data.baseLineNumber()); QScriptXmlParser::Result extraInfo = QScriptXmlParser::parse(xml); m_debugger->scriptsModel->addExtraScriptInfo( scriptId, extraInfo.functionsInfo, extraInfo.executableLineNumbers); diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp index a263f8a..492b79f 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent.cpp +++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp @@ -88,7 +88,7 @@ QScriptDebuggerAgentPrivate *QScriptDebuggerAgentPrivate::get( */ QScriptDebuggerAgent::QScriptDebuggerAgent( QScriptDebuggerBackendPrivate *backend, QScriptEngine *engine) - : QScriptEngineAgent(*new QScriptDebuggerAgentPrivate, engine) + : QScriptEngineAgent(engine), d_ptr(new QScriptDebuggerAgentPrivate()) { Q_D(QScriptDebuggerAgent); d->backend = backend; @@ -110,6 +110,7 @@ QScriptDebuggerAgent::~QScriptDebuggerAgent() Q_D(QScriptDebuggerAgent); if (d->backend) d->backend->agentDestroyed(this); + delete d; } /*! diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p.h index da06726..805efc1 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent_p.h +++ b/src/scripttools/debugging/qscriptdebuggeragent_p.h @@ -125,6 +125,7 @@ public: const QVariant &argument = QVariant()); private: + QScriptDebuggerAgentPrivate *d_ptr; Q_DECLARE_PRIVATE(QScriptDebuggerAgent) Q_DISABLE_COPY(QScriptDebuggerAgent) }; diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h index 7c229a4..09d0121 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h +++ b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h @@ -53,8 +53,6 @@ // We mean it. // -#include <private/qscriptengineagent_p.h> - #include <QtScript/qscriptvalue.h> #include <QtCore/qdatetime.h> #include <QtCore/qhash.h> @@ -68,9 +66,7 @@ QT_BEGIN_NAMESPACE class QScriptDebuggerAgent; class QScriptDebuggerAgentPrivate - : public QScriptEngineAgentPrivate { - Q_DECLARE_PUBLIC(QScriptDebuggerAgent) public: enum State { NoState, diff --git a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp index adb4f33..73049d5 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp @@ -361,6 +361,7 @@ void QScriptDebuggerConsoleGlobalObject::warning(const QString &text, int lineNumber, int columnNumber) { Q_D(QScriptDebuggerConsoleGlobalObject); + Q_ASSERT(d->messageHandler != 0); d->messageHandler->message(QtWarningMsg, text, fileName, lineNumber, columnNumber); } @@ -369,6 +370,7 @@ void QScriptDebuggerConsoleGlobalObject::message(const QString &text, int lineNumber, int columnNumber) { Q_D(QScriptDebuggerConsoleGlobalObject); + Q_ASSERT(d->messageHandler != 0); d->messageHandler->message(QtDebugMsg, text, fileName, lineNumber, columnNumber); } @@ -377,6 +379,7 @@ void QScriptDebuggerConsoleGlobalObject::error(const QString &text, int lineNumber, int columnNumber) { Q_D(QScriptDebuggerConsoleGlobalObject); + Q_ASSERT(d->messageHandler != 0); d->messageHandler->message(QtCriticalMsg, text, fileName, lineNumber, columnNumber); } diff --git a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp index 651b062..a6bb78b 100644 --- a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp +++ b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp @@ -131,11 +131,14 @@ QVariant QScriptDebuggerStackModel::data(const QModelIndex &index, int role) con name = QString::fromLatin1("<anonymous>"); return name; } else if (index.column() == 2) { - if (info.lineNumber() == -1) - return QString::fromLatin1("<native>"); QString fn = QFileInfo(info.fileName()).fileName(); - if (fn.isEmpty()) - fn = QString::fromLatin1("<anonymous script, id=%0>").arg(info.scriptId()); + if (fn.isEmpty()) { + if (info.functionType() == QScriptContextInfo::ScriptFunction) + fn = QString::fromLatin1("<anonymous script, id=%0>").arg(info.scriptId()); + else + fn = QString::fromLatin1("<native>"); + + } return QString::fromLatin1("%0:%1").arg(fn).arg(info.lineNumber()); } } else if (role == Qt::ToolTipRole) { diff --git a/src/scripttools/debugging/qscriptedit.cpp b/src/scripttools/debugging/qscriptedit.cpp index 4f76695..a0c7199 100644 --- a/src/scripttools/debugging/qscriptedit.cpp +++ b/src/scripttools/debugging/qscriptedit.cpp @@ -156,6 +156,16 @@ void QScriptEdit::setExecutableLineNumbers(const QSet<int> &lineNumbers) m_executableLineNumbers = lineNumbers; } +bool QScriptEdit::isExecutableLine(int lineNumber) const +{ +#if 0 // ### enable me once we have information about the script again + return m_executableLineNumbers.contains(lineNumber); +#else + Q_UNUSED(lineNumber); + return true; +#endif +} + int QScriptEdit::currentLineNumber() const { return textCursor().blockNumber() + m_baseLineNumber; @@ -342,7 +352,7 @@ void QScriptEdit::extraAreaPaintEvent(QPaintEvent *e) icon.paint(&painter, r, Qt::AlignCenter); } - if (!m_executableLineNumbers.contains(lineNumber)) + if (!isExecutableLine(lineNumber)) painter.setPen(pal.color(QPalette::Mid)); else painter.setPen(QColor(Qt::darkCyan)); @@ -369,7 +379,7 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) if (e->type() == QEvent::MouseMove && e->buttons() == 0) { // mouse tracking bool hand = (e->pos().x() <= markWidth); int lineNumber = cursor.blockNumber() + m_baseLineNumber; - hand = hand && m_executableLineNumbers.contains(lineNumber); + hand = hand && isExecutableLine(lineNumber); #ifndef QT_NO_CURSOR if (hand != (m_extraArea->cursor().shape() == Qt::PointingHandCursor)) m_extraArea->setCursor(hand ? Qt::PointingHandCursor : Qt::ArrowCursor); @@ -379,7 +389,7 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) if (e->type() == QEvent::MouseButtonPress) { if (e->button() == Qt::LeftButton) { int lineNumber = cursor.blockNumber() + m_baseLineNumber; - bool executable = m_executableLineNumbers.contains(lineNumber); + bool executable = isExecutableLine(lineNumber); if ((e->pos().x() <= markWidth) && executable) m_extraAreaToggleBlockNumber = cursor.blockNumber(); else @@ -394,7 +404,7 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) } } else if (e->button() == Qt::RightButton) { int lineNumber = cursor.blockNumber() + m_baseLineNumber; - if (!m_executableLineNumbers.contains(lineNumber)) + if (!isExecutableLine(lineNumber)) return; bool has = m_breakpoints.contains(lineNumber); QMenu *popup = new QMenu(); diff --git a/src/scripttools/debugging/qscriptedit_p.h b/src/scripttools/debugging/qscriptedit_p.h index 2db2d7c..ee3dfc1 100644 --- a/src/scripttools/debugging/qscriptedit_p.h +++ b/src/scripttools/debugging/qscriptedit_p.h @@ -75,6 +75,7 @@ public: int executionLineNumber() const; void setExecutionLineNumber(int lineNumber, bool error); void setExecutableLineNumbers(const QSet<int> &lineNumbers); + bool isExecutableLine(int lineNumber) const; int currentLineNumber() const; void gotoLine(int lineNumber); diff --git a/src/scripttools/scripttools.pro b/src/scripttools/scripttools.pro index 5878db2..b1df7aa 100644 --- a/src/scripttools/scripttools.pro +++ b/src/scripttools/scripttools.pro @@ -9,6 +9,7 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript include(../qbase.pri) + include(debugging/debugging.pri) symbian:TARGET.UID3=0x2001E625 |