forked from qt-creator/qt-creator
QML-Debugger: Compile with QT_NO_CAST_FROM_ASCII.
Change-Id: Id6f437c54504f6730c8726264f460b8f1631899d Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -332,7 +332,7 @@ void QmlAdapter::logServiceStatusChange(const QString &service,
|
|||||||
void QmlAdapter::logServiceActivity(const QString &service, const QString &logMessage)
|
void QmlAdapter::logServiceActivity(const QString &service, const QString &logMessage)
|
||||||
{
|
{
|
||||||
if (!d->m_engine.isNull())
|
if (!d->m_engine.isNull())
|
||||||
d->m_engine.data()->showMessage(QString("%1 %2").arg(service, logMessage), LogDebug);
|
d->m_engine.data()->showMessage(service + QLatin1Char(' ') + logMessage, LogDebug);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ void QmlEngine::retryMessageBoxFinished(int result)
|
|||||||
}
|
}
|
||||||
case QMessageBox::Help: {
|
case QMessageBox::Help: {
|
||||||
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
||||||
helpManager->handleHelpRequest("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html");
|
helpManager->handleHelpRequest(QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html"));
|
||||||
// fall through
|
// fall through
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -830,17 +830,13 @@ void QmlEngine::executeDebuggerCommand(const QString& command)
|
|||||||
|
|
||||||
QString QmlEngine::qmlImportPath() const
|
QString QmlEngine::qmlImportPath() const
|
||||||
{
|
{
|
||||||
return startParameters().environment.value("QML_IMPORT_PATH");
|
return startParameters().environment.value(QLatin1String("QML_IMPORT_PATH"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::logMessage(const QString &service, LogDirection direction, const QString &message)
|
void QmlEngine::logMessage(const QString &service, LogDirection direction, const QString &message)
|
||||||
{
|
{
|
||||||
QString msg = service;
|
QString msg = service;
|
||||||
if (direction == LogSend) {
|
msg += direction == LogSend ? QLatin1String(": sending ") : QLatin1String(": receiving ");
|
||||||
msg += ": sending ";
|
|
||||||
} else {
|
|
||||||
msg += ": receiving ";
|
|
||||||
}
|
|
||||||
msg += message;
|
msg += message;
|
||||||
showMessage(msg, LogDebug);
|
showMessage(msg, LogDebug);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -903,13 +903,13 @@ QScriptValue QmlV8DebuggerClientPrivate::initObject()
|
|||||||
void QmlV8DebuggerClientPrivate::logSendMessage(const QString &msg) const
|
void QmlV8DebuggerClientPrivate::logSendMessage(const QString &msg) const
|
||||||
{
|
{
|
||||||
if (engine)
|
if (engine)
|
||||||
engine->logMessage("V8DebuggerClient", QmlEngine::LogSend, msg);
|
engine->logMessage(QLatin1String("V8DebuggerClient"), QmlEngine::LogSend, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlV8DebuggerClientPrivate::logReceiveMessage(const QString &msg) const
|
void QmlV8DebuggerClientPrivate::logReceiveMessage(const QString &msg) const
|
||||||
{
|
{
|
||||||
if (engine)
|
if (engine)
|
||||||
engine->logMessage("V8DebuggerClient", QmlEngine::LogReceive, msg);
|
engine->logMessage(QLatin1String("V8DebuggerClient"), QmlEngine::LogReceive, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO::remove this method
|
//TODO::remove this method
|
||||||
@@ -928,7 +928,7 @@ void QmlV8DebuggerClientPrivate::reformatRequest(QByteArray &request)
|
|||||||
interrupt();
|
interrupt();
|
||||||
|
|
||||||
} else if (command == V8REQUEST) {
|
} else if (command == V8REQUEST) {
|
||||||
QString requestString(data);
|
const QString requestString = QLatin1String(data);
|
||||||
const QVariantMap reqMap = parser.call(QScriptValue(),
|
const QVariantMap reqMap = parser.call(QScriptValue(),
|
||||||
QScriptValueList() <<
|
QScriptValueList() <<
|
||||||
QScriptValue(requestString)).toVariant().toMap();
|
QScriptValue(requestString)).toVariant().toMap();
|
||||||
@@ -1058,16 +1058,16 @@ void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id)
|
|||||||
if (d->isOldService) {
|
if (d->isOldService) {
|
||||||
d->setBreakpoint(QString(_(SCRIPT)), QFileInfo(params.fileName).fileName(),
|
d->setBreakpoint(QString(_(SCRIPT)), QFileInfo(params.fileName).fileName(),
|
||||||
params.lineNumber - 1, -1, params.enabled,
|
params.lineNumber - 1, -1, params.enabled,
|
||||||
QString(params.condition), params.ignoreCount);
|
QLatin1String(params.condition), params.ignoreCount);
|
||||||
} else {
|
} else {
|
||||||
d->setBreakpoint(QString(_(SCRIPTREGEXP)), QFileInfo(params.fileName).fileName(),
|
d->setBreakpoint(QString(_(SCRIPTREGEXP)), QFileInfo(params.fileName).fileName(),
|
||||||
params.lineNumber - 1, -1, params.enabled,
|
params.lineNumber - 1, -1, params.enabled,
|
||||||
QString(params.condition), params.ignoreCount);
|
QLatin1String(params.condition), params.ignoreCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (params.type == BreakpointByFunction) {
|
} else if (params.type == BreakpointByFunction) {
|
||||||
d->setBreakpoint(QString(_(FUNCTION)), params.functionName,
|
d->setBreakpoint(QString(_(FUNCTION)), params.functionName,
|
||||||
-1, -1, params.enabled, QString(params.condition),
|
-1, -1, params.enabled, QLatin1String(params.condition),
|
||||||
params.ignoreCount);
|
params.ignoreCount);
|
||||||
|
|
||||||
} else if (params.type == BreakpointOnQmlSignalHandler) {
|
} else if (params.type == BreakpointOnQmlSignalHandler) {
|
||||||
@@ -1112,7 +1112,7 @@ void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
int breakpoint = d->breakpoints.value(id);
|
int breakpoint = d->breakpoints.value(id);
|
||||||
d->changeBreakpoint(breakpoint, params.enabled, QString(params.condition),
|
d->changeBreakpoint(breakpoint, params.enabled, QLatin1String(params.condition),
|
||||||
params.ignoreCount);
|
params.ignoreCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1205,7 +1205,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
type = QByteArray(V8MESSAGE);
|
type = QByteArray(V8MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->logReceiveMessage(QString(_("%1 %2")).arg(_(V8DEBUG), QString(type)));
|
d->logReceiveMessage(_(V8DEBUG) + QLatin1Char(' ') + QLatin1String(type));
|
||||||
if (type == CONNECT) {
|
if (type == CONNECT) {
|
||||||
//debugging session started
|
//debugging session started
|
||||||
|
|
||||||
@@ -1216,9 +1216,9 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
//break on signal handler requested
|
//break on signal handler requested
|
||||||
|
|
||||||
} else if (type == V8MESSAGE) {
|
} else if (type == V8MESSAGE) {
|
||||||
QString responseString(response);
|
const QString responseString = QLatin1String(response);
|
||||||
SDEBUG(responseString);
|
SDEBUG(responseString);
|
||||||
d->logReceiveMessage(QString(_("%1 %2")).arg(_(V8MESSAGE), responseString));
|
d->logReceiveMessage(QLatin1String(V8MESSAGE) + QLatin1Char(' ') + responseString);
|
||||||
|
|
||||||
const QVariantMap resp = d->parser.call(QScriptValue(),
|
const QVariantMap resp = d->parser.call(QScriptValue(),
|
||||||
QScriptValueList() <<
|
QScriptValueList() <<
|
||||||
@@ -1353,10 +1353,10 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
QStringList sourceFiles;
|
QStringList sourceFiles;
|
||||||
for (int i = 0; i < body.size(); ++i) {
|
for (int i = 0; i < body.size(); ++i) {
|
||||||
const QVariantMap entryMap = body.at(i).toMap();
|
const QVariantMap entryMap = body.at(i).toMap();
|
||||||
const int lineOffset = entryMap.value("lineOffset").toInt();
|
const int lineOffset = entryMap.value(QLatin1String("lineOffset")).toInt();
|
||||||
const int columnOffset = entryMap.value("columnOffset").toInt();
|
const int columnOffset = entryMap.value(QLatin1String("columnOffset")).toInt();
|
||||||
const QString name = entryMap.value("name").toString();
|
const QString name = entryMap.value(QLatin1String("name")).toString();
|
||||||
const QString source = entryMap.value("source").toString();
|
const QString source = entryMap.value(QLatin1String("source")).toString();
|
||||||
|
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
@@ -1614,7 +1614,7 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const
|
|||||||
|
|
||||||
//Check if the frameIndex is same as current Stack Index
|
//Check if the frameIndex is same as current Stack Index
|
||||||
StackHandler *stackHandler = d->engine->stackHandler();
|
StackHandler *stackHandler = d->engine->stackHandler();
|
||||||
int frameIndex = currentFrame.value("index").toInt();
|
int frameIndex = currentFrame.value(QLatin1String("index")).toInt();
|
||||||
|
|
||||||
d->clearCache();
|
d->clearCache();
|
||||||
d->refsVal = refsVal;
|
d->refsVal = refsVal;
|
||||||
@@ -1622,7 +1622,7 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const
|
|||||||
{
|
{
|
||||||
WatchData data;
|
WatchData data;
|
||||||
data.exp = QByteArray("this");
|
data.exp = QByteArray("this");
|
||||||
data.name = QString(data.exp);
|
data.name = QLatin1String(data.exp);
|
||||||
data.iname = QByteArray("local.") + data.exp;
|
data.iname = QByteArray("local.") + data.exp;
|
||||||
QVariantMap receiver = currentFrame.value(_("receiver")).toMap();
|
QVariantMap receiver = currentFrame.value(_("receiver")).toMap();
|
||||||
if (receiver.contains(_(REF))) {
|
if (receiver.contains(_(REF))) {
|
||||||
@@ -1695,10 +1695,10 @@ void QmlV8DebuggerClient::updateScope(const QVariant &bodyVal, const QVariant &r
|
|||||||
WatchData data;
|
WatchData data;
|
||||||
data.exp = localData.value(_(NAME)).toByteArray();
|
data.exp = localData.value(_(NAME)).toByteArray();
|
||||||
//Check for v8 specific local data
|
//Check for v8 specific local data
|
||||||
if (data.exp.startsWith(".") || data.exp.isEmpty())
|
if (data.exp.startsWith('.') || data.exp.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
data.name = QString(data.exp);
|
data.name = QLatin1String(data.exp);
|
||||||
data.iname = QByteArray("local.") + data.exp;
|
data.iname = QByteArray("local.") + data.exp;
|
||||||
|
|
||||||
int handle = localData.value(_(REF)).toInt();
|
int handle = localData.value(_(REF)).toInt();
|
||||||
@@ -1873,7 +1873,7 @@ void QmlV8DebuggerClient::expandLocalsAndWatchers(const QVariant &bodyVal, const
|
|||||||
data.name = propertyData.value(_(NAME)).toString();
|
data.name = propertyData.value(_(NAME)).toString();
|
||||||
|
|
||||||
//Check for v8 specific local data
|
//Check for v8 specific local data
|
||||||
if (data.name.startsWith(".") || data.name.isEmpty())
|
if (data.name.startsWith(QLatin1Char('.')) || data.name.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (parent && parent->type == "object") {
|
if (parent && parent->type == "object") {
|
||||||
if (parent->value == _("Array"))
|
if (parent->value == _("Array"))
|
||||||
@@ -1900,7 +1900,7 @@ void QmlV8DebuggerClient::expandLocalsAndWatchers(const QVariant &bodyVal, const
|
|||||||
//rest
|
//rest
|
||||||
WatchData data;
|
WatchData data;
|
||||||
data.exp = prepend;
|
data.exp = prepend;
|
||||||
data.name = data.exp;
|
data.name = QLatin1String(data.exp);
|
||||||
data.iname = QByteArray("local.") + data.exp;
|
data.iname = QByteArray("local.") + data.exp;
|
||||||
data.id = handle.toInt();
|
data.id = handle.toInt();
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QTextStream>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -148,7 +149,7 @@ void QScriptDebuggerClient::executeStep()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPINTO";
|
QByteArray cmd = "STEPINTO";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ void QScriptDebuggerClient::executeStepOut()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPOUT";
|
QByteArray cmd = "STEPOUT";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ void QScriptDebuggerClient::executeNext()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPOVER";
|
QByteArray cmd = "STEPOVER";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +179,7 @@ void QScriptDebuggerClient::executeStepI()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPINTO";
|
QByteArray cmd = "STEPINTO";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +189,7 @@ void QScriptDebuggerClient::continueInferior()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "CONTINUE";
|
QByteArray cmd = "CONTINUE";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ void QScriptDebuggerClient::interruptInferior()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "INTERRUPT";
|
QByteArray cmd = "INTERRUPT";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +227,7 @@ void QScriptDebuggerClient::activateFrame(int index)
|
|||||||
QByteArray cmd = "ACTIVATE_FRAME";
|
QByteArray cmd = "ACTIVATE_FRAME";
|
||||||
rs << cmd
|
rs << cmd
|
||||||
<< index;
|
<< index;
|
||||||
d->logSendMessage(QString(_("%1 %2")).arg(cmd, QString::number(index)));
|
d->logSendMessage(QLatin1String(cmd) + QLatin1Char(' ') + QString::number(index));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,13 +272,20 @@ void QScriptDebuggerClient::synchronizeBreakpoints()
|
|||||||
rs << cmd
|
rs << cmd
|
||||||
<< d->breakpoints;
|
<< d->breakpoints;
|
||||||
|
|
||||||
QStringList logBreakpoints;
|
QString logBreakpoints;
|
||||||
|
QTextStream str(&logBreakpoints);
|
||||||
|
str << cmd << " (";
|
||||||
|
bool first = true;
|
||||||
foreach (const JSAgentBreakpointData &bp, d->breakpoints) {
|
foreach (const JSAgentBreakpointData &bp, d->breakpoints) {
|
||||||
logBreakpoints << QString("[%1, %2, %3]").arg(bp.functionName,
|
if (first) {
|
||||||
bp.fileUrl,
|
first = false;
|
||||||
QString::number(bp.lineNumber));
|
} else {
|
||||||
|
str << ", ";
|
||||||
|
}
|
||||||
|
str << '[' << bp.functionName << ", " << bp.fileUrl << ", " << bp.lineNumber << ']';
|
||||||
}
|
}
|
||||||
d->logSendMessage(QString(_("%1 (%2)")).arg(cmd, logBreakpoints.join(", ")));
|
str << ')';
|
||||||
|
d->logSendMessage(logBreakpoints);
|
||||||
|
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
@@ -290,8 +298,9 @@ void QScriptDebuggerClient::assignValueInDebugger(const QByteArray expr, const q
|
|||||||
QByteArray cmd = "SET_PROPERTY";
|
QByteArray cmd = "SET_PROPERTY";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << expr << id << property << value;
|
rs << expr << id << property << value;
|
||||||
d->logSendMessage(QString(_("%1 %2 %3 %4 %5")).arg(cmd, expr, QString::number(id), property,
|
d->logSendMessage(QString::fromLatin1("%1 %2 %3 %4 %5").
|
||||||
value));
|
arg(QLatin1String(cmd), QLatin1String(expr),
|
||||||
|
QString::number(id), property, value));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +311,8 @@ void QScriptDebuggerClient::updateWatchData(const WatchData &data)
|
|||||||
QByteArray cmd = "EXEC";
|
QByteArray cmd = "EXEC";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << data.iname << data.name;
|
rs << data.iname << data.name;
|
||||||
d->logSendMessage(QString(_("%1 %2 %3")).arg(cmd, data.iname, data.name));
|
d->logSendMessage(QLatin1String(cmd) + QLatin1Char(' ') + QLatin1String(data.iname)
|
||||||
|
+ QLatin1Char(' ') + data.name);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +323,8 @@ void QScriptDebuggerClient::executeDebuggerCommand(const QString &command)
|
|||||||
QByteArray cmd = "EXEC";
|
QByteArray cmd = "EXEC";
|
||||||
QByteArray console = "console";
|
QByteArray console = "console";
|
||||||
rs << cmd << console << command;
|
rs << cmd << console << command;
|
||||||
d->logSendMessage(QString(_("%1 %2 %3")).arg(cmd, console, command));
|
d->logSendMessage(QLatin1String(cmd) + QLatin1Char(' ') + QLatin1String(console)
|
||||||
|
+ QLatin1Char(' ') + command);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +335,8 @@ void QScriptDebuggerClient::synchronizeWatchers(const QStringList &watchers)
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "WATCH_EXPRESSIONS";
|
QByteArray cmd = "WATCH_EXPRESSIONS";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
d->logSendMessage(QString(_("%1 (%2)")).arg(cmd, watchers.join(", ")));
|
d->logSendMessage(QString::fromLatin1("%1 (%2)").arg(QLatin1String(cmd),
|
||||||
|
watchers.join(QLatin1String(", "))));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +347,8 @@ void QScriptDebuggerClient::expandObject(const QByteArray &iname, quint64 object
|
|||||||
QByteArray cmd = "EXPAND";
|
QByteArray cmd = "EXPAND";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << iname << objectId;
|
rs << iname << objectId;
|
||||||
d->logSendMessage(QString(_("%1 %2 %3")).arg(cmd, iname, QString::number(objectId)));
|
d->logSendMessage(QLatin1String(cmd) + QLatin1Char(' ') + QLatin1String(iname)
|
||||||
|
+ QString::number(objectId));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +360,7 @@ void QScriptDebuggerClient::sendPing()
|
|||||||
QByteArray cmd = "PING";
|
QByteArray cmd = "PING";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << d->ping;
|
rs << d->ping;
|
||||||
d->logSendMessage(cmd);
|
d->logSendMessage(QLatin1String(cmd));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,14 +389,14 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
for (int i = 0; i != stackFrames.size(); ++i) {
|
for (int i = 0; i != stackFrames.size(); ++i) {
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
frame.line = stackFrames.at(i).lineNumber;
|
frame.line = stackFrames.at(i).lineNumber;
|
||||||
frame.function = stackFrames.at(i).functionName;
|
frame.function = QLatin1String(stackFrames.at(i).functionName);
|
||||||
frame.file = d->engine->toFileInProject(QUrl(stackFrames.at(i).fileUrl));
|
frame.file = d->engine->toFileInProject(QUrl(QLatin1String(stackFrames.at(i).fileUrl)));
|
||||||
frame.usable = QFileInfo(frame.file).isReadable();
|
frame.usable = QFileInfo(frame.file).isReadable();
|
||||||
frame.level = i + 1;
|
frame.level = i + 1;
|
||||||
ideStackFrames << frame;
|
ideStackFrames << frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ideStackFrames.size() && ideStackFrames.back().function == "<global>")
|
if (ideStackFrames.size() && ideStackFrames.back().function == QLatin1String("<global>"))
|
||||||
ideStackFrames.takeLast();
|
ideStackFrames.takeLast();
|
||||||
d->engine->stackHandler()->setFrames(ideStackFrames);
|
d->engine->stackHandler()->setFrames(ideStackFrames);
|
||||||
|
|
||||||
@@ -419,7 +432,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
bool becauseOfException;
|
bool becauseOfException;
|
||||||
stream >> becauseOfException;
|
stream >> becauseOfException;
|
||||||
|
|
||||||
logString += becauseOfException ? " exception" : " no_exception";
|
logString += becauseOfException ? QLatin1String(" exception") : QLatin1String(" no_exception");
|
||||||
|
|
||||||
if (becauseOfException) {
|
if (becauseOfException) {
|
||||||
QString error;
|
QString error;
|
||||||
@@ -433,7 +446,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
? tr("<p>An uncaught exception occurred:</p><p>%1</p>")
|
? tr("<p>An uncaught exception occurred:</p><p>%1</p>")
|
||||||
.arg(Qt::escape(error))
|
.arg(Qt::escape(error))
|
||||||
: tr("<p>An uncaught exception occurred in <i>%1</i>:</p><p>%2</p>")
|
: tr("<p>An uncaught exception occurred in <i>%1</i>:</p><p>%2</p>")
|
||||||
.arg(stackFrames.value(0).fileUrl, Qt::escape(error));
|
.arg(QLatin1String(stackFrames.value(0).fileUrl), Qt::escape(error));
|
||||||
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg);
|
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
@@ -476,8 +489,8 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
QByteArray iname;
|
QByteArray iname;
|
||||||
stream >> iname >> data;
|
stream >> iname >> data;
|
||||||
|
|
||||||
d->logReceiveMessage(QString("%1 %2 %3").arg(QString(command), QString(iname),
|
d->logReceiveMessage(QLatin1String(command) + QLatin1Char(' ')
|
||||||
QString(data.value)));
|
+ QLatin1String(iname) + QLatin1Char(' ') + data.value);
|
||||||
data.iname = iname;
|
data.iname = iname;
|
||||||
if (iname.startsWith("watch.")) {
|
if (iname.startsWith("watch.")) {
|
||||||
d->engine->watchHandler()->insertData(data);
|
d->engine->watchHandler()->insertData(data);
|
||||||
@@ -490,9 +503,9 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
QList<WatchData> result;
|
QList<WatchData> result;
|
||||||
QByteArray iname;
|
QByteArray iname;
|
||||||
stream >> iname >> result;
|
stream >> iname >> result;
|
||||||
d->logReceiveMessage(QString("%1 %2 (%3 x watchdata)").arg( QString(command),
|
d->logReceiveMessage(QString::fromLatin1("%1 %2 (%3 x watchdata)").
|
||||||
QString(iname),
|
arg(QLatin1String(command), QLatin1String(iname),
|
||||||
QString::number(result.size())));
|
QString::number(result.size())));
|
||||||
bool needPing = false;
|
bool needPing = false;
|
||||||
|
|
||||||
foreach (WatchData data, result) {
|
foreach (WatchData data, result) {
|
||||||
@@ -515,10 +528,9 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
stream >> watches;
|
stream >> watches;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->logReceiveMessage(QString("%1 %2 (%3 x locals) (%4 x watchdata)").arg(
|
d->logReceiveMessage(QString::fromLatin1("%1 %2 (%3 x locals) (%4 x watchdata)").arg(
|
||||||
QString(command), QString::number(frameId),
|
QLatin1String(command), QString::number(frameId),
|
||||||
QString::number(locals.size()),
|
QString::number(locals.size()), QString::number(watches.size())));
|
||||||
QString::number(watches.size())));
|
|
||||||
d->engine->watchHandler()->beginCycle();
|
d->engine->watchHandler()->beginCycle();
|
||||||
bool needPing = false;
|
bool needPing = false;
|
||||||
foreach (WatchData data, watches) {
|
foreach (WatchData data, watches) {
|
||||||
@@ -548,13 +560,13 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
int ping;
|
int ping;
|
||||||
stream >> ping;
|
stream >> ping;
|
||||||
|
|
||||||
d->logReceiveMessage(QString("%1 %2").arg(QString(command), QString::number(ping)));
|
d->logReceiveMessage(QLatin1String(command) + QLatin1Char(' ') + QString::number(ping));
|
||||||
|
|
||||||
if (ping == d->ping)
|
if (ping == d->ping)
|
||||||
d->engine->watchHandler()->endCycle();
|
d->engine->watchHandler()->endCycle();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << Q_FUNC_INFO << "Unknown command: " << command;
|
qDebug() << Q_FUNC_INFO << "Unknown command: " << command;
|
||||||
d->logReceiveMessage(QString("%1 UNKNOWN COMMAND!!").arg(QString(command)));
|
d->logReceiveMessage(QLatin1String(command) + QLatin1String(" UNKNOWN COMMAND!!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -567,13 +579,13 @@ void QScriptDebuggerClient::setEngine(QmlEngine *engine)
|
|||||||
void QScriptDebuggerClientPrivate::logSendMessage(const QString &msg) const
|
void QScriptDebuggerClientPrivate::logSendMessage(const QString &msg) const
|
||||||
{
|
{
|
||||||
if (engine)
|
if (engine)
|
||||||
engine->logMessage("QScriptDebuggerClient", QmlEngine::LogSend, msg);
|
engine->logMessage(QLatin1String("QScriptDebuggerClient"), QmlEngine::LogSend, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QScriptDebuggerClientPrivate::logReceiveMessage(const QString &msg) const
|
void QScriptDebuggerClientPrivate::logReceiveMessage(const QString &msg) const
|
||||||
{
|
{
|
||||||
if (engine)
|
if (engine)
|
||||||
engine->logMessage("QScriptDebuggerClient", QmlEngine::LogReceive, msg);
|
engine->logMessage(QLatin1String("QScriptDebuggerClient"), QmlEngine::LogReceive, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user