L10n: tr()-Fixes.

This commit is contained in:
Friedemann Kleint
2011-03-07 17:20:10 +01:00
parent 0da97d73ec
commit 5c3596e935
8 changed files with 88 additions and 60 deletions

View File

@@ -34,13 +34,13 @@
**************************************************************************/ **************************************************************************/
#include "modelhelpers.h" #include "modelhelpers.h"
#include <QString>
#include <QDir>
#include <QPair>
#include "frame.h" #include "frame.h"
#include <QtCore/QString>
#include <QtCore/QDir>
#include <QtCore/QPair>
#include <QtCore/QCoreApplication>
namespace Valgrind { namespace Valgrind {
namespace XmlProtocol { namespace XmlProtocol {
@@ -57,26 +57,33 @@ QString toolTipForFrame(const Frame &frame)
QList<StringPair> lines; QList<StringPair> lines;
if (!frame.functionName().isEmpty()) if (!frame.functionName().isEmpty())
lines << qMakePair(QObject::tr("Function:"), frame.functionName()); lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Function:"),
frame.functionName());
if (!location.isEmpty()) if (!location.isEmpty())
lines << qMakePair(QObject::tr("Location:"), location); lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Location:"),
location);
if (frame.instructionPointer()) if (frame.instructionPointer())
lines << qMakePair(QObject::tr("Instruction pointer:"), lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol",
QString("0x%1").arg(frame.instructionPointer(), 0, 16)); "Instruction pointer:"),
QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16));
if (!frame.object().isEmpty()) if (!frame.object().isEmpty())
lines << qMakePair(QObject::tr("Object:"), frame.object()); lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
QString html = "<html>" QString html = "<html>"
"<head>" "<head>"
"<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n" "<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n"
"<body><dl>"; "<body><dl>";
foreach(const StringPair &pair, lines) foreach (const StringPair &pair, lines) {
html += "<dt>" + pair.first + "</dt><dd>" + pair.second + "</dd>\n"; html += QLatin1String("<dt>");
html += pair.first;
html += QLatin1String("</dt><dd>");
html += pair.second;
html += QLatin1String("</dd>\n");
}
html += "</dl></body></html>"; html += "</dl></body></html>";
return html; return html;
} }
} }
} }

View File

@@ -36,7 +36,7 @@
#ifndef LIBVALGRIND_PROTOCOL_MODELHELPERS_H #ifndef LIBVALGRIND_PROTOCOL_MODELHELPERS_H
#define LIBVALGRIND_PROTOCOL_MODELHELPERS_H #define LIBVALGRIND_PROTOCOL_MODELHELPERS_H
#include <QtGlobal> #include <QtCore/QtGlobal>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QString; class QString;

View File

