forked from qt-creator/qt-creator
Project: Make setRequiredKitPredicate private
Make calling Project::supportsKit(...) the default implementation. Change-Id: I0e47972097e760e2ff3be229afb85eff839146b8 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -376,7 +376,7 @@ bool CMakeProject::knowsAllBuildExecutables() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeProject::supportsKit(Kit *k, QString *errorMessage) const
|
bool CMakeProject::supportsKit(const Kit *k, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
if (!CMakeKitInformation::cmakeTool(k)) {
|
if (!CMakeKitInformation::cmakeTool(k)) {
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
bool requiresTargetPanel() const final;
|
bool requiresTargetPanel() const final;
|
||||||
bool knowsAllBuildExecutables() const final;
|
bool knowsAllBuildExecutables() const final;
|
||||||
|
|
||||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage = 0) const final;
|
bool supportsKit(const ProjectExplorer::Kit *k, QString *errorMessage = nullptr) const final;
|
||||||
|
|
||||||
void runCMake();
|
void runCMake();
|
||||||
void runCMakeAndScanProjectTree();
|
void runCMakeAndScanProjectTree();
|
||||||
|
@@ -159,7 +159,7 @@ void NimProject::updateProject()
|
|||||||
emitParsingFinished(true);
|
emitParsingFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NimProject::supportsKit(Kit *k, QString *errorMessage) const
|
bool NimProject::supportsKit(const Kit *k, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
auto tc = dynamic_cast<NimToolChain*>(ToolChainKitInformation::toolChain(k, Constants::C_NIMLANGUAGE_ID));
|
auto tc = dynamic_cast<NimToolChain*>(ToolChainKitInformation::toolChain(k, Constants::C_NIMLANGUAGE_ID));
|
||||||
if (!tc) {
|
if (!tc) {
|
||||||
|
@@ -41,17 +41,17 @@ class NimProject : public ProjectExplorer::Project
|
|||||||
public:
|
public:
|
||||||
explicit NimProject(const Utils::FileName &fileName);
|
explicit NimProject(const Utils::FileName &fileName);
|
||||||
|
|
||||||
bool needsConfiguration() const override;
|
bool needsConfiguration() const final;
|
||||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
|
bool supportsKit(const ProjectExplorer::Kit *k, QString *errorMessage) const final;
|
||||||
Utils::FileNameList nimFiles() const;
|
Utils::FileNameList nimFiles() const;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const final;
|
||||||
|
|
||||||
bool addFiles(const QStringList &filePaths);
|
bool addFiles(const QStringList &filePaths);
|
||||||
bool removeFiles(const QStringList &filePaths);
|
bool removeFiles(const QStringList &filePaths);
|
||||||
bool renameFile(const QString &filePath, const QString &newFilePath);
|
bool renameFile(const QString &filePath, const QString &newFilePath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void scheduleProjectScan();
|
void scheduleProjectScan();
|
||||||
|
@@ -200,6 +200,8 @@ Project::Project(const QString &mimeType, const Utils::FileName &fileName,
|
|||||||
|
|
||||||
// Only set up containernode after d is set so that it will find the project directory!
|
// Only set up containernode after d is set so that it will find the project directory!
|
||||||
d->m_containerNode = std::make_unique<ContainerNode>(this);
|
d->m_containerNode = std::make_unique<ContainerNode>(this);
|
||||||
|
|
||||||
|
setRequiredKitPredicate([this](const Kit *k) { return supportsKit(k); });
|
||||||
}
|
}
|
||||||
|
|
||||||
Project::~Project()
|
Project::~Project()
|
||||||
@@ -329,7 +331,7 @@ Target *Project::target(Kit *k) const
|
|||||||
return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::kit, k));
|
return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::kit, k));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::supportsKit(Kit *k, QString *errorMessage) const
|
bool Project::supportsKit(const Kit *k, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(k);
|
Q_UNUSED(k);
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
|
@@ -123,7 +123,7 @@ public:
|
|||||||
Target *activeTarget() const;
|
Target *activeTarget() const;
|
||||||
Target *target(Core::Id id) const;
|
Target *target(Core::Id id) const;
|
||||||
Target *target(Kit *k) const;
|
Target *target(Kit *k) const;
|
||||||
virtual bool supportsKit(Kit *k, QString *errorMessage = nullptr) const;
|
virtual bool supportsKit(const Kit *k, QString *errorMessage = nullptr) const;
|
||||||
|
|
||||||
Target *createTarget(Kit *k);
|
Target *createTarget(Kit *k);
|
||||||
static bool copySteps(Target *sourceTarget, Target *newTarget);
|
static bool copySteps(Target *sourceTarget, Target *newTarget);
|
||||||
@@ -230,7 +230,8 @@ protected:
|
|||||||
void emitParsingFinished(bool success);
|
void emitParsingFinished(bool success);
|
||||||
|
|
||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
void setRequiredKitPredicate(const Kit::Predicate &predicate);
|
// Used to pre-check kits in the TargetSetupPage. RequiredKitPredicate
|
||||||
|
// is used to select kits available in the TargetSetupPage
|
||||||
void setPreferredKitPredicate(const Kit::Predicate &predicate);
|
void setPreferredKitPredicate(const Kit::Predicate &predicate);
|
||||||
|
|
||||||
void setId(Core::Id id);
|
void setId(Core::Id id);
|
||||||
@@ -242,6 +243,9 @@ protected:
|
|||||||
virtual void projectLoaded(); // Called when the project is fully loaded.
|
virtual void projectLoaded(); // Called when the project is fully loaded.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// The predicate used to select kits available in TargetSetupPage.
|
||||||
|
void setRequiredKitPredicate(const Kit::Predicate &predicate);
|
||||||
|
|
||||||
void handleSubTreeChanged(FolderNode *node);
|
void handleSubTreeChanged(FolderNode *node);
|
||||||
void setActiveTarget(Target *target);
|
void setActiveTarget(Target *target);
|
||||||
ProjectPrivate *d;
|
ProjectPrivate *d;
|
||||||
|
@@ -168,7 +168,6 @@ QmakeProject::QmakeProject(const FileName &fileName) :
|
|||||||
s_projects.append(this);
|
s_projects.append(this);
|
||||||
setId(Constants::QMAKEPROJECT_ID);
|
setId(Constants::QMAKEPROJECT_ID);
|
||||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||||
setRequiredKitPredicate(QtSupport::QtKitInformation::qtVersionPredicate());
|
|
||||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
setDisplayName(fileName.toFileInfo().completeBaseName());
|
||||||
|
|
||||||
const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
|
const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
|
||||||
@@ -589,7 +588,7 @@ void QmakeProject::buildFinished(bool success)
|
|||||||
m_qmakeVfs->invalidateContents();
|
m_qmakeVfs->invalidateContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeProject::supportsKit(Kit *k, QString *errorMessage) const
|
bool QmakeProject::supportsKit(const Kit *k, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
if (!version && errorMessage)
|
if (!version && errorMessage)
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
QmakeProFile *rootProFile() const;
|
QmakeProFile *rootProFile() const;
|
||||||
|
|
||||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMesage) const final;
|
bool supportsKit(const ProjectExplorer::Kit *k, QString *errorMesage) const final;
|
||||||
|
|
||||||
QmakeProFileNode *rootProjectNode() const final;
|
QmakeProFileNode *rootProjectNode() const final;
|
||||||
|
|
||||||
|
@@ -266,7 +266,7 @@ void QmlProject::refreshTargetDirectory()
|
|||||||
updateDeploymentData(target);
|
updateDeploymentData(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const
|
bool QmlProject::supportsKit(const Kit *k, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
explicit QmlProject(const Utils::FileName &filename);
|
explicit QmlProject(const Utils::FileName &filename);
|
||||||
~QmlProject() override;
|
~QmlProject() override;
|
||||||
|
|
||||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
|
bool supportsKit(const ProjectExplorer::Kit *k, QString *errorMessage = nullptr) const final;
|
||||||
|
|
||||||
bool validProjectFile() const;
|
bool validProjectFile() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user