From 67195f4270b53e33dea704ded57ed96dcd4af54e Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 5 Jan 2023 09:07:46 +0100 Subject: [PATCH] Valgrind: Use named classes for run worker factories Change-Id: I05009aa2fe4541e10fa56a3a095db030e18b79b5 Reviewed-by: Christian Stenger Reviewed-by: --- src/plugins/valgrind/callgrindtool.cpp | 23 ++++++++++++++--------- src/plugins/valgrind/callgrindtool.h | 8 ++------ src/plugins/valgrind/memchecktool.cpp | 22 ++++++++++++++-------- src/plugins/valgrind/memchecktool.h | 6 ++---- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index b959ecfcbd2..70e7a4ee42a 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -78,14 +78,23 @@ using namespace TextEditor; using namespace ProjectExplorer; using namespace Utils; -namespace Valgrind { -namespace Internal { +namespace Valgrind::Internal { const char CallgrindLocalActionId[] = "Callgrind.Local.Action"; const char CallgrindRemoteActionId[] = "Callgrind.Remote.Action"; const char CALLGRIND_RUN_MODE[] = "CallgrindTool.CallgrindRunMode"; -class CallgrindToolPrivate : public QObject +class CallgrindToolRunnerFactory final : public RunWorkerFactory +{ +public: + CallgrindToolRunnerFactory() + { + setProduct(); + addSupportedRunMode(CALLGRIND_RUN_MODE); + } +}; + +class CallgrindToolPrivate final : public QObject { Q_OBJECT @@ -195,10 +204,7 @@ public: Perspective m_perspective{"Callgrind.Perspective", Tr::tr("Callgrind")}; - RunWorkerFactory callgrindRunWorkerFactory{ - RunWorkerFactory::make(), - {CALLGRIND_RUN_MODE} - }; + CallgrindToolRunnerFactory callgrindRunWorkerFactory; }; CallgrindToolPrivate::CallgrindToolPrivate() @@ -965,7 +971,6 @@ CallgrindTool::~CallgrindTool() delete dd; } -} // namespace Internal -} // namespace Valgrind +} // Valgrind::Internal #include "callgrindtool.moc" diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h index 63909455641..8b4b00f7dad 100644 --- a/src/plugins/valgrind/callgrindtool.h +++ b/src/plugins/valgrind/callgrindtool.h @@ -3,10 +3,7 @@ #pragma once -namespace Valgrind { -namespace Internal { - -class ValgrindGlobalSettings; +namespace Valgrind::Internal { class CallgrindTool final { @@ -15,5 +12,4 @@ public: ~CallgrindTool(); }; -} // namespace Internal -} // namespace Valgrind +} // Valgrind::Internal diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index b9789260e8d..23e0fc7cb8d 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -87,8 +87,7 @@ using namespace ProjectExplorer; using namespace Utils; using namespace Valgrind::XmlProtocol; -namespace Valgrind { -namespace Internal { +namespace Valgrind::Internal { const char MEMCHECK_RUN_MODE[] = "MemcheckTool.MemcheckRunMode"; const char MEMCHECK_WITH_GDB_RUN_MODE[] = "MemcheckTool.MemcheckWithGdbRunMode"; @@ -379,6 +378,17 @@ static void initKindFilterAction(QAction *action, const QVariantList &kinds) action->setData(kinds); } +class MemcheckToolRunnerFactory final : public RunWorkerFactory +{ +public: + MemcheckToolRunnerFactory() + { + setProduct(); + addSupportedRunMode(MEMCHECK_RUN_MODE); + addSupportedRunMode(MEMCHECK_WITH_GDB_RUN_MODE); + } +}; + class MemcheckToolPrivate : public QObject { public: @@ -434,10 +444,7 @@ private: QString m_exitMsg; Perspective m_perspective{"Memcheck.Perspective", Tr::tr("Memcheck")}; - RunWorkerFactory memcheckToolRunnerFactory{ - RunWorkerFactory::make(), - {MEMCHECK_RUN_MODE, MEMCHECK_WITH_GDB_RUN_MODE} - }; + MemcheckToolRunnerFactory memcheckToolRunnerFactory; }; static MemcheckToolPrivate *dd = nullptr; @@ -1775,7 +1782,6 @@ MemcheckTool::~MemcheckTool() delete dd; } -} // namespace Internal -} // namespace Valgrind +} // Valgrind::Internal #include "memchecktool.moc" diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h index 5ddd38b3fef..a7e270cfca7 100644 --- a/src/plugins/valgrind/memchecktool.h +++ b/src/plugins/valgrind/memchecktool.h @@ -3,8 +3,7 @@ #pragma once -namespace Valgrind { -namespace Internal { +namespace Valgrind::Internal { class MemcheckToolRunner; @@ -15,5 +14,4 @@ public: ~MemcheckTool(); }; -} // namespace Internal -} // namespace Valgrind +} // Valgrind::Internal