Commit ec493900 authored by Friedemann Kleint's avatar Friedemann Kleint Committed by hjk

QML-Debugger: Compile with QT_NO_CAST_FROM_ASCII.

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