forked from qt-creator/qt-creator
ProjectExplorer: Consolidate RunConfigurationFactory::ids
It was already only one id string with two names. Since it is not an id for the factory but the id of the created run configuration, settle of runConfigurationId() as accessor. The factory and id fields in RunConfigurationCreationInfo were redundant. factory always implies (runconfiguration)id (but not necessarily the other way round, in theory different factories are possible for the same runconfiguration type for different devices). So drop the id field here. In one case now factory pointers instead of ids are compared, but this is neutral there as this happens in a context of a fixed Target, device and project are fixed there, so id and factory are equally unique. Change-Id: I859aa91486a2dd4abfc7369540a3322d6ec6260d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -120,22 +120,22 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidRunSupport>(),
|
||||
{NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidDebugSupport>(),
|
||||
{DEBUG_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory profilerWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidQmlToolingSupport>(),
|
||||
{QML_PROFILER_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewWorkerFactory{
|
||||
RunWorkerFactory::make<AndroidQmlToolingSupport>(),
|
||||
{QML_PREVIEW_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewWorkerFactory2{
|
||||
RunWorkerFactory::make<AndroidQmlPreviewWorker>(),
|
||||
|
@@ -82,7 +82,8 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<BareMetalDebugSupport>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE, ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigurationFactory.id(), customRunConfigurationFactory.id()}
|
||||
{runConfigurationFactory.runConfigurationId(),
|
||||
customRunConfigurationFactory.runConfigurationId()}
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -184,7 +184,7 @@ public:
|
||||
m_makeInstallStepFactory{RemoteLinux::Constants::MakeInstallStepId};
|
||||
|
||||
const QList<Core::Id> supportedRunConfigs {
|
||||
m_runConfigFactory.id(),
|
||||
m_runConfigFactory.runConfigurationId(),
|
||||
"QmlProjectManager.QmlRunConfiguration"
|
||||
};
|
||||
|
||||
|
@@ -85,17 +85,17 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<IosRunSupport>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigurationFactory.id()}
|
||||
{runConfigurationFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<IosDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigurationFactory.id()}
|
||||
{runConfigurationFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<IosQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
{runConfigurationFactory.id()}
|
||||
{runConfigurationFactory.runConfigurationId()}
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -88,7 +88,7 @@ private:
|
||||
RunWorkerFactory
|
||||
m_mesonRunWorkerFactory{RunWorkerFactory::make<ProjectExplorer::SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{m_runConfigurationFactory.id()}};
|
||||
{m_runConfigurationFactory.runConfigurationId()}};
|
||||
void saveAll()
|
||||
{
|
||||
m_toolsSettings.saveMesonTools(MesonTools::tools(), ICore::dialogParent());
|
||||
|
@@ -78,17 +78,17 @@ public:
|
||||
RunWorkerFactory nimRunWorkerFactory {
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{nimRunConfigFactory.id()}
|
||||
{nimRunConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory nimbleRunWorkerFactory {
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{nimbleRunConfigFactory.id()}
|
||||
{nimbleRunConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory nimbleTestWorkerFactory {
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{nimbleTestConfigFactory.id()}
|
||||
{nimbleTestConfigFactory.runConfigurationId()}
|
||||
};
|
||||
NimbleBuildStepFactory nimbleBuildStepFactory;
|
||||
NimbleTaskStepFactory nimbleTaskStepFactory;
|
||||
|
@@ -184,7 +184,7 @@ void AddRunConfigDialog::accept()
|
||||
const TreeItem * const item = model->itemForIndex(proxyModel->mapToSource(selected.first()));
|
||||
QTC_ASSERT(item, return);
|
||||
m_creationInfo = static_cast<const CandidateTreeItem *>(item)->creationInfo();
|
||||
QTC_ASSERT(m_creationInfo.id.isValid(), return);
|
||||
QTC_ASSERT(m_creationInfo.factory, return);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
@@ -624,7 +624,7 @@ public:
|
||||
RunWorkerFactory m_customExecutableRunWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{Constants::NORMAL_RUN_MODE},
|
||||
{m_customExecutableRunConfigFactory.id()}
|
||||
{m_customExecutableRunConfigFactory.runConfigurationId()}
|
||||
};
|
||||
|
||||
ProjectFileWizardExtension m_projectFileWizardExtension;
|
||||
@@ -657,7 +657,9 @@ public:
|
||||
RunWorkerFactory desktopRunWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{qmakeRunConfigFactory.id(), qbsRunConfigFactory.id(), cmakeRunConfigFactory.id()}
|
||||
{qmakeRunConfigFactory.runConfigurationId(),
|
||||
qbsRunConfigFactory.runConfigurationId(),
|
||||
cmakeRunConfigFactory.runConfigurationId()}
|
||||
};
|
||||
|
||||
};
|
||||
|
@@ -458,7 +458,6 @@ RunConfigurationFactory::availableCreators(Target *target) const
|
||||
displayName = decoratedTargetName(displayName, target);
|
||||
RunConfigurationCreationInfo rci;
|
||||
rci.factory = this;
|
||||
rci.id = m_runConfigBaseId;
|
||||
rci.buildKey = ti.buildKey;
|
||||
rci.projectFilePath = ti.projectFilePath;
|
||||
rci.displayName = displayName;
|
||||
@@ -532,7 +531,6 @@ RunConfiguration *RunConfigurationFactory::create(Target *target) const
|
||||
RunConfiguration *RunConfigurationCreationInfo::create(Target *target) const
|
||||
{
|
||||
QTC_ASSERT(factory->canHandle(target), return nullptr);
|
||||
QTC_ASSERT(id == factory->runConfigurationBaseId(), return nullptr);
|
||||
|
||||
RunConfiguration *rc = factory->create(target);
|
||||
if (!rc)
|
||||
@@ -550,7 +548,7 @@ RunConfiguration *RunConfigurationFactory::restore(Target *parent, const QVarian
|
||||
for (RunConfigurationFactory *factory : g_runConfigurationFactories) {
|
||||
if (factory->canHandle(parent)) {
|
||||
const Core::Id id = idFromMap(map);
|
||||
if (id.name().startsWith(factory->m_runConfigBaseId.name())) {
|
||||
if (id.name().startsWith(factory->m_runConfigurationId.name())) {
|
||||
RunConfiguration *rc = factory->create(parent);
|
||||
if (rc->fromMap(map)) {
|
||||
rc->update();
|
||||
@@ -601,7 +599,6 @@ FixedRunConfigurationFactory::availableCreators(Target *parent) const
|
||||
: m_fixedBuildTarget;
|
||||
RunConfigurationCreationInfo rci;
|
||||
rci.factory = this;
|
||||
rci.id = runConfigurationBaseId();
|
||||
rci.displayName = displayName;
|
||||
return {rci};
|
||||
}
|
||||
|
@@ -207,7 +207,6 @@ public:
|
||||
RunConfiguration *create(Target *target) const;
|
||||
|
||||
const RunConfigurationFactory *factory = nullptr;
|
||||
Core::Id id;
|
||||
QString buildKey;
|
||||
QString displayName;
|
||||
QString displayNameUniquifier;
|
||||
@@ -228,8 +227,7 @@ public:
|
||||
static RunConfiguration *clone(Target *parent, RunConfiguration *source);
|
||||
static const QList<RunConfigurationCreationInfo> creatorsForTarget(Target *parent);
|
||||
|
||||
Core::Id id() const { return m_runConfigBaseId; }
|
||||
Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
|
||||
Core::Id runConfigurationId() const { return m_runConfigurationId; }
|
||||
|
||||
static QString decoratedTargetName(const QString &targetName, Target *kit);
|
||||
|
||||
@@ -239,16 +237,16 @@ protected:
|
||||
using RunConfigurationCreator = std::function<RunConfiguration *(Target *)>;
|
||||
|
||||
template <class RunConfig>
|
||||
void registerRunConfiguration(Core::Id runConfigBaseId)
|
||||
void registerRunConfiguration(Core::Id runConfigurationId)
|
||||
{
|
||||
m_creator = [runConfigBaseId](Target *t) -> RunConfiguration * {
|
||||
return new RunConfig(t, runConfigBaseId);
|
||||
m_creator = [runConfigurationId](Target *t) -> RunConfiguration * {
|
||||
return new RunConfig(t, runConfigurationId);
|
||||
};
|
||||
m_runConfigBaseId = runConfigBaseId;
|
||||
m_runConfigurationId = runConfigurationId;
|
||||
}
|
||||
|
||||
void addSupportedProjectType(Core::Id id);
|
||||
void addSupportedTargetDeviceType(Core::Id id);
|
||||
void addSupportedProjectType(Core::Id projectTypeId);
|
||||
void addSupportedTargetDeviceType(Core::Id deviceTypeId);
|
||||
void setDecorateDisplayNames(bool on);
|
||||
|
||||
private:
|
||||
@@ -257,7 +255,7 @@ private:
|
||||
|
||||
friend class RunConfigurationCreationInfo;
|
||||
RunConfigurationCreator m_creator;
|
||||
Core::Id m_runConfigBaseId;
|
||||
Core::Id m_runConfigurationId;
|
||||
QList<Core::Id> m_supportedProjectTypes;
|
||||
QList<Core::Id> m_supportedTargetDeviceTypes;
|
||||
bool m_decorateDisplayNames = false;
|
||||
|
@@ -201,11 +201,11 @@ void RunSettingsWidget::showAddRunConfigDialog()
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
RunConfigurationCreationInfo rci = dlg.creationInfo();
|
||||
QTC_ASSERT(rci.id.isValid(), return);
|
||||
QTC_ASSERT(rci.factory, return);
|
||||
RunConfiguration *newRC = rci.create(m_target);
|
||||
if (!newRC)
|
||||
return;
|
||||
QTC_CHECK(newRC->id() == rci.id);
|
||||
QTC_CHECK(newRC->id() == rci.factory->runConfigurationId());
|
||||
m_target->addRunConfiguration(newRC);
|
||||
m_target->setActiveRunConfiguration(newRC);
|
||||
m_removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
|
||||
|
@@ -625,7 +625,7 @@ void Target::updateDefaultRunConfigurations()
|
||||
bool present = false;
|
||||
for (const RunConfigurationCreationInfo &item : creators) {
|
||||
QString buildKey = rc->buildKey();
|
||||
if (item.id == rc->id() && item.buildKey == buildKey) {
|
||||
if (item.factory->runConfigurationId() == rc->id() && item.buildKey == buildKey) {
|
||||
existing.append(item);
|
||||
present = true;
|
||||
}
|
||||
@@ -643,7 +643,7 @@ void Target::updateDefaultRunConfigurations()
|
||||
continue;
|
||||
bool exists = false;
|
||||
for (const RunConfigurationCreationInfo &ex : existing) {
|
||||
if (ex.id == item.id && ex.buildKey == item.buildKey)
|
||||
if (ex.factory == item.factory && ex.buildKey == item.buildKey)
|
||||
exists = true;
|
||||
}
|
||||
if (exists)
|
||||
@@ -652,7 +652,7 @@ void Target::updateDefaultRunConfigurations()
|
||||
RunConfiguration *rc = item.create(this);
|
||||
if (!rc)
|
||||
continue;
|
||||
QTC_CHECK(rc->id() == item.id);
|
||||
QTC_CHECK(rc->id() == item.factory->runConfigurationId());
|
||||
if (!rc->isConfigured())
|
||||
newUnconfigured << rc;
|
||||
else
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -132,17 +132,17 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<QnxDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<QnxQmlProfilerSupport>(),
|
||||
{}, // FIXME: Shouldn't this use the run mode id somehow?
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -83,8 +83,8 @@ public:
|
||||
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory;
|
||||
|
||||
const QList<Core::Id> supportedRunConfigs {
|
||||
runConfigurationFactory.id(),
|
||||
customRunConfigurationFactory.id(),
|
||||
runConfigurationFactory.runConfigurationId(),
|
||||
customRunConfigurationFactory.runConfigurationId(),
|
||||
"QmlProjectManager.QmlRunConfiguration"
|
||||
};
|
||||
|
||||
|
@@ -62,13 +62,13 @@ public:
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<WinRtRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.id()}
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<WinRtDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigFactory.id()},
|
||||
{runConfigFactory.runConfigurationId()},
|
||||
{Internal::Constants::WINRT_DEVICE_TYPE_LOCAL}
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user