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;
|
||||
}
|
||||
|
||||
void Node::setIsGenerated(bool g)
|
||||
{
|
||||
m_flags.setFlag(FlagIsGenerated, g);
|
||||
}
|
||||
|
||||
void Node::setAbsoluteFilePathAndLine(const Utils::FileName &path, int line)
|
||||
{
|
||||
if (m_filePath == path && m_line == line)
|
||||
@@ -215,6 +220,14 @@ bool Node::isEnabled() const
|
||||
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
|
||||
{
|
||||
return false;
|
||||
@@ -276,9 +289,9 @@ FileType Node::fileTypeForFileName(const Utils::FileName &file)
|
||||
FileNode::FileNode(const Utils::FileName &filePath,
|
||||
const FileType fileType,
|
||||
bool generated, int line) : Node(NodeType::File, filePath, line),
|
||||
m_fileType(fileType),
|
||||
m_generated(generated)
|
||||
m_fileType(fileType)
|
||||
{
|
||||
setIsGenerated(generated);
|
||||
if (fileType == FileType::Project)
|
||||
setPriority(DefaultProjectFilePriority);
|
||||
else
|
||||
@@ -298,14 +311,6 @@ FileType FileNode::fileType() const
|
||||
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,
|
||||
const std::function<FileNode *(const Utils::FileName &)> factory,
|
||||
QSet<QString> &visited, QFutureInterface<QList<FileNode*>> *future,
|
||||
@@ -385,6 +390,7 @@ FolderNode::FolderNode(const Utils::FileName &folderPath, NodeType nodeType, con
|
||||
m_displayName(displayName)
|
||||
{
|
||||
setPriority(DefaultFolderPriority);
|
||||
setIsGenerated(false);
|
||||
if (m_displayName.isEmpty())
|
||||
m_displayName = folderPath.toUserOutput();
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ public:
|
||||
virtual QString displayName() const;
|
||||
virtual QString tooltip() const;
|
||||
bool isEnabled() const;
|
||||
bool isGenerated() const;
|
||||
|
||||
virtual bool supportsAction(ProjectAction action, Node *node) const;
|
||||
|
||||
@@ -154,6 +155,7 @@ protected:
|
||||
Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1);
|
||||
|
||||
void setPriority(int priority);
|
||||
void setIsGenerated(bool g);
|
||||
|
||||
private:
|
||||
FolderNode *m_parentFolderNode = nullptr;
|
||||
@@ -164,6 +166,7 @@ private:
|
||||
enum NodeFlag : quint16 {
|
||||
FlagNone = 0,
|
||||
FlagIsEnabled = 1 << 0,
|
||||
FlagIsGenerated = 1 << 1,
|
||||
};
|
||||
using NodeFlags = QFlags<NodeFlag>;
|
||||
NodeFlags m_flags = FlagIsEnabled;
|
||||
@@ -177,7 +180,6 @@ public:
|
||||
FileNode *clone() const;
|
||||
|
||||
FileType fileType() const;
|
||||
bool isGenerated() const;
|
||||
|
||||
FileNode *asFileNode() final { return this; }
|
||||
const FileNode *asFileNode() const final { return this; }
|
||||
@@ -189,7 +191,6 @@ public:
|
||||
|
||||
private:
|
||||
FileType m_fileType;
|
||||
bool m_generated;
|
||||
};
|
||||
|
||||
// Documentation inside.
|
||||
|
||||
Reference in New Issue
Block a user