@@ -42,13 +42,13 @@
#include "suppression.h" #include "suppression.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QAbstractSocket> #include <QtNetwork/QAbstractSocket>
#include <QCoreApplication> #include <QtCore/QCoreApplication>
#include <QHash> #include <QtCore/QHash>
#include <QIODevice> #include <QtCore/QIODevice>
#include <QPair> #include <QtCore/QPair>
#include <QThread> #include <QtCore/QThread>
#include <QXmlStreamReader> #include <QtCore/QXmlStreamReader>
using namespace Valgrind; using namespace Valgrind;
using namespace Valgrind::XmlProtocol; using namespace Valgrind::XmlProtocol;
@@ -194,7 +194,8 @@ static quint64 parseHex(const QString &str, const QString &context)
bool ok; bool ok;
const quint64 v = str.toULongLong(&ok, 16); const quint64 v = str.toULongLong(&ok, 16);
if (!ok) if (!ok)
throw ParserException(QObject::tr("Could not parse hex number from \"%1\" (%2)").arg(str, context)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse hex number from \"%1\" (%2)").arg(str, context));
return v; return v;
} }
@@ -203,7 +204,8 @@ static qint64 parseInt64(const QString &str, const QString &context)
bool ok; bool ok;
const quint64 v = str.toLongLong(&ok); const quint64 v = str.toLongLong(&ok);
if (!ok) if (!ok)
throw ParserException(QObject::tr("Could not parse hex number from \"%1\" (%2)").arg(str, context)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse hex number from \"%1\" (%2)").arg(str, context));
return v; return v;
} }
@@ -262,7 +264,8 @@ QString Parser::Private::blockingReadElementText()
//affects at least Qt <= 4.7.1. Reported as QTBUG-14661. //affects at least Qt <= 4.7.1. Reported as QTBUG-14661.
if (!reader.isStartElement()) if (!reader.isStartElement())
throw ParserException(QObject::tr("trying to read element text although current position is not start of element")); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"trying to read element text although current position is not start of element"));
QString result; QString result;
@@ -279,10 +282,12 @@ QString Parser::Private::blockingReadElementText()
case QXmlStreamReader::Comment: case QXmlStreamReader::Comment:
break; break;
case QXmlStreamReader::StartElement: case QXmlStreamReader::StartElement:
throw ParserException(QObject::tr("Unexpected child element while reading element text")); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected child element while reading element text"));
default: default:
//TODO handle //TODO handle
throw ParserException(QObject::tr("Unexpected token type %1").arg(type)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected token type %1").arg(type));
break; break;
} }
} }
@@ -294,9 +299,11 @@ void Parser::Private::checkProtocolVersion(const QString &versionStr)
bool ok; bool ok;
const int version = versionStr.toInt(&ok); const int version = versionStr.toInt(&ok);
if (!ok) if (!ok)
throw ParserException(QObject::tr("Could not parse protocol version from \"%1\"").arg(versionStr)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse protocol version from \"%1\"").arg(versionStr));
if (version != 4) if (version != 4)
throw ParserException(QObject::tr("XmlProtocol version %1 not supported (supported version: 4)").arg(version)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"XmlProtocol version %1 not supported (supported version: 4)").arg(version));
} }
void Parser::Private::checkTool(const QString &reportedStr) void Parser::Private::checkTool(const QString &reportedStr)
@@ -304,7 +311,8 @@ void Parser::Private::checkTool(const QString &reportedStr)
const QHash<QString,Parser::Tool>::ConstIterator reported = toolsByName.find(reportedStr); const QHash<QString,Parser::Tool>::ConstIterator reported = toolsByName.find(reportedStr);
if (reported == toolsByName.constEnd()) if (reported == toolsByName.constEnd())
throw ParserException(QObject::tr("Valgrind tool \"%1\" not supported").arg(reportedStr)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Valgrind tool \"%1\" not supported").arg(reportedStr));
tool = reported.value(); tool = reported.value();
} }
@@ -361,7 +369,8 @@ MemcheckErrorKind Parser::Private::parseMemcheckErrorKind(const QString &kind)
if (it != errorKindsByName_memcheck.constEnd()) if (it != errorKindsByName_memcheck.constEnd())
return *it; return *it;
else else
throw ParserException(QObject::tr("Unknown memcheck error kind \"%1\"").arg(kind)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown memcheck error kind \"%1\"").arg(kind));
} }
HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind) HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
@@ -370,7 +379,8 @@ HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
if (it != errorKindsByName_helgrind.constEnd()) if (it != errorKindsByName_helgrind.constEnd())
return *it; return *it;
else else
throw ParserException(QObject::tr("Unknown helgrind error kind \"%1\"").arg(kind)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown helgrind error kind \"%1\"").arg(kind));
} }
PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind) PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
@@ -379,7 +389,8 @@ PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
if (it != errorKindsByName_ptrcheck.constEnd()) if (it != errorKindsByName_ptrcheck.constEnd())
return *it; return *it;
else else
throw ParserException(QObject::tr("Unknown ptrcheck error kind \"%1\"").arg(kind)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown ptrcheck error kind \"%1\"").arg(kind));
} }
int Parser::Private::parseErrorKind(const QString &kind) int Parser::Private::parseErrorKind(const QString &kind)
@@ -395,7 +406,8 @@ int Parser::Private::parseErrorKind(const QString &kind)
default: default:
break; break;
} }
throw ParserException(QObject::tr("Could not parse error kind, tool not yet set.")); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Could not parse error kind, tool not yet set."));
} }
static Status::State parseState(const QString &state) static Status::State parseState(const QString &state)
@@ -404,7 +416,8 @@ static Status::State parseState(const QString &state)
return Status::Running; return Status::Running;
if (state == QLatin1String("FINISHED")) if (state == QLatin1String("FINISHED"))
return Status::Finished; return Status::Finished;
throw ParserException(QObject::tr("Unknown state \"%1\"").arg(state)); throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown state \"%1\"").arg(state));
} }
void Parser::Private::reportInternalError(const QString &e) void Parser::Private::reportInternalError(const QString &e)
@@ -722,7 +735,8 @@ void Parser::Private::parse(QIODevice *device)
} catch (const ParserException &e) { } catch (const ParserException &e) {
reportInternalError(e.message()); reportInternalError(e.message());
} catch (...) { } catch (...) {
reportInternalError(QObject::tr("Unexpected exception caught during parsing.")); reportInternalError(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unexpected exception caught during parsing."));
} }
emit q->finished(); emit q->finished();
} }

