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:
Daniel Teske
2015-09-10 17:47:57 +02:00
parent fa94ec2c3b
commit bcdadbec72
13 changed files with 50 additions and 298 deletions

View File

@@ -56,51 +56,3 @@ QList<ProjectAction> AutotoolsProjectNode::supportedActions(Node *node) const
Q_UNUSED(node); Q_UNUSED(node);
return QList<ProjectAction>(); 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;
}

View File

@@ -58,14 +58,6 @@ public:
bool showInSimpleTree() const; bool showInSimpleTree() const;
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) 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: private:
AutotoolsProject *m_project; AutotoolsProject *m_project;

View File

@@ -49,48 +49,3 @@ QList<ProjectExplorer::ProjectAction> CMakeProjectNode::supportedActions(Node *n
Q_UNUSED(node); Q_UNUSED(node);
return QList<ProjectExplorer::ProjectAction>(); 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;
}

View File

@@ -45,18 +45,6 @@ public:
CMakeProjectNode(const Utils::FileName &fileName); CMakeProjectNode(const Utils::FileName &fileName);
virtual bool showInSimpleTree() const; virtual bool showInSimpleTree() const;
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) 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 } // namespace Internal

View File

@@ -229,24 +229,6 @@ QList<ProjectAction> GenericProjectNode::supportedActions(Node *node) const
<< Rename; << 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) bool GenericProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
{ {
Q_UNUSED(notAdded) Q_UNUSED(notAdded)
@@ -261,12 +243,6 @@ bool GenericProjectNode::removeFiles(const QStringList &filePaths, QStringList *
return m_project->removeFiles(filePaths); 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) bool GenericProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
{ {
return m_project->renameFile(filePath, newFilePath); return m_project->renameFile(filePath, newFilePath);

View File

@@ -56,14 +56,8 @@ public:
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) 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 addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0); bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, const QString &newFilePath); bool renameFile(const QString &filePath, const QString &newFilePath);
void refresh(QSet<QString> oldFileList = QSet<QString>()); void refresh(QSet<QString> oldFileList = QSet<QString>());

View File

@@ -591,25 +591,50 @@ QList<ProjectNode*> ProjectNode::subProjectNodes() const
return m_subProjectNodes; return m_subProjectNodes;
} }
/*! bool ProjectNode::canAddSubProject(const QString &proFilePath) const
\function bool ProjectNode::addSubProjects(const QStringList &) {
*/ Q_UNUSED(proFilePath)
return false;
}
/*! bool ProjectNode::addSubProjects(const QStringList &proFilePaths)
\function bool ProjectNode::removeSubProjects(const QStringList &) {
*/ Q_UNUSED(proFilePaths)
return false;
}
/*! bool ProjectNode::removeSubProjects(const QStringList &proFilePaths)
\function bool ProjectNode::addFiles(const FileType, const QStringList &, QStringList *) {
*/ Q_UNUSED(proFilePaths)
return false;
}
/*! bool ProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
\function bool ProjectNode::removeFiles(const FileType, const QStringList &, QStringList *) {
*/ Q_UNUSED(filePaths)
Q_UNUSED(notAdded)
return false;
}
/*! bool ProjectNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
\function bool ProjectNode::renameFile(const FileType, const QString &, const QString &) {
*/ 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 bool ProjectNode::deploysFolder(const QString &folder) const
{ {

View File

@@ -245,27 +245,30 @@ public:
// all subFolders that are projects // all subFolders that are projects
QList<ProjectNode*> subProjectNodes() const; 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; bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0) override;
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0) override;
virtual bool removeSubProjects(const QStringList &proFilePaths) = 0; bool deleteFiles(const QStringList &filePaths) override;
bool renameFile(const QString &filePath, const QString &newFilePath) override;
// by default returns false // by default returns false
virtual bool deploysFolder(const QString &folder) const; virtual bool deploysFolder(const QString &folder) const;
virtual QList<RunConfiguration *> runConfigurations() 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 // to be called in implementation of
// the corresponding public functions // the corresponding public functions
void addProjectNodes(const QList<ProjectNode*> &subProjects); void addProjectNodes(const QList<ProjectNode*> &subProjects);
void removeProjectNodes(const QList<ProjectNode*> &subProjects); void removeProjectNodes(const QList<ProjectNode*> &subProjects);
ProjectNode *asProjectNode(); ProjectNode *asProjectNode() override;
protected: protected:
// this is just the in-memory representation, a subclass // this is just the in-memory representation, a subclass

View File

@@ -340,16 +340,7 @@ public:
QList<ProjectAction> supportedActions(Node *node) const override; 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; bool renameFile(const QString &filePath, const QString &newFilePath) override;
void refresh(QSet<QString> oldFileList = QSet<QString>()); void refresh(QSet<QString> oldFileList = QSet<QString>());
private: private:
@@ -1081,44 +1072,6 @@ QList<ProjectAction> PythonProjectNode::supportedActions(Node *node) const
return {}; 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) bool PythonProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
{ {
return m_project->renameFile(filePath, newFilePath); return m_project->renameFile(filePath, newFilePath);

View File

@@ -312,51 +312,6 @@ QList<ProjectExplorer::ProjectAction> QbsBaseProjectNode::supportedActions(Proje
return QList<ProjectExplorer::ProjectAction>(); 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: // QbsGroupNode:
// -------------------------------------------------------------------- // --------------------------------------------------------------------

View File

@@ -81,18 +81,6 @@ public:
bool showInSimpleTree() const; bool showInSimpleTree() const;
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) 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: private:
friend class QbsGroupNode; friend class QbsGroupNode;
}; };

View File

@@ -188,34 +188,11 @@ QList<ProjectExplorer::ProjectAction> QmlProjectNode::supportedActions(Node *nod
return actions; 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*/) bool QmlProjectNode::addFiles(const QStringList &filePaths, QStringList * /*notAdded*/)
{ {
return m_project->addFiles(filePaths); return m_project->addFiles(filePaths);
} }
bool QmlProjectNode::removeFiles(const QStringList & /*filePaths*/, QStringList * /*notRemoved*/)
{
return false;
}
bool QmlProjectNode::deleteFiles(const QStringList & /*filePaths*/) bool QmlProjectNode::deleteFiles(const QStringList & /*filePaths*/)
{ {
return true; return true;

View File

@@ -57,13 +57,7 @@ public:
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) 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 addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
virtual bool deleteFiles(const QStringList &filePaths); virtual bool deleteFiles(const QStringList &filePaths);
virtual bool renameFile(const QString &filePath, const QString &newFilePath); virtual bool renameFile(const QString &filePath, const QString &newFilePath);