PE: Let build config factories handle multiple project mime types

Change-Id: I95ee363357da9f210672c42b5c6be3378fa51d9a
Reviewed-by: Jaime Resano <Jaime.RESANO-AISA@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2025-03-10 16:05:30 +01:00
parent 896739d136
commit 74e57329aa
2 changed files with 14 additions and 5 deletions

View File

@@ -1270,9 +1270,12 @@ BuildConfigurationFactory *BuildConfigurationFactory::find(const Kit *k, const F
QTC_ASSERT(k, return nullptr); QTC_ASSERT(k, return nullptr);
const Utils::Id deviceType = RunDeviceTypeKitAspect::deviceTypeId(k); const Utils::Id deviceType = RunDeviceTypeKitAspect::deviceTypeId(k);
for (BuildConfigurationFactory *factory : std::as_const(g_buildConfigurationFactories)) { for (BuildConfigurationFactory *factory : std::as_const(g_buildConfigurationFactories)) {
if (Utils::mimeTypeForFile(projectPath).matchesName(factory->m_supportedProjectMimeTypeName) if (!factory->supportsTargetDeviceType(deviceType))
&& factory->supportsTargetDeviceType(deviceType)) continue;
return factory; for (const QString &mimeType : std::as_const(factory->m_supportedProjectMimeTypeNames)) {
if (Utils::mimeTypeForFile(projectPath).matchesName(mimeType))
return factory;
}
} }
return nullptr; return nullptr;
} }
@@ -1294,7 +1297,12 @@ void BuildConfigurationFactory::setSupportedProjectType(Utils::Id id)
void BuildConfigurationFactory::setSupportedProjectMimeTypeName(const QString &mimeTypeName) void BuildConfigurationFactory::setSupportedProjectMimeTypeName(const QString &mimeTypeName)
{ {
m_supportedProjectMimeTypeName = mimeTypeName; setSupportedProjectMimeTypeNames({mimeTypeName});
}
void BuildConfigurationFactory::setSupportedProjectMimeTypeNames(const QStringList &mimeTypeNames)
{
m_supportedProjectMimeTypeNames = mimeTypeNames;
} }
void BuildConfigurationFactory::addSupportedTargetDeviceType(Utils::Id id) void BuildConfigurationFactory::addSupportedTargetDeviceType(Utils::Id id)

View File

@@ -210,6 +210,7 @@ protected:
bool supportsTargetDeviceType(Utils::Id id) const; bool supportsTargetDeviceType(Utils::Id id) const;
void setSupportedProjectType(Utils::Id id); void setSupportedProjectType(Utils::Id id);
void setSupportedProjectMimeTypeName(const QString &mimeTypeName); void setSupportedProjectMimeTypeName(const QString &mimeTypeName);
void setSupportedProjectMimeTypeNames(const QStringList &mimeTypeNames);
void addSupportedTargetDeviceType(Utils::Id id); void addSupportedTargetDeviceType(Utils::Id id);
void setDefaultDisplayName(const QString &defaultDisplayName); void setDefaultDisplayName(const QString &defaultDisplayName);
@@ -229,7 +230,7 @@ private:
Utils::Id m_buildConfigId; Utils::Id m_buildConfigId;
Utils::Id m_supportedProjectType; Utils::Id m_supportedProjectType;
QList<Utils::Id> m_supportedTargetDeviceTypes; QList<Utils::Id> m_supportedTargetDeviceTypes;
QString m_supportedProjectMimeTypeName; QStringList m_supportedProjectMimeTypeNames;
IssueReporter m_issueReporter; IssueReporter m_issueReporter;
BuildGenerator m_buildGenerator; BuildGenerator m_buildGenerator;
}; };