forked from qt-creator/qt-creator
ProjectNodes: Move isGenerated from FileNode to Node
We have complex nodes like the ResourceTopLevelNode which can be generated. Change-Id: Ifdbe72323b668961c50252f597a0bf67ec41f30b Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -127,6 +127,11 @@ void Node::setPriority(int p)
|
|||||||
m_priority = p;
|
m_priority = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node::setIsGenerated(bool g)
|
||||||
|
{
|
||||||
|
m_flags.setFlag(FlagIsGenerated, g);
|
||||||
|
}
|
||||||
|
|
||||||
void Node::setAbsoluteFilePathAndLine(const Utils::FileName &path, int line)
|
void Node::setAbsoluteFilePathAndLine(const Utils::FileName &path, int line)
|
||||||
{
|
{
|
||||||
if (m_filePath == path && m_line == line)
|
if (m_filePath == path && m_line == line)
|
||||||
@@ -215,6 +220,14 @@ bool Node::isEnabled() const
|
|||||||
return parent ? parent->isEnabled() : true;
|
return parent ? parent->isEnabled() : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the file is automatically generated by a compile step.
|
||||||
|
*/
|
||||||
|
bool Node::isGenerated() const
|
||||||
|
{
|
||||||
|
return m_flags.testFlag(FlagIsGenerated);
|
||||||
|
}
|
||||||
|
|
||||||
bool Node::supportsAction(ProjectAction, Node *) const
|
bool Node::supportsAction(ProjectAction, Node *) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -276,9 +289,9 @@ FileType Node::fileTypeForFileName(const Utils::FileName &file)
|
|||||||
FileNode::FileNode(const Utils::FileName &filePath,
|
FileNode::FileNode(const Utils::FileName &filePath,
|
||||||
const FileType fileType,
|
const FileType fileType,
|
||||||
bool generated, int line) : Node(NodeType::File, filePath, line),
|
bool generated, int line) : Node(NodeType::File, filePath, line),
|
||||||
m_fileType(fileType),
|
m_fileType(fileType)
|
||||||
m_generated(generated)
|
|
||||||
{
|
{
|
||||||
|
setIsGenerated(generated);
|
||||||
if (fileType == FileType::Project)
|
if (fileType == FileType::Project)
|
||||||
setPriority(DefaultProjectFilePriority);
|
setPriority(DefaultProjectFilePriority);
|
||||||
else
|
else
|
||||||
@@ -298,14 +311,6 @@ FileType FileNode::fileType() const
|
|||||||
return m_fileType;
|
return m_fileType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns \c true if the file is automatically generated by a compile step.
|
|
||||||
*/
|
|
||||||
bool FileNode::isGenerated() const
|
|
||||||
{
|
|
||||||
return m_generated;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QList<FileNode *> scanForFilesRecursively(const Utils::FileName &directory,
|
static QList<FileNode *> scanForFilesRecursively(const Utils::FileName &directory,
|
||||||
const std::function<FileNode *(const Utils::FileName &)> factory,
|
const std::function<FileNode *(const Utils::FileName &)> factory,
|
||||||
QSet<QString> &visited, QFutureInterface<QList<FileNode*>> *future,
|
QSet<QString> &visited, QFutureInterface<QList<FileNode*>> *future,
|
||||||
@@ -385,6 +390,7 @@ FolderNode::FolderNode(const Utils::FileName &folderPath, NodeType nodeType, con
|
|||||||
m_displayName(displayName)
|
m_displayName(displayName)
|
||||||
{
|
{
|
||||||
setPriority(DefaultFolderPriority);
|
setPriority(DefaultFolderPriority);
|
||||||
|
setIsGenerated(false);
|
||||||
if (m_displayName.isEmpty())
|
if (m_displayName.isEmpty())
|
||||||
m_displayName = folderPath.toUserOutput();
|
m_displayName = folderPath.toUserOutput();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ public:
|
|||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString tooltip() const;
|
virtual QString tooltip() const;
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
bool isGenerated() const;
|
||||||
|
|
||||||
virtual bool supportsAction(ProjectAction action, Node *node) const;
|
virtual bool supportsAction(ProjectAction action, Node *node) const;
|
||||||
|
|
||||||
@@ -154,6 +155,7 @@ protected:
|
|||||||
Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1);
|
Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1);
|
||||||
|
|
||||||
void setPriority(int priority);
|
void setPriority(int priority);
|
||||||
|
void setIsGenerated(bool g);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FolderNode *m_parentFolderNode = nullptr;
|
FolderNode *m_parentFolderNode = nullptr;
|
||||||
@@ -164,6 +166,7 @@ private:
|
|||||||
enum NodeFlag : quint16 {
|
enum NodeFlag : quint16 {
|
||||||
FlagNone = 0,
|
FlagNone = 0,
|
||||||
FlagIsEnabled = 1 << 0,
|
FlagIsEnabled = 1 << 0,
|
||||||
|
FlagIsGenerated = 1 << 1,
|
||||||
};
|
};
|
||||||
using NodeFlags = QFlags<NodeFlag>;
|
using NodeFlags = QFlags<NodeFlag>;
|
||||||
NodeFlags m_flags = FlagIsEnabled;
|
NodeFlags m_flags = FlagIsEnabled;
|
||||||
@@ -177,7 +180,6 @@ public:
|
|||||||
FileNode *clone() const;
|
FileNode *clone() const;
|
||||||
|
|
||||||
FileType fileType() const;
|
FileType fileType() const;
|
||||||
bool isGenerated() const;
|
|
||||||
|
|
||||||
FileNode *asFileNode() final { return this; }
|
FileNode *asFileNode() final { return this; }
|
||||||
const FileNode *asFileNode() const final { return this; }
|
const FileNode *asFileNode() const final { return this; }
|
||||||
@@ -189,7 +191,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FileType m_fileType;
|
FileType m_fileType;
|
||||||
bool m_generated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Documentation inside.
|
// Documentation inside.
|
||||||
|
|||||||
Reference in New Issue
Block a user