From 5c3596e935f045c610653ea299c9ae23ced99f9d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Mon, 7 Mar 2011 17:20:10 +0100 Subject: [PATCH] L10n: tr()-Fixes. --- .../valgrind/xmlprotocol/modelhelpers.cpp | 35 +++++++----- src/libs/valgrind/xmlprotocol/modelhelpers.h | 2 +- src/libs/valgrind/xmlprotocol/parser.cpp | 56 ++++++++++++------- src/libs/valgrind/xmlprotocol/parser.h | 2 +- src/plugins/debugger/breakhandler.cpp | 17 ++++-- src/plugins/memcheck/memcheckconfigwidget.ui | 2 +- src/plugins/memcheck/memcheckerrorview.cpp | 32 ++++++----- src/plugins/memcheck/memchecksettings.cpp | 2 +- 8 files changed, 88 insertions(+), 60 deletions(-) diff --git a/src/libs/valgrind/xmlprotocol/modelhelpers.cpp b/src/libs/valgrind/xmlprotocol/modelhelpers.cpp index 8e7ec3370b8..44415decfbe 100644 --- a/src/libs/valgrind/xmlprotocol/modelhelpers.cpp +++ b/src/libs/valgrind/xmlprotocol/modelhelpers.cpp @@ -34,13 +34,13 @@ **************************************************************************/ #include "modelhelpers.h" - -#include <QString> -#include <QDir> -#include <QPair> - #include "frame.h" +#include <QtCore/QString> +#include <QtCore/QDir> +#include <QtCore/QPair> +#include <QtCore/QCoreApplication> + namespace Valgrind { namespace XmlProtocol { @@ -57,26 +57,33 @@ QString toolTipForFrame(const Frame &frame) QList<StringPair> lines; if (!frame.functionName().isEmpty()) - lines << qMakePair(QObject::tr("Function:"), frame.functionName()); + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Function:"), + frame.functionName()); if (!location.isEmpty()) - lines << qMakePair(QObject::tr("Location:"), location); + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Location:"), + location); if (frame.instructionPointer()) - lines << qMakePair(QObject::tr("Instruction pointer:"), - QString("0x%1").arg(frame.instructionPointer(), 0, 16)); + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", + "Instruction pointer:"), + QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16)); if (!frame.object().isEmpty()) - lines << qMakePair(QObject::tr("Object:"), frame.object()); + lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object()); QString html = "<html>" "<head>" "<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n" "<body><dl>"; - foreach(const StringPair &pair, lines) - html += "<dt>" + pair.first + "</dt><dd>" + pair.second + "</dd>\n"; - + foreach (const StringPair &pair, lines) { + html += QLatin1String("<dt>"); + html += pair.first; + html += QLatin1String("</dt><dd>"); + html += pair.second; + html += QLatin1String("</dd>\n"); + } html += "</dl></body></html>"; return html; } } -} \ No newline at end of file +} diff --git a/src/libs/valgrind/xmlprotocol/modelhelpers.h b/src/libs/valgrind/xmlprotocol/modelhelpers.h index f22dba25439..910b928966c 100644 --- a/src/libs/valgrind/xmlprotocol/modelhelpers.h +++ b/src/libs/valgrind/xmlprotocol/modelhelpers.h @@ -36,7 +36,7 @@ #ifndef LIBVALGRIND_PROTOCOL_MODELHELPERS_H #define LIBVALGRIND_PROTOCOL_MODELHELPERS_H -#include <QtGlobal> +#include <QtCore/QtGlobal> QT_BEGIN_NAMESPACE class QString; diff --git a/src/libs/valgrind/xmlprotocol/parser.cpp b/src/libs/valgrind/xmlprotocol/parser.cpp index d7b994c4607..5a4c2501340 100644 --- a/src/libs/valgrind/xmlprotocol/parser.cpp +++ b/src/libs/valgrind/xmlprotocol/parser.cpp @@ -42,13 +42,13 @@ #include "suppression.h" #include <utils/qtcassert.h> -#include <QAbstractSocket> -#include <QCoreApplication> -#include <QHash> -#include <QIODevice> -#include <QPair> -#include <QThread> -#include <QXmlStreamReader> +#include <QtNetwork/QAbstractSocket> +#include <QtCore/QCoreApplication> +#include <QtCore/QHash> +#include <QtCore/QIODevice> +#include <QtCore/QPair> +#include <QtCore/QThread> +#include <QtCore/QXmlStreamReader> using namespace Valgrind; using namespace Valgrind::XmlProtocol; @@ -194,7 +194,8 @@ static quint64 parseHex(const QString &str, const QString &context) bool ok; const quint64 v = str.toULongLong(&ok, 16); 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; } @@ -203,7 +204,8 @@ static qint64 parseInt64(const QString &str, const QString &context) bool ok; const quint64 v = str.toLongLong(&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; } @@ -262,7 +264,8 @@ QString Parser::Private::blockingReadElementText() //affects at least Qt <= 4.7.1. Reported as QTBUG-14661. 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; @@ -279,10 +282,12 @@ QString Parser::Private::blockingReadElementText() case QXmlStreamReader::Comment: break; 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: //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; } } @@ -294,9 +299,11 @@ void Parser::Private::checkProtocolVersion(const QString &versionStr) bool ok; const int version = versionStr.toInt(&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) - 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) @@ -304,7 +311,8 @@ void Parser::Private::checkTool(const QString &reportedStr) const QHash<QString,Parser::Tool>::ConstIterator reported = toolsByName.find(reportedStr); 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(); } @@ -361,7 +369,8 @@ MemcheckErrorKind Parser::Private::parseMemcheckErrorKind(const QString &kind) if (it != errorKindsByName_memcheck.constEnd()) return *it; 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) @@ -370,7 +379,8 @@ HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind) if (it != errorKindsByName_helgrind.constEnd()) return *it; 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) @@ -379,7 +389,8 @@ PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind) if (it != errorKindsByName_ptrcheck.constEnd()) return *it; 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) @@ -395,7 +406,8 @@ int Parser::Private::parseErrorKind(const QString &kind) default: 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) @@ -404,7 +416,8 @@ static Status::State parseState(const QString &state) return Status::Running; if (state == QLatin1String("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) @@ -722,7 +735,8 @@ void Parser::Private::parse(QIODevice *device) } catch (const ParserException &e) { reportInternalError(e.message()); } catch (...) { - reportInternalError(QObject::tr("Unexpected exception caught during parsing.")); + reportInternalError(QCoreApplication::translate("Valgrind::XmlProtocol::Parser", + "Unexpected exception caught during parsing.")); } emit q->finished(); } diff --git a/src/libs/valgrind/xmlprotocol/parser.h b/src/libs/valgrind/xmlprotocol/parser.h index 108763f10c2..69cf6c3222c 100644 --- a/src/libs/valgrind/xmlprotocol/parser.h +++ b/src/libs/valgrind/xmlprotocol/parser.h @@ -38,7 +38,7 @@ #include "../valgrind_global.h" -#include <QObject> +#include <QtCore/QObject> QT_BEGIN_NAMESPACE class QIODevice; diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 913e8242a68..aabe0ebe18b 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -84,6 +84,11 @@ static QString stateToString(BreakpointState 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) { switch (type) { @@ -94,17 +99,17 @@ static QString typeToString(BreakpointType type) case BreakpointByAddress: return BreakHandler::tr("Breakpoint by Address"); case BreakpointAtThrow: - return BreakHandler::tr("Breakpoint at \"throw\""); + return msgBreakpointAtSpecialFunc("throw"); case BreakpointAtCatch: - return BreakHandler::tr("Breakpoint at \"catch\""); + return msgBreakpointAtSpecialFunc("catch"); case BreakpointAtFork: - return BreakHandler::tr("Breakpoint at \"fork\""); + return msgBreakpointAtSpecialFunc("fork"); case BreakpointAtExec: - return BreakHandler::tr("Breakpoint at \"exec\""); + return msgBreakpointAtSpecialFunc("exec"); case BreakpointAtVFork: - return BreakHandler::tr("Breakpoint at \"vfork\""); + return msgBreakpointAtSpecialFunc("vfork"); case BreakpointAtSysCall: - return BreakHandler::tr("Breakpoint at \"syscall\""); + return msgBreakpointAtSpecialFunc("syscall"); case BreakpointAtMain: return BreakHandler::tr("Breakpoint at Function \"main()\""); case Watchpoint: diff --git a/src/plugins/memcheck/memcheckconfigwidget.ui b/src/plugins/memcheck/memcheckconfigwidget.ui index f4c00471b46..fbc111cf354 100644 --- a/src/plugins/memcheck/memcheckconfigwidget.ui +++ b/src/plugins/memcheck/memcheckconfigwidget.ui @@ -20,7 +20,7 @@ </sizepolicy> </property> <property name="title"> - <string>Memory Analyzation Options</string> + <string>Memory Analysis Options</string> </property> <layout class="QFormLayout" name="formLayout_4"> <property name="fieldGrowthPolicy"> diff --git a/src/plugins/memcheck/memcheckerrorview.cpp b/src/plugins/memcheck/memcheckerrorview.cpp index 754a1159ba9..3565baebfcf 100644 --- a/src/plugins/memcheck/memcheckerrorview.cpp +++ b/src/plugins/memcheck/memcheckerrorview.cpp @@ -54,18 +54,19 @@ #include <utils/qtcassert.h> -#include <QDir> -#include <QLabel> -#include <QListView> -#include <QPainter> -#include <QScrollBar> -#include <QSortFilterProxyModel> -#include <QVBoxLayout> -#include <QDebug> -#include <QAction> -#include <QClipboard> -#include <QApplication> -#include <QMenu> +#include <QtCore/QDir> +#include <QtCore/QDebug> + +#include <QtGui/QLabel> +#include <QtGui/QListView> +#include <QtGui/QPainter> +#include <QtGui/QScrollBar> +#include <QtGui/QSortFilterProxyModel> +#include <QtGui/QVBoxLayout> +#include <QtGui/QAction> +#include <QtGui/QClipboard> +#include <QtGui/QApplication> +#include <QtGui/QMenu> using namespace Analyzer; using namespace Analyzer::Internal; @@ -151,7 +152,7 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo, } 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()) return path; else @@ -182,8 +183,9 @@ QString errorLocation(const QModelIndex &index, const Error &error, }; QTC_ASSERT(model, return QString()); - return QObject::tr("in %1").arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(), - link, linkAttr)); + return QCoreApplication::tr("Analyzer::Internal", "in %1"). + arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(), + link, linkAttr)); } QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const diff --git a/src/plugins/memcheck/memchecksettings.cpp b/src/plugins/memcheck/memchecksettings.cpp index 03d8b4ad31d..5d645558190 100644 --- a/src/plugins/memcheck/memchecksettings.cpp +++ b/src/plugins/memcheck/memchecksettings.cpp @@ -149,7 +149,7 @@ QString AbstractMemcheckSettings::id() const QString AbstractMemcheckSettings::displayName() const { - return tr("Memory Analyzation"); + return tr("Memory Analysis"); } QWidget* AbstractMemcheckSettings::createConfigWidget(QWidget *parent) -- GitLab