View File

@@ -38,7 +38,7 @@
#include "../valgrind_global.h" #include "../valgrind_global.h"
#include <QObject> #include <QtCore/QObject>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QIODevice; class QIODevice;

View File

@@ -84,6 +84,11 @@ static QString stateToString(BreakpointState state)
return BreakHandler::tr("<invalid state>"); return BreakHandler::tr("<invalid state>");
} }
static QString msgBreakpointAtSpecialFunc(const char *func)
{
return BreakHandler::tr("Breakpoint at \"%1\"").arg(QString::fromAscii(func));
}
static QString typeToString(BreakpointType type) static QString typeToString(BreakpointType type)
{ {
switch (type) { switch (type) {
@@ -94,17 +99,17 @@ static QString typeToString(BreakpointType type)
case BreakpointByAddress: case BreakpointByAddress:
return BreakHandler::tr("Breakpoint by Address"); return BreakHandler::tr("Breakpoint by Address");
case BreakpointAtThrow: case BreakpointAtThrow:
return BreakHandler::tr("Breakpoint at \"throw\""); return msgBreakpointAtSpecialFunc("throw");
case BreakpointAtCatch: case BreakpointAtCatch:
return BreakHandler::tr("Breakpoint at \"catch\""); return msgBreakpointAtSpecialFunc("catch");
case BreakpointAtFork: case BreakpointAtFork:
return BreakHandler::tr("Breakpoint at \"fork\""); return msgBreakpointAtSpecialFunc("fork");
case BreakpointAtExec: case BreakpointAtExec:
return BreakHandler::tr("Breakpoint at \"exec\""); return msgBreakpointAtSpecialFunc("exec");
case BreakpointAtVFork: case BreakpointAtVFork:
return BreakHandler::tr("Breakpoint at \"vfork\""); return msgBreakpointAtSpecialFunc("vfork");
case BreakpointAtSysCall: case BreakpointAtSysCall:
return BreakHandler::tr("Breakpoint at \"syscall\""); return msgBreakpointAtSpecialFunc("syscall");
case BreakpointAtMain: case BreakpointAtMain:
return BreakHandler::tr("Breakpoint at Function \"main()\""); return BreakHandler::tr("Breakpoint at Function \"main()\"");
case Watchpoint: case Watchpoint:

View File

@@ -20,7 +20,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="title">
<string>Memory Analyzation Options</string> <string>Memory Analysis Options</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_4"> <layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">

View File

@@ -54,18 +54,19 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QtCore/QDir>
#include <QLabel> #include <QtCore/QDebug>
#include <QListView>
#include <QPainter> #include <QtGui/QLabel>
#include <QScrollBar> #include <QtGui/QListView>
#include <QSortFilterProxyModel> #include <QtGui/QPainter>
#include <QVBoxLayout> #include <QtGui/QScrollBar>
#include <QDebug> #include <QtGui/QSortFilterProxyModel>
#include <QAction> #include <QtGui/QVBoxLayout>
#include <QClipboard> #include <QtGui/QAction>
#include <QApplication> #include <QtGui/QClipboard>
#include <QMenu> #include <QtGui/QApplication>
#include <QtGui/QMenu>
using namespace Analyzer; using namespace Analyzer;
using namespace Analyzer::Internal; using namespace Analyzer::Internal;
@@ -151,7 +152,7 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo,
} }
if (!fn.isEmpty()) if (!fn.isEmpty())
return QObject::tr("%1 in %2").arg(Qt::escape(fn), path); return QCoreApplication::tr("Analyzer::Internal", "%1 in %2").arg(Qt::escape(fn), path);
else if (!path.isEmpty()) else if (!path.isEmpty())
return path; return path;
else else
@@ -182,8 +183,9 @@ QString errorLocation(const QModelIndex &index, const Error &error,
}; };
QTC_ASSERT(model, return QString()); QTC_ASSERT(model, return QString());
return QObject::tr("in %1").arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(), return QCoreApplication::tr("Analyzer::Internal", "in %1").
link, linkAttr)); arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(),
link, linkAttr));
} }
QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const

View File

@@ -149,7 +149,7 @@ QString AbstractMemcheckSettings::id() const
QString AbstractMemcheckSettings::displayName() const QString AbstractMemcheckSettings::displayName() const
{ {
return tr("Memory Analyzation"); return tr("Memory Analysis");
} }
QWidget* AbstractMemcheckSettings::createConfigWidget(QWidget *parent) QWidget* AbstractMemcheckSettings::createConfigWidget(QWidget *parent)