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 ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace Valgrind { namespace Valgrind::Internal {
namespace Internal {
const char CallgrindLocalActionId[] = "Callgrind.Local.Action"; const char CallgrindLocalActionId[] = "Callgrind.Local.Action";
const char CallgrindRemoteActionId[] = "Callgrind.Remote.Action"; const char CallgrindRemoteActionId[] = "Callgrind.Remote.Action";
const char CALLGRIND_RUN_MODE[] = "CallgrindTool.CallgrindRunMode"; 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 Q_OBJECT
@@ -195,10 +204,7 @@ public:
Perspective m_perspective{"Callgrind.Perspective", Tr::tr("Callgrind")}; Perspective m_perspective{"Callgrind.Perspective", Tr::tr("Callgrind")};
RunWorkerFactory callgrindRunWorkerFactory{ CallgrindToolRunnerFactory callgrindRunWorkerFactory;
RunWorkerFactory::make<CallgrindToolRunner>(),
{CALLGRIND_RUN_MODE}
};
}; };
CallgrindToolPrivate::CallgrindToolPrivate() CallgrindToolPrivate::CallgrindToolPrivate()
@@ -965,7 +971,6 @@ CallgrindTool::~CallgrindTool()
delete dd; delete dd;
} }
} // namespace Internal } // Valgrind::Internal
} // namespace Valgrind
#include "callgrindtool.moc" #include "callgrindtool.moc"

View File

@@ -3,10 +3,7 @@
#pragma once #pragma once
namespace Valgrind { namespace Valgrind::Internal {
namespace Internal {
class ValgrindGlobalSettings;
class CallgrindTool final class CallgrindTool final
{ {
@@ -15,5 +12,4 @@ public:
~CallgrindTool(); ~CallgrindTool();
}; };
} // namespace Internal } // Valgrind::Internal
} // namespace Valgrind

View File

@@ -87,8 +87,7 @@ using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
using namespace Valgrind::XmlProtocol; using namespace Valgrind::XmlProtocol;
namespace Valgrind { namespace Valgrind::Internal {
namespace Internal {
const char MEMCHECK_RUN_MODE[] = "MemcheckTool.MemcheckRunMode"; const char MEMCHECK_RUN_MODE[] = "MemcheckTool.MemcheckRunMode";
const char MEMCHECK_WITH_GDB_RUN_MODE[] = "MemcheckTool.MemcheckWithGdbRunMode"; const char MEMCHECK_WITH_GDB_RUN_MODE[] = "MemcheckTool.MemcheckWithGdbRunMode";
@@ -379,6 +378,17 @@ static void initKindFilterAction(QAction *action, const QVariantList &kinds)
action->setData(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 class MemcheckToolPrivate : public QObject
{ {
public: public:
@@ -434,10 +444,7 @@ private:
QString m_exitMsg; QString m_exitMsg;
Perspective m_perspective{"Memcheck.Perspective", Tr::tr("Memcheck")}; Perspective m_perspective{"Memcheck.Perspective", Tr::tr("Memcheck")};
RunWorkerFactory memcheckToolRunnerFactory{ MemcheckToolRunnerFactory memcheckToolRunnerFactory;
RunWorkerFactory::make<MemcheckToolRunner>(),
{MEMCHECK_RUN_MODE, MEMCHECK_WITH_GDB_RUN_MODE}
};
}; };
static MemcheckToolPrivate *dd = nullptr; static MemcheckToolPrivate *dd = nullptr;
@@ -1775,7 +1782,6 @@ MemcheckTool::~MemcheckTool()
delete dd; delete dd;
} }
} // namespace Internal } // Valgrind::Internal
} // namespace Valgrind
#include "memchecktool.moc" #include "memchecktool.moc"

View File

@@ -3,8 +3,7 @@
#pragma once #pragma once
namespace Valgrind { namespace Valgrind::Internal {
namespace Internal {
class MemcheckToolRunner; class MemcheckToolRunner;
@@ -15,5 +14,4 @@ public:
~MemcheckTool(); ~MemcheckTool();
}; };
} // namespace Internal } // Valgrind::Internal
} // namespace Valgrind