Core/Utils: Migrate further to Utils::Id

The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-06-26 13:59:38 +02:00
parent c9eedbe0f3
commit e1c88116b3
655 changed files with 2115 additions and 2093 deletions

View File

@@ -74,13 +74,13 @@ namespace ProjectExplorer {
static QList<RunWorkerFactory *> g_runWorkerFactories;
static QSet<Core::Id> g_runModes;
static QSet<Core::Id> g_runConfigs;
static QSet<Utils::Id> g_runModes;
static QSet<Utils::Id> g_runConfigs;
RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
const QList<Core::Id> &runModes,
const QList<Core::Id> &runConfigs,
const QList<Core::Id> &deviceTypes)
const QList<Utils::Id> &runModes,
const QList<Utils::Id> &runConfigs,
const QList<Utils::Id> &deviceTypes)
: m_producer(producer),
m_supportedRunModes(runModes),
m_supportedRunConfigurations(runConfigs),
@@ -89,9 +89,9 @@ RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
g_runWorkerFactories.append(this);
// Debugging only.
for (Core::Id runMode : runModes)
for (Utils::Id runMode : runModes)
g_runModes.insert(runMode);
for (Core::Id runConfig : runConfigs)
for (Utils::Id runConfig : runConfigs)
g_runConfigs.insert(runConfig);
}
@@ -100,8 +100,8 @@ RunWorkerFactory::~RunWorkerFactory()
g_runWorkerFactories.removeOne(this);
}
bool RunWorkerFactory::canRun(Core::Id runMode,
Core::Id deviceType,
bool RunWorkerFactory::canRun(Utils::Id runMode,
Utils::Id deviceType,
const QString &runConfigId) const
{
if (!m_supportedRunModes.contains(runMode))
@@ -112,7 +112,7 @@ bool RunWorkerFactory::canRun(Core::Id runMode,
//if (!m_supportedRunConfigurations.contains(runConfigId)
// return false;
bool ok = false;
for (const Core::Id &id : m_supportedRunConfigurations) {
for (const Utils::Id &id : m_supportedRunConfigurations) {
if (runConfigId.startsWith(id.toString())) {
ok = true;
break;
@@ -131,13 +131,13 @@ bool RunWorkerFactory::canRun(Core::Id runMode,
void RunWorkerFactory::dumpAll()
{
const QList<Core::Id> devices =
const QList<Utils::Id> devices =
Utils::transform(IDeviceFactory::allDeviceFactories(), &IDeviceFactory::deviceType);
for (Core::Id runMode : qAsConst(g_runModes)) {
for (Utils::Id runMode : qAsConst(g_runModes)) {
qDebug() << "";
for (Core::Id device : devices) {
for (Core::Id runConfig : qAsConst(g_runConfigs)) {
for (Utils::Id device : devices) {
for (Utils::Id runConfig : qAsConst(g_runConfigs)) {
const auto check = std::bind(&RunWorkerFactory::canRun,
std::placeholders::_1,
runMode,
@@ -276,7 +276,7 @@ static QString stateName(RunControlState s)
class RunControlPrivate : public QObject
{
public:
RunControlPrivate(RunControl *parent, Core::Id mode)
RunControlPrivate(RunControl *parent, Utils::Id mode)
: q(parent), runMode(mode)
{
icon = Icons::RUN_SMALL_TOOLBAR;
@@ -319,13 +319,13 @@ public:
QString displayName;
Runnable runnable;
IDevice::ConstPtr device;
Core::Id runMode;
Utils::Id runMode;
Utils::Icon icon;
const MacroExpander *macroExpander;
QPointer<RunConfiguration> runConfiguration; // Not owned. Avoid use.
QString buildKey;
QMap<Core::Id, QVariantMap> settingsData;
Core::Id runConfigId;
QMap<Utils::Id, QVariantMap> settingsData;
Utils::Id runConfigId;
BuildTargetInfo buildTargetInfo;
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
FilePath buildDirectory;
@@ -348,7 +348,7 @@ public:
using namespace Internal;
RunControl::RunControl(Core::Id mode) :
RunControl::RunControl(Utils::Id mode) :
d(std::make_unique<RunControlPrivate>(this, mode))
{
}
@@ -459,7 +459,7 @@ void RunControl::initiateFinish()
QTimer::singleShot(0, d.get(), &RunControlPrivate::initiateFinish);
}
RunWorker *RunControl::createWorker(Core::Id workerId)
RunWorker *RunControl::createWorker(Utils::Id workerId)
{
const auto check = std::bind(&RunWorkerFactory::canRun,
std::placeholders::_1,
@@ -489,7 +489,7 @@ bool RunControl::createMainWorker()
return candidates.front()->producer()(this) != nullptr;
}
bool RunControl::canRun(Core::Id runMode, Core::Id deviceType, Core::Id runConfigId)
bool RunControl::canRun(Utils::Id runMode, Utils::Id deviceType, Utils::Id runConfigId)
{
const auto check = std::bind(&RunWorkerFactory::canRun,
std::placeholders::_1,
@@ -829,7 +829,7 @@ QList<Utils::OutputLineParser *> RunControl::createOutputParsers() const
QList<Utils::OutputLineParser *> parsers = OutputFormatterFactory::createFormatters(target());
if (const auto customParsersAspect
= (runConfiguration() ? runConfiguration()->aspect<CustomParsersAspect>() : nullptr)) {
for (const Core::Id id : customParsersAspect->parsers()) {
for (const Utils::Id id : customParsersAspect->parsers()) {
if (CustomParser * const parser = CustomParser::createFromId(id))
parsers << parser;
}
@@ -837,7 +837,7 @@ QList<Utils::OutputLineParser *> RunControl::createOutputParsers() const
return parsers;
}
Core::Id RunControl::runMode() const
Utils::Id RunControl::runMode() const
{
return d->runMode;
}
@@ -902,12 +902,12 @@ const MacroExpander *RunControl::macroExpander() const
return d->macroExpander;
}
ProjectConfigurationAspect *RunControl::aspect(Core::Id id) const
ProjectConfigurationAspect *RunControl::aspect(Utils::Id id) const
{
return d->runConfiguration ? d->runConfiguration->aspect(id) : nullptr;
}
QVariantMap RunControl::settingsData(Core::Id id) const
QVariantMap RunControl::settingsData(Utils::Id id) const
{
return d->settingsData.value(id);
}