forked from qt-creator/qt-creator
ProjectNode: Provide default implementations of a few functions
Since a lot of derived classes can make use of those. Change-Id: I051542e8d318476348d753de4d4c0a30b3a9ed62 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -56,51 +56,3 @@ QList<ProjectAction> AutotoolsProjectNode::supportedActions(Node *node) const
|
||||
Q_UNUSED(node);
|
||||
return QList<ProjectAction>();
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::addFiles( const QStringList &filePaths,
|
||||
QStringList *notAdded)
|
||||
{
|
||||
Q_UNUSED(filePaths);
|
||||
Q_UNUSED(notAdded);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::removeFiles(const QStringList &filePaths,
|
||||
QStringList *notRemoved)
|
||||
{
|
||||
Q_UNUSED(filePaths);
|
||||
Q_UNUSED(notRemoved);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(filePaths);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutotoolsProjectNode::renameFile(const QString &filePath,
|
||||
const QString &newFilePath)
|
||||
{
|
||||
Q_UNUSED(filePath);
|
||||
Q_UNUSED(newFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,14 +58,6 @@ public:
|
||||
|
||||
bool showInSimpleTree() const;
|
||||
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
bool canAddSubProject(const QString &proFilePath) const;
|
||||
bool addSubProjects(const QStringList &proFilePaths);
|
||||
bool removeSubProjects(const QStringList &proFilePaths);
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
||||
bool deleteFiles(const QStringList &filePaths);
|
||||
bool renameFile(const QString &filePath,
|
||||
const QString &newFilePath);
|
||||
|
||||
private:
|
||||
AutotoolsProject *m_project;
|
||||
|
||||
@@ -49,48 +49,3 @@ QList<ProjectExplorer::ProjectAction> CMakeProjectNode::supportedActions(Node *n
|
||||
Q_UNUSED(node);
|
||||
return QList<ProjectExplorer::ProjectAction>();
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
Q_UNUSED(notAdded)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
Q_UNUSED(notRemoved)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
Q_UNUSED(filePath)
|
||||
Q_UNUSED(newFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,18 +45,6 @@ public:
|
||||
CMakeProjectNode(const Utils::FileName &fileName);
|
||||
virtual bool showInSimpleTree() const;
|
||||
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
|
||||
virtual bool canAddSubProject(const QString &proFilePath) const;
|
||||
|
||||
virtual bool addSubProjects(const QStringList &proFilePaths);
|
||||
virtual bool removeSubProjects(const QStringList &proFilePaths);
|
||||
virtual bool addFiles( const QStringList &filePaths,
|
||||
QStringList *notAdded = 0);
|
||||
virtual bool removeFiles(const QStringList &filePaths,
|
||||
QStringList *notRemoved = 0);
|
||||
virtual bool deleteFiles(const QStringList &filePaths);
|
||||
virtual bool renameFile(const QString &filePath,
|
||||
const QString &newFilePath);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -229,24 +229,6 @@ QList<ProjectAction> GenericProjectNode::supportedActions(Node *node) const
|
||||
<< Rename;
|
||||
}
|
||||
|
||||
bool GenericProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenericProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenericProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenericProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
{
|
||||
Q_UNUSED(notAdded)
|
||||
@@ -261,12 +243,6 @@ bool GenericProjectNode::removeFiles(const QStringList &filePaths, QStringList *
|
||||
return m_project->removeFiles(filePaths);
|
||||
}
|
||||
|
||||
bool GenericProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenericProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
return m_project->renameFile(filePath, newFilePath);
|
||||
|
||||
@@ -56,14 +56,8 @@ public:
|
||||
|
||||
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
|
||||
bool canAddSubProject(const QString &proFilePath) const;
|
||||
|
||||
bool addSubProjects(const QStringList &proFilePaths);
|
||||
bool removeSubProjects(const QStringList &proFilePaths);
|
||||
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
||||
bool deleteFiles(const QStringList &filePaths);
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath);
|
||||
|
||||
void refresh(QSet<QString> oldFileList = QSet<QString>());
|
||||
|
||||
@@ -591,25 +591,50 @@ QList<ProjectNode*> ProjectNode::subProjectNodes() const
|
||||
return m_subProjectNodes;
|
||||
}
|
||||
|
||||
/*!
|
||||
\function bool ProjectNode::addSubProjects(const QStringList &)
|
||||
*/
|
||||
bool ProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\function bool ProjectNode::removeSubProjects(const QStringList &)
|
||||
*/
|
||||
bool ProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\function bool ProjectNode::addFiles(const FileType, const QStringList &, QStringList *)
|
||||
*/
|
||||
bool ProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\function bool ProjectNode::removeFiles(const FileType, const QStringList &, QStringList *)
|
||||
*/
|
||||
bool ProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
Q_UNUSED(notAdded)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\function bool ProjectNode::renameFile(const FileType, const QString &, const QString &)
|
||||
*/
|
||||
bool ProjectNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
Q_UNUSED(notRemoved)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
Q_UNUSED(filePath)
|
||||
Q_UNUSED(newFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProjectNode::deploysFolder(const QString &folder) const
|
||||
{
|
||||
|
||||
@@ -245,27 +245,30 @@ public:
|
||||
// all subFolders that are projects
|
||||
QList<ProjectNode*> subProjectNodes() const;
|
||||
|
||||
virtual bool canAddSubProject(const QString &proFilePath) const = 0;
|
||||
virtual bool canAddSubProject(const QString &proFilePath) const;
|
||||
virtual bool addSubProjects(const QStringList &proFilePaths);
|
||||
virtual bool removeSubProjects(const QStringList &proFilePaths);
|
||||
|
||||
virtual bool addSubProjects(const QStringList &proFilePaths) = 0;
|
||||
|
||||
virtual bool removeSubProjects(const QStringList &proFilePaths) = 0;
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0) override;
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0) override;
|
||||
bool deleteFiles(const QStringList &filePaths) override;
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath) override;
|
||||
|
||||
// by default returns false
|
||||
virtual bool deploysFolder(const QString &folder) const;
|
||||
|
||||
virtual QList<RunConfiguration *> runConfigurations() const;
|
||||
|
||||
void accept(NodesVisitor *visitor);
|
||||
void accept(NodesVisitor *visitor) override;
|
||||
|
||||
bool isEnabled() const { return true; }
|
||||
bool isEnabled() const override { return true; }
|
||||
|
||||
// to be called in implementation of
|
||||
// the corresponding public functions
|
||||
void addProjectNodes(const QList<ProjectNode*> &subProjects);
|
||||
void removeProjectNodes(const QList<ProjectNode*> &subProjects);
|
||||
|
||||
ProjectNode *asProjectNode();
|
||||
ProjectNode *asProjectNode() override;
|
||||
|
||||
protected:
|
||||
// this is just the in-memory representation, a subclass
|
||||
|
||||
@@ -340,16 +340,7 @@ public:
|
||||
|
||||
QList<ProjectAction> supportedActions(Node *node) const override;
|
||||
|
||||
bool canAddSubProject(const QString &proFilePath) const override;
|
||||
|
||||
bool addSubProjects(const QStringList &proFilePaths) override;
|
||||
bool removeSubProjects(const QStringList &proFilePaths) override;
|
||||
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0) override;
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0) override;
|
||||
bool deleteFiles(const QStringList &filePaths) override;
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath) override;
|
||||
|
||||
void refresh(QSet<QString> oldFileList = QSet<QString>());
|
||||
|
||||
private:
|
||||
@@ -1081,44 +1072,6 @@ QList<ProjectAction> PythonProjectNode::supportedActions(Node *node) const
|
||||
return {};
|
||||
}
|
||||
|
||||
bool PythonProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PythonProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PythonProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PythonProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
{
|
||||
Q_UNUSED(notAdded)
|
||||
|
||||
return m_project->addFiles(filePaths);
|
||||
}
|
||||
|
||||
bool PythonProjectNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
|
||||
{
|
||||
Q_UNUSED(notRemoved)
|
||||
|
||||
return m_project->removeFiles(filePaths);
|
||||
}
|
||||
|
||||
bool PythonProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(filePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PythonProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
return m_project->renameFile(filePath, newFilePath);
|
||||
|
||||
@@ -312,51 +312,6 @@ QList<ProjectExplorer::ProjectAction> QbsBaseProjectNode::supportedActions(Proje
|
||||
return QList<ProjectExplorer::ProjectAction>();
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
{
|
||||
Q_UNUSED(filePaths);
|
||||
Q_UNUSED(notAdded);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
|
||||
{
|
||||
Q_UNUSED(filePaths);
|
||||
Q_UNUSED(notRemoved);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(filePaths);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QbsBaseProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
Q_UNUSED(filePath);
|
||||
Q_UNUSED(newFilePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// QbsGroupNode:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -81,18 +81,6 @@ public:
|
||||
bool showInSimpleTree() const;
|
||||
|
||||
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
|
||||
bool canAddSubProject(const QString &proFilePath) const;
|
||||
|
||||
bool addSubProjects(const QStringList &proFilePaths);
|
||||
|
||||
bool removeSubProjects(const QStringList &proFilePaths);
|
||||
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
||||
bool deleteFiles(const QStringList &filePaths);
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath);
|
||||
|
||||
private:
|
||||
friend class QbsGroupNode;
|
||||
};
|
||||
|
||||
@@ -188,34 +188,11 @@ QList<ProjectExplorer::ProjectAction> QmlProjectNode::supportedActions(Node *nod
|
||||
return actions;
|
||||
}
|
||||
|
||||
bool QmlProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||
{
|
||||
Q_UNUSED(proFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlProjectNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
Q_UNUSED(proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlProjectNode::addFiles(const QStringList &filePaths, QStringList * /*notAdded*/)
|
||||
{
|
||||
return m_project->addFiles(filePaths);
|
||||
}
|
||||
|
||||
bool QmlProjectNode::removeFiles(const QStringList & /*filePaths*/, QStringList * /*notRemoved*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlProjectNode::deleteFiles(const QStringList & /*filePaths*/)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -57,13 +57,7 @@ public:
|
||||
|
||||
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
|
||||
virtual bool canAddSubProject(const QString &proFilePath) const;
|
||||
|
||||
virtual bool addSubProjects(const QStringList &proFilePaths);
|
||||
virtual bool removeSubProjects(const QStringList &proFilePaths);
|
||||
|
||||
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
||||
virtual bool deleteFiles(const QStringList &filePaths);
|
||||
virtual bool renameFile(const QString &filePath, const QString &newFilePath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user