Valgrind: Use named classes for run worker factories

Change-Id: I05009aa2fe4541e10fa56a3a095db030e18b79b5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-01-05 09:07:46 +01:00
parent 15d6e1df1b
commit 67195f4270
4 changed files with 32 additions and 27 deletions

View File

@@ -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<CallgrindToolRunner>();
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<CallgrindToolRunner>(),
{CALLGRIND_RUN_MODE}
};
CallgrindToolRunnerFactory callgrindRunWorkerFactory;
};
CallgrindToolPrivate::CallgrindToolPrivate()
@@ -965,7 +971,6 @@ CallgrindTool::~CallgrindTool()
delete dd;
}
} // namespace Internal
} // namespace Valgrind
} // Valgrind::Internal
#include "callgrindtool.moc"

View File

@@ -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

View File

@@ -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<MemcheckToolRunner>();
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<MemcheckToolRunner>(),
{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"

View File

@@ -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