forked from qt-creator/qt-creator
Merge DeployConfigurationFactory::{canHandle,canOffer}
Previous uses of canOffer are effectively unchanged in behavior, other plain uses of canHandle now also check the additional requirements on the Qt version on Android (the only platform that had a custom hasBuildTarget() implementation). This is assumed to make no difference in practice. Change-Id: If12895d1421d5565ff91a18bf4d7df96c8191160 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -60,8 +60,11 @@ AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory()
|
||||
setDefaultDisplayName(AndroidDeployConfiguration::tr("Deploy to Android device"));
|
||||
}
|
||||
|
||||
bool AndroidDeployConfigurationFactory::hasAvailableBuildTargets(Target *parent) const
|
||||
bool AndroidDeployConfigurationFactory::canHandle(Target *parent) const
|
||||
{
|
||||
if (!DeployConfigurationFactory::canHandle(parent))
|
||||
return false;
|
||||
|
||||
if (!parent->project()->id().name().startsWith("QmlProjectManager.QmlProject")) {
|
||||
// Avoid tool chain check for QML Project
|
||||
Core::Id cxxLangId(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
|
||||
@@ -44,7 +44,7 @@ class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigur
|
||||
public:
|
||||
AndroidDeployConfigurationFactory();
|
||||
|
||||
bool hasAvailableBuildTargets(ProjectExplorer::Target *parent) const override;
|
||||
bool canHandle(ProjectExplorer::Target *parent) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -151,21 +151,11 @@ DeployConfigurationFactory::~DeployConfigurationFactory()
|
||||
g_deployConfigurationFactories.removeOne(this);
|
||||
}
|
||||
|
||||
bool DeployConfigurationFactory::canOffer(Target *parent) const
|
||||
{
|
||||
return canHandle(parent) && hasAvailableBuildTargets(parent);
|
||||
}
|
||||
|
||||
Core::Id DeployConfigurationFactory::creationId() const
|
||||
{
|
||||
return m_deployConfigBaseId;
|
||||
}
|
||||
|
||||
bool DeployConfigurationFactory::hasAvailableBuildTargets(Target *) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QString DeployConfigurationFactory::defaultDisplayName() const
|
||||
{
|
||||
return m_defaultDisplayName;
|
||||
@@ -242,7 +232,7 @@ const QList<DeployConfigurationFactory *> DeployConfigurationFactory::find(Targe
|
||||
{
|
||||
return Utils::filtered(g_deployConfigurationFactories,
|
||||
[&parent](DeployConfigurationFactory *factory) {
|
||||
return factory->canOffer(parent);
|
||||
return factory->canHandle(parent);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@ public:
|
||||
// the name to display to the user
|
||||
QString defaultDisplayName() const;
|
||||
|
||||
bool canOffer(Target *parent) const;
|
||||
bool canCreate(Target *parent, Core::Id id) const;
|
||||
virtual DeployConfiguration *create(Target *parent, Core::Id id);
|
||||
|
||||
@@ -97,10 +96,9 @@ public:
|
||||
void setDefaultDisplayName(const QString &defaultDisplayName);
|
||||
void setSupportedProjectType(Core::Id id);
|
||||
|
||||
protected:
|
||||
virtual bool canHandle(ProjectExplorer::Target *target) const;
|
||||
virtual bool hasAvailableBuildTargets(Target *parent) const;
|
||||
|
||||
protected:
|
||||
using DeployConfigurationCreator = std::function<DeployConfiguration *(Target *)>;
|
||||
|
||||
template <class DeployConfig>
|
||||
|
||||
Reference in New Issue
Block a user