Debugger: Use QStringLiteral where appropriate

Change-Id: I5c33113783834ef0c7292f5f19f12d8c68f42141
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
Kai Koehne 2012-03-08 15:01:53 +01:00 committed by Qt by Nokia
parent 70ac6b1705
commit fd1e8c80f8
8 changed files with 27 additions and 27 deletions

View File

@ -69,7 +69,7 @@ public:
QDebugMessageService::QDebugMessageService(QObject *parent) : QDebugMessageService::QDebugMessageService(QObject *parent) :
QQmlDebugService(*(new QDebugMessageServicePrivate()), QQmlDebugService(*(new QDebugMessageServicePrivate()),
QLatin1String("DebugMessages"), 2, parent) QStringLiteral("DebugMessages"), 2, parent)
{ {
Q_D(QDebugMessageService); Q_D(QDebugMessageService);

View File

@ -155,7 +155,7 @@ void QQmlDebugServerPrivate::advertisePlugins()
pluginNames << service->name(); pluginNames << service->name();
pluginVersions << service->version(); pluginVersions << service->version();
} }
out << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << pluginNames << pluginVersions; out << QString(QStringLiteral("QDeclarativeDebugClient")) << 1 << pluginNames << pluginVersions;
} }
QMetaObject::invokeMethod(q, "_q_sendMessages", Qt::QueuedConnection, Q_ARG(QList<QByteArray>, QList<QByteArray>() << message)); QMetaObject::invokeMethod(q, "_q_sendMessages", Qt::QueuedConnection, Q_ARG(QList<QByteArray>, QList<QByteArray>() << message));
@ -217,8 +217,8 @@ void QQmlDebugServerThread::run()
connection->setPort(m_port, m_block); connection->setPort(m_port, m_block);
} else { } else {
QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp)); QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp));
qWarning() << QString::fromAscii("QML Debugger: Ignoring \"-qmljsdebugger=%1\". " qWarning() << QString(QLatin1String("QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
"Remote debugger plugin has not been found.").arg(appD->qmljsDebugArgumentsString()); "Remote debugger plugin has not been found.")).arg(appD->qmljsDebugArgumentsString());
} }
exec(); exec();
@ -262,9 +262,9 @@ QQmlDebugServer *QQmlDebugServer::instance()
// format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block] // format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block]
if (!appD->qmljsDebugArgumentsString().isEmpty()) { if (!appD->qmljsDebugArgumentsString().isEmpty()) {
if (!QQmlEnginePrivate::qml_debugging_enabled) { if (!QQmlEnginePrivate::qml_debugging_enabled) {
qWarning() << QString::fromLatin1( qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". " "QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
"Debugging has not been enabled.").arg( "Debugging has not been enabled.")).arg(
appD->qmljsDebugArgumentsString()); appD->qmljsDebugArgumentsString());
return 0; return 0;
} }
@ -273,9 +273,9 @@ QQmlDebugServer *QQmlDebugServer::instance()
if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) {
int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(','));
port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok); port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok);
pluginName = QLatin1String("qmldbg_tcp"); pluginName = QStringLiteral("qmldbg_tcp");
} else if (appD->qmljsDebugArgumentsString().contains(QLatin1String("ost"))) { } else if (appD->qmljsDebugArgumentsString().contains(QLatin1String("ost"))) {
pluginName = QLatin1String("qmldbg_ost"); pluginName = QStringLiteral("qmldbg_ost");
ok = true; ok = true;
} }
@ -298,17 +298,17 @@ QQmlDebugServer *QQmlDebugServer::instance()
} }
} else { } else {
qWarning() << QString::fromLatin1( qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". " "QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
"Format is -qmljsdebugger=port:<port>[,block]").arg( "Format is -qmljsdebugger=port:<port>[,block]")).arg(
appD->qmljsDebugArgumentsString()); appD->qmljsDebugArgumentsString());
} }
} }
#else #else
if (!appD->qmljsDebugArgumentsString().isEmpty()) { if (!appD->qmljsDebugArgumentsString().isEmpty()) {
qWarning() << QString::fromLatin1( qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". " "QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
"QtQml is not configured for debugging.").arg( "QtQml is not configured for debugging.")).arg(
appD->qmljsDebugArgumentsString()); appD->qmljsDebugArgumentsString());
} }
#endif #endif
@ -373,7 +373,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
pluginVersions << service->version(); pluginVersions << service->version();
} }
out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << pluginNames << pluginVersions; out << QString(QStringLiteral("QDeclarativeDebugClient")) << 0 << protocolVersion << pluginNames << pluginVersions;
} }
d->connection->send(QList<QByteArray>() << helloAnswer); d->connection->send(QList<QByteArray>() << helloAnswer);

View File

