forked from qt-creator/qt-creator
ProjectNodes: Move supportedActions to Node
By default this simply calls the parent's supportedActions. Most changes are due to the enum moving. Change-Id: I25bf21b712cca48450014dbb0f748ac0c461e029 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -50,10 +50,10 @@ bool AutotoolsProjectNode::hasBuildTargets() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectNode::ProjectAction> AutotoolsProjectNode::supportedActions(Node *node) const
|
QList<ProjectExplorer::ProjectAction> AutotoolsProjectNode::supportedActions(Node *node) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(node);
|
Q_UNUSED(node);
|
||||||
return QList<ProjectNode::ProjectAction>();
|
return QList<ProjectExplorer::ProjectAction>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutotoolsProjectNode::canAddSubProject(const QString &proFilePath) const
|
bool AutotoolsProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile);
|
AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile);
|
||||||
|
|
||||||
bool hasBuildTargets() const;
|
bool hasBuildTargets() const;
|
||||||
QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||||
bool canAddSubProject(const QString &proFilePath) const;
|
bool canAddSubProject(const QString &proFilePath) const;
|
||||||
bool addSubProjects(const QStringList &proFilePaths);
|
bool addSubProjects(const QStringList &proFilePaths);
|
||||||
bool removeSubProjects(const QStringList &proFilePaths);
|
bool removeSubProjects(const QStringList &proFilePaths);
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ bool CMakeProjectNode::hasBuildTargets() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::ProjectNode::ProjectAction> CMakeProjectNode::supportedActions(Node *node) const
|
QList<ProjectExplorer::ProjectAction> CMakeProjectNode::supportedActions(Node *node) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(node);
|
Q_UNUSED(node);
|
||||||
return QList<ProjectAction>();
|
return QList<ProjectExplorer::ProjectAction>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeProjectNode::canAddSubProject(const QString &proFilePath) const
|
bool CMakeProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class CMakeProjectNode : public ProjectExplorer::ProjectNode
|
|||||||
public:
|
public:
|
||||||
CMakeProjectNode(const QString &fileName);
|
CMakeProjectNode(const QString &fileName);
|
||||||
virtual bool hasBuildTargets() const;
|
virtual bool hasBuildTargets() const;
|
||||||
virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
|
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
virtual bool canAddSubProject(const QString &proFilePath) const;
|
virtual bool canAddSubProject(const QString &proFilePath) const;
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ bool GenericProjectNode::hasBuildTargets() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectNode::ProjectAction> GenericProjectNode::supportedActions(Node *node) const
|
QList<ProjectExplorer::ProjectAction> GenericProjectNode::supportedActions(Node *node) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(node);
|
Q_UNUSED(node);
|
||||||
return QList<ProjectAction>()
|
return QList<ProjectAction>()
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
|
|
||||||
bool hasBuildTargets() const;
|
bool hasBuildTargets() const;
|
||||||
|
|
||||||
QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
bool canAddSubProject(const QString &proFilePath) const;
|
bool canAddSubProject(const QString &proFilePath) const;
|
||||||
|
|
||||||
|
|||||||
@@ -2680,8 +2680,8 @@ void ProjectExplorerPlugin::updateContextMenuActions()
|
|||||||
runMenu->menu()->clear();
|
runMenu->menu()->clear();
|
||||||
|
|
||||||
if (d->m_currentNode && d->m_currentNode->projectNode()) {
|
if (d->m_currentNode && d->m_currentNode->projectNode()) {
|
||||||
QList<ProjectNode::ProjectAction> actions =
|
QList<ProjectExplorer::ProjectAction> actions =
|
||||||
d->m_currentNode->projectNode()->supportedActions(d->m_currentNode);
|
d->m_currentNode->supportedActions(d->m_currentNode);
|
||||||
|
|
||||||
if (ProjectNode *pn = qobject_cast<ProjectNode *>(d->m_currentNode)) {
|
if (ProjectNode *pn = qobject_cast<ProjectNode *>(d->m_currentNode)) {
|
||||||
if (pn == d->m_currentProject->rootProjectNode()) {
|
if (pn == d->m_currentProject->rootProjectNode()) {
|
||||||
@@ -2705,26 +2705,26 @@ void ProjectExplorerPlugin::updateContextMenuActions()
|
|||||||
}
|
}
|
||||||
if (qobject_cast<FolderNode*>(d->m_currentNode)) {
|
if (qobject_cast<FolderNode*>(d->m_currentNode)) {
|
||||||
// Also handles ProjectNode
|
// Also handles ProjectNode
|
||||||
d->m_addNewFileAction->setEnabled(actions.contains(ProjectNode::AddNewFile));
|
d->m_addNewFileAction->setEnabled(actions.contains(ProjectExplorer::AddNewFile));
|
||||||
d->m_addNewSubprojectAction->setEnabled(d->m_currentNode->nodeType() == ProjectNodeType
|
d->m_addNewSubprojectAction->setEnabled(d->m_currentNode->nodeType() == ProjectNodeType
|
||||||
&& actions.contains(ProjectNode::AddSubProject));
|
&& actions.contains(ProjectExplorer::AddSubProject));
|
||||||
d->m_addExistingFilesAction->setEnabled(actions.contains(ProjectNode::AddExistingFile));
|
d->m_addExistingFilesAction->setEnabled(actions.contains(ProjectExplorer::AddExistingFile));
|
||||||
d->m_addExistingDirectoryAction->setEnabled(actions.contains(ProjectNode::AddExistingDirectory));
|
d->m_addExistingDirectoryAction->setEnabled(actions.contains(ProjectExplorer::AddExistingDirectory));
|
||||||
d->m_renameFileAction->setEnabled(actions.contains(ProjectNode::Rename));
|
d->m_renameFileAction->setEnabled(actions.contains(ProjectExplorer::Rename));
|
||||||
} else if (qobject_cast<FileNode*>(d->m_currentNode)) {
|
} else if (qobject_cast<FileNode*>(d->m_currentNode)) {
|
||||||
// Enable and show remove / delete in magic ways:
|
// Enable and show remove / delete in magic ways:
|
||||||
// If both are disabled show Remove
|
// If both are disabled show Remove
|
||||||
// If both are enabled show both (can't happen atm)
|
// If both are enabled show both (can't happen atm)
|
||||||
// If only removeFile is enabled only show it
|
// If only removeFile is enabled only show it
|
||||||
// If only deleteFile is enable only show it
|
// If only deleteFile is enable only show it
|
||||||
bool enableRemove = actions.contains(ProjectNode::RemoveFile);
|
bool enableRemove = actions.contains(ProjectExplorer::RemoveFile);
|
||||||
d->m_removeFileAction->setEnabled(enableRemove);
|
d->m_removeFileAction->setEnabled(enableRemove);
|
||||||
bool enableDelete = actions.contains(ProjectNode::EraseFile);
|
bool enableDelete = actions.contains(ProjectExplorer::EraseFile);
|
||||||
d->m_deleteFileAction->setEnabled(enableDelete);
|
d->m_deleteFileAction->setEnabled(enableDelete);
|
||||||
d->m_deleteFileAction->setVisible(enableDelete);
|
d->m_deleteFileAction->setVisible(enableDelete);
|
||||||
|
|
||||||
d->m_removeFileAction->setVisible(!enableDelete || enableRemove);
|
d->m_removeFileAction->setVisible(!enableDelete || enableRemove);
|
||||||
d->m_renameFileAction->setEnabled(actions.contains(ProjectNode::Rename));
|
d->m_renameFileAction->setEnabled(actions.contains(ProjectExplorer::Rename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2791,8 +2791,8 @@ void ProjectExplorerPlugin::addNewSubproject()
|
|||||||
QString location = directoryFor(d->m_currentNode);
|
QString location = directoryFor(d->m_currentNode);
|
||||||
|
|
||||||
if (d->m_currentNode->nodeType() == ProjectNodeType
|
if (d->m_currentNode->nodeType() == ProjectNodeType
|
||||||
&& d->m_currentNode->projectNode()->supportedActions(
|
&& d->m_currentNode->supportedActions(
|
||||||
d->m_currentNode->projectNode()).contains(ProjectNode::AddSubProject)) {
|
d->m_currentNode).contains(ProjectExplorer::AddSubProject)) {
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path());
|
map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path());
|
||||||
if (d->m_currentProject) {
|
if (d->m_currentProject) {
|
||||||
|
|||||||
@@ -94,20 +94,20 @@ namespace Internal {
|
|||||||
class AllProjectNodesVisitor : public NodesVisitor
|
class AllProjectNodesVisitor : public NodesVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AllProjectNodesVisitor(ProjectNode::ProjectAction action)
|
AllProjectNodesVisitor(ProjectExplorer::ProjectAction action)
|
||||||
: m_action(action)
|
: m_action(action)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
static ProjectNodeList allProjects(ProjectNode::ProjectAction action);
|
static ProjectNodeList allProjects(ProjectExplorer::ProjectAction action);
|
||||||
|
|
||||||
virtual void visitProjectNode(ProjectNode *node);
|
virtual void visitProjectNode(ProjectNode *node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectNodeList m_projectNodes;
|
ProjectNodeList m_projectNodes;
|
||||||
ProjectNode::ProjectAction m_action;
|
ProjectExplorer::ProjectAction m_action;
|
||||||
};
|
};
|
||||||
|
|
||||||
ProjectNodeList AllProjectNodesVisitor::allProjects(ProjectNode::ProjectAction action)
|
ProjectNodeList AllProjectNodesVisitor::allProjects(ProjectExplorer::ProjectAction action)
|
||||||
{
|
{
|
||||||
AllProjectNodesVisitor visitor(action);
|
AllProjectNodesVisitor visitor(action);
|
||||||
SessionManager::sessionNode()->accept(&visitor);
|
SessionManager::sessionNode()->accept(&visitor);
|
||||||
@@ -397,7 +397,7 @@ QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const IWizard *w
|
|||||||
|
|
||||||
static inline void getProjectChoicesAndToolTips(QStringList *projectChoicesParam,
|
static inline void getProjectChoicesAndToolTips(QStringList *projectChoicesParam,
|
||||||
QStringList *projectToolTipsParam,
|
QStringList *projectToolTipsParam,
|
||||||
ProjectNode::ProjectAction *projectActionParam,
|
ProjectExplorer::ProjectAction *projectActionParam,
|
||||||
const QString &generatedProjectFilePath,
|
const QString &generatedProjectFilePath,
|
||||||
ProjectWizardContext *context)
|
ProjectWizardContext *context)
|
||||||
{
|
{
|
||||||
@@ -413,12 +413,12 @@ static inline void getProjectChoicesAndToolTips(QStringList *projectChoicesParam
|
|||||||
// via Map.
|
// via Map.
|
||||||
ProjectEntryMap entryMap;
|
ProjectEntryMap entryMap;
|
||||||
|
|
||||||
ProjectNode::ProjectAction projectAction =
|
ProjectExplorer::ProjectAction projectAction =
|
||||||
context->wizard->kind() == IWizard::ProjectWizard
|
context->wizard->kind() == IWizard::ProjectWizard
|
||||||
? ProjectNode::AddSubProject : ProjectNode::AddNewFile;
|
? ProjectExplorer::AddSubProject : ProjectExplorer::AddNewFile;
|
||||||
foreach (ProjectNode *n, AllProjectNodesVisitor::allProjects(projectAction)) {
|
foreach (ProjectNode *n, AllProjectNodesVisitor::allProjects(projectAction)) {
|
||||||
if (projectAction == ProjectNode::AddNewFile
|
if (projectAction == ProjectExplorer::AddNewFile
|
||||||
|| (projectAction == ProjectNode::AddSubProject
|
|| (projectAction == ProjectExplorer::AddSubProject
|
||||||
&& (generatedProjectFilePath.isEmpty() ? true : n->canAddSubProject(generatedProjectFilePath))))
|
&& (generatedProjectFilePath.isEmpty() ? true : n->canAddSubProject(generatedProjectFilePath))))
|
||||||
entryMap.insert(ProjectEntry(n), true);
|
entryMap.insert(ProjectEntry(n), true);
|
||||||
}
|
}
|
||||||
@@ -441,14 +441,14 @@ void ProjectFileWizardExtension::initProjectChoices(const QString &generatedProj
|
|||||||
{
|
{
|
||||||
QStringList projectChoices;
|
QStringList projectChoices;
|
||||||
QStringList projectToolTips;
|
QStringList projectToolTips;
|
||||||
ProjectNode::ProjectAction projectAction;
|
ProjectExplorer::ProjectAction projectAction;
|
||||||
|
|
||||||
getProjectChoicesAndToolTips(&projectChoices, &projectToolTips, &projectAction,
|
getProjectChoicesAndToolTips(&projectChoices, &projectToolTips, &projectAction,
|
||||||
generatedProjectFilePath, m_context);
|
generatedProjectFilePath, m_context);
|
||||||
|
|
||||||
m_context->page->setProjects(projectChoices);
|
m_context->page->setProjects(projectChoices);
|
||||||
m_context->page->setProjectToolTips(projectToolTips);
|
m_context->page->setProjectToolTips(projectToolTips);
|
||||||
m_context->page->setAddingSubProject(projectAction == ProjectNode::AddSubProject);
|
m_context->page->setAddingSubProject(projectAction == ProjectExplorer::AddSubProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectFileWizardExtension::processFiles(
|
bool ProjectFileWizardExtension::processFiles(
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const
|
|||||||
return 0; // no flags for session node...
|
return 0; // no flags for session node...
|
||||||
if (!qobject_cast<ProjectNode *>(node)) {
|
if (!qobject_cast<ProjectNode *>(node)) {
|
||||||
// either folder or file node
|
// either folder or file node
|
||||||
if (node->projectNode()->supportedActions(node).contains(ProjectNode::Rename))
|
if (node->supportedActions(node).contains(ProjectExplorer::Rename))
|
||||||
f = f | Qt::ItemIsEditable;
|
f = f | Qt::ItemIsEditable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,6 +178,11 @@ bool Node::isEnabled() const
|
|||||||
return parentFolderNode()->isEnabled();
|
return parentFolderNode()->isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<ProjectAction> Node::supportedActions(Node *node) const
|
||||||
|
{
|
||||||
|
return parentFolderNode()->supportedActions(node);
|
||||||
|
}
|
||||||
|
|
||||||
void Node::setNodeType(NodeType type)
|
void Node::setNodeType(NodeType type)
|
||||||
{
|
{
|
||||||
m_nodeType = type;
|
m_nodeType = type;
|
||||||
@@ -730,6 +735,12 @@ SessionNode::SessionNode(QObject *parentObject)
|
|||||||
setNodeType(SessionNodeType);
|
setNodeType(SessionNodeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<ProjectAction> SessionNode::supportedActions(Node *node) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(node)
|
||||||
|
return QList<ProjectAction>();
|
||||||
|
}
|
||||||
|
|
||||||
QList<NodesWatcher*> SessionNode::watchers() const
|
QList<NodesWatcher*> SessionNode::watchers() const
|
||||||
{
|
{
|
||||||
return m_watchers;
|
return m_watchers;
|
||||||
|
|||||||
@@ -66,6 +66,27 @@ enum FileType {
|
|||||||
FileTypeSize
|
FileTypeSize
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ProjectAction {
|
||||||
|
AddSubProject,
|
||||||
|
RemoveSubProject,
|
||||||
|
// Let's the user select to which project file
|
||||||
|
// the file is added
|
||||||
|
AddNewFile,
|
||||||
|
AddExistingFile,
|
||||||
|
// Add files, which match user defined filters,
|
||||||
|
// from an existing directory and its subdirectories
|
||||||
|
AddExistingDirectory,
|
||||||
|
// Removes a file from the project, optionally also
|
||||||
|
// delete it on disc
|
||||||
|
RemoveFile,
|
||||||
|
// Deletes a file from the file system, informs the project
|
||||||
|
// that a file was deleted
|
||||||
|
// DeleteFile is a define on windows...
|
||||||
|
EraseFile,
|
||||||
|
Rename,
|
||||||
|
HasSubProjectRunConfigurations
|
||||||
|
};
|
||||||
|
|
||||||
class Node;
|
class Node;
|
||||||
class FileNode;
|
class FileNode;
|
||||||
class FileContainerNode;
|
class FileContainerNode;
|
||||||
@@ -88,6 +109,8 @@ public:
|
|||||||
virtual QString tooltip() const;
|
virtual QString tooltip() const;
|
||||||
virtual bool isEnabled() const;
|
virtual bool isEnabled() const;
|
||||||
|
|
||||||
|
virtual QList<ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
void setLine(int line);
|
void setLine(int line);
|
||||||
void setPathAndLine(const QString &path, int line);
|
void setPathAndLine(const QString &path, int line);
|
||||||
@@ -177,27 +200,6 @@ class PROJECTEXPLORER_EXPORT ProjectNode : public FolderNode
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ProjectAction {
|
|
||||||
AddSubProject,
|
|
||||||
RemoveSubProject,
|
|
||||||
// Let's the user select to which project file
|
|
||||||
// the file is added
|
|
||||||
AddNewFile,
|
|
||||||
AddExistingFile,
|
|
||||||
// Add files, which match user defined filters,
|
|
||||||
// from an existing directory and its subdirectories
|
|
||||||
AddExistingDirectory,
|
|
||||||
// Removes a file from the project, optionally also
|
|
||||||
// delete it on disc
|
|
||||||
RemoveFile,
|
|
||||||
// Deletes a file from the file system, informs the project
|
|
||||||
// that a file was deleted
|
|
||||||
// DeleteFile is a define on windows...
|
|
||||||
EraseFile,
|
|
||||||
Rename,
|
|
||||||
HasSubProjectRunConfigurations
|
|
||||||
};
|
|
||||||
|
|
||||||
QString vcsTopic() const;
|
QString vcsTopic() const;
|
||||||
|
|
||||||
// all subFolders that are projects
|
// all subFolders that are projects
|
||||||
@@ -209,8 +211,6 @@ public:
|
|||||||
void hasBuildTargetsChanged();
|
void hasBuildTargetsChanged();
|
||||||
virtual bool hasBuildTargets() const = 0;
|
virtual bool hasBuildTargets() const = 0;
|
||||||
|
|
||||||
virtual QList<ProjectAction> supportedActions(Node *node) const = 0;
|
|
||||||
|
|
||||||
virtual bool canAddSubProject(const QString &proFilePath) const = 0;
|
virtual bool canAddSubProject(const QString &proFilePath) const = 0;
|
||||||
|
|
||||||
virtual bool addSubProjects(const QStringList &proFilePaths) = 0;
|
virtual bool addSubProjects(const QStringList &proFilePaths) = 0;
|
||||||
@@ -270,6 +270,8 @@ class PROJECTEXPLORER_EXPORT SessionNode : public FolderNode {
|
|||||||
public:
|
public:
|
||||||
SessionNode(QObject *parentObject);
|
SessionNode(QObject *parentObject);
|
||||||
|
|
||||||
|
QList<ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
QList<ProjectNode*> projectNodes() const;
|
QList<ProjectNode*> projectNodes() const;
|
||||||
|
|
||||||
QList<NodesWatcher*> watchers() const;
|
QList<NodesWatcher*> watchers() const;
|
||||||
|
|||||||
@@ -252,10 +252,10 @@ bool QbsBaseProjectNode::hasBuildTargets() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::ProjectNode::ProjectAction> QbsBaseProjectNode::supportedActions(ProjectExplorer::Node *node) const
|
QList<ProjectExplorer::ProjectAction> QbsBaseProjectNode::supportedActions(ProjectExplorer::Node *node) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(node);
|
Q_UNUSED(node);
|
||||||
return QList<ProjectExplorer::ProjectNode::ProjectAction>();
|
return QList<ProjectExplorer::ProjectAction>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsBaseProjectNode::canAddSubProject(const QString &proFilePath) const
|
bool QbsBaseProjectNode::canAddSubProject(const QString &proFilePath) const
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
bool hasBuildTargets() const;
|
bool hasBuildTargets() const;
|
||||||
|
|
||||||
QList<ProjectAction> supportedActions(Node *node) const;
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
bool canAddSubProject(const QString &proFilePath) const;
|
bool canAddSubProject(const QString &proFilePath) const;
|
||||||
|
|
||||||
|
|||||||
@@ -825,9 +825,9 @@ void QmakePriFileNode::setIncludedInExactParse(bool b)
|
|||||||
m_includedInExactParse = b;
|
m_includedInExactParse = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectNode::ProjectAction> QmakePriFileNode::supportedActions(Node *node) const
|
QList<ProjectExplorer::ProjectAction> QmakePriFileNode::supportedActions(Node *node) const
|
||||||
{
|
{
|
||||||
QList<ProjectAction> actions;
|
QList<ProjectExplorer::ProjectAction> actions;
|
||||||
|
|
||||||
const FolderNode *folderNode = this;
|
const FolderNode *folderNode = this;
|
||||||
const QmakeProFileNode *proFileNode;
|
const QmakeProFileNode *proFileNode;
|
||||||
@@ -843,11 +843,11 @@ QList<ProjectNode::ProjectAction> QmakePriFileNode::supportedActions(Node *node)
|
|||||||
// projects (e.g. cpp). It'd be nice if the "add" action could
|
// projects (e.g. cpp). It'd be nice if the "add" action could
|
||||||
// work on a subset of the file types according to project type.
|
// work on a subset of the file types according to project type.
|
||||||
|
|
||||||
actions << AddNewFile;
|
actions << ProjectExplorer::AddNewFile;
|
||||||
if (m_recursiveEnumerateFiles.contains(Utils::FileName::fromString(node->path())))
|
if (m_recursiveEnumerateFiles.contains(Utils::FileName::fromString(node->path())))
|
||||||
actions << EraseFile;
|
actions << ProjectExplorer::EraseFile;
|
||||||
else
|
else
|
||||||
actions << RemoveFile;
|
actions << ProjectExplorer::RemoveFile;
|
||||||
|
|
||||||
bool addExistingFiles = true;
|
bool addExistingFiles = true;
|
||||||
if (node->nodeType() == ProjectExplorer::VirtualFolderNodeType) {
|
if (node->nodeType() == ProjectExplorer::VirtualFolderNodeType) {
|
||||||
@@ -865,12 +865,12 @@ QList<ProjectNode::ProjectAction> QmakePriFileNode::supportedActions(Node *node)
|
|||||||
addExistingFiles = addExistingFiles && !deploysFolder(node->path());
|
addExistingFiles = addExistingFiles && !deploysFolder(node->path());
|
||||||
|
|
||||||
if (addExistingFiles)
|
if (addExistingFiles)
|
||||||
actions << AddExistingFile << AddExistingDirectory;
|
actions << ProjectExplorer::AddExistingFile << ProjectExplorer::AddExistingDirectory;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SubDirsTemplate:
|
case SubDirsTemplate:
|
||||||
actions << AddSubProject << RemoveSubProject;
|
actions << ProjectExplorer::AddSubProject << ProjectExplorer::RemoveSubProject;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -878,13 +878,13 @@ QList<ProjectNode::ProjectAction> QmakePriFileNode::supportedActions(Node *node)
|
|||||||
|
|
||||||
ProjectExplorer::FileNode *fileNode = qobject_cast<FileNode *>(node);
|
ProjectExplorer::FileNode *fileNode = qobject_cast<FileNode *>(node);
|
||||||
if (fileNode && fileNode->fileType() != ProjectExplorer::ProjectFileType)
|
if (fileNode && fileNode->fileType() != ProjectExplorer::ProjectFileType)
|
||||||
actions << Rename;
|
actions << ProjectExplorer::Rename;
|
||||||
|
|
||||||
|
|
||||||
ProjectExplorer::Target *target = m_project->activeTarget();
|
ProjectExplorer::Target *target = m_project->activeTarget();
|
||||||
QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(target);
|
QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(target);
|
||||||
if (factory && !factory->runConfigurationsForNode(target, node).isEmpty())
|
if (factory && !factory->runConfigurationsForNode(target, node).isEmpty())
|
||||||
actions << HasSubProjectRunConfigurations;
|
actions << ProjectExplorer::HasSubProjectRunConfigurations;
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// ProjectNode interface
|
// ProjectNode interface
|
||||||
QList<ProjectAction> supportedActions(Node *node) const;
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
bool hasBuildTargets() const { return false; }
|
bool hasBuildTargets() const { return false; }
|
||||||
|
|
||||||
|
|||||||
@@ -170,16 +170,16 @@ bool QmlProjectNode::hasBuildTargets() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::ProjectNode::ProjectAction> QmlProjectNode::supportedActions(Node *node) const
|
QList<ProjectExplorer::ProjectAction> QmlProjectNode::supportedActions(Node *node) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(node);
|
Q_UNUSED(node);
|
||||||
QList<ProjectAction> actions;
|
QList<ProjectExplorer::ProjectAction> actions;
|
||||||
actions.append(AddNewFile);
|
actions.append(ProjectExplorer::AddNewFile);
|
||||||
actions.append(EraseFile);
|
actions.append(ProjectExplorer::EraseFile);
|
||||||
if (node->nodeType() == ProjectExplorer::FileNodeType) {
|
if (node->nodeType() == ProjectExplorer::FileNodeType) {
|
||||||
ProjectExplorer::FileNode *fileNode = static_cast<ProjectExplorer::FileNode *>(node);
|
ProjectExplorer::FileNode *fileNode = static_cast<ProjectExplorer::FileNode *>(node);
|
||||||
if (fileNode->fileType() != ProjectExplorer::ProjectFileType)
|
if (fileNode->fileType() != ProjectExplorer::ProjectFileType)
|
||||||
actions.append(Rename);
|
actions.append(ProjectExplorer::Rename);
|
||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
virtual bool hasBuildTargets() const;
|
virtual bool hasBuildTargets() const;
|
||||||
|
|
||||||
virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions(Node *node) const;
|
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||||
|
|
||||||
virtual bool canAddSubProject(const QString &proFilePath) const;
|
virtual bool canAddSubProject(const QString &proFilePath) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user