aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/valgrind
diff options
context:
space:
mode:
authorhjk <[email protected]>2022-07-08 16:08:27 +0200
committerhjk <[email protected]>2022-07-11 07:14:37 +0000
commit866f20e4f9497575094a927dc833e27b6b07e8e5 (patch)
tree24c32b443351fb87eea8e2274cd7b59f5ea5c929 /src/plugins/valgrind
parentf901478c6ae5710a030e529e015dbbf6d57b99f8 (diff)
Valgrind: Use Tr::tr
Change-Id: I77b27462d88079699e620ef459f951846c15c3e2 Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src/plugins/valgrind')
-rw-r--r--src/plugins/valgrind/callgrind/callgrindabstractmodel.h6
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcallmodel.cpp15
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcallmodel.h10
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcostitem.cpp17
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcostitem.h6
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcycledetection.cpp8
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcycledetection.h6
-rw-r--r--src/plugins/valgrind/callgrind/callgrinddatamodel.cpp33
-rw-r--r--src/plugins/valgrind/callgrind/callgrindfunction.cpp4
-rw-r--r--src/plugins/valgrind/callgrind/callgrindparsedata.cpp33
-rw-r--r--src/plugins/valgrind/callgrindcostdelegate.cpp2
-rw-r--r--src/plugins/valgrind/callgrindengine.cpp25
-rw-r--r--src/plugins/valgrind/callgrindtextmark.cpp7
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp83
-rw-r--r--src/plugins/valgrind/callgrindtool.h8
-rw-r--r--src/plugins/valgrind/callgrindvisualisation.cpp4
-rw-r--r--src/plugins/valgrind/memcheckerrorview.cpp7
-rw-r--r--src/plugins/valgrind/memcheckerrorview.h2
-rw-r--r--src/plugins/valgrind/memchecktool.cpp87
-rw-r--r--src/plugins/valgrind/memchecktool.h11
-rw-r--r--src/plugins/valgrind/suppressiondialog.cpp9
-rw-r--r--src/plugins/valgrind/suppressiondialog.h2
-rw-r--r--src/plugins/valgrind/valgrindconfigwidget.cpp14
-rw-r--r--src/plugins/valgrind/valgrindconfigwidget.h6
-rw-r--r--src/plugins/valgrind/valgrindengine.cpp24
-rw-r--r--src/plugins/valgrind/valgrindengine.h8
-rw-r--r--src/plugins/valgrind/valgrindmemcheckparsertest.h3
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp6
-rw-r--r--src/plugins/valgrind/valgrindplugin.h6
-rw-r--r--src/plugins/valgrind/valgrindrunner.cpp5
-rw-r--r--src/plugins/valgrind/valgrindsettings.cpp87
-rw-r--r--src/plugins/valgrind/valgrindsettings.h10
-rw-r--r--src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp11
-rw-r--r--src/plugins/valgrind/xmlprotocol/errorlistmodel.h2
-rw-r--r--src/plugins/valgrind/xmlprotocol/modelhelpers.cpp15
-rw-r--r--src/plugins/valgrind/xmlprotocol/parser.cpp45
-rw-r--r--src/plugins/valgrind/xmlprotocol/stackmodel.cpp15
-rw-r--r--src/plugins/valgrind/xmlprotocol/threadedparser.cpp3
38 files changed, 292 insertions, 353 deletions
diff --git a/src/plugins/valgrind/callgrind/callgrindabstractmodel.h b/src/plugins/valgrind/callgrind/callgrindabstractmodel.h
index 4730308c08c..105c8ed7c8c 100644
--- a/src/plugins/valgrind/callgrind/callgrindabstractmodel.h
+++ b/src/plugins/valgrind/callgrind/callgrindabstractmodel.h
@@ -27,8 +27,7 @@
#include <QAbstractItemView>
-namespace Valgrind {
-namespace Callgrind {
+namespace Valgrind::Callgrind {
class ParseData;
@@ -40,5 +39,4 @@ enum AbstractModelRoles
NextCustomRole
};
-} // Callgrind
-} // Valgrind
+} // Valgrind::Internal
diff --git a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp
index 28add4b4256..cb4ef188889 100644
--- a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp
@@ -28,13 +28,13 @@
#include "callgrindfunctioncall.h"
#include "callgrindfunction.h"
#include "callgrindparsedata.h"
+#include "valgrindtr.h"
#include <utils/qtcassert.h>
#include <QVector>
-namespace Valgrind {
-namespace Callgrind {
+namespace Valgrind::Callgrind {
class CallModel::Private
{
@@ -205,16 +205,15 @@ QVariant CallModel::headerData(int section, Qt::Orientation orientation, int rol
}
if (section == CalleeColumn)
- return tr("Callee");
+ return Tr::tr("Callee");
else if (section == CallerColumn)
- return tr("Caller");
+ return Tr::tr("Caller");
else if (section == CostColumn)
- return tr("Cost");
+ return Tr::tr("Cost");
else if (section == CallsColumn)
- return tr("Calls");
+ return Tr::tr("Calls");
return QVariant();
}
-} // namespace Callgrind
-} // namespace Valgrind
+} // Valgrind::Callgrind
diff --git a/src/plugins/valgrind/callgrind/callgrindcallmodel.h b/src/plugins/valgrind/callgrind/callgrindcallmodel.h
index b10e872844b..4cf8a5977df 100644
--- a/src/plugins/valgrind/callgrind/callgrindcallmodel.h
+++ b/src/plugins/valgrind/callgrind/callgrindcallmodel.h
@@ -25,12 +25,11 @@
#pragma once
-#include <QAbstractItemModel>
-
#include "callgrindabstractmodel.h"
-namespace Valgrind {
-namespace Callgrind {
+#include <QAbstractItemModel>
+
+namespace Valgrind::Callgrind {
class FunctionCall;
class Function;
@@ -83,5 +82,4 @@ private:
Private *d;
};
-} // namespace Callgrind
-} // namespace Valgrind
+} // Valgrind::Callgrind
diff --git a/src/plugins/valgrind/callgrind/callgrindcostitem.cpp b/src/plugins/valgrind/callgrind/callgrindcostitem.cpp
index 91d3eba74cd..2e82f171d1f 100644
--- a/src/plugins/valgrind/callgrind/callgrindcostitem.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcostitem.cpp
@@ -25,19 +25,17 @@
#include "callgrindcostitem.h"
-#include <QString>
-#include <QStringList>
-#include <QVector>
-
#include "callgrindparsedata.h"
#include "callgrindfunctioncall.h"
-namespace Valgrind {
-namespace Callgrind {
+#include <QString>
+#include <QStringList>
+#include <QVector>
-//BEGIN CostItem::Private
+namespace Valgrind::Callgrind {
-class CostItem::Private {
+class CostItem::Private
+{
public:
Private(ParseData *data);
~Private();
@@ -132,5 +130,4 @@ void CostItem::setDifferingFile(qint64 fileId)
d->m_differingFileId = fileId;
}
-} // namespace Callgrind
-} // namespace Valgrind
+} // Valgrind::Callgrind
diff --git a/src/plugins/valgrind/callgrind/callgrindcostitem.h b/src/plugins/valgrind/callgrind/callgrindcostitem.h
index 6f0f6792e81..4e95ca9dee2 100644
--- a/src/plugins/valgrind/callgrind/callgrindcostitem.h
+++ b/src/plugins/valgrind/callgrind/callgrindcostitem.h
@@ -27,8 +27,7 @@
#include <QVector>
-namespace Valgrind {
-namespace Callgrind {
+namespace Valgrind::Callgrind {
class FunctionCall;
class ParseData;
@@ -84,5 +83,4 @@ private:
Private *d;
};
-} // namespace Callgrind
-} // namespace Valgrind
+} // Valgrind::Callgrind
diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp
index 79443aa5b65..e513fe34d16 100644
--- a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp
@@ -34,9 +34,7 @@
#include <QDebug>
-namespace Valgrind {
-namespace Callgrind {
-namespace Internal {
+namespace Valgrind::Callgrind::Internal {
CycleDetection::CycleDetection(ParseData *data)
: m_data(data)
@@ -110,6 +108,4 @@ void CycleDetection::tarjanForChildNode(Node *node, Node *childNode)
}
}
-} // namespace Internal
-} // namespace Callgrind
-} // namespace Valgrind
+} // namespace Valgrind::Callgrind::Internal
diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.h b/src/plugins/valgrind/callgrind/callgrindcycledetection.h
index eddc6fee0a3..b858916a98d 100644
--- a/src/plugins/valgrind/callgrind/callgrindcycledetection.h
+++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.h
@@ -28,8 +28,7 @@
#include <QHash>
#include <QStack>
-namespace Valgrind {
-namespace Callgrind {
+namespace Valgrind::Callgrind {
class Function;
class ParseData;
@@ -72,5 +71,4 @@ private:
} // namespace Internal
-} // namespace Callgrind
-} // namespace Valgrind
+} // namespace Valgrind::Callgrind
diff --git a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp
index b64ee8764d0..4a4acb14e79 100644
--- a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp
+++ b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp
@@ -28,6 +28,7 @@
#include "callgrindparsedata.h"
#include "callgrindfunction.h"
#include "callgrindcostitem.h"
+#include "valgrindtr.h"
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -230,8 +231,8 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
QString entry = "<dt>%1</dt><dd>%2</dd>\n";
// body, function info first
- ret += entry.arg(tr("Function:")).arg(func->name().toHtmlEscaped());
- ret += entry.arg(tr("File:")).arg(func->file());
+ ret += entry.arg(Tr::tr("Function:")).arg(func->name().toHtmlEscaped());
+ ret += entry.arg(Tr::tr("File:")).arg(func->file());
if (!func->costItems().isEmpty()) {
const CostItem *firstItem = func->costItems().constFirst();
for (int i = 0; i < d->m_data->positions().size(); ++i) {
@@ -239,17 +240,17 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
.arg(firstItem->position(i));
}
}
- ret += entry.arg(tr("Object:")).arg(func->object());
- ret += entry.arg(tr("Called:")).arg(tr("%n time(s)", nullptr, func->called()));
+ ret += entry.arg(Tr::tr("Object:")).arg(func->object());
+ ret += entry.arg(Tr::tr("Called:")).arg(Tr::tr("%n time(s)", nullptr, func->called()));
ret += "</dl><p/>";
// self/inclusive costs
entry = "<td class='group'>%1</td><td>%2</td>";
ret += "<table>";
ret += "<thead><tr class='head'>";
- ret += "<td>" + tr("Events") + "</td>";
- ret += entry.arg(tr("Self costs")).arg(tr("(%)"));
- ret += entry.arg(tr("Incl. costs")).arg(tr("(%)"));
+ ret += "<td>" + Tr::tr("Events") + "</td>";
+ ret += entry.arg(Tr::tr("Self costs")).arg(Tr::tr("(%)"));
+ ret += entry.arg(Tr::tr("Incl. costs")).arg(Tr::tr("(%)"));
ret += "</tr></thead>";
ret += "<tbody>";
for (int i = 0; i < d->m_data->events().size(); ++i) {
@@ -264,8 +265,8 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
ret += "<td class='head'><nobr>" +
noWrap(ParseData::prettyStringForEvent(d->m_data->events().at(i)))
+ "</nobr></td>";
- ret += entry.arg(selfCost).arg(tr("(%1%)").arg(relSelfCost));
- ret += entry.arg(inclCost).arg(tr("(%1%)").arg(relInclCost));
+ ret += entry.arg(selfCost).arg(Tr::tr("(%1%)").arg(relSelfCost));
+ ret += entry.arg(inclCost).arg(Tr::tr("(%1%)").arg(relInclCost));
ret += "</tr>";
}
ret += "</tbody></table>";
@@ -317,22 +318,22 @@ QVariant DataModel::headerData(int section, Qt::Orientation orientation, int rol
const QString prettyCostStr = ParseData::prettyStringForEvent(d->m_data->events().at(d->m_event));
if (section == SelfCostColumn)
- return tr("%1 cost spent in a given function excluding costs from called functions.").arg(prettyCostStr);
+ return Tr::tr("%1 cost spent in a given function excluding costs from called functions.").arg(prettyCostStr);
if (section == InclusiveCostColumn)
- return tr("%1 cost spent in a given function including costs from called functions.").arg(prettyCostStr);
+ return Tr::tr("%1 cost spent in a given function including costs from called functions.").arg(prettyCostStr);
return QVariant();
}
if (section == NameColumn)
- return tr("Function");
+ return Tr::tr("Function");
if (section == LocationColumn)
- return tr("Location");
+ return Tr::tr("Location");
if (section == CalledColumn)
- return tr("Called");
+ return Tr::tr("Called");
if (section == SelfCostColumn)
- return tr("Self Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString());
+ return Tr::tr("Self Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString());
if (section == InclusiveCostColumn)
- return tr("Incl. Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString());
+ return Tr::tr("Incl. Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString());
return QVariant();
}
diff --git a/src/plugins/valgrind/callgrind/callgrindfunction.cpp b/src/plugins/valgrind/callgrind/callgrindfunction.cpp
index 9a7f4fe81bc..e8bf79f26db 100644
--- a/src/plugins/valgrind/callgrind/callgrindfunction.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindfunction.cpp
@@ -203,9 +203,9 @@ QString Function::location() const
if (f.isEmpty() || f == "???")
return o;
if (pos.isEmpty())
- return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1 in %2").arg(f, o);
+ return QCoreApplication::translate("Valgrind", "%1 in %2").arg(f, o);
- return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1:%2 in %3").arg(f, pos, o);
+ return QCoreApplication::translate("Valgrind", "%1:%2 in %3").arg(f, pos, o);
}
int Function::lineNumber() const
diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp
index ba1e4258023..d2a72f2741c 100644
--- a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp
@@ -28,6 +28,7 @@
#include "callgrindfunction.h"
#include "callgrindcycledetection.h"
#include "callgrindfunctioncycle.h"
+#include "valgrindtr.h"
#include <utils/qtcassert.h>
@@ -39,10 +40,8 @@
namespace Valgrind {
namespace Callgrind {
-//BEGIN ParseData::Private
-
-class ParseData::Private {
- Q_DECLARE_TR_FUNCTIONS(Valgrind::Callgrind::ParseData)
+class ParseData::Private
+{
public:
Private(ParseData *q, const QString &fileName)
: m_fileName(fileName)
@@ -177,27 +176,27 @@ QString ParseData::prettyStringForEvent(const QString &event)
QString type;
if (event.contains('L'))
- type = ParseData::Private::tr("Last-level"); // first, "L" overwrites the others
+ type = Tr::tr("Last-level"); // first, "L" overwrites the others
else if (event.at(0) == 'I')
- type = ParseData::Private::tr("Instruction");
+ type = Tr::tr("Instruction");
else if (event.at(0) == 'D')
- type = ParseData::Private::tr("Cache");
+ type = Tr::tr("Cache");
else if (event.left(2) == "Bc")
- type = ParseData::Private::tr("Conditional branches");
+ type = Tr::tr("Conditional branches");
else if (event.left(2) == "Bi")
- type = ParseData::Private::tr("Indirect branches");
+ type = Tr::tr("Indirect branches");
QStringList prettyString;
prettyString << type;
if (event.at(1).isNumber())
- prettyString << ParseData::Private::tr("level %1").arg(event.at(1));
- prettyString << (isRead ? ParseData::Private::tr("read") : ParseData::Private::tr("write"));
+ prettyString << Tr::tr("level %1").arg(event.at(1));
+ prettyString << (isRead ? Tr::tr("read") : Tr::tr("write"));
if (event.at(0) == 'B')
- prettyString << (isMiss ? ParseData::Private::tr("mispredicted") : ParseData::Private::tr("executed"));
+ prettyString << (isMiss ? Tr::tr("mispredicted") : Tr::tr("executed"));
else
- prettyString << (isMiss ? ParseData::Private::tr("miss") : ParseData::Private::tr("access"));
+ prettyString << (isMiss ? Tr::tr("miss") : Tr::tr("access"));
// add original abbreviation
prettyString << '(' + event + ')';
@@ -218,10 +217,10 @@ void ParseData::setEvents(const QStringList &events)
QString ParseData::prettyStringForPosition(const QString &position)
{
if (position == "line")
- return ParseData::Private::tr("Line:"); // as in: "line number"
- else if (position == "instr")
- return ParseData::Private::tr("Instruction"); // as in: "instruction address"
- return ParseData::Private::tr("Position:"); // never reached, in theory
+ return Tr::tr("Line:"); // as in: "line number"
+ if (position == "instr")
+ return Tr::tr("Instruction"); // as in: "instruction address"
+ return Tr::tr("Position:"); // never reached, in theory
}
QStringList ParseData::positions() const
diff --git a/src/plugins/valgrind/callgrindcostdelegate.cpp b/src/plugins/valgrind/callgrindcostdelegate.cpp
index 921c9e3164b..c403f8ebb3e 100644
--- a/src/plugins/valgrind/callgrindcostdelegate.cpp
+++ b/src/plugins/valgrind/callgrindcostdelegate.cpp
@@ -25,11 +25,9 @@
#include "callgrindcostdelegate.h"
-#include "callgrindcostview.h"
#include "callgrindhelper.h"
#include "callgrind/callgrindabstractmodel.h"
-#include "callgrind/callgrindparsedata.h"
#include <utils/qtcassert.h>
diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp
index 8aafa076ae7..4874ec05889 100644
--- a/src/plugins/valgrind/callgrindengine.cpp
+++ b/src/plugins/valgrind/callgrindengine.cpp
@@ -29,6 +29,7 @@
#include <valgrind/callgrind/callgrindparser.h>
#include <valgrind/valgrindrunner.h>
+#include <valgrind/valgrindtr.h>
#include <debugger/analyzer/analyzermanager.h>
@@ -113,13 +114,13 @@ QStringList CallgrindToolRunner::toolArguments() const
QString CallgrindToolRunner::progressTitle() const
{
- return tr("Profiling");
+ return Tr::tr("Profiling");
}
void CallgrindToolRunner::start()
{
const FilePath executable = runControl()->commandLine().executable();
- appendMessage(tr("Profiling %1").arg(executable.toUserOutput()), NormalMessageFormat);
+ appendMessage(Tr::tr("Profiling %1").arg(executable.toUserOutput()), NormalMessageFormat);
return ValgrindToolRunner::start();
}
@@ -188,7 +189,7 @@ static QString toOptionString(CallgrindToolRunner::Option option)
void CallgrindToolRunner::run(Option option)
{
if (m_controllerProcess) {
- showStatusMessage(tr("Previous command has not yet finished."));
+ showStatusMessage(Tr::tr("Previous command has not yet finished."));
return;
}
@@ -199,16 +200,16 @@ void CallgrindToolRunner::run(Option option)
switch (option) {
case CallgrindToolRunner::Dump:
- showStatusMessage(tr("Dumping profile data..."));
+ showStatusMessage(Tr::tr("Dumping profile data..."));
break;
case CallgrindToolRunner::ResetEventCounters:
- showStatusMessage(tr("Resetting event counters..."));
+ showStatusMessage(Tr::tr("Resetting event counters..."));
break;
case CallgrindToolRunner::Pause:
- showStatusMessage(tr("Pausing instrumentation..."));
+ showStatusMessage(Tr::tr("Pausing instrumentation..."));
break;
case CallgrindToolRunner::UnPause:
- showStatusMessage(tr("Unpausing instrumentation..."));
+ showStatusMessage(Tr::tr("Unpausing instrumentation..."));
break;
default:
break;
@@ -236,7 +237,7 @@ void CallgrindToolRunner::controllerProcessDone()
m_controllerProcess.release()->deleteLater();
if (result != ProcessResult::FinishedWithSuccess) {
- showStatusMessage(tr("An error occurred while trying to run %1: %2").arg(CALLGRIND_CONTROL_BINARY).arg(error));
+ showStatusMessage(Tr::tr("An error occurred while trying to run %1: %2").arg(CALLGRIND_CONTROL_BINARY).arg(error));
qWarning() << "Controller exited abnormally:" << error;
return;
}
@@ -251,12 +252,12 @@ void CallgrindToolRunner::controllerProcessDone()
m_paused = true;
break;
case Dump:
- showStatusMessage(tr("Callgrind dumped profiling info"));
+ showStatusMessage(Tr::tr("Callgrind dumped profiling info"));
triggerParse();
break;
case UnPause:
m_paused = false;
- showStatusMessage(tr("Callgrind unpaused."));
+ showStatusMessage(Tr::tr("Callgrind unpaused."));
break;
default:
break;
@@ -271,7 +272,7 @@ void CallgrindToolRunner::triggerParse()
{
TemporaryFile dataFile("callgrind.out");
if (!dataFile.open()) {
- showStatusMessage(tr("Failed opening temp file..."));
+ showStatusMessage(Tr::tr("Failed opening temp file..."));
return;
}
m_hostOutputFile = FilePath::fromString(dataFile.fileName());
@@ -280,7 +281,7 @@ void CallgrindToolRunner::triggerParse()
const auto afterCopy = [this](bool res) {
QTC_CHECK(res);
QTC_ASSERT(m_hostOutputFile.exists(), return);
- showStatusMessage(tr("Parsing Profile Data..."));
+ showStatusMessage(Tr::tr("Parsing Profile Data..."));
m_parser.parse(m_hostOutputFile);
};
m_valgrindOutputFile.asyncCopyFile(afterCopy, m_hostOutputFile);
diff --git a/src/plugins/valgrind/callgrindtextmark.cpp b/src/plugins/valgrind/callgrindtextmark.cpp
index 32418ce92cc..a35ace1e1bd 100644
--- a/src/plugins/valgrind/callgrindtextmark.cpp
+++ b/src/plugins/valgrind/callgrindtextmark.cpp
@@ -29,14 +29,15 @@
#include "callgrind/callgrinddatamodel.h"
#include "callgrind/callgrindfunction.h"
+#include "valgrindtr.h"
+
+#include <utils/qtcassert.h>
#include <QDebug>
#include <QLabel>
#include <QLayout>
#include <QPainter>
-#include <utils/qtcassert.h>
-
using namespace Utils;
using namespace Valgrind::Internal;
using namespace Valgrind::Callgrind;
@@ -51,7 +52,7 @@ CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
setPriority(TextEditor::TextMark::HighPriority);
const Function *f = function();
const QString inclusiveCost = QLocale::system().toString(f->inclusiveCost(0));
- setLineAnnotation(tr("%1 (Called: %2; Incl. Cost: %3)")
+ setLineAnnotation(Tr::tr("%1 (Called: %2; Incl. Cost: %3)")
.arg(CallgrindHelper::toPercent(costs() * 100.0f))
.arg(f->called())
.arg(inclusiveCost));
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index 4819d356f06..3f2afc1f02a 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -30,6 +30,7 @@
#include "callgrindengine.h"
#include "callgrindtextmark.h"
#include "callgrindvisualisation.h"
+#include "valgrindtr.h"
#include <valgrind/callgrind/callgrindcallmodel.h>
#include <valgrind/callgrind/callgrindcostitem.h>
@@ -215,7 +216,7 @@ public:
QString m_toggleCollectFunction;
bool m_toolBusy = false;
- Perspective m_perspective{"Callgrind.Perspective", CallgrindTool::tr("Callgrind")};
+ Perspective m_perspective{"Callgrind.Perspective", Tr::tr("Callgrind")};
RunWorkerFactory callgrindRunWorkerFactory{
RunWorkerFactory::make<CallgrindToolRunner>(),
@@ -248,11 +249,11 @@ CallgrindToolPrivate::CallgrindToolPrivate()
m_stopAction = Debugger::createStopAction();
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
- QString toolTip = CallgrindTool::tr("Valgrind Function Profiler uses the "
+ QString toolTip = Tr::tr("Valgrind Function Profiler uses the "
"Callgrind tool to record function calls when a program runs.");
if (!Utils::HostOsInfo::isWindowsHost()) {
- auto action = new QAction(CallgrindTool::tr("Valgrind Function Profiler"), this);
+ auto action = new QAction(Tr::tr("Valgrind Function Profiler"), this);
action->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(action, CallgrindLocalActionId),
Debugger::Constants::G_ANALYZER_TOOLS);
@@ -268,7 +269,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
});
}
- auto action = new QAction(CallgrindTool::tr("Valgrind Function Profiler (External Application)"), this);
+ auto action = new QAction(Tr::tr("Valgrind Function Profiler (External Application)"), this);
action->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(action, CallgrindRemoteActionId),
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
@@ -296,7 +297,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
Context analyzerContext = Context(Debugger::Constants::C_DEBUGMODE);
editorContextMenu->addSeparator(analyzerContext);
- auto action = new QAction(CallgrindTool::tr("Profile Costs of This Function and Its Callees"), this);
+ auto action = new QAction(Tr::tr("Profile Costs of This Function and Its Callees"), this);
action->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL.icon());
connect(action, &QAction::triggered, this,
&CallgrindToolPrivate::handleShowCostsOfFunction);
@@ -315,14 +316,14 @@ CallgrindToolPrivate::CallgrindToolPrivate()
m_visualization = new Visualization;
m_visualization->setFrameStyle(QFrame::NoFrame);
m_visualization->setObjectName("Valgrind.CallgrindTool.Visualisation");
- m_visualization->setWindowTitle(CallgrindTool::tr("Visualization"));
+ m_visualization->setWindowTitle(Tr::tr("Visualization"));
m_visualization->setModel(&m_dataModel);
connect(m_visualization, &Visualization::functionActivated,
this, &CallgrindToolPrivate::visualisationFunctionSelected);
m_callersView = new CostView;
m_callersView->setObjectName("Valgrind.CallgrindTool.CallersView");
- m_callersView->setWindowTitle(CallgrindTool::tr("Callers"));
+ m_callersView->setWindowTitle(Tr::tr("Callers"));
m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView");
m_callersView->sortByColumn(CallModel::CostColumn, Qt::DescendingOrder);
m_callersView->setFrameStyle(QFrame::NoFrame);
@@ -335,7 +336,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
m_calleesView = new CostView;
m_calleesView->setObjectName("Valgrind.CallgrindTool.CalleesView");
- m_calleesView->setWindowTitle(CallgrindTool::tr("Callees"));
+ m_calleesView->setWindowTitle(Tr::tr("Callees"));
m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView");
m_calleesView->sortByColumn(CallModel::CostColumn, Qt::DescendingOrder);
m_calleesView->setFrameStyle(QFrame::NoFrame);
@@ -348,7 +349,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
m_flatView = new CostView;
m_flatView->setObjectName("Valgrind.CallgrindTool.FlatView");
- m_flatView->setWindowTitle(CallgrindTool::tr("Functions"));
+ m_flatView->setWindowTitle(Tr::tr("Functions"));
m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView");
m_flatView->sortByColumn(DataModel::SelfCostColumn, Qt::DescendingOrder);
m_flatView->setFrameStyle(QFrame::NoFrame);
@@ -368,7 +369,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
// load external log file
action = m_loadExternalLogFile = new QAction(this);
action->setIcon(Utils::Icons::OPENFILE_TOOLBAR.icon());
- action->setToolTip(CallgrindTool::tr("Load External Log File"));
+ action->setToolTip(Tr::tr("Load External Log File"));
connect(action, &QAction::triggered, this, &CallgrindToolPrivate::loadExternalLogFile);
action = m_startKCachegrind = new QAction(this);
@@ -376,7 +377,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
const Utils::Icon kCachegrindIcon({{":/valgrind/images/kcachegrind.png",
Theme::IconsBaseColor}});
action->setIcon(kCachegrindIcon.icon());
- action->setToolTip(CallgrindTool::tr("Open results in KCachegrind."));
+ action->setToolTip(Tr::tr("Open results in KCachegrind."));
connect(action, &QAction::triggered, this, [this, settings] {
QtcProcess::startDetached({FilePath::fromString(settings->kcachegrindExecutable.value()), { m_lastFileName }});
});
@@ -385,30 +386,30 @@ CallgrindToolPrivate::CallgrindToolPrivate()
m_dumpAction = action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::Icons::REDO.icon());
- //action->setText(CallgrindTool::tr("Dump"));
- action->setToolTip(CallgrindTool::tr("Request the dumping of profile information. This will update the Callgrind visualization."));
+ //action->setText(Tr::tr("Dump"));
+ action->setToolTip(Tr::tr("Request the dumping of profile information. This will update the Callgrind visualization."));
connect(action, &QAction::triggered, this, &CallgrindToolPrivate::slotRequestDump);
// reset action
m_resetAction = action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::Icons::RELOAD_TOOLBAR.icon());
- //action->setText(CallgrindTool::tr("Reset"));
- action->setToolTip(CallgrindTool::tr("Reset all event counters."));
+ //action->setText(Tr::tr("Reset"));
+ action->setToolTip(Tr::tr("Reset all event counters."));
connect(action, &QAction::triggered, this, &CallgrindToolPrivate::resetRequested);
// pause action
m_pauseAction = action = new QAction(this);
action->setCheckable(true);
action->setIcon(Utils::Icons::INTERRUPT_SMALL_TOOLBAR.icon());
- //action->setText(CallgrindTool::tr("Ignore"));
- action->setToolTip(CallgrindTool::tr("Pause event logging. No events are counted which will speed up program execution during profiling."));
+ //action->setText(Tr::tr("Ignore"));
+ action->setToolTip(Tr::tr("Pause event logging. No events are counted which will speed up program execution during profiling."));
connect(action, &QAction::toggled, this, &CallgrindToolPrivate::pauseToggled);
// discard data action
m_discardAction = action = new QAction(this);
action->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
- action->setToolTip(CallgrindTool::tr("Discard Data"));
+ action->setToolTip(Tr::tr("Discard Data"));
connect(action, &QAction::triggered, this, [this](bool) {
clearTextMarks();
doClear(true);
@@ -419,19 +420,19 @@ CallgrindToolPrivate::CallgrindToolPrivate()
m_goBack = action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::Icons::PREV_TOOLBAR.icon());
- action->setToolTip(CallgrindTool::tr("Go back one step in history. This will select the previously selected item."));
+ action->setToolTip(Tr::tr("Go back one step in history. This will select the previously selected item."));
connect(action, &QAction::triggered, &m_stackBrowser, &StackBrowser::goBack);
// go forward
m_goNext = action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::Icons::NEXT_TOOLBAR.icon());
- action->setToolTip(CallgrindTool::tr("Go forward one step in history."));
+ action->setToolTip(Tr::tr("Go forward one step in history."));
connect(action, &QAction::triggered, &m_stackBrowser, &StackBrowser::goNext);
// event selection
m_eventCombo = new QComboBox;
- m_eventCombo->setToolTip(CallgrindTool::tr("Selects which events from the profiling data are shown and visualized."));
+ m_eventCombo->setToolTip(Tr::tr("Selects which events from the profiling data are shown and visualized."));
connect(m_eventCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &CallgrindToolPrivate::setCostEvent);
updateEventCombo();
@@ -455,23 +456,23 @@ CallgrindToolPrivate::CallgrindToolPrivate()
auto group = new QActionGroup(this);
// Show costs as absolute numbers
- m_costAbsolute = new QAction(CallgrindTool::tr("Absolute Costs"), this);
- m_costAbsolute->setToolTip(CallgrindTool::tr("Show costs as absolute numbers."));
+ m_costAbsolute = new QAction(Tr::tr("Absolute Costs"), this);
+ m_costAbsolute->setToolTip(Tr::tr("Show costs as absolute numbers."));
m_costAbsolute->setCheckable(true);
m_costAbsolute->setChecked(true);
connect(m_costAbsolute, &QAction::toggled, this, &CallgrindToolPrivate::updateCostFormat);
group->addAction(m_costAbsolute);
// Show costs in percentages
- m_costRelative = new QAction(CallgrindTool::tr("Relative Costs"), this);
- m_costRelative->setToolTip(CallgrindTool::tr("Show costs relative to total inclusive cost."));
+ m_costRelative = new QAction(Tr::tr("Relative Costs"), this);
+ m_costRelative->setToolTip(Tr::tr("Show costs relative to total inclusive cost."));
m_costRelative->setCheckable(true);
connect(m_costRelative, &QAction::toggled, this, &CallgrindToolPrivate::updateCostFormat);
group->addAction(m_costRelative);
// Show costs relative to parent
- m_costRelativeToParent = new QAction(CallgrindTool::tr("Relative Costs to Parent"), this);
- m_costRelativeToParent->setToolTip(CallgrindTool::tr("Show costs relative to parent function's inclusive cost."));
+ m_costRelativeToParent = new QAction(Tr::tr("Relative Costs to Parent"), this);
+ m_costRelativeToParent->setToolTip(Tr::tr("Show costs relative to parent function's inclusive cost."));
m_costRelativeToParent->setCheckable(true);
connect(m_costRelativeToParent, &QAction::toggled, this, &CallgrindToolPrivate::updateCostFormat);
group->addAction(m_costRelativeToParent);
@@ -480,7 +481,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
button->addActions(group->actions());
button->setPopupMode(QToolButton::InstantPopup);
button->setText("$");
- button->setToolTip(CallgrindTool::tr("Cost Format"));
+ button->setToolTip(Tr::tr("Cost Format"));
m_perspective.addToolBarWidget(button);
}
@@ -490,7 +491,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
// Filter
m_searchFilter = new QLineEdit;
- m_searchFilter->setPlaceholderText(CallgrindTool::tr("Filter..."));
+ m_searchFilter->setPlaceholderText(Tr::tr("Filter..."));
connect(m_searchFilter, &QLineEdit::textChanged,
&m_updateTimer, QOverload<>::of(&QTimer::start));
@@ -784,10 +785,10 @@ void CallgrindToolPrivate::updateRunActions()
if (m_toolBusy) {
m_startAction->setEnabled(false);
m_startKCachegrind->setEnabled(false);
- m_startAction->setToolTip(CallgrindTool::tr("A Valgrind Callgrind analysis is still in progress."));
+ m_startAction->setToolTip(Tr::tr("A Valgrind Callgrind analysis is still in progress."));
m_stopAction->setEnabled(true);
} else {
- QString whyNot = CallgrindTool::tr("Start a Valgrind Callgrind analysis.");
+ QString whyNot = Tr::tr("Start a Valgrind Callgrind analysis.");
bool canRun = ProjectExplorerPlugin::canRunStartupProject(CALLGRIND_RUN_MODE, &whyNot);
m_startAction->setToolTip(whyNot);
m_startAction->setEnabled(canRun);
@@ -814,7 +815,7 @@ void CallgrindToolPrivate::engineFinished()
if (data)
showParserResults(data);
else
- Debugger::showPermanentStatusMessage(CallgrindTool::tr("Profiling aborted."));
+ Debugger::showPermanentStatusMessage(Tr::tr("Profiling aborted."));
setBusyCursor(false);
}
@@ -825,14 +826,14 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data)
if (data) {
// be careful, the list of events might be empty
if (data->events().isEmpty()) {
- msg = CallgrindTool::tr("Parsing finished, no data.");
+ msg = Tr::tr("Parsing finished, no data.");
} else {
const QString costStr = QString::fromLatin1("%1 %2")
.arg(QString::number(data->totalCost(0)), data->events().constFirst());
- msg = CallgrindTool::tr("Parsing finished, total cost of %1 reported.").arg(costStr);
+ msg = Tr::tr("Parsing finished, total cost of %1 reported.").arg(costStr);
}
} else {
- msg = CallgrindTool::tr("Parsing failed.");
+ msg = Tr::tr("Parsing failed.");
}
Debugger::showPermanentStatusMessage(msg);
}
@@ -851,7 +852,7 @@ void CallgrindToolPrivate::requestContextMenu(TextEditorWidget *widget, int line
for (CallgrindTextMark *textMark : qAsConst(m_textMarks)) {
if (textMark->fileName() == widget->textDocument()->filePath() && textMark->lineNumber() == line) {
const Function *func = textMark->function();
- QAction *action = menu->addAction(CallgrindTool::tr("Select This Function in the Analyzer Output"));
+ QAction *action = menu->addAction(Tr::tr("Select This Function in the Analyzer Output"));
connect(action, &QAction::triggered, this, [this, func] { selectFunction(func); });
break;
}
@@ -877,7 +878,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
void CallgrindToolPrivate::slotRequestDump()
{
//setBusy(true);
- m_visualization->setText(CallgrindTool::tr("Populating..."));
+ m_visualization->setText(Tr::tr("Populating..."));
emit dumpRequested();
}
@@ -885,22 +886,22 @@ void CallgrindToolPrivate::loadExternalLogFile()
{
const FilePath filePath = FileUtils::getOpenFilePath(
nullptr,
- CallgrindTool::tr("Open Callgrind Log File"),
+ Tr::tr("Open Callgrind Log File"),
{},
- CallgrindTool::tr("Callgrind Output (callgrind.out*);;All Files (*)"));
+ Tr::tr("Callgrind Output (callgrind.out*);;All Files (*)"));
if (filePath.isEmpty())
return;
QFile logFile(filePath.toString());
if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QString msg = CallgrindTool::tr("Callgrind: Failed to open file for reading: %1")
+ QString msg = Tr::tr("Callgrind: Failed to open file for reading: %1")
.arg(filePath.toUserOutput());
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return;
}
- Debugger::showPermanentStatusMessage(CallgrindTool::tr("Parsing Profile Data..."));
+ Debugger::showPermanentStatusMessage(Tr::tr("Parsing Profile Data..."));
QCoreApplication::processEvents();
Parser parser;
diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h
index 6b614248c66..91d69a50148 100644
--- a/src/plugins/valgrind/callgrindtool.h
+++ b/src/plugins/valgrind/callgrindtool.h
@@ -25,20 +25,16 @@
#pragma once
-#include <QCoreApplication>
-
namespace Valgrind {
namespace Internal {
class ValgrindGlobalSettings;
-class CallgrindTool final : public QObject
+class CallgrindTool final
{
- Q_OBJECT
-
public:
CallgrindTool();
- ~CallgrindTool() final;
+ ~CallgrindTool();
};
} // namespace Internal
diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp
index e159b153b3b..27f27a72db4 100644
--- a/src/plugins/valgrind/callgrindvisualisation.cpp
+++ b/src/plugins/valgrind/callgrindvisualisation.cpp
@@ -26,11 +26,13 @@
#include "callgrindvisualisation.h"
#include "callgrindhelper.h"
+#include "valgrindtr.h"
#include <valgrind/callgrind/callgrindabstractmodel.h>
#include <valgrind/callgrind/callgrinddatamodel.h>
#include <valgrind/callgrind/callgrindfunction.h>
#include <valgrind/callgrind/callgrindproxymodel.h>
+
#include <utils/qtcassert.h>
#include <QAbstractItemModel>
@@ -387,7 +389,7 @@ void Visualization::populateScene()
QString ratioPercentString = QString::number(ratioPercent);
ratioPercentString.append(QLocale::system().percent());
const int hiddenFunctions = d->m_model->sourceModel()->rowCount() - d->m_model->rowCount();
- text = tr("All functions with an inclusive cost ratio higher than %1 (%2 are hidden)")
+ text = Tr::tr("All functions with an inclusive cost ratio higher than %1 (%2 are hidden)")
.arg(ratioPercentString, hiddenFunctions);
}
diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp
index 951136f8c6e..f7c7b81052d 100644
--- a/src/plugins/valgrind/memcheckerrorview.cpp
+++ b/src/plugins/valgrind/memcheckerrorview.cpp
@@ -28,18 +28,17 @@
#include "suppressiondialog.h"
#include "valgrindsettings.h"
+#include "valgrindtr.h"
#include "xmlprotocol/error.h"
#include "xmlprotocol/errorlistmodel.h"
-#include "xmlprotocol/frame.h"
-#include "xmlprotocol/stack.h"
-#include "xmlprotocol/modelhelpers.h"
#include "xmlprotocol/suppression.h"
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
+
#include <utils/qtcassert.h>
#include <utils/icon.h>
#include <utils/theme/theme.h>
@@ -56,7 +55,7 @@ MemcheckErrorView::MemcheckErrorView(QWidget *parent)
: Debugger::DetailedErrorView(parent)
{
m_suppressAction = new QAction(this);
- m_suppressAction->setText(tr("Suppress Error"));
+ m_suppressAction->setText(Tr::tr("Suppress Error"));
const QIcon icon = Icon({
{":/utils/images/eye_open.png", Theme::TextColorNormal},
{":/valgrind/images/suppressoverlay.png", Theme::IconsErrorColor}},
diff --git a/src/plugins/valgrind/memcheckerrorview.h b/src/plugins/valgrind/memcheckerrorview.h
index 888140fc45e..972da686b63 100644
--- a/src/plugins/valgrind/memcheckerrorview.h
+++ b/src/plugins/valgrind/memcheckerrorview.h
@@ -39,8 +39,6 @@ class ValgrindBaseSettings;
class MemcheckErrorView : public Debugger::DetailedErrorView
{
- Q_OBJECT
-
public:
MemcheckErrorView(QWidget *parent = nullptr);
~MemcheckErrorView() override;
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index 1cd50e2a19b..89922c8cd7e 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -27,10 +27,11 @@
#include "memchecktool.h"
#include "memcheckerrorview.h"
-#include "valgrindsettings.h"
#include "valgrindengine.h"
-#include "valgrindsettings.h"
#include "valgrindrunner.h"
+#include "valgrindsettings.h"
+#include "valgrindsettings.h"
+#include "valgrindtr.h"
#include "xmlprotocol/error.h"
#include "xmlprotocol/error.h"
@@ -188,7 +189,7 @@ private:
QString MemcheckToolRunner::progressTitle() const
{
- return MemcheckTool::tr("Analyzing Memory");
+ return Tr::tr("Analyzing Memory");
}
void MemcheckToolRunner::start()
@@ -454,7 +455,7 @@ private:
bool m_toolBusy = false;
QString m_exitMsg;
- Perspective m_perspective{"Memcheck.Perspective", MemcheckTool::tr("Memcheck")};
+ Perspective m_perspective{"Memcheck.Perspective", Tr::tr("Memcheck")};
RunWorkerFactory memcheckToolRunnerFactory{
RunWorkerFactory::make<MemcheckToolRunner>(),
@@ -544,31 +545,31 @@ MemcheckToolPrivate::MemcheckToolPrivate()
setObjectName("MemcheckTool");
- m_filterProjectAction = new QAction(MemcheckTool::tr("External Errors"), this);
+ m_filterProjectAction = new QAction(Tr::tr("External Errors"), this);
m_filterProjectAction->setToolTip(
- MemcheckTool::tr("Show issues originating outside currently opened projects."));
+ Tr::tr("Show issues originating outside currently opened projects."));
m_filterProjectAction->setCheckable(true);
- m_suppressionSeparator = new QAction(MemcheckTool::tr("Suppressions"), this);
+ m_suppressionSeparator = new QAction(Tr::tr("Suppressions"), this);
m_suppressionSeparator->setSeparator(true);
m_suppressionSeparator->setToolTip(
- MemcheckTool::tr("These suppression files were used in the last memory analyzer run."));
+ Tr::tr("These suppression files were used in the last memory analyzer run."));
- QAction *a = new QAction(MemcheckTool::tr("Definite Memory Leaks"), this);
+ QAction *a = new QAction(Tr::tr("Definite Memory Leaks"), this);
initKindFilterAction(a, {Leak_DefinitelyLost, Leak_IndirectlyLost});
m_errorFilterActions.append(a);
- a = new QAction(MemcheckTool::tr("Possible Memory Leaks"), this);
+ a = new QAction(Tr::tr("Possible Memory Leaks"), this);
initKindFilterAction(a, {Leak_PossiblyLost, Leak_StillReachable});
m_errorFilterActions.append(a);
- a = new QAction(MemcheckTool::tr("Use of Uninitialized Memory"), this);
+ a = new QAction(Tr::tr("Use of Uninitialized Memory"), this);
initKindFilterAction(a, {InvalidRead, InvalidWrite, InvalidJump, Overlap,
InvalidMemPool, UninitCondition, UninitValue,
SyscallParam, ClientCheck});
m_errorFilterActions.append(a);
- a = new QAction(MemcheckTool::tr("Invalid Calls to \"free()\""), this);
+ a = new QAction(Tr::tr("Invalid Calls to \"free()\""), this);
initKindFilterAction(a, { InvalidFree, MismatchedFree });
m_errorFilterActions.append(a);
@@ -586,7 +587,7 @@ MemcheckToolPrivate::MemcheckToolPrivate()
m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
m_errorView->setAutoScroll(false);
m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView");
- m_errorView->setWindowTitle(MemcheckTool::tr("Memory Issues"));
+ m_errorView->setWindowTitle(Tr::tr("Memory Issues"));
m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr);
@@ -604,7 +605,7 @@ MemcheckToolPrivate::MemcheckToolPrivate()
// Load external XML log file
auto action = new QAction(this);
action->setIcon(Icons::OPENFILE_TOOLBAR.icon());
- action->setToolTip(MemcheckTool::tr("Load External XML Log File"));
+ action->setToolTip(Tr::tr("Load External XML Log File"));
connect(action, &QAction::triggered, this, &MemcheckToolPrivate::loadExternalXmlLogFile);
m_loadExternalLogFile = action;
@@ -612,7 +613,7 @@ MemcheckToolPrivate::MemcheckToolPrivate()
action = new QAction(this);
action->setDisabled(true);
action->setIcon(Icons::PREV_TOOLBAR.icon());
- action->setToolTip(MemcheckTool::tr("Go to previous leak."));
+ action->setToolTip(Tr::tr("Go to previous leak."));
connect(action, &QAction::triggered, m_errorView, &MemcheckErrorView::goBack);
m_goBack = action;
@@ -620,13 +621,13 @@ MemcheckToolPrivate::MemcheckToolPrivate()
action = new QAction(this);
action->setDisabled(true);
action->setIcon(Icons::NEXT_TOOLBAR.icon());
- action->setToolTip(MemcheckTool::tr("Go to next leak."));
+ action->setToolTip(Tr::tr("Go to next leak."));
connect(action, &QAction::triggered, m_errorView, &MemcheckErrorView::goNext);
m_goNext = action;
auto filterButton = new QToolButton;
filterButton->setIcon(Icons::FILTER.icon());
- filterButton->setText(MemcheckTool::tr("Error Filter"));
+ filterButton->setText(Tr::tr("Error Filter"));
filterButton->setPopupMode(QToolButton::InstantPopup);
filterButton->setProperty("noArrow", true);
@@ -640,11 +641,11 @@ MemcheckToolPrivate::MemcheckToolPrivate()
filterButton->setMenu(m_filterMenu);
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
- QString toolTip = MemcheckTool::tr("Valgrind Analyze Memory uses the Memcheck tool to find memory leaks.");
+ QString toolTip = Tr::tr("Valgrind Analyze Memory uses the Memcheck tool to find memory leaks.");
if (!HostOsInfo::isWindowsHost()) {
action = new QAction(this);
- action->setText(MemcheckTool::tr("Valgrind Memory Analyzer"));
+ action->setText(Tr::tr("Valgrind Memory Analyzer"));
action->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(action, "Memcheck.Local"),
Debugger::Constants::G_ANALYZER_TOOLS);
@@ -661,8 +662,8 @@ MemcheckToolPrivate::MemcheckToolPrivate()
});
action = new QAction(this);
- action->setText(MemcheckTool::tr("Valgrind Memory Analyzer with GDB"));
- action->setToolTip(MemcheckTool::tr("Valgrind Analyze Memory with GDB uses the "
+ action->setText(Tr::tr("Valgrind Memory Analyzer with GDB"));
+ action->setToolTip(Tr::tr("Valgrind Analyze Memory with GDB uses the "
"Memcheck tool to find memory leaks.\nWhen a problem is detected, "
"the application is interrupted and can be debugged."));
menu->addAction(ActionManager::registerAction(action, "MemcheckWithGdb.Local"),
@@ -679,9 +680,9 @@ MemcheckToolPrivate::MemcheckToolPrivate()
action->setEnabled(m_startWithGdbAction->isEnabled());
});
} else {
- action = new QAction(MemcheckTool::tr("Heob"), this);
+ action = new QAction(Tr::tr("Heob"), this);
Core::Command *cmd = Core::ActionManager::registerAction(action, "Memcheck.Local");
- cmd->setDefaultKeySequence(QKeySequence(MemcheckTool::tr("Ctrl+Alt+H")));
+ cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Alt+H")));
connect(action, &QAction::triggered, this, &MemcheckToolPrivate::heobAction);
menu->addAction(cmd, Debugger::Constants::G_ANALYZER_TOOLS);
connect(m_startAction, &QAction::changed, action, [action, this] {
@@ -690,7 +691,7 @@ MemcheckToolPrivate::MemcheckToolPrivate()
}
action = new QAction(this);
- action->setText(MemcheckTool::tr("Valgrind Memory Analyzer (External Application)"));
+ action->setText(Tr::tr("Valgrind Memory Analyzer (External Application)"));
action->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(action, "Memcheck.Remote"),
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
@@ -752,7 +753,7 @@ void MemcheckToolPrivate::heobAction()
}
}
if (!hasLocalRc) {
- const QString msg = MemcheckTool::tr("Heob: No local run configuration available.");
+ const QString msg = Tr::tr("Heob: No local run configuration available.");
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return;
@@ -761,7 +762,7 @@ void MemcheckToolPrivate::heobAction()
|| abi.os() != Abi::WindowsOS
|| abi.binaryFormat() != Abi::PEFormat
|| (abi.wordWidth() != 32 && abi.wordWidth() != 64)) {
- const QString msg = MemcheckTool::tr("Heob: No toolchain available.");
+ const QString msg = Tr::tr("Heob: No toolchain available.");
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return;
@@ -774,7 +775,7 @@ void MemcheckToolPrivate::heobAction()
// target executable
if (executable.isEmpty()) {
- const QString msg = MemcheckTool::tr("Heob: No executable set.");
+ const QString msg = Tr::tr("Heob: No executable set.");
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return;
@@ -782,7 +783,7 @@ void MemcheckToolPrivate::heobAction()
if (!executable.exists())
executable = executable.withExecutableSuffix();
if (!executable.exists()) {
- const QString msg = MemcheckTool::tr("Heob: Cannot find %1.").arg(executable.toUserOutput());
+ const QString msg = Tr::tr("Heob: Cannot find %1.").arg(executable.toUserOutput());
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return;
@@ -808,8 +809,8 @@ void MemcheckToolPrivate::heobAction()
if (!QFile::exists(heobPath)) {
QMessageBox::critical(
Core::ICore::dialogParent(),
- MemcheckTool::tr("Heob"),
- MemcheckTool::tr("The %1 executables must be in the appropriate location.")
+ Tr::tr("Heob"),
+ Tr::tr("The %1 executables must be in the appropriate location.")
.arg("<a href=\"https://github.com/ssbssa/heob/releases\">Heob</a>"));
return;
}
@@ -821,8 +822,8 @@ void MemcheckToolPrivate::heobAction()
if (!QFile::exists(dwarfstackPath)
&& CheckableMessageBox::doNotShowAgainInformation(
Core::ICore::dialogParent(),
- MemcheckTool::tr("Heob"),
- MemcheckTool::tr("Heob used with MinGW projects needs the %1 DLLs for proper "
+ Tr::tr("Heob"),
+ Tr::tr("Heob used with MinGW projects needs the %1 DLLs for proper "
"stacktrace resolution.")
.arg(
"<a "
@@ -877,7 +878,7 @@ void MemcheckToolPrivate::heobAction()
CREATE_UNICODE_ENVIRONMENT | CREATE_SUSPENDED | CREATE_NEW_CONSOLE, envPtr,
reinterpret_cast<LPCWSTR>(workingDirectory.utf16()), &si, &pi)) {
DWORD e = GetLastError();
- const QString msg = MemcheckTool::tr("Heob: Cannot create %1 process (%2).")
+ const QString msg = Tr::tr("Heob: Cannot create %1 process (%2).")
.arg(heob)
.arg(qt_error_string(e));
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
@@ -905,16 +906,16 @@ void MemcheckToolPrivate::updateRunActions()
{
if (m_toolBusy) {
m_startAction->setEnabled(false);
- m_startAction->setToolTip(MemcheckTool::tr("A Valgrind Memcheck analysis is still in progress."));
+ m_startAction->setToolTip(Tr::tr("A Valgrind Memcheck analysis is still in progress."));
m_startWithGdbAction->setEnabled(false);
- m_startWithGdbAction->setToolTip(MemcheckTool::tr("A Valgrind Memcheck analysis is still in progress."));
+ m_startWithGdbAction->setToolTip(Tr::tr("A Valgrind Memcheck analysis is still in progress."));
m_stopAction->setEnabled(true);
} else {
- QString whyNot = MemcheckTool::tr("Start a Valgrind Memcheck analysis.");
+ QString whyNot = Tr::tr("Start a Valgrind Memcheck analysis.");
bool canRun = ProjectExplorerPlugin::canRunStartupProject(MEMCHECK_RUN_MODE, &whyNot);
m_startAction->setToolTip(whyNot);
m_startAction->setEnabled(canRun);
- whyNot = MemcheckTool::tr("Start a Valgrind Memcheck with GDB analysis.");
+ whyNot = Tr::tr("Start a Valgrind Memcheck with GDB analysis.");
canRun = ProjectExplorerPlugin::canRunStartupProject(MEMCHECK_WITH_GDB_RUN_MODE, &whyNot);
m_startWithGdbAction->setToolTip(whyNot);
m_startWithGdbAction->setEnabled(canRun);
@@ -1040,9 +1041,9 @@ void MemcheckToolPrivate::loadExternalXmlLogFile()
{
const FilePath filePath = FileUtils::getOpenFilePath(
nullptr,
- MemcheckTool::tr("Open Memcheck XML Log File"),
+ Tr::tr("Open Memcheck XML Log File"),
{},
- MemcheckTool::tr("XML Files (*.xml);;All Files (*)"));
+ Tr::tr("XML Files (*.xml);;All Files (*)"));
if (filePath.isEmpty())
return;
@@ -1055,7 +1056,7 @@ void MemcheckToolPrivate::loadXmlLogFile(const QString &filePath)
auto logFile = new QFile(filePath);
if (!logFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
delete logFile;
- QString msg = MemcheckTool::tr("Memcheck: Failed to open file for reading: %1").arg(filePath);
+ QString msg = Tr::tr("Memcheck: Failed to open file for reading: %1").arg(filePath);
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
if (!m_exitMsg.isEmpty())
@@ -1093,7 +1094,7 @@ void MemcheckToolPrivate::parserError(const Error &error)
void MemcheckToolPrivate::internalParserError(const QString &errorString)
{
- QString msg = MemcheckTool::tr("Memcheck: Error occurred parsing Valgrind output: %1").arg(errorString);
+ QString msg = Tr::tr("Memcheck: Error occurred parsing Valgrind output: %1").arg(errorString);
TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
}
@@ -1147,13 +1148,13 @@ void MemcheckToolPrivate::engineFinished()
const int issuesFound = updateUiAfterFinishedHelper();
Debugger::showPermanentStatusMessage(
- MemcheckTool::tr("Memory Analyzer Tool finished. %n issues were found.", nullptr, issuesFound));
+ Tr::tr("Memory Analyzer Tool finished. %n issues were found.", nullptr, issuesFound));
}
void MemcheckToolPrivate::loadingExternalXmlLogFileFinished()
{
const int issuesFound = updateUiAfterFinishedHelper();
- QString statusMessage = MemcheckTool::tr("Log file processed. %n issues were found.", nullptr, issuesFound);
+ QString statusMessage = Tr::tr("Log file processed. %n issues were found.", nullptr, issuesFound);
if (!m_exitMsg.isEmpty())
statusMessage += ' ' + m_exitMsg;
Debugger::showPermanentStatusMessage(statusMessage);
diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h
index 1e4e245cd78..a331de3d61e 100644
--- a/src/plugins/valgrind/memchecktool.h
+++ b/src/plugins/valgrind/memchecktool.h
@@ -26,23 +26,16 @@
#pragma once
-#include <QObject>
-
namespace Valgrind {
namespace Internal {
class MemcheckToolRunner;
-class MemcheckTool final : public QObject
+class MemcheckTool final
{
- Q_OBJECT
-
public:
MemcheckTool();
- ~MemcheckTool() final;
-
-private:
- class MemcheckToolPrivate *d = nullptr;
+ ~MemcheckTool();
};
} // namespace Internal
diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp
index bde173edccd..bddd22da52b 100644
--- a/src/plugins/valgrind/suppressiondialog.cpp
+++ b/src/plugins/valgrind/suppressiondialog.cpp
@@ -28,6 +28,7 @@
#include "memcheckerrorview.h"
#include "valgrindsettings.h"
+#include "valgrindtr.h"
#include "xmlprotocol/suppression.h"
#include "xmlprotocol/errorlistmodel.h"
@@ -121,11 +122,11 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
m_fileChooser(new PathChooser(this)),
m_suppressionEdit(new QPlainTextEdit(this))
{
- setWindowTitle(tr("Save Suppression"));
+ setWindowTitle(Tr::tr("Save Suppression"));
- auto fileLabel = new QLabel(tr("Suppression File:"), this);
+ auto fileLabel = new QLabel(Tr::tr("Suppression File:"), this);
- auto suppressionsLabel = new QLabel(tr("Suppression:"), this);
+ auto suppressionsLabel = new QLabel(Tr::tr("Suppression:"), this);
suppressionsLabel->setBuddy(m_suppressionEdit);
QFont font;
@@ -149,7 +150,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
m_fileChooser->setHistoryCompleter("Valgrind.Suppression.History");
m_fileChooser->setPath(defaultSuppFile.fileName());
m_fileChooser->setPromptDialogFilter("*.supp");
- m_fileChooser->setPromptDialogTitle(tr("Select Suppression File"));
+ m_fileChooser->setPromptDialogTitle(Tr::tr("Select Suppression File"));
QString suppressions;
for (const Error &error : qAsConst(m_errors))
diff --git a/src/plugins/valgrind/suppressiondialog.h b/src/plugins/valgrind/suppressiondialog.h
index a1ca3f93f7a..0cf5b871bef 100644
--- a/src/plugins/valgrind/suppressiondialog.h
+++ b/src/plugins/valgrind/suppressiondialog.h
@@ -45,8 +45,6 @@ class ValgrindBaseSettings;
class SuppressionDialog : public QDialog
{
- Q_OBJECT
-
public:
SuppressionDialog(MemcheckErrorView *view,
const QList<XmlProtocol::Error> &errors);
diff --git a/src/plugins/valgrind/valgrindconfigwidget.cpp b/src/plugins/valgrind/valgrindconfigwidget.cpp
index 980b04fc73d..8fa534870b3 100644
--- a/src/plugins/valgrind/valgrindconfigwidget.cpp
+++ b/src/plugins/valgrind/valgrindconfigwidget.cpp
@@ -26,7 +26,7 @@
#include "valgrindconfigwidget.h"
#include "valgrindsettings.h"
-#include "valgrindplugin.h"
+#include "valgrindtr.h"
#include <debugger/analyzer/analyzericons.h>
@@ -43,8 +43,6 @@ namespace Internal {
class ValgrindConfigWidget : public Core::IOptionsPageWidget
{
- Q_DECLARE_TR_FUNCTIONS(Valgrind::Internal::ValgrindConfigWidget)
-
public:
explicit ValgrindConfigWidget(ValgrindBaseSettings *settings);
@@ -100,9 +98,9 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
};
Column {
- Group { Title(tr("Valgrind Generic Settings")), generic },
- Group { Title(tr("MemCheck Memory Analysis Options")), memcheck },
- Group { Title(tr("CallGrind Profiling Options")), callgrind },
+ Group { Title(Tr::tr("Valgrind Generic Settings")), generic },
+ Group { Title(Tr::tr("MemCheck Memory Analysis Options")), memcheck },
+ Group { Title(Tr::tr("CallGrind Profiling Options")), callgrind },
Stretch(),
}.attachTo(this);
}
@@ -112,9 +110,9 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings)
ValgrindOptionsPage::ValgrindOptionsPage()
{
setId(ANALYZER_VALGRIND_SETTINGS);
- setDisplayName(ValgrindConfigWidget::tr("Valgrind"));
+ setDisplayName(Tr::tr("Valgrind"));
setCategory("T.Analyzer");
- setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
+ setDisplayCategory(Tr::tr("Analyzer"));
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
setWidgetCreator([] { return new ValgrindConfigWidget(ValgrindGlobalSettings::instance()); });
}
diff --git a/src/plugins/valgrind/valgrindconfigwidget.h b/src/plugins/valgrind/valgrindconfigwidget.h
index 0cef8a9d739..f165dbc5e46 100644
--- a/src/plugins/valgrind/valgrindconfigwidget.h
+++ b/src/plugins/valgrind/valgrindconfigwidget.h
@@ -28,8 +28,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
-namespace Valgrind {
-namespace Internal {
+namespace Valgrind::Internal {
class ValgrindOptionsPage final : public Core::IOptionsPage
{
@@ -39,5 +38,4 @@ public:
static QWidget *createSettingsWidget(class ValgrindBaseSettings *settings);
};
-} // namespace Internal
-} // namespace Valgrind
+} // Valgrind::Internal
diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp
index fdb147e1c74..5e9a7b6aa7a 100644
--- a/src/plugins/valgrind/valgrindengine.cpp
+++ b/src/plugins/valgrind/valgrindengine.cpp
@@ -25,7 +25,9 @@
****************************************************************************/
#include "valgrindengine.h"
+
#include "valgrindsettings.h"
+#include "valgrindtr.h"
#include <debugger/analyzer/analyzermanager.h>
@@ -50,8 +52,7 @@ using namespace Core;
using namespace Utils;
using namespace ProjectExplorer;
-namespace Valgrind {
-namespace Internal {
+namespace Valgrind::Internal {
ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl)
: RunWorker(runControl)
@@ -84,9 +85,9 @@ void ValgrindToolRunner::start()
m_progress.reportStarted();
#if VALGRIND_DEBUG_OUTPUT
- emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), LogMessageFormat);
- emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), LogMessageFormat);
- emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), LogMessageFormat);
+ emit outputReceived(Tr::tr("Valgrind options: %1").arg(toolArguments().join(' ')), LogMessageFormat);
+ emit outputReceived(Tr::tr("Working directory: %1").arg(runnable().workingDirectory), LogMessageFormat);
+ emit outputReceived(Tr::tr("Command line arguments: %1").arg(runnable().debuggeeArgs), LogMessageFormat);
#endif
@@ -155,7 +156,7 @@ void ValgrindToolRunner::handleProgressFinished()
void ValgrindToolRunner::runnerFinished()
{
- appendMessage(tr("Analyzing finished."), NormalMessageFormat);
+ appendMessage(Tr::tr("Analyzing finished."), NormalMessageFormat);
m_progress.reportFinished();
@@ -167,13 +168,13 @@ void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::P
if (error == QProcess::FailedToStart) {
const QString valgrind = m_settings.valgrindExecutable.value();
if (!valgrind.isEmpty())
- appendMessage(tr("Error: \"%1\" could not be started: %2").arg(valgrind, message), ErrorMessageFormat);
+ appendMessage(Tr::tr("Error: \"%1\" could not be started: %2").arg(valgrind, message), ErrorMessageFormat);
else
- appendMessage(tr("Error: no Valgrind executable set."), ErrorMessageFormat);
+ appendMessage(Tr::tr("Error: no Valgrind executable set."), ErrorMessageFormat);
} else if (m_isStopping && error == QProcess::Crashed) { // process gets killed on stop
- appendMessage(tr("Process terminated."), ErrorMessageFormat);
+ appendMessage(Tr::tr("Process terminated."), ErrorMessageFormat);
} else {
- appendMessage(tr("Process exited with return value %1\n").arg(message), NormalMessageFormat);
+ appendMessage(Tr::tr("Process exited with return value %1\n").arg(message), NormalMessageFormat);
}
if (m_isStopping)
@@ -184,5 +185,4 @@ void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::P
pane->popup(IOutputPane::NoModeSwitch);
}
-} // namespace Internal
-} // namepsace Valgrind
+} // Valgrid::Internal
diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h
index 8bb050405af..12b917be3ac 100644
--- a/src/plugins/valgrind/valgrindengine.h
+++ b/src/plugins/valgrind/valgrindengine.h
@@ -34,13 +34,10 @@
#include <QFutureInterface>
-namespace Valgrind {
-namespace Internal {
+namespace Valgrind::Internal {
class ValgrindToolRunner : public ProjectExplorer::RunWorker
{
- Q_OBJECT
-
public:
explicit ValgrindToolRunner(ProjectExplorer::RunControl *runControl);
@@ -68,5 +65,4 @@ private:
bool m_isStopping = false;
};
-} // namespace Internal
-} // namespace Valgrind
+} // Valgrind::Internal
diff --git a/src/plugins/valgrind/valgrindmemcheckparsertest.h b/src/plugins/valgrind/valgrindmemcheckparsertest.h
index 6dff0aef57d..05094b2174b 100644
--- a/src/plugins/valgrind/valgrindmemcheckparsertest.h
+++ b/src/plugins/valgrind/valgrindmemcheckparsertest.h
@@ -51,7 +51,6 @@ void dumpError(const Valgrind::XmlProtocol::Error &e);
class Recorder : public QObject
{
- Q_OBJECT
public:
explicit Recorder(XmlProtocol::Parser *parser)
{
@@ -87,8 +86,6 @@ public:
class RunnerDumper : public QObject
{
- Q_OBJECT
-
public:
explicit RunnerDumper(ValgrindRunner *runner)
{
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index ee0d1378516..60688505cf8 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -28,8 +28,9 @@
#include "callgrindtool.h"
#include "memchecktool.h"
-#include "valgrindsettings.h"
#include "valgrindconfigwidget.h"
+#include "valgrindsettings.h"
+#include "valgrindtr.h"
#ifdef WITH_TESTS
# include "valgrindmemcheckparsertest.h"
@@ -61,8 +62,7 @@ public:
setProjectSettings(new ValgrindProjectSettings);
setGlobalSettings(ValgrindGlobalSettings::instance());
setId(ANALYZER_VALGRIND_SETTINGS);
- setDisplayName(QCoreApplication::translate("Valgrind::Internal::ValgrindRunConfigurationAspect",
- "Valgrind Settings"));
+ setDisplayName(Tr::tr("Valgrind Settings"));
setUsingGlobalSettings(true);
resetProjectToGlobalSettings();
setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h
index d458cefffb6..0f02decc9ab 100644
--- a/src/plugins/valgrind/valgrindplugin.h
+++ b/src/plugins/valgrind/valgrindplugin.h
@@ -29,8 +29,7 @@
#include <extensionsystem/iplugin.h>
#include <projectexplorer/projectexplorer.h>
-namespace Valgrind {
-namespace Internal {
+namespace Valgrind::Internal {
class ValgrindPlugin final : public ExtensionSystem::IPlugin
{
@@ -49,5 +48,4 @@ private:
class ValgrindPluginPrivate *d = nullptr;
};
-} // namespace Internal
-} // namespace Valgrind
+} // Valgrind::Internal
diff --git a/src/plugins/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrindrunner.cpp
index f606789cf11..193b2aa5e99 100644
--- a/src/plugins/valgrind/valgrindrunner.cpp
+++ b/src/plugins/valgrind/valgrindrunner.cpp
@@ -26,6 +26,7 @@
#include "valgrindrunner.h"
+#include "valgrindtr.h"
#include "xmlprotocol/threadedparser.h"
#include <utils/hostosinfo.h>
@@ -107,14 +108,14 @@ bool ValgrindRunner::Private::startServers()
const bool xmlOK = m_xmlServer.listen(m_localServerAddress);
const QString ip = m_localServerAddress.toString();
if (!xmlOK) {
- emit q->processErrorReceived(tr("XmlServer on %1:").arg(ip) + ' '
+ emit q->processErrorReceived(Tr::tr("XmlServer on %1:").arg(ip) + ' '
+ m_xmlServer.errorString(), QProcess::FailedToStart );
return false;
}
m_xmlServer.setMaxPendingConnections(1);
const bool logOK = m_logServer.listen(m_localServerAddress);
if (!logOK) {
- emit q->processErrorReceived(tr("LogServer on %1:").arg(ip) + ' '
+ emit q->processErrorReceived(Tr::tr("LogServer on %1:").arg(ip) + ' '
+ m_logServer.errorString(), QProcess::FailedToStart );
return false;
}
diff --git a/src/plugins/valgrind/valgrindsettings.cpp b/src/plugins/valgrind/valgrindsettings.cpp
index 4ffac890746..c2e9934255d 100644
--- a/src/plugins/valgrind/valgrindsettings.cpp
+++ b/src/plugins/valgrind/valgrindsettings.cpp
@@ -25,7 +25,10 @@
****************************************************************************/
#include "valgrindsettings.h"
+
+#include "callgrindcostdelegate.h"
#include "valgrindconfigwidget.h"
+#include "valgrindtr.h"
#include <coreplugin/icore.h>
@@ -45,8 +48,7 @@
using namespace Utils;
-namespace Valgrind {
-namespace Internal {
+namespace Valgrind::Internal {
//
// SuppressionAspect
@@ -54,8 +56,6 @@ namespace Internal {
class SuppressionAspectPrivate : public QObject
{
- Q_DECLARE_TR_FUNCTIONS(Valgrind::Internal::ValgrindConfigWidget)
-
public:
SuppressionAspectPrivate(SuppressionAspect *q, bool global) : q(q), isGlobal(global) {}
@@ -86,9 +86,9 @@ void SuppressionAspectPrivate::slotAddSuppression()
QTC_ASSERT(conf, return);
const FilePaths files =
FileUtils::getOpenFilePaths(nullptr,
- tr("Valgrind Suppression Files"),
+ Tr::tr("Valgrind Suppression Files"),
conf->lastSuppressionDirectory.filePath(),
- tr("Valgrind Suppression File (*.supp);;All Files (*)"));
+ Tr::tr("Valgrind Suppression File (*.supp);;All Files (*)"));
//dialog.setHistory(conf->lastSuppressionDialogHistory());
if (!files.isEmpty()) {
for (const FilePath &file : files)
@@ -159,8 +159,8 @@ void SuppressionAspect::addToLayout(LayoutBuilder &builder)
using namespace Layouting;
- d->addEntry = new QPushButton(tr("Add..."));
- d->removeEntry = new QPushButton(tr("Remove"));
+ d->addEntry = new QPushButton(Tr::tr("Add..."));
+ d->removeEntry = new QPushButton(Tr::tr("Remove"));
d->entryList = createSubWidget<QListView>();
d->entryList->setModel(&d->m_model);
@@ -173,7 +173,7 @@ void SuppressionAspect::addToLayout(LayoutBuilder &builder)
connect(d->entryList->selectionModel(), &QItemSelectionModel::selectionChanged,
d, &SuppressionAspectPrivate::slotSuppressionSelectionChanged);
- builder.addItem(Column { new QLabel(tr("Suppression files:")), Stretch() });
+ builder.addItem(Column { new QLabel(Tr::tr("Suppression files:")), Stretch() });
Row group {
d->entryList.data(),
Column { d->addEntry.data(), d->removeEntry.data(), Stretch() }
@@ -233,8 +233,8 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
valgrindExecutable.setDisplayStyle(StringAspect::PathChooserDisplay);
valgrindExecutable.setExpectedKind(PathChooser::Command);
valgrindExecutable.setHistoryCompleter("Valgrind.Command.History");
- valgrindExecutable.setDisplayName(tr("Valgrind Command"));
- valgrindExecutable.setLabelText(tr("Valgrind executable:"));
+ valgrindExecutable.setDisplayName(Tr::tr("Valgrind Command"));
+ valgrindExecutable.setLabelText(Tr::tr("Valgrind executable:"));
if (Utils::HostOsInfo::isWindowsHost()) {
// On Window we know that we don't have a local valgrind
// executable, so having the "Browse" button in the path chooser
@@ -246,7 +246,7 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
registerAspect(&valgrindArguments);
valgrindArguments.setSettingsKey(base + "ValgrindArguments");
valgrindArguments.setDisplayStyle(StringAspect::LineEditDisplay);
- valgrindArguments.setLabelText(tr("Valgrind arguments:"));
+ valgrindArguments.setLabelText(Tr::tr("Valgrind arguments:"));
registerAspect(&selfModifyingCodeDetection);
selfModifyingCodeDetection.setSettingsKey(base + "SelfModifyingCodeDetection");
@@ -256,46 +256,46 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
selfModifyingCodeDetection.addOption("Only on Stack");
selfModifyingCodeDetection.addOption("Everywhere");
selfModifyingCodeDetection.addOption("Everywhere Except in File-backend Mappings");
- selfModifyingCodeDetection.setLabelText(tr("Detect self-modifying code:"));
+ selfModifyingCodeDetection.setLabelText(Tr::tr("Detect self-modifying code:"));
// Memcheck
registerAspect(&memcheckArguments);
memcheckArguments.setSettingsKey(base + "Memcheck.Arguments");
memcheckArguments.setDisplayStyle(StringAspect::LineEditDisplay);
- memcheckArguments.setLabelText(tr("Extra MemCheck arguments:"));
+ memcheckArguments.setLabelText(Tr::tr("Extra MemCheck arguments:"));
registerAspect(&filterExternalIssues);
filterExternalIssues.setSettingsKey(base + "FilterExternalIssues");
filterExternalIssues.setDefaultValue(true);
filterExternalIssues.setIcon(Icons::FILTER.icon());
filterExternalIssues.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- filterExternalIssues.setLabelText(tr("Show Project Costs Only"));
- filterExternalIssues.setToolTip(tr("Show only profiling info that originated from this project source."));
+ filterExternalIssues.setLabelText(Tr::tr("Show Project Costs Only"));
+ filterExternalIssues.setToolTip(Tr::tr("Show only profiling info that originated from this project source."));
registerAspect(&trackOrigins);
trackOrigins.setSettingsKey(base + "TrackOrigins");
trackOrigins.setDefaultValue(true);
trackOrigins.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- trackOrigins.setLabelText(tr("Track origins of uninitialized memory"));
+ trackOrigins.setLabelText(Tr::tr("Track origins of uninitialized memory"));
registerAspect(&showReachable);
showReachable.setSettingsKey(base + "ShowReachable");
showReachable.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- showReachable.setLabelText(tr("Show reachable and indirectly lost blocks"));
+ showReachable.setLabelText(Tr::tr("Show reachable and indirectly lost blocks"));
registerAspect(&leakCheckOnFinish);
leakCheckOnFinish.setSettingsKey(base + "LeakCheckOnFinish");
leakCheckOnFinish.setDefaultValue(LeakCheckOnFinishSummaryOnly);
leakCheckOnFinish.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
- leakCheckOnFinish.addOption(tr("No"));
- leakCheckOnFinish.addOption(tr("Summary Only"));
- leakCheckOnFinish.addOption(tr("Full"));
- leakCheckOnFinish.setLabelText(tr("Check for leaks on finish:"));
+ leakCheckOnFinish.addOption(Tr::tr("No"));
+ leakCheckOnFinish.addOption(Tr::tr("Summary Only"));
+ leakCheckOnFinish.addOption(Tr::tr("Full"));
+ leakCheckOnFinish.setLabelText(Tr::tr("Check for leaks on finish:"));
registerAspect(&numCallers);
numCallers.setSettingsKey(base + "NumCallers");
numCallers.setDefaultValue(25);
- numCallers.setLabelText(tr("Backtrace frame count:"));
+ numCallers.setLabelText(Tr::tr("Backtrace frame count:"));
// Callgrind
@@ -303,26 +303,26 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
kcachegrindExecutable.setSettingsKey(base + "KCachegrindExecutable");
kcachegrindExecutable.setDefaultValue("kcachegrind");
kcachegrindExecutable.setDisplayStyle(StringAspect::PathChooserDisplay);
- kcachegrindExecutable.setLabelText(tr("KCachegrind executable:"));
+ kcachegrindExecutable.setLabelText(Tr::tr("KCachegrind executable:"));
kcachegrindExecutable.setExpectedKind(Utils::PathChooser::Command);
- kcachegrindExecutable.setDisplayName(tr("KCachegrind Command"));
+ kcachegrindExecutable.setDisplayName(Tr::tr("KCachegrind Command"));
registerAspect(&callgrindArguments);
callgrindArguments.setSettingsKey(base + "Callgrind.Arguments");
callgrindArguments.setDisplayStyle(StringAspect::LineEditDisplay);
- callgrindArguments.setLabelText(tr("Extra CallGrind arguments:"));
+ callgrindArguments.setLabelText(Tr::tr("Extra CallGrind arguments:"));
registerAspect(&enableEventToolTips);
enableEventToolTips.setDefaultValue(true);
enableEventToolTips.setSettingsKey(base + "Callgrind.EnableEventToolTips");
enableEventToolTips.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- enableEventToolTips.setLabelText(tr("Show additional information for events in tooltips"));
+ enableEventToolTips.setLabelText(Tr::tr("Show additional information for events in tooltips"));
registerAspect(&enableCacheSim);
enableCacheSim.setSettingsKey(base + "Callgrind.EnableCacheSim");
enableCacheSim.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- enableCacheSim.setLabelText(tr("Enable cache simulation"));
- enableCacheSim.setToolTip("<html><head/><body>" + tr(
+ enableCacheSim.setLabelText(Tr::tr("Enable cache simulation"));
+ enableCacheSim.setToolTip("<html><head/><body>" + Tr::tr(
"<p>Does full cache simulation.</p>\n"
"<p>By default, only instruction read accesses will be counted (\"Ir\").</p>\n"
"<p>\n"
@@ -335,8 +335,8 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
registerAspect(&enableBranchSim);
enableBranchSim.setSettingsKey(base + "Callgrind.EnableBranchSim");
enableBranchSim.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- enableBranchSim.setLabelText(tr("Enable branch prediction simulation"));
- enableBranchSim.setToolTip("<html><head/><body>\n" + tr(
+ enableBranchSim.setLabelText(Tr::tr("Enable branch prediction simulation"));
+ enableBranchSim.setToolTip("<html><head/><body>\n" + Tr::tr(
"<p>Does branch prediction simulation.</p>\n"
"<p>Further event counters are enabled: </p>\n"
"<ul><li>Number of executed conditional branches and related predictor misses (\n"
@@ -347,29 +347,29 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
registerAspect(&collectSystime);
collectSystime.setSettingsKey(base + "Callgrind.CollectSystime");
collectSystime.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
- collectSystime.setLabelText(tr("Collect system call time"));
- collectSystime.setToolTip(tr("Collects information for system call times."));
+ collectSystime.setLabelText(Tr::tr("Collect system call time"));
+ collectSystime.setToolTip(Tr::tr("Collects information for system call times."));
registerAspect(&collectBusEvents);
collectBusEvents.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
collectBusEvents.setSettingsKey(base + "Callgrind.CollectBusEvents");
- collectBusEvents.setLabelText(tr("Collect global bus events"));
- collectBusEvents.setToolTip(tr("Collect the number of global bus events that are executed. "
+ collectBusEvents.setLabelText(Tr::tr("Collect global bus events"));
+ collectBusEvents.setToolTip(Tr::tr("Collect the number of global bus events that are executed. "
"The event type \"Ge\" is used for these events."));
registerAspect(&minimumInclusiveCostRatio);
minimumInclusiveCostRatio.setSettingsKey(base + "Callgrind.MinimumCostRatio");
minimumInclusiveCostRatio.setDefaultValue(0.01);
- minimumInclusiveCostRatio.setSuffix(tr("%"));
- minimumInclusiveCostRatio.setLabelText(tr("Result view: Minimum event cost:"));
- minimumInclusiveCostRatio.setToolTip(tr("Limits the amount of results the profiler gives you. "
+ minimumInclusiveCostRatio.setSuffix(Tr::tr("%"));
+ minimumInclusiveCostRatio.setLabelText(Tr::tr("Result view: Minimum event cost:"));
+ minimumInclusiveCostRatio.setToolTip(Tr::tr("Limits the amount of results the profiler gives you. "
"A lower limit will likely increase performance."));
registerAspect(&visualizationMinimumInclusiveCostRatio);
visualizationMinimumInclusiveCostRatio.setSettingsKey(base + "Callgrind.VisualisationMinimumCostRatio");
visualizationMinimumInclusiveCostRatio.setDefaultValue(10.0);
- visualizationMinimumInclusiveCostRatio.setLabelText(tr("Visualization: Minimum event cost:"));
- visualizationMinimumInclusiveCostRatio.setSuffix(tr("%"));
+ visualizationMinimumInclusiveCostRatio.setLabelText(Tr::tr("Visualization: Minimum event cost:"));
+ visualizationMinimumInclusiveCostRatio.setSuffix(Tr::tr("%"));
registerAspect(&visibleErrorKinds);
visibleErrorKinds.setSettingsKey(base + "VisibleErrorKinds");
@@ -405,7 +405,7 @@ ValgrindGlobalSettings::ValgrindGlobalSettings()
detectCycles.setSettingsKey(base + "Callgrind.CycleDetection");
detectCycles.setDefaultValue(true);
detectCycles.setLabelText("O"); // FIXME: Create a real icon
- detectCycles.setToolTip(tr("Enable cycle detection to properly handle recursive "
+ detectCycles.setToolTip(Tr::tr("Enable cycle detection to properly handle recursive "
"or circular function calls."));
registerAspect(&costFormat);
@@ -417,7 +417,7 @@ ValgrindGlobalSettings::ValgrindGlobalSettings()
shortenTemplates.setSettingsKey(base + "Callgrind.ShortenTemplates");
shortenTemplates.setDefaultValue(true);
shortenTemplates.setLabelText("<>"); // FIXME: Create a real icon
- shortenTemplates.setToolTip(tr("Remove template parameter lists when displaying function names."));
+ shortenTemplates.setToolTip(Tr::tr("Remove template parameter lists when displaying function names."));
setConfigWidgetCreator([this] { return ValgrindOptionsPage::createSettingsWidget(this); });
readSettings();
@@ -493,5 +493,4 @@ ValgrindProjectSettings::ValgrindProjectSettings()
});
}
-} // namespace Internal
-} // namespace Valgrind
+} // Valgrind::Internal
diff --git a/src/plugins/valgrind/valgrindsettings.h b/src/plugins/valgrind/valgrindsettings.h
index 7d4f01f79ea..0ebed44255e 100644
--- a/src/plugins/valgrind/valgrindsettings.h
+++ b/src/plugins/valgrind/valgrindsettings.h
@@ -26,13 +26,10 @@
#pragma once
-#include "callgrindcostdelegate.h"
-
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
-namespace Valgrind {
-namespace Internal {
+namespace Valgrind::Internal {
const char ANALYZER_VALGRIND_SETTINGS[] = "Analyzer.Valgrind.Settings";
@@ -40,7 +37,7 @@ class SuppressionAspectPrivate;
class SuppressionAspect final : public Utils::BaseAspect
{
- Q_DECLARE_TR_FUNCTIONS(Valgrind::Internal::SuppressionAspect)
+ Q_OBJECT
public:
explicit SuppressionAspect(bool global);
@@ -176,5 +173,4 @@ public:
ValgrindProjectSettings();
};
-} // namespace Internal
-} // namespace Valgrind
+} // Valgrind::Internal
diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp
index 7431b0692cd..e1944ee62af 100644
--- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp
+++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp
@@ -29,6 +29,7 @@
#include "frame.h"
#include "stack.h"
#include "modelhelpers.h"
+#include "../valgrindtr.h"
#include <debugger/analyzer/diagnosticlocation.h>
#include <utils/qtcassert.h>
@@ -87,7 +88,7 @@ private:
ErrorListModel::ErrorListModel(QObject *parent)
: Utils::TreeModel<>(parent)
{
- setHeader(QStringList() << tr("Issue") << tr("Location"));
+ setHeader({Tr::tr("Issue"), Tr::tr("Location")});
}
Frame ErrorListModel::findRelevantFrame(const Error &error) const
@@ -126,7 +127,7 @@ static QString makeFrameName(const Frame &frame, bool withLocation)
if (!fn.isEmpty()) {
const QString location = withLocation || path == frame.object()
? QString::fromLatin1(" in %2").arg(path) : QString();
- return QCoreApplication::translate("Valgrind::Internal", "%1%2").arg(fn, location);
+ return QCoreApplication::translate("Valgrind", "%1%2").arg(fn, location);
}
if (!path.isEmpty())
return path;
@@ -135,8 +136,8 @@ static QString makeFrameName(const Frame &frame, bool withLocation)
QString ErrorListModel::errorLocation(const Error &error) const
{
- return QCoreApplication::translate("Valgrind::Internal", "in %1").
- arg(makeFrameName(findRelevantFrame(error), true));
+ return QCoreApplication::translate("Valgrind", "in %1")
+ .arg(makeFrameName(findRelevantFrame(error), true));
}
void ErrorListModel::addError(const Error &error)
@@ -221,7 +222,7 @@ QVariant ErrorItem::data(int column, int role) const
|| m_error.stacks().constFirst().frames().constFirst().functionName().isEmpty()) {
return m_error.what();
}
- return ErrorListModel::tr("%1 in function %2")
+ return Tr::tr("%1 in function %2")
.arg(m_error.what(), m_error.stacks().constFirst().frames().constFirst().functionName());
case Qt::ToolTipRole:
return toolTipForFrame(m_model->findRelevantFrame(m_error));
diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.h b/src/plugins/valgrind/xmlprotocol/errorlistmodel.h
index 9d4915147b9..34fc3868701 100644
--- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.h
+++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.h
@@ -39,8 +39,6 @@ class Frame;
class ErrorListModel : public Utils::TreeModel<>
{
- Q_OBJECT
-
public:
enum Role {
ErrorRole = Debugger::DetailedErrorView::FullTextRole + 1,
diff --git a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
index d2722311871..443e4ffbe15 100644
--- a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
+++ b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
@@ -26,11 +26,11 @@
#include "modelhelpers.h"
#include "frame.h"
+#include "../valgrindtr.h"
#include <QString>
#include <QDir>
#include <QPair>
-#include <QCoreApplication>
namespace Valgrind {
namespace XmlProtocol {
@@ -48,17 +48,14 @@ QString toolTipForFrame(const Frame &frame)
QList<StringPair> lines;
if (!frame.functionName().isEmpty())
- lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Function:"),
- frame.functionName());
+ lines << qMakePair(Tr::tr("Function:"), frame.functionName());
if (!location.isEmpty())
- lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Location:"),
- location);
+ lines << qMakePair(Tr::tr("Location:"), location);
if (frame.instructionPointer())
- lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol",
- "Instruction pointer:"),
- QString::fromLatin1("0x%1").arg(frame.instructionPointer(), 0, 16));
+ lines << qMakePair(Tr::tr("Instruction pointer:"),
+ QString("0x%1").arg(frame.instructionPointer(), 0, 16));
if (!frame.object().isEmpty())
- lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
+ lines << qMakePair(Tr::tr("Object:"), frame.object());
QString html = "<html><head>"
"<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n"
diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp
index cc552859925..4afb1cbf0e5 100644
--- a/src/plugins/valgrind/xmlprotocol/parser.cpp
+++ b/src/plugins/valgrind/xmlprotocol/parser.cpp
@@ -31,10 +31,11 @@
#include "stack.h"
#include "status.h"
#include "suppression.h"
+#include "../valgrindtr.h"
+
#include <utils/qtcassert.h>
#include <QAbstractSocket>
-#include <QCoreApplication>
#include <QHash>
#include <QIODevice>
#include <QPair>
@@ -173,8 +174,7 @@ static quint64 parseHex(const QString &str, const QString &context)
bool ok;
const quint64 v = str.toULongLong(&ok, 16);
if (!ok)
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Could not parse hex number from \"%1\" (%2)").arg(str, context));
+ throw ParserException(Tr::tr("Could not parse hex number from \"%1\" (%2)").arg(str, context));
return v;
}
@@ -183,8 +183,7 @@ static qint64 parseInt64(const QString &str, const QString &context)
bool ok;
const quint64 v = str.toLongLong(&ok);
if (!ok)
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Could not parse hex number from \"%1\" (%2)").arg(str, context));
+ throw ParserException(Tr::tr("Could not parse hex number from \"%1\" (%2)").arg(str, context));
return v;
}
@@ -242,8 +241,7 @@ QString Parser::Private::blockingReadElementText()
//affects at least Qt <= 4.7.1. Reported as QTBUG-14661.
if (!reader.isStartElement())
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "trying to read element text although current position is not start of element"));
+ throw ParserException(Tr::tr("trying to read element text although current position is not start of element"));
QString result;
@@ -260,12 +258,10 @@ QString Parser::Private::blockingReadElementText()
case QXmlStreamReader::Comment:
break;
case QXmlStreamReader::StartElement:
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unexpected child element while reading element text"));
+ throw ParserException(Tr::tr("Unexpected child element while reading element text"));
default:
//TODO handle
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unexpected token type %1").arg(type));
+ throw ParserException(Tr::tr("Unexpected token type %1").arg(type));
break;
}
}
@@ -277,11 +273,9 @@ void Parser::Private::checkProtocolVersion(const QString &versionStr)
bool ok;
const int version = versionStr.toInt(&ok);
if (!ok)
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Could not parse protocol version from \"%1\"").arg(versionStr));
+ throw ParserException(Tr::tr("Could not parse protocol version from \"%1\"").arg(versionStr));
if (version != 4)
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "XmlProtocol version %1 not supported (supported version: 4)").arg(version));
+ throw ParserException(Tr::tr("XmlProtocol version %1 not supported (supported version: 4)").arg(version));
}
void Parser::Private::checkTool(const QString &reportedStr)
@@ -289,8 +283,7 @@ void Parser::Private::checkTool(const QString &reportedStr)
const QHash<QString,Parser::Tool>::ConstIterator reported = toolsByName.constFind(reportedStr);
if (reported == toolsByName.constEnd())
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Valgrind tool \"%1\" not supported").arg(reportedStr));
+ throw ParserException(Tr::tr("Valgrind tool \"%1\" not supported").arg(reportedStr));
tool = reported.value();
}
@@ -349,8 +342,7 @@ MemcheckErrorKind Parser::Private::parseMemcheckErrorKind(const QString &kind)
if (it != errorKindsByName_memcheck.constEnd())
return *it;
else
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unknown memcheck error kind \"%1\"").arg(kind));
+ throw ParserException(Tr::tr("Unknown memcheck error kind \"%1\"").arg(kind));
}
HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
@@ -359,8 +351,7 @@ HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
if (it != errorKindsByName_helgrind.constEnd())
return *it;
else
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unknown helgrind error kind \"%1\"").arg(kind));
+ throw ParserException(Tr::tr("Unknown helgrind error kind \"%1\"").arg(kind));
}
PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
@@ -369,8 +360,7 @@ PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
if (it != errorKindsByName_ptrcheck.constEnd())
return *it;
else
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unknown ptrcheck error kind \"%1\"").arg(kind));
+ throw ParserException(Tr::tr("Unknown ptrcheck error kind \"%1\"").arg(kind));
}
int Parser::Private::parseErrorKind(const QString &kind)
@@ -386,8 +376,7 @@ int Parser::Private::parseErrorKind(const QString &kind)
default:
break;
}
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Could not parse error kind, tool not yet set."));
+ throw ParserException(Tr::tr("Could not parse error kind, tool not yet set."));
}
static Status::State parseState(const QString &state)
@@ -396,8 +385,7 @@ static Status::State parseState(const QString &state)
return Status::Running;
if (state == "FINISHED")
return Status::Finished;
- throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unknown state \"%1\"").arg(state));
+ throw ParserException(Tr::tr("Unknown state \"%1\"").arg(state));
}
void Parser::Private::reportInternalError(const QString &e)
@@ -723,8 +711,7 @@ void Parser::Private::parse(QIODevice *device)
} catch (const ParserException &e) {
reportInternalError(e.message());
} catch (...) {
- reportInternalError(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
- "Unexpected exception caught during parsing."));
+ reportInternalError(Tr::tr("Unexpected exception caught during parsing."));
}
emit q->finished();
}
diff --git a/src/plugins/valgrind/xmlprotocol/stackmodel.cpp b/src/plugins/valgrind/xmlprotocol/stackmodel.cpp
index 00eb0a7a092..4674a2b56e1 100644
--- a/src/plugins/valgrind/xmlprotocol/stackmodel.cpp
+++ b/src/plugins/valgrind/xmlprotocol/stackmodel.cpp
@@ -29,6 +29,7 @@
#include "frame.h"
#include "stack.h"
#include "modelhelpers.h"
+#include "../valgrindtr.h"
#include <utils/qtcassert.h>
@@ -155,19 +156,19 @@ QVariant StackModel::headerData(int section, Qt::Orientation orientation, int ro
switch (section) {
case NameColumn:
- return tr("Description");
+ return Tr::tr("Description");
case InstructionPointerColumn:
- return tr("Instruction Pointer");
+ return Tr::tr("Instruction Pointer");
case ObjectColumn:
- return tr("Object");
+ return Tr::tr("Object");
case FunctionNameColumn:
- return tr("Function");
+ return Tr::tr("Function");
case DirectoryColumn:
- return tr("Directory");
+ return Tr::tr("Directory");
case FileColumn:
- return tr("File");
+ return Tr::tr("File");
case LineColumn:
- return tr("Line");
+ return Tr::tr("Line");
}
return QVariant();
diff --git a/src/plugins/valgrind/xmlprotocol/threadedparser.cpp b/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
index 52454855065..2712e06b84f 100644
--- a/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
+++ b/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
@@ -27,9 +27,8 @@
#include "threadedparser.h"
#include "parser.h"
#include "error.h"
-#include "frame.h"
#include "status.h"
-#include "suppression.h"
+
#include <utils/qtcassert.h>
#include <QIODevice>