@ -216,11 +216,11 @@ bool QQmlDebugService::hasDebuggingClient()
QString QQmlDebugService::objectToString(QObject *obj) QString QQmlDebugService::objectToString(QObject *obj)
{ {
if(!obj) if(!obj)
return QLatin1String("NULL"); return QStringLiteral("NULL");
QString objectName = obj->objectName(); QString objectName = obj->objectName();
if(objectName.isEmpty()) if(objectName.isEmpty())
objectName = QLatin1String("<unnamed>"); objectName = QStringLiteral("<unnamed>");
QString rv = QString::fromUtf8(obj->metaObject()->className()) + QString rv = QString::fromUtf8(obj->metaObject()->className()) +
QLatin1String(": ") + objectName; QLatin1String(": ") + objectName;

View File

@ -67,7 +67,7 @@ QQmlEngineDebugService *QQmlEngineDebugService::instance()
} }
QQmlEngineDebugService::QQmlEngineDebugService(QObject *parent) QQmlEngineDebugService::QQmlEngineDebugService(QObject *parent)
: QQmlDebugService(QLatin1String("QDeclarativeEngine"), 1, parent), : QQmlDebugService(QStringLiteral("QDeclarativeEngine"), 1, parent),
m_watch(new QQmlWatcher(this)), m_watch(new QQmlWatcher(this)),
m_statesDelegate(0) m_statesDelegate(0)
{ {
@ -206,12 +206,12 @@ QVariant QQmlEngineDebugService::valueContents(const QVariant &value) const
if (o) { if (o) {
QString name = o->objectName(); QString name = o->objectName();
if (name.isEmpty()) if (name.isEmpty())
name = QLatin1String("<unnamed object>"); name = QStringLiteral("<unnamed object>");
return name; return name;
} }
} }
return QLatin1String("<unknown value>"); return QStringLiteral("<unknown value>");
} }
void QQmlEngineDebugService::buildObjectDump(QDataStream &message, void QQmlEngineDebugService::buildObjectDump(QDataStream &message,
@ -247,7 +247,7 @@ void QQmlEngineDebugService::buildObjectDump(QDataStream &message,
prop.value = expr->expression(); prop.value = expr->expression();
QObject *scope = expr->scopeObject(); QObject *scope = expr->scopeObject();
if (scope) { if (scope) {
QString sig = QLatin1String(scope->metaObject()->method(signal->index()).signature()); QString sig = QString::fromLatin1(scope->metaObject()->method(signal->index()).signature());
int lparen = sig.indexOf(QLatin1Char('(')); int lparen = sig.indexOf(QLatin1Char('('));
if (lparen >= 0) { if (lparen >= 0) {
QString methodName = sig.mid(0, lparen); QString methodName = sig.mid(0, lparen);
@ -510,11 +510,11 @@ void QQmlEngineDebugService::processMessage(const QByteArray &message)
bool undefined = false; bool undefined = false;
QVariant value = exprObj.evaluate(&undefined); QVariant value = exprObj.evaluate(&undefined);
if (undefined) if (undefined)
result = QLatin1String("<undefined>"); result = QString(QStringLiteral("<undefined>"));
else else
result = valueContents(value); result = valueContents(value);
} else { } else {
result = QLatin1String("<unknown context>"); result = QString(QStringLiteral("<unknown context>"));
} }
QByteArray reply; QByteArray reply;
@ -667,11 +667,11 @@ void QQmlEngineDebugService::setMethodBody(int objectId, const QString &method,
QString paramStr; QString paramStr;
for (int ii = 0; ii < paramNames.count(); ++ii) { for (int ii = 0; ii < paramNames.count(); ++ii) {
if (ii != 0) paramStr.append(QLatin1String(",")); if (ii != 0) paramStr.append(QLatin1Char(','));
paramStr.append(QString::fromUtf8(paramNames.at(ii))); paramStr.append(QString::fromUtf8(paramNames.at(ii)));
} }
QString jsfunction = QLatin1String("(function ") + method + QLatin1String("(") + paramStr + QString jsfunction = QLatin1String("(function ") + method + QLatin1Char('(') + paramStr +
QLatin1String(") {"); QLatin1String(") {");
jsfunction += body; jsfunction += body;
jsfunction += QLatin1String("\n})"); jsfunction += QLatin1String("\n})");

View File

@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QQmlInspectorService, serviceInstance) Q_GLOBAL_STATIC(QQmlInspectorService, serviceInstance)
QQmlInspectorService::QQmlInspectorService() QQmlInspectorService::QQmlInspectorService()
: QQmlDebugService(QLatin1String("QDeclarativeObserverMode"), 1) : QQmlDebugService(QStringLiteral("QDeclarativeObserverMode"), 1)
, m_currentInspectorPlugin(0) , m_currentInspectorPlugin(0)
{ {
registerService(); registerService();

View File

@ -77,7 +77,7 @@ QByteArray QQmlProfilerData::toByteArray() const
} }
QQmlProfilerService::QQmlProfilerService() QQmlProfilerService::QQmlProfilerService()
: QQmlDebugService(QLatin1String("CanvasFrameRate"), 1), : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1),
m_enabled(false), m_messageReceived(false) m_enabled(false), m_messageReceived(false)
{ {
m_timer.start(); m_timer.start();

View File

@ -120,7 +120,7 @@ public:
QV8DebugService::QV8DebugService(QObject *parent) QV8DebugService::QV8DebugService(QObject *parent)
: QQmlDebugService(*(new QV8DebugServicePrivate()), : QQmlDebugService(*(new QV8DebugServicePrivate()),
QLatin1String("V8Debugger"), 2, parent) QStringLiteral("V8Debugger"), 2, parent)
{ {
Q_D(QV8DebugService); Q_D(QV8DebugService);
v8ServiceInstancePtr = this; v8ServiceInstancePtr = this;

View File

@ -101,7 +101,7 @@ public:
}; };
QV8ProfilerService::QV8ProfilerService(QObject *parent) QV8ProfilerService::QV8ProfilerService(QObject *parent)
: QQmlDebugService(*(new QV8ProfilerServicePrivate()), QLatin1String("V8Profiler"), 1, parent) : QQmlDebugService(*(new QV8ProfilerServicePrivate()), QStringLiteral("V8Profiler"), 1, parent)
{ {
Q_D(QV8ProfilerService); Q_D(QV8ProfilerService);